Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(){
int n, i, j = 0;
int prime[10001];
for(i = 2; i <= 10000; i++) {
prime[i] = 1;
}
for(i = 2; i*i <= 10000; i++) {
if(prime[i]) {
for(j = 2 * i; j <= 10000; j += i) {
prime[j] = 0;
}
}
}
while(1){
scanf("%d", &n);
if(n == 0) break;
for(i=n ; i >= 5 ; i--){
if(prime[i] && prime[i-2]) break;
}
printf("%d %d\n", i - 2, i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277896/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277896/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%prime = alloca [10001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %prime) #3
br label %vector.body
vector.body: ; preds = %vector.body.1, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.3, %vector.body.1 ]
%offset.idx = or i64 %index, 2
%0 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 8, !tbaa !5
%2 = icmp eq i64 %index, 9984
br i1 %2, label %for.body, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%offset.idx.1 = or i64 %index, 10
%3 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 8, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 8, !tbaa !5
%offset.idx.2 = or i64 %index, 18
%5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 8, !tbaa !5
%offset.idx.3 = or i64 %index, 26
%7 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %offset.idx.3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 8, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 8, !tbaa !5
%index.next.3 = add nuw nsw i64 %index, 32
br label %vector.body
for.body: ; preds = %vector.body
%arrayidx = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9994
store i32 1, ptr %arrayidx, align 8, !tbaa !5
%arrayidx.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9995
store i32 1, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx.2 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9996
store i32 1, ptr %arrayidx.2, align 16, !tbaa !5
%arrayidx.3 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9997
store i32 1, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx.4 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9998
store i32 1, ptr %arrayidx.4, align 8, !tbaa !5
%arrayidx.5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 9999
store i32 1, ptr %arrayidx.5, align 4, !tbaa !5
%arrayidx.6 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 10000
store i32 1, ptr %arrayidx.6, align 16, !tbaa !5
br label %for.body3
while.cond.preheader: ; preds = %for.inc14
%call58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp1759 = icmp eq i32 %9, 0
br i1 %cmp1759, label %while.end, label %for.cond20.preheader
for.body3: ; preds = %for.inc14.1, %for.body
%indvars.iv63 = phi i64 [ 2, %for.body ], [ %indvars.iv.next64.1, %for.inc14.1 ]
%indvars.iv61 = phi i64 [ 4, %for.body ], [ %indvars.iv.next62.1, %for.inc14.1 ]
%arrayidx5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv63
%10 = load i32, ptr %arrayidx5, align 8, !tbaa !5
%tobool.not.not = icmp eq i32 %10, 0
br i1 %tobool.not.not, label %for.inc14, label %for.body9
for.body9: ; preds = %for.body3, %for.body9
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body9 ], [ %indvars.iv61, %for.body3 ]
%arrayidx11 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv65
store i32 0, ptr %arrayidx11, align 8, !tbaa !5
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, %indvars.iv63
%cmp8 = icmp ult i64 %indvars.iv.next66, 10001
br i1 %cmp8, label %for.body9, label %for.inc14, !llvm.loop !13
for.inc14: ; preds = %for.body9, %for.body3
%indvars.iv.next64 = or i64 %indvars.iv63, 1
%indvars.iv.next62 = or i64 %indvars.iv61, 2
%exitcond69.not = icmp eq i64 %indvars.iv.next64, 101
br i1 %exitcond69.not, label %while.cond.preheader, label %for.body3.1, !llvm.loop !14
for.body3.1: ; preds = %for.inc14
%arrayidx5.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv.next64
%11 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%tobool.not.not.1 = icmp eq i32 %11, 0
br i1 %tobool.not.not.1, label %for.inc14.1, label %for.body9.1
for.body9.1: ; preds = %for.body3.1, %for.body9.1
%indvars.iv65.1 = phi i64 [ %indvars.iv.next66.1, %for.body9.1 ], [ %indvars.iv.next62, %for.body3.1 ]
%arrayidx11.1 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv65.1
store i32 0, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next66.1 = add nuw nsw i64 %indvars.iv65.1, %indvars.iv.next64
%cmp8.1 = icmp ult i64 %indvars.iv.next66.1, 10001
br i1 %cmp8.1, label %for.body9.1, label %for.inc14.1, !llvm.loop !13
for.inc14.1: ; preds = %for.body9.1, %for.body3.1
%indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2
%indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 4
br label %for.body3
for.cond20.preheader: ; preds = %while.cond.preheader, %for.end32
%12 = phi i32 [ %16, %for.end32 ], [ %9, %while.cond.preheader ]
%cmp2155 = icmp sgt i32 %12, 4
br i1 %cmp2155, label %for.body22.preheader, label %for.end32
for.body22.preheader: ; preds = %for.cond20.preheader
%13 = zext i32 %12 to i64
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.inc31
%indvars.iv70 = phi i64 [ %13, %for.body22.preheader ], [ %indvars.iv.next71, %for.inc31 ]
%arrayidx24 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv70
%14 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%tobool25.not = icmp eq i32 %14, 0
br i1 %tobool25.not, label %for.inc31, label %land.lhs.true
land.lhs.true: ; preds = %for.body22
%sub = add nuw i64 %indvars.iv70, 4294967294
%idxprom26 = and i64 %sub, 4294967295
%arrayidx27 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %idxprom26
%15 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%tobool28.not = icmp eq i32 %15, 0
br i1 %tobool28.not, label %for.inc31, label %for.end32.loopexit.split.loop.exit
for.inc31: ; preds = %for.body22, %land.lhs.true
%indvars.iv.next71 = add nsw i64 %indvars.iv70, -1
%cmp21 = icmp sgt i64 %indvars.iv70, 5
br i1 %cmp21, label %for.body22, label %for.end32, !llvm.loop !15
for.end32.loopexit.split.loop.exit: ; preds = %land.lhs.true
%indvars72.le = trunc i64 %indvars.iv70 to i32
br label %for.end32
for.end32: ; preds = %for.inc31, %for.end32.loopexit.split.loop.exit, %for.cond20.preheader
%i.2.lcssa = phi i32 [ %12, %for.cond20.preheader ], [ %indvars72.le, %for.end32.loopexit.split.loop.exit ], [ 4, %for.inc31 ]
%sub33 = add nsw i32 %i.2.lcssa, -2
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub33, i32 noundef %i.2.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%16 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp eq i32 %16, 0
br i1 %cmp17, label %while.end, label %for.cond20.preheader
while.end: ; preds = %for.end32, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %prime) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int isprime(int n){
for(int i=2; i*i<=n; i++){
if(n%i==0)
return 0;
}
return 1;
}
int main(){
int num;
while(1){
scanf("%d", &num);
if(num==0)break;
for(int i=num; i>2; i--){
if(isprime(i)==1)
if(isprime(i-2)==1){
printf("%d %d\n", i-2, i);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277939/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277939/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isprime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp slt i32 %n, 4
br i1 %cmp.not6, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.07, 1
%mul = mul nsw i32 %inc, %inc
%cmp.not = icmp sgt i32 %mul, %n
br i1 %cmp.not, label %cleanup.loopexit, label %for.body, !llvm.loop !5
for.body: ; preds = %entry, %for.cond
%i.07 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %n, %i.07
%cmp1 = icmp ne i32 %rem, 0
br i1 %cmp1, label %for.cond, label %cleanup.loopexit
cleanup.loopexit: ; preds = %for.body, %for.cond
%0 = zext i1 %cmp1 to i32
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %entry
%cmp.not.lcssa = phi i32 [ 1, %entry ], [ %0, %cleanup.loopexit ]
ret i32 %cmp.not.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !7
%cmp51 = icmp eq i32 %0, 0
br i1 %cmp51, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %cleanup
%1 = phi i32 [ %2, %cleanup ], [ %0, %entry ]
%cmp148 = icmp sgt i32 %1, 2
br i1 %cmp148, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %for.cond.preheader
%cmp.not6.i65 = icmp eq i32 %1, 3
br i1 %cmp.not6.i65, label %if.then7, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader, %for.inc
%i.04966 = phi i32 [ %dec, %for.inc ], [ %1, %for.body.preheader ]
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.07.i, 1
%mul.i = mul nsw i32 %inc.i, %inc.i
%cmp.not.i = icmp sgt i32 %mul.i, %i.04966
br i1 %cmp.not.i, label %if.then4, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.body.i.preheader, %for.cond.i
%i.07.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body.i.preheader ]
%rem.i = srem i32 %i.04966, %i.07.i
%cmp1.i.not = icmp eq i32 %rem.i, 0
br i1 %cmp1.i.not, label %for.inc, label %for.cond.i
if.then4: ; preds = %for.cond.i
%sub = add nsw i32 %i.04966, -2
%cmp.not6.i18 = icmp slt i32 %i.04966, 6
br i1 %cmp.not6.i18, label %if.then7, label %for.body.i19
for.cond.i25: ; preds = %for.body.i19
%inc.i26 = add nuw nsw i32 %i.07.i20, 1
%mul.i27 = mul nsw i32 %inc.i26, %inc.i26
%cmp.not.i28 = icmp sgt i32 %mul.i27, %sub
br i1 %cmp.not.i28, label %if.then7, label %for.body.i19, !llvm.loop !5
for.body.i19: ; preds = %if.then4, %for.cond.i25
%i.07.i20 = phi i32 [ %inc.i26, %for.cond.i25 ], [ 2, %if.then4 ]
%rem.i21 = srem i32 %sub, %i.07.i20
%cmp1.i22.not = icmp eq i32 %rem.i21, 0
br i1 %cmp1.i22.not, label %for.inc, label %for.cond.i25
if.then7: ; preds = %if.then4, %for.inc, %for.cond.i25, %for.body.preheader
%i.04964 = phi i32 [ %1, %for.body.preheader ], [ %i.04966, %for.cond.i25 ], [ %dec, %for.inc ], [ %i.04966, %if.then4 ]
%sub3640 = phi i32 [ 1, %for.body.preheader ], [ %sub, %for.cond.i25 ], [ 1, %for.inc ], [ %sub, %if.then4 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub3640, i32 noundef %i.04964)
br label %cleanup
for.inc: ; preds = %for.body.i, %for.body.i19
%dec = add nsw i32 %i.04966, -1
%cmp.not6.i = icmp eq i32 %dec, 3
br i1 %cmp.not6.i, label %if.then7, label %for.body.i.preheader
cleanup: ; preds = %for.cond.preheader, %if.then7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%2 = load i32, ptr %num, align 4, !tbaa !7
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main () {
int t = 0;
int res = 0;
int lim = 1;
int pow = 1;
res = scanf("%d", &t);
while (pow*3 <= 1000000000) {
lim++;
pow *= 3;
}
while (t > 0) {
int n = 0;
res = scanf("%d", &n);
if (n > lim) {
printf("NO\n");
} else {
int pow = 3;
printf("YES\n");
printf("1");
n--;
while (n > 0) {
printf(" %d", pow);
pow *= 3;
n--;
}
printf("\n");
}
t--;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27799/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.6 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
store i32 0, ptr %t, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%.pr = load i32, ptr %t, align 4, !tbaa !5
%cmp330 = icmp sgt i32 %.pr, 0
br i1 %cmp330, label %while.body4, label %while.end20
while.body4: ; preds = %entry, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 0, ptr %n, align 4, !tbaa !5
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 19
br i1 %cmp6, label %if.then, label %if.else
if.then: ; preds = %while.body4
%puts25 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %if.end
if.else: ; preds = %while.body4
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%putchar = call i32 @putchar(i32 49)
%storemerge.in26 = load i32, ptr %n, align 4, !tbaa !5
%storemerge27 = add nsw i32 %storemerge.in26, -1
store i32 %storemerge27, ptr %n, align 4, !tbaa !5
%cmp1228 = icmp sgt i32 %storemerge.in26, 1
br i1 %cmp1228, label %while.body13, label %while.end17
while.body13: ; preds = %if.else, %while.body13
%pow8.029 = phi i32 [ %mul15, %while.body13 ], [ 3, %if.else ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %pow8.029)
%mul15 = mul nsw i32 %pow8.029, 3
%storemerge.in = load i32, ptr %n, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, -1
store i32 %storemerge, ptr %n, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %storemerge.in, 1
br i1 %cmp12, label %while.body13, label %while.end17, !llvm.loop !9
while.end17: ; preds = %while.body13, %if.else
%putchar24 = call i32 @putchar(i32 10)
br label %if.end
if.end: ; preds = %while.end17, %if.then
%1 = load i32, ptr %t, align 4, !tbaa !5
%dec19 = add nsw i32 %1, -1
store i32 %dec19, ptr %t, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%cmp3 = icmp sgt i32 %1, 1
br i1 %cmp3, label %while.body4, label %while.end20, !llvm.loop !11
while.end20: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int s, t, info, math, sci, en;
scanf("%d%d%d%d", &info, &math, &sci, &en);
s = info + math + sci + en;
scanf("%d%d%d%d", &info, &math, &sci, &en);
t = info + math + sci + en;
if(s>t) {
printf("%d\n", s);
} else {
printf("%d\n", t);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278053/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278053/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%info = alloca i32, align 4
%math = alloca i32, align 4
%sci = alloca i32, align 4
%en = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %info) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %math) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sci) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %en) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %info, ptr noundef nonnull %math, ptr noundef nonnull %sci, ptr noundef nonnull %en)
%0 = load i32, ptr %info, align 4, !tbaa !5
%1 = load i32, ptr %math, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %sci, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%3 = load i32, ptr %en, align 4, !tbaa !5
%add2 = add nsw i32 %add1, %3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %info, ptr noundef nonnull %math, ptr noundef nonnull %sci, ptr noundef nonnull %en)
%4 = load i32, ptr %info, align 4, !tbaa !5
%5 = load i32, ptr %math, align 4, !tbaa !5
%add4 = add nsw i32 %5, %4
%6 = load i32, ptr %sci, align 4, !tbaa !5
%add5 = add nsw i32 %add4, %6
%7 = load i32, ptr %en, align 4, !tbaa !5
%add6 = add nsw i32 %add5, %7
%add2.add6 = call i32 @llvm.smax.i32(i32 %add2, i32 %add6)
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add2.add6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %en) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sci) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %math) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %info) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a1,b1,c1,d1,a2,b2,c2,d2,s,t;
scanf("%d %d %d %d",&a1,&b1,&c1,&d1);
scanf("%d %d %d %d",&a2,&b2,&c2,&d2);
s=a1+b1+c1+d1;
t=a2+b2+c2+d2;
if(s>t)
printf("%d\n",s);
else
printf("%d\n",t);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278097/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278097/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a1 = alloca i32, align 4
%b1 = alloca i32, align 4
%c1 = alloca i32, align 4
%d1 = alloca i32, align 4
%a2 = alloca i32, align 4
%b2 = alloca i32, align 4
%c2 = alloca i32, align 4
%d2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %b1, ptr noundef nonnull %c1, ptr noundef nonnull %d1)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a2, ptr noundef nonnull %b2, ptr noundef nonnull %c2, ptr noundef nonnull %d2)
%0 = load i32, ptr %a1, align 4, !tbaa !5
%1 = load i32, ptr %b1, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c1, align 4, !tbaa !5
%add2 = add nsw i32 %add, %2
%3 = load i32, ptr %d1, align 4, !tbaa !5
%add3 = add nsw i32 %add2, %3
%4 = load i32, ptr %a2, align 4, !tbaa !5
%5 = load i32, ptr %b2, align 4, !tbaa !5
%add4 = add nsw i32 %5, %4
%6 = load i32, ptr %c2, align 4, !tbaa !5
%add5 = add nsw i32 %add4, %6
%7 = load i32, ptr %d2, align 4, !tbaa !5
%add6 = add nsw i32 %add5, %7
%add3.add6 = call i32 @llvm.smax.i32(i32 %add3, i32 %add6)
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add3.add6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int t;
scanf("%d", &t);
while(t--) {
int n;
scanf("%d", &n);
printf("%d\n", (1<<n)-1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27814/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27814/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec3 = add nsw i32 %0, -1
store i32 %dec3, ptr %t, align 4, !tbaa !5
%tobool.not4 = icmp eq i32 %0, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%notmask = shl nsw i32 -1, %1
%sub = xor i32 %notmask, -1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%2 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int sub[5];
int sum[2];
int i;
for(i=-0;i<2;i++){
scanf("%d %d %d %d",&sub[0],&sub[1],&sub[2],&sub[3]);
sum[0]=sub[0]+sub[1]+sub[2]+sub[3];
}
if(sum[0]>sum[1]){
printf("%d\n",sum[0]);
}
else{
printf("%d\n",sum[1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278204/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278204/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%sub = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %sub) #3
%arrayidx1 = getelementptr inbounds [5 x i32], ptr %sub, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [5 x i32], ptr %sub, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [5 x i32], ptr %sub, i64 0, i64 3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sub, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sub, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef undef)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %sub) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int t=0;
int cmpfunc (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
scanf("%d",&t);
for(int i=0;i<t;i++){
int n=0;
scanf("%d",&n);
unsigned long long a=(int)pow(3,n-1);
if(a<=1000000000){
printf("YES\n");
for(int m=0;m<n-1;m++)printf("%lld ",(long long)pow(3,m));
printf("%lld \n",(long long)pow(3,n-1));
}
else printf("NO\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27827/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27827/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@t = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld \00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%lld \0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpfunc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
%0 = load i32, ptr @t, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end, %entry
ret i32 0
for.body: ; preds = %entry, %if.end
%i.035 = phi i32 [ %inc25, %if.end ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr %n, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%conv = sitofp i32 %sub to double
%call2 = call double @pow(double noundef 3.000000e+00, double noundef %conv) #6
%conv3 = fptosi double %call2 to i32
%cmp5 = icmp ult i32 %conv3, 1000000001
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %for.body
%puts30 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%2 = load i32, ptr %n, align 4, !tbaa !5
%sub931 = add nsw i32 %2, -1
%cmp1032 = icmp sgt i32 %2, 1
br i1 %cmp1032, label %for.body13, label %for.cond.cleanup12
for.cond.cleanup12: ; preds = %for.body13, %if.then
%sub9.lcssa = phi i32 [ %sub931, %if.then ], [ %sub9, %for.body13 ]
%conv19 = sitofp i32 %sub9.lcssa to double
%call20 = call double @pow(double noundef 3.000000e+00, double noundef %conv19) #6
%conv21 = fptosi double %call20 to i64
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %conv21)
br label %if.end
for.body13: ; preds = %if.then, %for.body13
%m.033 = phi i32 [ %inc, %for.body13 ], [ 0, %if.then ]
%conv14 = sitofp i32 %m.033 to double
%call15 = call double @pow(double noundef 3.000000e+00, double noundef %conv14) #6
%conv16 = fptosi double %call15 to i64
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %conv16)
%inc = add nuw nsw i32 %m.033, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%sub9 = add nsw i32 %3, -1
%cmp10 = icmp slt i32 %inc, %sub9
br i1 %cmp10, label %for.body13, label %for.cond.cleanup12, !llvm.loop !9
if.else: ; preds = %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %for.cond.cleanup12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
%inc25 = add nuw nsw i32 %i.035, 1
%4 = load i32, ptr @t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc25, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define min(a,b) ((a)<(b)?(a):(b))
struct st{
int num;
int c;
int cd;
};
int main(){
int n,c,i,j,k,l;
int d[31][31];
int cc[500][500];
scanf("%d%d",&n,&c);
int se[3][100]={0},tt[3]={0};
for(i=0;i<c;i++){
for(j=0;j<c;j++){
scanf("%d",&d[i][j]);
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%d",&cc[i][j]);
se[(i+j)%3][cc[i][j]-1]++;
}
}
long long ans=2000000000000000;
for(i=0;i<c;i++){
for(j=0;j<c;j++){
for(k=0;k<c;k++){
long long tmp=0;
if(i==j||j==k||k==i)continue;
for(l=0;l<c;l++)tmp+=d[l][i]*se[0][l];
for(l=0;l<c;l++)tmp+=d[l][j]*se[1][l];
for(l=0;l<c;l++)tmp+=d[l][k]*se[2][l];
ans=min(ans,tmp);
}
}
}
printf("%lld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278312/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278312/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca [31 x [31 x i32]], align 16
%cc = alloca [500 x [500 x i32]], align 16
%se = alloca [3 x [100 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 3844, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %cc) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %c)
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %se) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1200) %se, i8 0, i64 1200, i1 false)
%0 = load i32, ptr %c, align 4, !tbaa !5
%cmp168 = icmp sgt i32 %0, 0
br i1 %cmp168, label %for.cond1.preheader, label %for.cond10.preheader
for.cond1.preheader: ; preds = %entry, %for.inc7
%1 = phi i32 [ %6, %for.inc7 ], [ %0, %entry ]
%indvars.iv210 = phi i64 [ %indvars.iv.next211, %for.inc7 ], [ 0, %entry ]
%cmp2166 = icmp sgt i32 %1, 0
br i1 %cmp2166, label %for.body3, label %for.cond1.preheader.for.inc7_crit_edge
for.cond1.preheader.for.inc7_crit_edge: ; preds = %for.cond1.preheader
%.pre248 = sext i32 %1 to i64
br label %for.inc7
for.cond10.preheader: ; preds = %for.inc7, %entry
%2 = phi i32 [ %0, %entry ], [ %6, %for.inc7 ]
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp11172 = icmp sgt i32 %3, 0
br i1 %cmp11172, label %for.cond13.preheader, label %for.cond36.preheader
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv210, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %c, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !9
for.inc7: ; preds = %for.body3, %for.cond1.preheader.for.inc7_crit_edge
%.pre-phi = phi i64 [ %.pre248, %for.cond1.preheader.for.inc7_crit_edge ], [ %5, %for.body3 ]
%6 = phi i32 [ %1, %for.cond1.preheader.for.inc7_crit_edge ], [ %4, %for.body3 ]
%indvars.iv.next211 = add nuw nsw i64 %indvars.iv210, 1
%cmp = icmp slt i64 %indvars.iv.next211, %.pre-phi
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !11
for.cond13.preheader: ; preds = %for.cond10.preheader, %for.inc33
%7 = phi i32 [ %37, %for.inc33 ], [ %3, %for.cond10.preheader ]
%indvars.iv217 = phi i64 [ %indvars.iv.next218, %for.inc33 ], [ 0, %for.cond10.preheader ]
%cmp14170 = icmp sgt i32 %7, 0
br i1 %cmp14170, label %for.body15, label %for.cond13.preheader.for.inc33_crit_edge
for.cond13.preheader.for.inc33_crit_edge: ; preds = %for.cond13.preheader
%.pre249 = sext i32 %7 to i64
br label %for.inc33
for.cond36.preheader.loopexit: ; preds = %for.inc33
%.pre = load i32, ptr %c, align 4, !tbaa !5
br label %for.cond36.preheader
for.cond36.preheader: ; preds = %for.cond36.preheader.loopexit, %for.cond10.preheader
%8 = phi i32 [ %.pre, %for.cond36.preheader.loopexit ], [ %2, %for.cond10.preheader ]
%cmp37202 = icmp sgt i32 %8, 0
br i1 %cmp37202, label %for.cond39.preheader.us.preheader, label %for.end107
for.cond39.preheader.us.preheader: ; preds = %for.cond36.preheader
%wide.trip.count246 = zext i32 %8 to i64
%9 = add nsw i64 %wide.trip.count246, -1
%xtraiter = and i64 %wide.trip.count246, 1
%10 = icmp eq i64 %9, 0
%unroll_iter = and i64 %wide.trip.count246, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%xtraiter264 = and i64 %wide.trip.count246, 1
%11 = icmp eq i64 %9, 0
%unroll_iter267 = and i64 %wide.trip.count246, 4294967294
%lcmp.mod265.not = icmp eq i64 %xtraiter264, 0
%xtraiter269 = and i64 %wide.trip.count246, 1
%12 = icmp eq i64 %9, 0
%unroll_iter272 = and i64 %wide.trip.count246, 4294967294
%lcmp.mod270.not = icmp eq i64 %xtraiter269, 0
br label %for.cond39.preheader.us
for.cond39.preheader.us: ; preds = %for.cond39.preheader.us.preheader, %for.cond39.for.inc105_crit_edge.split.us.us
%indvars.iv243 = phi i64 [ 0, %for.cond39.preheader.us.preheader ], [ %indvars.iv.next244, %for.cond39.for.inc105_crit_edge.split.us.us ]
%ans.0204.us = phi i64 [ 2000000000000000, %for.cond39.preheader.us.preheader ], [ %.us-phi.us.us, %for.cond39.for.inc105_crit_edge.split.us.us ]
br label %for.cond42.preheader.us.us
for.cond42.preheader.us.us: ; preds = %for.cond42.for.inc102_crit_edge.us.us, %for.cond39.preheader.us
%indvars.iv238 = phi i64 [ %indvars.iv.next239, %for.cond42.for.inc102_crit_edge.us.us ], [ 0, %for.cond39.preheader.us ]
%ans.1193.us.us = phi i64 [ %.us-phi.us.us, %for.cond42.for.inc102_crit_edge.us.us ], [ %ans.0204.us, %for.cond39.preheader.us ]
%cmp45.us.us = icmp eq i64 %indvars.iv243, %indvars.iv238
%cmp45.fr.us.us = freeze i1 %cmp45.us.us
br i1 %cmp45.fr.us.us, label %for.cond42.for.inc102_crit_edge.us.us, label %for.body44.us195.us
for.body44.us195.us: ; preds = %for.cond42.preheader.us.us, %cleanup.us.us
%indvars.iv233 = phi i64 [ %indvars.iv.next234, %cleanup.us.us ], [ 0, %for.cond42.preheader.us.us ]
%ans.2188.us.us = phi i64 [ %ans.3.us.us, %cleanup.us.us ], [ %ans.1193.us.us, %for.cond42.preheader.us.us ]
%cmp46.us.us = icmp eq i64 %indvars.iv238, %indvars.iv233
%cmp48.us.us = icmp eq i64 %indvars.iv233, %indvars.iv243
%or.cond165.us.us = or i1 %cmp48.us.us, %cmp46.us.us
br i1 %or.cond165.us.us, label %cleanup.us.us, label %for.body51.us.us.preheader
for.body51.us.us.preheader: ; preds = %for.body44.us195.us
br i1 %10, label %for.body66.us.us.preheader.unr-lcssa, label %for.body51.us.us
for.body83.us.us: ; preds = %for.body83.us.us.preheader, %for.body83.us.us
%indvars.iv228 = phi i64 [ %indvars.iv.next229.1, %for.body83.us.us ], [ 0, %for.body83.us.us.preheader ]
%tmp.2183.us.us = phi i64 [ %add93.us.us.1, %for.body83.us.us ], [ %add76.us.us.lcssa, %for.body83.us.us.preheader ]
%niter273 = phi i64 [ %niter273.next.1, %for.body83.us.us ], [ 0, %for.body83.us.us.preheader ]
%arrayidx87.us.us = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv228, i64 %indvars.iv233
%13 = load i32, ptr %arrayidx87.us.us, align 4, !tbaa !5
%arrayidx90.us.us = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 2, i64 %indvars.iv228
%14 = load i32, ptr %arrayidx90.us.us, align 8, !tbaa !5
%mul91.us.us = mul nsw i32 %14, %13
%conv92.us.us = sext i32 %mul91.us.us to i64
%add93.us.us = add nsw i64 %tmp.2183.us.us, %conv92.us.us
%indvars.iv.next229 = or i64 %indvars.iv228, 1
%arrayidx87.us.us.1 = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv.next229, i64 %indvars.iv233
%15 = load i32, ptr %arrayidx87.us.us.1, align 4, !tbaa !5
%arrayidx90.us.us.1 = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 2, i64 %indvars.iv.next229
%16 = load i32, ptr %arrayidx90.us.us.1, align 4, !tbaa !5
%mul91.us.us.1 = mul nsw i32 %16, %15
%conv92.us.us.1 = sext i32 %mul91.us.us.1 to i64
%add93.us.us.1 = add nsw i64 %add93.us.us, %conv92.us.us.1
%indvars.iv.next229.1 = add nuw nsw i64 %indvars.iv228, 2
%niter273.next.1 = add i64 %niter273, 2
%niter273.ncmp.1 = icmp eq i64 %niter273.next.1, %unroll_iter272
br i1 %niter273.ncmp.1, label %for.cond80.for.end96_crit_edge.us.us.unr-lcssa, label %for.body83.us.us, !llvm.loop !13
for.body66.us.us: ; preds = %for.body66.us.us.preheader, %for.body66.us.us
%indvars.iv223 = phi i64 [ %indvars.iv.next224.1, %for.body66.us.us ], [ 0, %for.body66.us.us.preheader ]
%tmp.1179.us.us = phi i64 [ %add76.us.us.1, %for.body66.us.us ], [ %add59.us.us.lcssa, %for.body66.us.us.preheader ]
%niter268 = phi i64 [ %niter268.next.1, %for.body66.us.us ], [ 0, %for.body66.us.us.preheader ]
%arrayidx70.us.us = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv223, i64 %indvars.iv238
%17 = load i32, ptr %arrayidx70.us.us, align 4, !tbaa !5
%arrayidx73.us.us = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 1, i64 %indvars.iv223
%18 = load i32, ptr %arrayidx73.us.us, align 8, !tbaa !5
%mul74.us.us = mul nsw i32 %18, %17
%conv75.us.us = sext i32 %mul74.us.us to i64
%add76.us.us = add nsw i64 %tmp.1179.us.us, %conv75.us.us
%indvars.iv.next224 = or i64 %indvars.iv223, 1
%arrayidx70.us.us.1 = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv.next224, i64 %indvars.iv238
%19 = load i32, ptr %arrayidx70.us.us.1, align 4, !tbaa !5
%arrayidx73.us.us.1 = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 1, i64 %indvars.iv.next224
%20 = load i32, ptr %arrayidx73.us.us.1, align 4, !tbaa !5
%mul74.us.us.1 = mul nsw i32 %20, %19
%conv75.us.us.1 = sext i32 %mul74.us.us.1 to i64
%add76.us.us.1 = add nsw i64 %add76.us.us, %conv75.us.us.1
%indvars.iv.next224.1 = add nuw nsw i64 %indvars.iv223, 2
%niter268.next.1 = add i64 %niter268, 2
%niter268.ncmp.1 = icmp eq i64 %niter268.next.1, %unroll_iter267
br i1 %niter268.ncmp.1, label %for.body83.us.us.preheader.unr-lcssa, label %for.body66.us.us, !llvm.loop !14
for.body83.us.us.preheader.unr-lcssa: ; preds = %for.body66.us.us, %for.body66.us.us.preheader
%add76.us.us.lcssa.ph = phi i64 [ undef, %for.body66.us.us.preheader ], [ %add76.us.us.1, %for.body66.us.us ]
%indvars.iv223.unr = phi i64 [ 0, %for.body66.us.us.preheader ], [ %indvars.iv.next224.1, %for.body66.us.us ]
%tmp.1179.us.us.unr = phi i64 [ %add59.us.us.lcssa, %for.body66.us.us.preheader ], [ %add76.us.us.1, %for.body66.us.us ]
br i1 %lcmp.mod265.not, label %for.body83.us.us.preheader, label %for.body66.us.us.epil
for.body66.us.us.epil: ; preds = %for.body83.us.us.preheader.unr-lcssa
%arrayidx70.us.us.epil = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv223.unr, i64 %indvars.iv238
%21 = load i32, ptr %arrayidx70.us.us.epil, align 4, !tbaa !5
%arrayidx73.us.us.epil = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 1, i64 %indvars.iv223.unr
%22 = load i32, ptr %arrayidx73.us.us.epil, align 4, !tbaa !5
%mul74.us.us.epil = mul nsw i32 %22, %21
%conv75.us.us.epil = sext i32 %mul74.us.us.epil to i64
%add76.us.us.epil = add nsw i64 %tmp.1179.us.us.unr, %conv75.us.us.epil
br label %for.body83.us.us.preheader
for.body83.us.us.preheader: ; preds = %for.body83.us.us.preheader.unr-lcssa, %for.body66.us.us.epil
%add76.us.us.lcssa = phi i64 [ %add76.us.us.lcssa.ph, %for.body83.us.us.preheader.unr-lcssa ], [ %add76.us.us.epil, %for.body66.us.us.epil ]
br i1 %12, label %for.cond80.for.end96_crit_edge.us.us.unr-lcssa, label %for.body83.us.us
for.body51.us.us: ; preds = %for.body51.us.us.preheader, %for.body51.us.us
%indvars.iv220 = phi i64 [ %indvars.iv.next221.1, %for.body51.us.us ], [ 0, %for.body51.us.us.preheader ]
%tmp.0176.us.us = phi i64 [ %add59.us.us.1, %for.body51.us.us ], [ 0, %for.body51.us.us.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body51.us.us ], [ 0, %for.body51.us.us.preheader ]
%arrayidx55.us.us = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv220, i64 %indvars.iv243
%23 = load i32, ptr %arrayidx55.us.us, align 4, !tbaa !5
%arrayidx58.us.us = getelementptr inbounds [100 x i32], ptr %se, i64 0, i64 %indvars.iv220
%24 = load i32, ptr %arrayidx58.us.us, align 8, !tbaa !5
%mul.us.us = mul nsw i32 %24, %23
%conv.us.us = sext i32 %mul.us.us to i64
%add59.us.us = add nsw i64 %tmp.0176.us.us, %conv.us.us
%indvars.iv.next221 = or i64 %indvars.iv220, 1
%arrayidx55.us.us.1 = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv.next221, i64 %indvars.iv243
%25 = load i32, ptr %arrayidx55.us.us.1, align 4, !tbaa !5
%arrayidx58.us.us.1 = getelementptr inbounds [100 x i32], ptr %se, i64 0, i64 %indvars.iv.next221
%26 = load i32, ptr %arrayidx58.us.us.1, align 4, !tbaa !5
%mul.us.us.1 = mul nsw i32 %26, %25
%conv.us.us.1 = sext i32 %mul.us.us.1 to i64
%add59.us.us.1 = add nsw i64 %add59.us.us, %conv.us.us.1
%indvars.iv.next221.1 = add nuw nsw i64 %indvars.iv220, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.body66.us.us.preheader.unr-lcssa, label %for.body51.us.us, !llvm.loop !15
for.body66.us.us.preheader.unr-lcssa: ; preds = %for.body51.us.us, %for.body51.us.us.preheader
%add59.us.us.lcssa.ph = phi i64 [ undef, %for.body51.us.us.preheader ], [ %add59.us.us.1, %for.body51.us.us ]
%indvars.iv220.unr = phi i64 [ 0, %for.body51.us.us.preheader ], [ %indvars.iv.next221.1, %for.body51.us.us ]
%tmp.0176.us.us.unr = phi i64 [ 0, %for.body51.us.us.preheader ], [ %add59.us.us.1, %for.body51.us.us ]
br i1 %lcmp.mod.not, label %for.body66.us.us.preheader, label %for.body51.us.us.epil
for.body51.us.us.epil: ; preds = %for.body66.us.us.preheader.unr-lcssa
%arrayidx55.us.us.epil = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv220.unr, i64 %indvars.iv243
%27 = load i32, ptr %arrayidx55.us.us.epil, align 4, !tbaa !5
%arrayidx58.us.us.epil = getelementptr inbounds [100 x i32], ptr %se, i64 0, i64 %indvars.iv220.unr
%28 = load i32, ptr %arrayidx58.us.us.epil, align 4, !tbaa !5
%mul.us.us.epil = mul nsw i32 %28, %27
%conv.us.us.epil = sext i32 %mul.us.us.epil to i64
%add59.us.us.epil = add nsw i64 %tmp.0176.us.us.unr, %conv.us.us.epil
br label %for.body66.us.us.preheader
for.body66.us.us.preheader: ; preds = %for.body66.us.us.preheader.unr-lcssa, %for.body51.us.us.epil
%add59.us.us.lcssa = phi i64 [ %add59.us.us.lcssa.ph, %for.body66.us.us.preheader.unr-lcssa ], [ %add59.us.us.epil, %for.body51.us.us.epil ]
br i1 %11, label %for.body83.us.us.preheader.unr-lcssa, label %for.body66.us.us
cleanup.us.us: ; preds = %for.cond80.for.end96_crit_edge.us.us, %for.body44.us195.us
%ans.3.us.us = phi i64 [ %cond.us.us, %for.cond80.for.end96_crit_edge.us.us ], [ %ans.2188.us.us, %for.body44.us195.us ]
%indvars.iv.next234 = add nuw nsw i64 %indvars.iv233, 1
%exitcond237.not = icmp eq i64 %indvars.iv.next234, %wide.trip.count246
br i1 %exitcond237.not, label %for.cond42.for.inc102_crit_edge.us.us, label %for.body44.us195.us, !llvm.loop !16
for.cond80.for.end96_crit_edge.us.us.unr-lcssa: ; preds = %for.body83.us.us, %for.body83.us.us.preheader
%add93.us.us.lcssa.ph = phi i64 [ undef, %for.body83.us.us.preheader ], [ %add93.us.us.1, %for.body83.us.us ]
%indvars.iv228.unr = phi i64 [ 0, %for.body83.us.us.preheader ], [ %indvars.iv.next229.1, %for.body83.us.us ]
%tmp.2183.us.us.unr = phi i64 [ %add76.us.us.lcssa, %for.body83.us.us.preheader ], [ %add93.us.us.1, %for.body83.us.us ]
br i1 %lcmp.mod270.not, label %for.cond80.for.end96_crit_edge.us.us, label %for.body83.us.us.epil
for.body83.us.us.epil: ; preds = %for.cond80.for.end96_crit_edge.us.us.unr-lcssa
%arrayidx87.us.us.epil = getelementptr inbounds [31 x [31 x i32]], ptr %d, i64 0, i64 %indvars.iv228.unr, i64 %indvars.iv233
%29 = load i32, ptr %arrayidx87.us.us.epil, align 4, !tbaa !5
%arrayidx90.us.us.epil = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 2, i64 %indvars.iv228.unr
%30 = load i32, ptr %arrayidx90.us.us.epil, align 4, !tbaa !5
%mul91.us.us.epil = mul nsw i32 %30, %29
%conv92.us.us.epil = sext i32 %mul91.us.us.epil to i64
%add93.us.us.epil = add nsw i64 %tmp.2183.us.us.unr, %conv92.us.us.epil
br label %for.cond80.for.end96_crit_edge.us.us
for.cond80.for.end96_crit_edge.us.us: ; preds = %for.cond80.for.end96_crit_edge.us.us.unr-lcssa, %for.body83.us.us.epil
%add93.us.us.lcssa = phi i64 [ %add93.us.us.lcssa.ph, %for.cond80.for.end96_crit_edge.us.us.unr-lcssa ], [ %add93.us.us.epil, %for.body83.us.us.epil ]
%cond.us.us = call i64 @llvm.smin.i64(i64 %ans.2188.us.us, i64 %add93.us.us.lcssa)
br label %cleanup.us.us
for.cond42.for.inc102_crit_edge.us.us: ; preds = %cleanup.us.us, %for.cond42.preheader.us.us
%.us-phi.us.us = phi i64 [ %ans.1193.us.us, %for.cond42.preheader.us.us ], [ %ans.3.us.us, %cleanup.us.us ]
%indvars.iv.next239 = add nuw nsw i64 %indvars.iv238, 1
%exitcond242.not = icmp eq i64 %indvars.iv.next239, %wide.trip.count246
br i1 %exitcond242.not, label %for.cond39.for.inc105_crit_edge.split.us.us, label %for.cond42.preheader.us.us, !llvm.loop !17
for.cond39.for.inc105_crit_edge.split.us.us: ; preds = %for.cond42.for.inc102_crit_edge.us.us
%indvars.iv.next244 = add nuw nsw i64 %indvars.iv243, 1
%exitcond247.not = icmp eq i64 %indvars.iv.next244, %wide.trip.count246
br i1 %exitcond247.not, label %for.end107, label %for.cond39.preheader.us, !llvm.loop !18
for.body15: ; preds = %for.cond13.preheader, %for.body15
%indvars.iv213 = phi i64 [ %indvars.iv.next214, %for.body15 ], [ 0, %for.cond13.preheader ]
%arrayidx19 = getelementptr inbounds [500 x [500 x i32]], ptr %cc, i64 0, i64 %indvars.iv217, i64 %indvars.iv213
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx19)
%31 = add nuw nsw i64 %indvars.iv213, %indvars.iv217
%32 = trunc i64 %31 to i32
%rem = urem i32 %32, 3
%idxprom21 = zext i32 %rem to i64
%33 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%sub = add nsw i32 %33, -1
%idxprom27 = sext i32 %sub to i64
%arrayidx28 = getelementptr inbounds [3 x [100 x i32]], ptr %se, i64 0, i64 %idxprom21, i64 %idxprom27
%34 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%inc29 = add nsw i32 %34, 1
store i32 %inc29, ptr %arrayidx28, align 4, !tbaa !5
%indvars.iv.next214 = add nuw nsw i64 %indvars.iv213, 1
%35 = load i32, ptr %n, align 4, !tbaa !5
%36 = sext i32 %35 to i64
%cmp14 = icmp slt i64 %indvars.iv.next214, %36
br i1 %cmp14, label %for.body15, label %for.inc33, !llvm.loop !19
for.inc33: ; preds = %for.body15, %for.cond13.preheader.for.inc33_crit_edge
%.pre-phi250 = phi i64 [ %.pre249, %for.cond13.preheader.for.inc33_crit_edge ], [ %36, %for.body15 ]
%37 = phi i32 [ %7, %for.cond13.preheader.for.inc33_crit_edge ], [ %35, %for.body15 ]
%indvars.iv.next218 = add nuw nsw i64 %indvars.iv217, 1
%cmp11 = icmp slt i64 %indvars.iv.next218, %.pre-phi250
br i1 %cmp11, label %for.cond13.preheader, label %for.cond36.preheader.loopexit, !llvm.loop !20
for.end107: ; preds = %for.cond39.for.inc105_crit_edge.split.us.us, %for.cond36.preheader
%ans.0.lcssa = phi i64 [ 2000000000000000, %for.cond36.preheader ], [ %.us-phi.us.us, %for.cond39.for.inc105_crit_edge.split.us.us ]
%call108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %se) #5
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %cc) #5
call void @llvm.lifetime.end.p0(i64 3844, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !12}
|
#include<stdio.h>
int main(){
int a[10],i;
scanf("%d",&a[0]);
while(a[0] !=0){
for(i =0;i <9;i++){
scanf("%d",&a[i+1]);
a[0]=a[0]-a[i+1];
}
printf("%d\n",a[0]);
scanf("%d",&a[0]);
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278356/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278356/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 16, !tbaa !5
%cmp.not18 = icmp eq i32 %0, 0
br i1 %cmp.not18, label %while.end, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 1
%arrayidx3.1 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 2
%arrayidx3.2 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 3
%arrayidx3.3 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 4
%arrayidx3.4 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 5
%arrayidx3.5 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 6
%arrayidx3.6 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 7
%arrayidx3.7 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 8
%arrayidx3.8 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 9
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %for.cond.preheader
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3)
%1 = load i32, ptr %a, align 16, !tbaa !5
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
store i32 %sub, ptr %a, align 16, !tbaa !5
%call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.1)
%3 = load i32, ptr %a, align 16, !tbaa !5
%4 = load i32, ptr %arrayidx3.1, align 8, !tbaa !5
%sub.1 = sub nsw i32 %3, %4
store i32 %sub.1, ptr %a, align 16, !tbaa !5
%call4.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.2)
%5 = load i32, ptr %a, align 16, !tbaa !5
%6 = load i32, ptr %arrayidx3.2, align 4, !tbaa !5
%sub.2 = sub nsw i32 %5, %6
store i32 %sub.2, ptr %a, align 16, !tbaa !5
%call4.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.3)
%7 = load i32, ptr %a, align 16, !tbaa !5
%8 = load i32, ptr %arrayidx3.3, align 16, !tbaa !5
%sub.3 = sub nsw i32 %7, %8
store i32 %sub.3, ptr %a, align 16, !tbaa !5
%call4.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.4)
%9 = load i32, ptr %a, align 16, !tbaa !5
%10 = load i32, ptr %arrayidx3.4, align 4, !tbaa !5
%sub.4 = sub nsw i32 %9, %10
store i32 %sub.4, ptr %a, align 16, !tbaa !5
%call4.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.5)
%11 = load i32, ptr %a, align 16, !tbaa !5
%12 = load i32, ptr %arrayidx3.5, align 8, !tbaa !5
%sub.5 = sub nsw i32 %11, %12
store i32 %sub.5, ptr %a, align 16, !tbaa !5
%call4.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.6)
%13 = load i32, ptr %a, align 16, !tbaa !5
%14 = load i32, ptr %arrayidx3.6, align 4, !tbaa !5
%sub.6 = sub nsw i32 %13, %14
store i32 %sub.6, ptr %a, align 16, !tbaa !5
%call4.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.7)
%15 = load i32, ptr %a, align 16, !tbaa !5
%16 = load i32, ptr %arrayidx3.7, align 16, !tbaa !5
%sub.7 = sub nsw i32 %15, %16
store i32 %sub.7, ptr %a, align 16, !tbaa !5
%call4.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3.8)
%17 = load i32, ptr %a, align 16, !tbaa !5
%18 = load i32, ptr %arrayidx3.8, align 4, !tbaa !5
%sub.8 = sub nsw i32 %17, %18
store i32 %sub.8, ptr %a, align 16, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%19 = load i32, ptr %a, align 16, !tbaa !5
%cmp.not = icmp eq i32 %19, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.cond.preheader, %entry
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
// your code goes here
int n,m,a,b;
scanf("%d %d %d %d",&n,&m,&a,&b);
if(b/m>=a)
printf("%d\n",n*a);
else
{
int tmp1=n%m;
int tmp2=n/m;
int cst=tmp2*b;
if(tmp1*a<b)
cst+=tmp1*a;
else
cst+=b;
printf("%d\n",cst);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2784/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2784/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not = icmp slt i32 %div, %2
%3 = load i32, ptr %n, align 4, !tbaa !5
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%mul = mul nsw i32 %3, %2
br label %if.end11
if.else: ; preds = %entry
%rem = srem i32 %3, %1
%div2 = sdiv i32 %3, %1
%mul3 = mul nsw i32 %div2, %0
%mul4 = mul nsw i32 %rem, %2
%mul4. = call i32 @llvm.smin.i32(i32 %mul4, i32 %0)
%cst.0 = add nsw i32 %mul3, %mul4.
br label %if.end11
if.end11: ; preds = %if.else, %if.then
%cst.0.sink = phi i32 [ %cst.0, %if.else ], [ %mul, %if.then ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cst.0.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n;
scanf("%d", &n);
long long int i = 0, k = 1;
while (i < n)
{
k = k * 2;
i++;
}
printf("%lld\n", k - 1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27845/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27845/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec12 = add nsw i32 %0, -1
store i32 %dec12, ptr %t, align 4, !tbaa !5
%tobool.not13 = icmp eq i32 %0, 0
br i1 %tobool.not13, label %while.end6, label %while.body
while.body: ; preds = %entry, %while.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%cmp9 = icmp sgt i32 %1, 0
br i1 %cmp9, label %while.body4.preheader, label %while.end
while.body4.preheader: ; preds = %while.body
%xtraiter = and i64 %conv, 7
%2 = icmp ult i32 %1, 8
br i1 %2, label %while.end.loopexit.unr-lcssa, label %while.body4.preheader.new
while.body4.preheader.new: ; preds = %while.body4.preheader
%unroll_iter = and i64 %conv, -8
br label %while.body4
while.body4: ; preds = %while.body4, %while.body4.preheader.new
%k.011 = phi i64 [ 1, %while.body4.preheader.new ], [ %mul, %while.body4 ]
%niter = phi i64 [ 0, %while.body4.preheader.new ], [ %niter.next.7, %while.body4 ]
%mul = shl i64 %k.011, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %while.end.loopexit.unr-lcssa, label %while.body4, !llvm.loop !9
while.end.loopexit.unr-lcssa: ; preds = %while.body4, %while.body4.preheader
%mul.lcssa.ph = phi i64 [ undef, %while.body4.preheader ], [ %mul, %while.body4 ]
%k.011.unr = phi i64 [ 1, %while.body4.preheader ], [ %mul, %while.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body4.epil
while.body4.epil: ; preds = %while.end.loopexit.unr-lcssa, %while.body4.epil
%k.011.epil = phi i64 [ %mul.epil, %while.body4.epil ], [ %k.011.unr, %while.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %while.body4.epil ], [ 0, %while.end.loopexit.unr-lcssa ]
%mul.epil = shl nsw i64 %k.011.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %while.end, label %while.body4.epil, !llvm.loop !11
while.end: ; preds = %while.end.loopexit.unr-lcssa, %while.body4.epil, %while.body
%k.0.lcssa = phi i64 [ 1, %while.body ], [ %mul.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %mul.epil, %while.body4.epil ]
%sub = add nsw i64 %k.0.lcssa, -1
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end6, label %while.body, !llvm.loop !13
while.end6: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main (void){
int a, b, c; // A, B, Cの初期値
int k; // 操作可能な回数
scanf("%d%d%d", &a, &b, &c);
scanf("%d", &k);
for (int i = 0; i < k; i++) {
if (a < b && b < c) {
continue;
}
// aを2倍することはありえない;問題は「bとcのどちらを2倍するか?」に尽きる
else if (c <= b) {
c *= 2;
}
else if (b <= a && b <= c) {
b *= 2;
}
}
// ループの結果、期待通りに並んで場合は「Yes」、それ以外は「No」を表示する
if (a < b && b < c) {
printf("Yes\n");
}
else {
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278514/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278514/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
%.pre = load i32, ptr %a, align 4, !tbaa !5
br i1 %cmp31, label %for.body.lr.ph, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre34 = load i32, ptr %b, align 4, !tbaa !5
%.pre35 = load i32, ptr %c, align 4
br label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%c.promoted = load i32, ptr %c, align 4
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
%xtraiter = and i32 %0, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %0, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.lr.ph
%.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %6, %for.inc.1 ]
%mul1129.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %mul1129.1, %for.inc.1 ]
%mul113032.unr = phi i32 [ %b.promoted, %for.body.lr.ph ], [ %mul1129.1, %for.inc.1 ]
%.unr = phi i32 [ %c.promoted, %for.body.lr.ph ], [ %6, %for.inc.1 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%cmp2.epil = icmp slt i32 %.pre, %mul113032.unr
%cmp3.epil = icmp slt i32 %mul113032.unr, %.unr
%or.cond.epil = select i1 %cmp2.epil, i1 %cmp3.epil, i1 false
br i1 %or.cond.epil, label %for.cond.cleanup, label %if.else.epil
if.else.epil: ; preds = %for.body.epil
br i1 %cmp3.epil, label %if.else6.epil, label %if.then5.epil
if.then5.epil: ; preds = %if.else.epil
%mul.epil = shl nsw i32 %.unr, 1
store i32 %mul.epil, ptr %c, align 4, !tbaa !5
br label %for.cond.cleanup
if.else6.epil: ; preds = %if.else.epil
br i1 %cmp2.epil, label %for.cond.cleanup, label %if.then10.epil
if.then10.epil: ; preds = %if.else6.epil
%mul11.epil = shl nsw i32 %mul113032.unr, 1
store i32 %mul11.epil, ptr %b, align 4, !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %if.then10.epil, %if.else6.epil, %if.then5.epil, %for.body.epil, %entry.for.cond.cleanup_crit_edge
%2 = phi i32 [ %.pre35, %entry.for.cond.cleanup_crit_edge ], [ %.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %.unr, %for.body.epil ], [ %.unr, %if.else6.epil ], [ %.unr, %if.then10.epil ], [ %mul.epil, %if.then5.epil ]
%3 = phi i32 [ %.pre34, %entry.for.cond.cleanup_crit_edge ], [ %mul1129.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul113032.unr, %for.body.epil ], [ %mul113032.unr, %if.else6.epil ], [ %mul11.epil, %if.then10.epil ], [ %mul113032.unr, %if.then5.epil ]
%cmp14 = icmp slt i32 %.pre, %3
%cmp16 = icmp slt i32 %3, %2
%or.cond28 = select i1 %cmp14, i1 %cmp16, i1 false
%str.4.str = select i1 %or.cond28, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
for.body: ; preds = %for.inc.1, %for.body.lr.ph.new
%mul113032 = phi i32 [ %b.promoted, %for.body.lr.ph.new ], [ %mul1129.1, %for.inc.1 ]
%4 = phi i32 [ %c.promoted, %for.body.lr.ph.new ], [ %6, %for.inc.1 ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.inc.1 ]
%cmp2 = icmp slt i32 %.pre, %mul113032
%cmp3 = icmp slt i32 %mul113032, %4
%or.cond = select i1 %cmp2, i1 %cmp3, i1 false
br i1 %or.cond, label %for.inc, label %if.else
if.else: ; preds = %for.body
br i1 %cmp3, label %if.else6, label %if.then5
if.then5: ; preds = %if.else
%mul = shl nsw i32 %4, 1
store i32 %mul, ptr %c, align 4, !tbaa !5
br label %for.inc
if.else6: ; preds = %if.else
br i1 %cmp2, label %for.inc, label %if.then10
if.then10: ; preds = %if.else6
%mul11 = shl nsw i32 %mul113032, 1
store i32 %mul11, ptr %b, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.else6, %if.then10, %if.then5
%5 = phi i32 [ %4, %for.body ], [ %4, %if.else6 ], [ %4, %if.then10 ], [ %mul, %if.then5 ]
%mul1129 = phi i32 [ %mul113032, %for.body ], [ %mul113032, %if.else6 ], [ %mul11, %if.then10 ], [ %mul113032, %if.then5 ]
%cmp2.1 = icmp slt i32 %.pre, %mul1129
%cmp3.1 = icmp slt i32 %mul1129, %5
%or.cond.1 = select i1 %cmp2.1, i1 %cmp3.1, i1 false
br i1 %or.cond.1, label %for.inc.1, label %if.else.1
if.else.1: ; preds = %for.inc
br i1 %cmp3.1, label %if.else6.1, label %if.then5.1
if.then5.1: ; preds = %if.else.1
%mul.1 = shl nsw i32 %5, 1
store i32 %mul.1, ptr %c, align 4, !tbaa !5
br label %for.inc.1
if.else6.1: ; preds = %if.else.1
br i1 %cmp2.1, label %for.inc.1, label %if.then10.1
if.then10.1: ; preds = %if.else6.1
%mul11.1 = shl nsw i32 %mul1129, 1
store i32 %mul11.1, ptr %b, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then10.1, %if.else6.1, %if.then5.1, %for.inc
%6 = phi i32 [ %5, %for.inc ], [ %5, %if.else6.1 ], [ %5, %if.then10.1 ], [ %mul.1, %if.then5.1 ]
%mul1129.1 = phi i32 [ %mul1129, %for.inc ], [ %mul1129, %if.else6.1 ], [ %mul11.1, %if.then10.1 ], [ %mul1129, %if.then5.1 ]
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int a,b,c,k;
scanf("%d %d %d", &a, &b, &c);
scanf("%d", &k);
while(b <= a){
b *= 2;
k--;
}
while(c <= b){
c *= 2;
k--;
}
(k >= 0)? printf("Yes") : printf("No");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278565/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278565/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%0 = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
%k.promoted = load i32, ptr %k, align 4, !tbaa !5
%cmp.not14 = icmp sgt i32 %b.promoted, %0
br i1 %cmp.not14, label %while.cond2.preheader, label %while.body
while.cond.while.cond2.preheader_crit_edge: ; preds = %while.body
store i32 %mul, ptr %b, align 4, !tbaa !5
store i32 %dec, ptr %k, align 4, !tbaa !5
br label %while.cond2.preheader
while.cond2.preheader: ; preds = %while.cond.while.cond2.preheader_crit_edge, %entry
%k.promoted18 = phi i32 [ %dec, %while.cond.while.cond2.preheader_crit_edge ], [ %k.promoted, %entry ]
%.lcssa = phi i32 [ %mul, %while.cond.while.cond2.preheader_crit_edge ], [ %b.promoted, %entry ]
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
%cmp3.not20 = icmp sgt i32 %c.promoted, %.lcssa
br i1 %cmp3.not20, label %while.end7, label %while.body4
while.body: ; preds = %entry, %while.body
%mul1216 = phi i32 [ %mul, %while.body ], [ %b.promoted, %entry ]
%dec1315 = phi i32 [ %dec, %while.body ], [ %k.promoted, %entry ]
%mul = shl nsw i32 %mul1216, 1
%dec = add nsw i32 %dec1315, -1
%cmp.not = icmp sgt i32 %mul, %0
br i1 %cmp.not, label %while.cond.while.cond2.preheader_crit_edge, label %while.body, !llvm.loop !9
while.body4: ; preds = %while.cond2.preheader, %while.body4
%mul51722 = phi i32 [ %mul5, %while.body4 ], [ %c.promoted, %while.cond2.preheader ]
%dec61921 = phi i32 [ %dec6, %while.body4 ], [ %k.promoted18, %while.cond2.preheader ]
%mul5 = shl nsw i32 %mul51722, 1
%dec6 = add nsw i32 %dec61921, -1
%cmp3.not = icmp sgt i32 %mul5, %.lcssa
br i1 %cmp3.not, label %while.cond2.while.end7_crit_edge, label %while.body4, !llvm.loop !11
while.cond2.while.end7_crit_edge: ; preds = %while.body4
store i32 %mul5, ptr %c, align 4, !tbaa !5
store i32 %dec6, ptr %k, align 4, !tbaa !5
br label %while.end7
while.end7: ; preds = %while.cond2.while.end7_crit_edge, %while.cond2.preheader
%1 = phi i32 [ %dec6, %while.cond2.while.end7_crit_edge ], [ %k.promoted18, %while.cond2.preheader ]
%cmp8 = icmp sgt i32 %1, -1
%.str.2..str.3 = select i1 %cmp8, ptr @.str.2, ptr @.str.3
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#include <limits.h>
#include<stdlib.h>
int main() {
int a, b, c,k;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &k);
int count = 0;
while (1) {
count++;
if (a >= b) {
b *= 2;
}
else if (b >= c) {
c *= 2;
}
else {
count--;
break;
}
}
if (k >= count) {
printf("Yes\n");
}
else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278608/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278608/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
br label %while.cond.outer
while.cond.outer: ; preds = %if.then5, %entry
%mul622.ph = phi i32 [ %mul6, %if.then5 ], [ %c.promoted, %entry ]
%mul20.ph = phi i32 [ %mul20, %if.then5 ], [ %b.promoted, %entry ]
%count.0.ph = phi i32 [ %inc, %if.then5 ], [ 0, %entry ]
br label %while.cond
while.cond: ; preds = %while.cond.outer, %if.then
%mul20 = phi i32 [ %mul, %if.then ], [ %mul20.ph, %while.cond.outer ]
%count.0 = phi i32 [ %inc, %if.then ], [ %count.0.ph, %while.cond.outer ]
%inc = add nuw nsw i32 %count.0, 1
%cmp.not = icmp slt i32 %0, %mul20
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %while.cond
%mul = shl nsw i32 %mul20, 1
store i32 %mul, ptr %b, align 4, !tbaa !5
br label %while.cond
if.else: ; preds = %while.cond
%cmp4.not = icmp slt i32 %mul20, %mul622.ph
br i1 %cmp4.not, label %if.else7, label %if.then5
if.then5: ; preds = %if.else
%mul6 = shl nsw i32 %mul622.ph, 1
store i32 %mul6, ptr %c, align 4, !tbaa !5
br label %while.cond.outer
if.else7: ; preds = %if.else
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp9.not = icmp slt i32 %1, %count.0
%str.str.3 = select i1 %cmp9.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#define P 1000000007
int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return *(int*)b-*(int*)a;}
uint32_t nextpint(void){
uint_fast32_t x=0;
while(1){
uint_fast8_t c=getchar();
if('0'<=c && c<='9'){
x=x*10+c-'0';
}else{
break;
}
}
return x;
}
int b[100000];
int main(void){
int n, h, i;
n=nextpint();
h=nextpint();
int a=0;
for(i=0; i<n; i++){
int A=nextpint();
if(A>a) a=A;
b[i]=nextpint();
}
qsort(b, n, sizeof(int), compr);
for(i=0; i<n; i++){
if(h<=0 || b[i]<=a) break;
h-=b[i];
}
printf("%d\n", h>0?i+(h+a-1)/a:i);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278659/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278659/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@b = dso_local global [100000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compw(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%conv = zext i1 %cmp to i32
%cmp1 = icmp slt i32 %0, %1
%conv2.neg = sext i1 %cmp1 to i32
%sub = add nsw i32 %conv2.neg, %conv
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @nextpint() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i16 = tail call i32 @getc(ptr noundef %0)
%conv117 = and i32 %call.i16, 254
%1 = add nsw i32 %conv117, -48
%or.cond18 = icmp ult i32 %1, 10
br i1 %or.cond18, label %cleanup, label %while.end
cleanup: ; preds = %entry, %cleanup
%call.i20 = phi i32 [ %call.i, %cleanup ], [ %call.i16, %entry ]
%x.019 = phi i32 [ %sub, %cleanup ], [ 0, %entry ]
%mul = mul i32 %x.019, 10
%2 = and i32 %call.i20, 255
%add = add i32 %mul, -48
%sub = add i32 %add, %2
%3 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = tail call i32 @getc(ptr noundef %3)
%conv1 = and i32 %call.i, 254
%4 = add nsw i32 %conv1, -48
%or.cond = icmp ult i32 %4, 10
br i1 %or.cond, label %cleanup, label %while.end
while.end: ; preds = %cleanup, %entry
%x.0.lcssa = phi i32 [ 0, %entry ], [ %sub, %cleanup ]
ret i32 %x.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i16.i = tail call i32 @getc(ptr noundef %0)
%conv117.i = and i32 %call.i16.i, 254
%1 = add nsw i32 %conv117.i, -48
%or.cond18.i = icmp ult i32 %1, 10
br i1 %or.cond18.i, label %cleanup.i, label %nextpint.exit
cleanup.i: ; preds = %entry, %cleanup.i
%call.i20.i = phi i32 [ %call.i.i, %cleanup.i ], [ %call.i16.i, %entry ]
%x.019.i = phi i32 [ %sub.i, %cleanup.i ], [ 0, %entry ]
%mul.i = mul i32 %x.019.i, 10
%2 = and i32 %call.i20.i, 255
%add.i = add nsw i32 %2, -48
%sub.i = add i32 %add.i, %mul.i
%3 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i.i = tail call i32 @getc(ptr noundef %3)
%conv1.i = and i32 %call.i.i, 254
%4 = add nsw i32 %conv1.i, -48
%or.cond.i = icmp ult i32 %4, 10
br i1 %or.cond.i, label %cleanup.i, label %nextpint.exit
nextpint.exit: ; preds = %cleanup.i, %entry
%x.0.lcssa.i = phi i32 [ 0, %entry ], [ %sub.i, %cleanup.i ]
%5 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i16.i44 = tail call i32 @getc(ptr noundef %5)
%conv117.i45 = and i32 %call.i16.i44, 254
%6 = add nsw i32 %conv117.i45, -48
%or.cond18.i46 = icmp ult i32 %6, 10
br i1 %or.cond18.i46, label %cleanup.i48, label %nextpint.exit57
cleanup.i48: ; preds = %nextpint.exit, %cleanup.i48
%call.i20.i49 = phi i32 [ %call.i.i54, %cleanup.i48 ], [ %call.i16.i44, %nextpint.exit ]
%x.019.i50 = phi i32 [ %sub.i53, %cleanup.i48 ], [ 0, %nextpint.exit ]
%mul.i51 = mul i32 %x.019.i50, 10
%7 = and i32 %call.i20.i49, 255
%add.i52 = add nsw i32 %7, -48
%sub.i53 = add i32 %add.i52, %mul.i51
%8 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i.i54 = tail call i32 @getc(ptr noundef %8)
%conv1.i55 = and i32 %call.i.i54, 254
%9 = add nsw i32 %conv1.i55, -48
%or.cond.i56 = icmp ult i32 %9, 10
br i1 %or.cond.i56, label %cleanup.i48, label %nextpint.exit57
nextpint.exit57: ; preds = %cleanup.i48, %nextpint.exit
%x.0.lcssa.i47 = phi i32 [ 0, %nextpint.exit ], [ %sub.i53, %cleanup.i48 ]
%cmp91 = icmp sgt i32 %x.0.lcssa.i, 0
br i1 %cmp91, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %nextpint.exit57
%wide.trip.count = zext i32 %x.0.lcssa.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %nextpint.exit85
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %nextpint.exit85 ]
%a.093 = phi i32 [ 0, %for.body.preheader ], [ %spec.select, %nextpint.exit85 ]
%10 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i16.i58 = tail call i32 @getc(ptr noundef %10)
%conv117.i59 = and i32 %call.i16.i58, 254
%11 = add nsw i32 %conv117.i59, -48
%or.cond18.i60 = icmp ult i32 %11, 10
br i1 %or.cond18.i60, label %cleanup.i62, label %nextpint.exit71
cleanup.i62: ; preds = %for.body, %cleanup.i62
%call.i20.i63 = phi i32 [ %call.i.i68, %cleanup.i62 ], [ %call.i16.i58, %for.body ]
%x.019.i64 = phi i32 [ %sub.i67, %cleanup.i62 ], [ 0, %for.body ]
%mul.i65 = mul i32 %x.019.i64, 10
%12 = and i32 %call.i20.i63, 255
%add.i66 = add nsw i32 %12, -48
%sub.i67 = add i32 %add.i66, %mul.i65
%13 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i.i68 = tail call i32 @getc(ptr noundef %13)
%conv1.i69 = and i32 %call.i.i68, 254
%14 = add nsw i32 %conv1.i69, -48
%or.cond.i70 = icmp ult i32 %14, 10
br i1 %or.cond.i70, label %cleanup.i62, label %nextpint.exit71
nextpint.exit71: ; preds = %cleanup.i62, %for.body
%x.0.lcssa.i61 = phi i32 [ 0, %for.body ], [ %sub.i67, %cleanup.i62 ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %x.0.lcssa.i61, i32 %a.093)
%15 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i16.i72 = tail call i32 @getc(ptr noundef %15)
%conv117.i73 = and i32 %call.i16.i72, 254
%16 = add nsw i32 %conv117.i73, -48
%or.cond18.i74 = icmp ult i32 %16, 10
br i1 %or.cond18.i74, label %cleanup.i76, label %nextpint.exit85
cleanup.i76: ; preds = %nextpint.exit71, %cleanup.i76
%call.i20.i77 = phi i32 [ %call.i.i82, %cleanup.i76 ], [ %call.i16.i72, %nextpint.exit71 ]
%x.019.i78 = phi i32 [ %sub.i81, %cleanup.i76 ], [ 0, %nextpint.exit71 ]
%mul.i79 = mul i32 %x.019.i78, 10
%17 = and i32 %call.i20.i77, 255
%add.i80 = add nsw i32 %17, -48
%sub.i81 = add i32 %add.i80, %mul.i79
%18 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i.i82 = tail call i32 @getc(ptr noundef %18)
%conv1.i83 = and i32 %call.i.i82, 254
%19 = add nsw i32 %conv1.i83, -48
%or.cond.i84 = icmp ult i32 %19, 10
br i1 %or.cond.i84, label %cleanup.i76, label %nextpint.exit85
nextpint.exit85: ; preds = %cleanup.i76, %nextpint.exit71
%x.0.lcssa.i75 = phi i32 [ 0, %nextpint.exit71 ], [ %sub.i81, %cleanup.i76 ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @b, i64 0, i64 %indvars.iv
store i32 %x.0.lcssa.i75, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %nextpint.exit85, %nextpint.exit57
%a.0.lcssa = phi i32 [ 0, %nextpint.exit57 ], [ %spec.select, %nextpint.exit85 ]
%conv = sext i32 %x.0.lcssa.i to i64
tail call void @qsort(ptr noundef nonnull @b, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @compr) #5
%cmp694 = icmp slt i32 %x.0.lcssa.i, 1
%cmp995 = icmp slt i32 %x.0.lcssa.i47, 1
%or.cond96 = select i1 %cmp694, i1 true, i1 %cmp995
br i1 %or.cond96, label %for.end21, label %lor.lhs.false
lor.lhs.false: ; preds = %for.end, %if.end16
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %if.end16 ], [ 0, %for.end ]
%h.098 = phi i32 [ %sub, %if.end16 ], [ %x.0.lcssa.i47, %for.end ]
%arrayidx12 = getelementptr inbounds [100000 x i32], ptr @b, i64 0, i64 %indvars.iv104
%20 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13.not = icmp sgt i32 %20, %a.0.lcssa
br i1 %cmp13.not, label %if.end16, label %cond.true.loopexit
if.end16: ; preds = %lor.lhs.false
%sub = sub nsw i32 %h.098, %20
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%cmp6 = icmp sge i64 %indvars.iv.next105, %conv
%cmp9 = icmp slt i32 %sub, 1
%or.cond = select i1 %cmp6, i1 true, i1 %cmp9
br i1 %or.cond, label %for.end21.loopexit, label %lor.lhs.false, !llvm.loop !13
for.end21.loopexit: ; preds = %if.end16
%21 = trunc i64 %indvars.iv.next105 to i32
br label %for.end21
for.end21: ; preds = %for.end21.loopexit, %for.end
%i.1.lcssa = phi i32 [ 0, %for.end ], [ %21, %for.end21.loopexit ]
%h.0.lcssa = phi i32 [ %x.0.lcssa.i47, %for.end ], [ %sub, %for.end21.loopexit ]
%cmp22 = icmp sgt i32 %h.0.lcssa, 0
br i1 %cmp22, label %cond.true, label %cond.end
cond.true.loopexit: ; preds = %lor.lhs.false
%22 = trunc i64 %indvars.iv104 to i32
br label %cond.true
cond.true: ; preds = %cond.true.loopexit, %for.end21
%i.190 = phi i32 [ %i.1.lcssa, %for.end21 ], [ %22, %cond.true.loopexit ]
%h.088 = phi i32 [ %h.0.lcssa, %for.end21 ], [ %h.098, %cond.true.loopexit ]
%add = add i32 %a.0.lcssa, -1
%sub24 = add i32 %add, %h.088
%div = sdiv i32 %sub24, %a.0.lcssa
%add25 = add nsw i32 %div, %i.190
br label %cond.end
cond.end: ; preds = %for.end21, %cond.true
%cond = phi i32 [ %add25, %cond.true ], [ %i.1.lcssa, %for.end21 ]
%call26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cond)
ret i32 0
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long int int64;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
void msort(int *a,int n,int *tmp){
if(n<=1) return;
int m=n/2;
msort(a,m,tmp);
msort(a+m,n-m,tmp);
int i=0;
int j=m;
int k=0;
while(i<m && j<n){
if(a[i]<=a[j]){
tmp[k++]=a[i++];
} else {
tmp[k++]=a[j++];
}
}
while(i<m) tmp[k++]=a[i++];
while(j<n) tmp[k++]=a[j++];
for(i=0;i<n;i++) a[i]=tmp[i];
return;
}
void run(void){
int n,h;
scanf("%d%d",&n,&h);
int *a=(int *)malloc(sizeof(int)*n);
int *b=(int *)malloc(sizeof(int)*n);
int i;
for(i=0;i<n;i++){
scanf("%d%d",a+i,b+i);
}
int maxA=0;
for(i=0;i<n;i++) maxA=MAX(maxA,a[i]);
msort(b,n,a);
int k=0;
i=n-1;
while(i>=0 && h>0 && b[i]>maxA){
h-=b[i--];
k++;
}
if(h>0){
k+=(h+maxA-1)/maxA;
}
printf("%d\n",k);
return;
}
int main(void){
run();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278701/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278701/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @msort(ptr noundef %a, i32 noundef %n, ptr noundef %tmp) local_unnamed_addr #0 {
entry:
%tmp155 = ptrtoint ptr %tmp to i64
%a134 = ptrtoint ptr %a to i64
%tmp133 = ptrtoint ptr %tmp to i64
%a127 = ptrtoint ptr %a to i64
%tmp126 = ptrtoint ptr %tmp to i64
%cmp = icmp slt i32 %n, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%div85 = lshr i32 %n, 1
tail call void @msort(ptr noundef %a, i32 noundef %div85, ptr noundef %tmp)
%idx.ext = zext i32 %div85 to i64
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
%sub = sub nsw i32 %n, %div85
tail call void @msort(ptr noundef %add.ptr, i32 noundef %sub, ptr noundef %tmp)
br label %while.body
while.cond19.preheader: ; preds = %while.body
%cmp2093 = icmp ult i32 %i.1, %div85
br i1 %cmp2093, label %while.body21.preheader, label %while.cond29.preheader
while.body21.preheader: ; preds = %while.cond19.preheader
%0 = and i64 %indvars.iv.next, 4294967295
%1 = zext i32 %i.1 to i64
%wide.trip.count = zext i32 %div85 to i64
%2 = zext i32 %i.088 to i64
%3 = sub nsw i64 %wide.trip.count, %2
%.neg = sext i1 %cmp5.not to i64
%4 = add nsw i64 %3, %.neg
%min.iters.check = icmp ult i64 %4, 12
br i1 %min.iters.check, label %while.body21.preheader172, label %vector.memcheck
vector.memcheck: ; preds = %while.body21.preheader
%5 = shl nuw nsw i64 %0, 2
%6 = add i64 %5, %tmp126
%7 = shl nuw nsw i64 %1, 2
%8 = add i64 %7, %a127
%9 = sub i64 %6, %8
%diff.check = icmp ult i64 %9, 32
br i1 %diff.check, label %while.body21.preheader172, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %4, -8
%ind.end = add nsw i64 %n.vec, %1
%ind.end128 = add nsw i64 %0, %n.vec
%invariant.gep = getelementptr i32, ptr %a, i64 %1
%10 = getelementptr i32, ptr %tmp, i64 %0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %gep, i64 4
%wide.load131 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr i32, ptr %10, i64 %index
store <4 x i32> %wide.load, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
store <4 x i32> %wide.load131, ptr %13, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %while.cond29.preheader, label %while.body21.preheader172
while.body21.preheader172: ; preds = %vector.memcheck, %while.body21.preheader, %middle.block
%indvars.iv106.ph = phi i64 [ %1, %vector.memcheck ], [ %1, %while.body21.preheader ], [ %ind.end, %middle.block ]
%indvars.iv104.ph = phi i64 [ %0, %vector.memcheck ], [ %0, %while.body21.preheader ], [ %ind.end128, %middle.block ]
%15 = sub nsw i64 %wide.trip.count, %indvars.iv106.ph
%16 = xor i64 %indvars.iv106.ph, -1
%17 = add i64 %16, %wide.trip.count
%xtraiter = and i64 %15, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body21.prol.loopexit, label %while.body21.prol
while.body21.prol: ; preds = %while.body21.preheader172, %while.body21.prol
%indvars.iv106.prol = phi i64 [ %indvars.iv.next107.prol, %while.body21.prol ], [ %indvars.iv106.ph, %while.body21.preheader172 ]
%indvars.iv104.prol = phi i64 [ %indvars.iv.next105.prol, %while.body21.prol ], [ %indvars.iv104.ph, %while.body21.preheader172 ]
%prol.iter = phi i64 [ %prol.iter.next, %while.body21.prol ], [ 0, %while.body21.preheader172 ]
%indvars.iv.next107.prol = add nsw i64 %indvars.iv106.prol, 1
%arrayidx24.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv106.prol
%18 = load i32, ptr %arrayidx24.prol, align 4, !tbaa !5
%indvars.iv.next105.prol = add nuw nsw i64 %indvars.iv104.prol, 1
%arrayidx27.prol = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv104.prol
store i32 %18, ptr %arrayidx27.prol, align 4, !tbaa !5
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body21.prol.loopexit, label %while.body21.prol, !llvm.loop !13
while.body21.prol.loopexit: ; preds = %while.body21.prol, %while.body21.preheader172
%indvars.iv.next105.lcssa.unr = phi i64 [ undef, %while.body21.preheader172 ], [ %indvars.iv.next105.prol, %while.body21.prol ]
%indvars.iv106.unr = phi i64 [ %indvars.iv106.ph, %while.body21.preheader172 ], [ %indvars.iv.next107.prol, %while.body21.prol ]
%indvars.iv104.unr = phi i64 [ %indvars.iv104.ph, %while.body21.preheader172 ], [ %indvars.iv.next105.prol, %while.body21.prol ]
%19 = icmp ult i64 %17, 3
br i1 %19, label %while.cond29.preheader, label %while.body21.preheader172.new
while.body21.preheader172.new: ; preds = %while.body21.prol.loopexit
%invariant.gep179 = getelementptr i32, ptr %a, i64 1
%invariant.gep181 = getelementptr i32, ptr %tmp, i64 1
%invariant.gep183 = getelementptr i32, ptr %a, i64 2
%invariant.gep185 = getelementptr i32, ptr %tmp, i64 2
%invariant.gep187 = getelementptr i32, ptr %a, i64 3
%invariant.gep189 = getelementptr i32, ptr %tmp, i64 3
br label %while.body21
while.body: ; preds = %if.end, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %if.end ]
%j.089 = phi i32 [ %j.1, %while.body ], [ %div85, %if.end ]
%i.088 = phi i32 [ %i.1, %while.body ], [ 0, %if.end ]
%idxprom = zext i32 %i.088 to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%20 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom3 = sext i32 %j.089 to i64
%arrayidx4 = getelementptr inbounds i32, ptr %a, i64 %idxprom3
%21 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5.not = icmp sle i32 %20, %21
%.sink = tail call i32 @llvm.smin.i32(i32 %20, i32 %21)
%inc = zext i1 %cmp5.not to i32
%i.1 = add nuw nsw i32 %i.088, %inc
%not.cmp5.not = xor i1 %cmp5.not, true
%inc12 = zext i1 %not.cmp5.not to i32
%j.1 = add i32 %j.089, %inc12
%22 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv
store i32 %.sink, ptr %22, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%cmp1 = icmp ult i32 %i.1, %div85
%cmp2 = icmp slt i32 %j.1, %n
%23 = and i1 %cmp1, %cmp2
br i1 %23, label %while.body, label %while.cond19.preheader, !llvm.loop !15
while.cond29.preheader: ; preds = %while.body21.prol.loopexit, %while.body21, %middle.block, %while.cond19.preheader
%k.2.lcssa.in = phi i64 [ %indvars.iv.next, %while.cond19.preheader ], [ %ind.end128, %middle.block ], [ %indvars.iv.next105.lcssa.unr, %while.body21.prol.loopexit ], [ %indvars.iv.next105.3, %while.body21 ]
%cmp3097 = icmp slt i32 %j.1, %n
br i1 %cmp3097, label %while.body31.preheader, label %for.cond.preheader
while.body31.preheader: ; preds = %while.cond29.preheader
%24 = and i64 %k.2.lcssa.in, 4294967295
%25 = sext i32 %j.1 to i64
%wide.trip.count119 = sext i32 %n to i64
%26 = sub nsw i64 %wide.trip.count119, %25
%min.iters.check138 = icmp ult i64 %26, 12
br i1 %min.iters.check138, label %while.body31.preheader171, label %vector.memcheck132
vector.memcheck132: ; preds = %while.body31.preheader
%27 = shl nuw nsw i64 %24, 2
%28 = add i64 %27, %tmp133
%29 = shl nsw i64 %25, 2
%30 = add i64 %29, %a134
%31 = sub i64 %28, %30
%diff.check135 = icmp ult i64 %31, 32
br i1 %diff.check135, label %while.body31.preheader171, label %vector.ph139
vector.ph139: ; preds = %vector.memcheck132
%n.vec141 = and i64 %26, -8
%ind.end142 = add nsw i64 %n.vec141, %25
%ind.end144 = add nsw i64 %24, %n.vec141
%invariant.gep191 = getelementptr i32, ptr %a, i64 %25
%32 = getelementptr i32, ptr %tmp, i64 %24
br label %vector.body147
vector.body147: ; preds = %vector.body147, %vector.ph139
%index148 = phi i64 [ 0, %vector.ph139 ], [ %index.next153, %vector.body147 ]
%gep192 = getelementptr i32, ptr %invariant.gep191, i64 %index148
%wide.load151 = load <4 x i32>, ptr %gep192, align 4, !tbaa !5
%33 = getelementptr inbounds i32, ptr %gep192, i64 4
%wide.load152 = load <4 x i32>, ptr %33, align 4, !tbaa !5
%34 = getelementptr i32, ptr %32, i64 %index148
store <4 x i32> %wide.load151, ptr %34, align 4, !tbaa !5
%35 = getelementptr inbounds i32, ptr %34, i64 4
store <4 x i32> %wide.load152, ptr %35, align 4, !tbaa !5
%index.next153 = add nuw i64 %index148, 8
%36 = icmp eq i64 %index.next153, %n.vec141
br i1 %36, label %middle.block136, label %vector.body147, !llvm.loop !16
middle.block136: ; preds = %vector.body147
%cmp.n146 = icmp eq i64 %26, %n.vec141
br i1 %cmp.n146, label %for.cond.preheader, label %while.body31.preheader171
while.body31.preheader171: ; preds = %vector.memcheck132, %while.body31.preheader, %middle.block136
%indvars.iv114.ph = phi i64 [ %25, %vector.memcheck132 ], [ %25, %while.body31.preheader ], [ %ind.end142, %middle.block136 ]
%indvars.iv112.ph = phi i64 [ %24, %vector.memcheck132 ], [ %24, %while.body31.preheader ], [ %ind.end144, %middle.block136 ]
%37 = sub nsw i64 %wide.trip.count119, %indvars.iv114.ph
%38 = xor i64 %indvars.iv114.ph, -1
%39 = add nsw i64 %38, %wide.trip.count119
%xtraiter173 = and i64 %37, 3
%lcmp.mod174.not = icmp eq i64 %xtraiter173, 0
br i1 %lcmp.mod174.not, label %while.body31.prol.loopexit, label %while.body31.prol
while.body31.prol: ; preds = %while.body31.preheader171, %while.body31.prol
%indvars.iv114.prol = phi i64 [ %indvars.iv.next115.prol, %while.body31.prol ], [ %indvars.iv114.ph, %while.body31.preheader171 ]
%indvars.iv112.prol = phi i64 [ %indvars.iv.next113.prol, %while.body31.prol ], [ %indvars.iv112.ph, %while.body31.preheader171 ]
%prol.iter175 = phi i64 [ %prol.iter175.next, %while.body31.prol ], [ 0, %while.body31.preheader171 ]
%indvars.iv.next115.prol = add nsw i64 %indvars.iv114.prol, 1
%arrayidx34.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv114.prol
%40 = load i32, ptr %arrayidx34.prol, align 4, !tbaa !5
%indvars.iv.next113.prol = add nuw nsw i64 %indvars.iv112.prol, 1
%arrayidx37.prol = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv112.prol
store i32 %40, ptr %arrayidx37.prol, align 4, !tbaa !5
%prol.iter175.next = add i64 %prol.iter175, 1
%prol.iter175.cmp.not = icmp eq i64 %prol.iter175.next, %xtraiter173
br i1 %prol.iter175.cmp.not, label %while.body31.prol.loopexit, label %while.body31.prol, !llvm.loop !17
while.body31.prol.loopexit: ; preds = %while.body31.prol, %while.body31.preheader171
%indvars.iv114.unr = phi i64 [ %indvars.iv114.ph, %while.body31.preheader171 ], [ %indvars.iv.next115.prol, %while.body31.prol ]
%indvars.iv112.unr = phi i64 [ %indvars.iv112.ph, %while.body31.preheader171 ], [ %indvars.iv.next113.prol, %while.body31.prol ]
%41 = icmp ult i64 %39, 3
br i1 %41, label %for.cond.preheader, label %while.body31.preheader171.new
while.body31.preheader171.new: ; preds = %while.body31.prol.loopexit
%invariant.gep193 = getelementptr i32, ptr %a, i64 1
%invariant.gep195 = getelementptr i32, ptr %tmp, i64 1
%invariant.gep197 = getelementptr i32, ptr %a, i64 2
%invariant.gep199 = getelementptr i32, ptr %tmp, i64 2
%invariant.gep201 = getelementptr i32, ptr %a, i64 3
%invariant.gep203 = getelementptr i32, ptr %tmp, i64 3
br label %while.body31
while.body21: ; preds = %while.body21, %while.body21.preheader172.new
%indvars.iv106 = phi i64 [ %indvars.iv106.unr, %while.body21.preheader172.new ], [ %indvars.iv.next107.3, %while.body21 ]
%indvars.iv104 = phi i64 [ %indvars.iv104.unr, %while.body21.preheader172.new ], [ %indvars.iv.next105.3, %while.body21 ]
%arrayidx24 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv106
%42 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%arrayidx27 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv104
store i32 %42, ptr %arrayidx27, align 4, !tbaa !5
%gep180 = getelementptr i32, ptr %invariant.gep179, i64 %indvars.iv106
%43 = load i32, ptr %gep180, align 4, !tbaa !5
%gep182 = getelementptr i32, ptr %invariant.gep181, i64 %indvars.iv104
store i32 %43, ptr %gep182, align 4, !tbaa !5
%gep184 = getelementptr i32, ptr %invariant.gep183, i64 %indvars.iv106
%44 = load i32, ptr %gep184, align 4, !tbaa !5
%gep186 = getelementptr i32, ptr %invariant.gep185, i64 %indvars.iv104
store i32 %44, ptr %gep186, align 4, !tbaa !5
%indvars.iv.next107.3 = add nsw i64 %indvars.iv106, 4
%gep188 = getelementptr i32, ptr %invariant.gep187, i64 %indvars.iv106
%45 = load i32, ptr %gep188, align 4, !tbaa !5
%indvars.iv.next105.3 = add nuw nsw i64 %indvars.iv104, 4
%gep190 = getelementptr i32, ptr %invariant.gep189, i64 %indvars.iv104
store i32 %45, ptr %gep190, align 4, !tbaa !5
%exitcond.not.3 = icmp eq i64 %indvars.iv.next107.3, %wide.trip.count
br i1 %exitcond.not.3, label %while.cond29.preheader, label %while.body21, !llvm.loop !18
for.cond.preheader: ; preds = %while.body31.prol.loopexit, %while.body31, %middle.block136, %while.cond29.preheader
%cmp39100 = icmp sgt i32 %n, 0
br i1 %cmp39100, label %for.body.preheader, label %return
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count124 = zext i32 %n to i64
%min.iters.check159 = icmp ult i32 %n, 8
%46 = sub i64 %a134, %tmp155
%diff.check156 = icmp ult i64 %46, 32
%or.cond = or i1 %min.iters.check159, %diff.check156
br i1 %or.cond, label %for.body.preheader170, label %vector.ph160
vector.ph160: ; preds = %for.body.preheader
%n.vec162 = and i64 %wide.trip.count124, 4294967288
br label %vector.body165
vector.body165: ; preds = %vector.body165, %vector.ph160
%index166 = phi i64 [ 0, %vector.ph160 ], [ %index.next169, %vector.body165 ]
%47 = getelementptr inbounds i32, ptr %tmp, i64 %index166
%wide.load167 = load <4 x i32>, ptr %47, align 4, !tbaa !5
%48 = getelementptr inbounds i32, ptr %47, i64 4
%wide.load168 = load <4 x i32>, ptr %48, align 4, !tbaa !5
%49 = getelementptr inbounds i32, ptr %a, i64 %index166
store <4 x i32> %wide.load167, ptr %49, align 4, !tbaa !5
%50 = getelementptr inbounds i32, ptr %49, i64 4
store <4 x i32> %wide.load168, ptr %50, align 4, !tbaa !5
%index.next169 = add nuw i64 %index166, 8
%51 = icmp eq i64 %index.next169, %n.vec162
br i1 %51, label %middle.block157, label %vector.body165, !llvm.loop !19
middle.block157: ; preds = %vector.body165
%cmp.n164 = icmp eq i64 %n.vec162, %wide.trip.count124
br i1 %cmp.n164, label %return, label %for.body.preheader170
for.body.preheader170: ; preds = %for.body.preheader, %middle.block157
%indvars.iv121.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec162, %middle.block157 ]
%52 = xor i64 %indvars.iv121.ph, -1
%53 = add nsw i64 %52, %wide.trip.count124
%xtraiter176 = and i64 %wide.trip.count124, 3
%lcmp.mod177.not = icmp eq i64 %xtraiter176, 0
br i1 %lcmp.mod177.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader170, %for.body.prol
%indvars.iv121.prol = phi i64 [ %indvars.iv.next122.prol, %for.body.prol ], [ %indvars.iv121.ph, %for.body.preheader170 ]
%prol.iter178 = phi i64 [ %prol.iter178.next, %for.body.prol ], [ 0, %for.body.preheader170 ]
%arrayidx41.prol = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv121.prol
%54 = load i32, ptr %arrayidx41.prol, align 4, !tbaa !5
%arrayidx43.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv121.prol
store i32 %54, ptr %arrayidx43.prol, align 4, !tbaa !5
%indvars.iv.next122.prol = add nuw nsw i64 %indvars.iv121.prol, 1
%prol.iter178.next = add i64 %prol.iter178, 1
%prol.iter178.cmp.not = icmp eq i64 %prol.iter178.next, %xtraiter176
br i1 %prol.iter178.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !20
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader170
%indvars.iv121.unr = phi i64 [ %indvars.iv121.ph, %for.body.preheader170 ], [ %indvars.iv.next122.prol, %for.body.prol ]
%55 = icmp ult i64 %53, 3
br i1 %55, label %return, label %for.body
while.body31: ; preds = %while.body31, %while.body31.preheader171.new
%indvars.iv114 = phi i64 [ %indvars.iv114.unr, %while.body31.preheader171.new ], [ %indvars.iv.next115.3, %while.body31 ]
%indvars.iv112 = phi i64 [ %indvars.iv112.unr, %while.body31.preheader171.new ], [ %indvars.iv.next113.3, %while.body31 ]
%arrayidx34 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv114
%56 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%arrayidx37 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv112
store i32 %56, ptr %arrayidx37, align 4, !tbaa !5
%gep194 = getelementptr i32, ptr %invariant.gep193, i64 %indvars.iv114
%57 = load i32, ptr %gep194, align 4, !tbaa !5
%gep196 = getelementptr i32, ptr %invariant.gep195, i64 %indvars.iv112
store i32 %57, ptr %gep196, align 4, !tbaa !5
%gep198 = getelementptr i32, ptr %invariant.gep197, i64 %indvars.iv114
%58 = load i32, ptr %gep198, align 4, !tbaa !5
%gep200 = getelementptr i32, ptr %invariant.gep199, i64 %indvars.iv112
store i32 %58, ptr %gep200, align 4, !tbaa !5
%indvars.iv.next115.3 = add nsw i64 %indvars.iv114, 4
%gep202 = getelementptr i32, ptr %invariant.gep201, i64 %indvars.iv114
%59 = load i32, ptr %gep202, align 4, !tbaa !5
%indvars.iv.next113.3 = add nuw nsw i64 %indvars.iv112, 4
%gep204 = getelementptr i32, ptr %invariant.gep203, i64 %indvars.iv112
store i32 %59, ptr %gep204, align 4, !tbaa !5
%exitcond120.not.3 = icmp eq i64 %indvars.iv.next115.3, %wide.trip.count119
br i1 %exitcond120.not.3, label %for.cond.preheader, label %while.body31, !llvm.loop !21
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv121 = phi i64 [ %indvars.iv.next122.3, %for.body ], [ %indvars.iv121.unr, %for.body.prol.loopexit ]
%arrayidx41 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv121
%60 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%arrayidx43 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv121
store i32 %60, ptr %arrayidx43, align 4, !tbaa !5
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%arrayidx41.1 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv.next122
%61 = load i32, ptr %arrayidx41.1, align 4, !tbaa !5
%arrayidx43.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next122
store i32 %61, ptr %arrayidx43.1, align 4, !tbaa !5
%indvars.iv.next122.1 = add nuw nsw i64 %indvars.iv121, 2
%arrayidx41.2 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv.next122.1
%62 = load i32, ptr %arrayidx41.2, align 4, !tbaa !5
%arrayidx43.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next122.1
store i32 %62, ptr %arrayidx43.2, align 4, !tbaa !5
%indvars.iv.next122.2 = add nuw nsw i64 %indvars.iv121, 3
%arrayidx41.3 = getelementptr inbounds i32, ptr %tmp, i64 %indvars.iv.next122.2
%63 = load i32, ptr %arrayidx41.3, align 4, !tbaa !5
%arrayidx43.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next122.2
store i32 %63, ptr %arrayidx43.3, align 4, !tbaa !5
%indvars.iv.next122.3 = add nuw nsw i64 %indvars.iv121, 4
%exitcond125.not.3 = icmp eq i64 %indvars.iv.next122.3, %wide.trip.count124
br i1 %exitcond125.not.3, label %return, label %for.body, !llvm.loop !22
return: ; preds = %for.body.prol.loopexit, %for.body, %middle.block157, %for.cond.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %h)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%call4 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %for.end19
for.cond9.preheader: ; preds = %for.body
%cmp1070 = icmp sgt i32 %7, 0
br i1 %cmp1070, label %for.body12.preheader, label %for.end19
for.body12.preheader: ; preds = %for.cond9.preheader
%wide.trip.count = zext i32 %7 to i64
%min.iters.check = icmp ult i32 %7, 8
br i1 %min.iters.check, label %for.body12.preheader115, label %vector.ph
vector.ph: ; preds = %for.body12.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%vec.phi109 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ]
%1 = getelementptr inbounds i32, ptr %call1, i64 %index
%wide.load = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load110 = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi109, <4 x i32> %wide.load110)
%index.next = add nuw i64 %index, 8
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !23
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %3, <4 x i32> %4)
%6 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end19, label %for.body12.preheader115
for.body12.preheader115: ; preds = %for.body12.preheader, %middle.block
%indvars.iv89.ph = phi i64 [ 0, %for.body12.preheader ], [ %n.vec, %middle.block ]
%maxA.072.ph = phi i32 [ 0, %for.body12.preheader ], [ %6, %middle.block ]
br label %for.body12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%add.ptr7 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr, ptr noundef %add.ptr7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond9.preheader, !llvm.loop !24
for.body12: ; preds = %for.body12.preheader115, %for.body12
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.body12 ], [ %indvars.iv89.ph, %for.body12.preheader115 ]
%maxA.072 = phi i32 [ %maxA.0., %for.body12 ], [ %maxA.072.ph, %for.body12.preheader115 ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv89
%9 = load i32, ptr %arrayidx, align 4, !tbaa !5
%maxA.0. = call i32 @llvm.smax.i32(i32 %maxA.072, i32 %9)
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%exitcond.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count
br i1 %exitcond.not, label %for.end19, label %for.body12, !llvm.loop !25
for.end19: ; preds = %for.body12, %middle.block, %entry, %for.cond9.preheader
%cmp107098 = phi i1 [ false, %for.cond9.preheader ], [ false, %entry ], [ %cmp1070, %middle.block ], [ %cmp1070, %for.body12 ]
%.lcssa6797 = phi i32 [ %7, %for.cond9.preheader ], [ %0, %entry ], [ %7, %middle.block ], [ %7, %for.body12 ]
%maxA.0.lcssa = phi i32 [ 0, %for.cond9.preheader ], [ 0, %entry ], [ %6, %middle.block ], [ %maxA.0., %for.body12 ]
call void @msort(ptr noundef %call4, i32 noundef %.lcssa6797, ptr noundef %call1)
%.pr = load i32, ptr %h, align 4
%cmp2276 = icmp sgt i32 %.pr, 0
%or.cond77 = select i1 %cmp107098, i1 %cmp2276, i1 false
br i1 %or.cond77, label %land.rhs.preheader, label %while.end
land.rhs.preheader: ; preds = %for.end19
%10 = zext i32 %.lcssa6797 to i64
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%indvars.iv92 = phi i64 [ %10, %land.rhs.preheader ], [ %indvars.iv.next93, %while.body ]
%k.078 = phi i32 [ 0, %land.rhs.preheader ], [ %inc31, %while.body ]
%11 = phi i32 [ %.pr, %land.rhs.preheader ], [ %sub30, %while.body ]
%indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
%idxprom24 = and i64 %indvars.iv.next93, 4294967295
%arrayidx25 = getelementptr inbounds i32, ptr %call4, i64 %idxprom24
%12 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %12, %maxA.0.lcssa
br i1 %cmp26, label %while.body, label %if.then
while.body: ; preds = %land.rhs
%sub30 = sub nsw i32 %11, %12
store i32 %sub30, ptr %h, align 4, !tbaa !5
%inc31 = add nuw nsw i32 %k.078, 1
%cmp20 = icmp ugt i64 %indvars.iv92, 1
%cmp22 = icmp sgt i32 %sub30, 0
%or.cond = select i1 %cmp20, i1 %cmp22, i1 false
br i1 %or.cond, label %land.rhs, label %while.end, !llvm.loop !26
while.end: ; preds = %while.body, %for.end19
%.lcssa = phi i32 [ %.pr, %for.end19 ], [ %sub30, %while.body ]
%k.0.lcssa = phi i32 [ 0, %for.end19 ], [ %inc31, %while.body ]
%cmp22.lcssa = phi i1 [ %cmp2276, %for.end19 ], [ %cmp22, %while.body ]
br i1 %cmp22.lcssa, label %if.then, label %if.end
if.then: ; preds = %land.rhs, %while.end
%13 = phi i32 [ %.lcssa, %while.end ], [ %11, %land.rhs ]
%k.065 = phi i32 [ %k.0.lcssa, %while.end ], [ %k.078, %land.rhs ]
%add = add nsw i32 %maxA.0.lcssa, -1
%sub34 = add i32 %add, %13
%div = sdiv i32 %sub34, %maxA.0.lcssa
%add35 = add nsw i32 %div, %k.065
br label %if.end
if.end: ; preds = %if.then, %while.end
%k.1 = phi i32 [ %add35, %if.then ], [ %k.0.lcssa, %while.end ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #5
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10, !11, !12}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !10, !11}
!22 = distinct !{!22, !10, !11}
!23 = distinct !{!23, !10, !11, !12}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10, !12, !11}
!26 = distinct !{!26, !10}
|
#include <stdio.h>
int main(void)
{
char inputString[1100] = {};
char answer[1100] = {};
int i;
int answerNumber = 0;
scanf("%s", &inputString);
for(i = 0; inputString[i] != '\0'; i++){
if(i % 2 == 0){
switch (inputString[i]){
case '1':
if(inputString[i + 1] == 'T'){
answer[answerNumber] = 'a';
}else if(inputString[i + 1] == 'L'){
answer[answerNumber] = 'i';
}else if(inputString[i + 1] == 'U'){
answer[answerNumber] = 'u';
}else if(inputString[i + 1] == 'R'){
answer[answerNumber] = 'e';
}else if(inputString[i + 1] == 'D'){
answer[answerNumber] = 'o';
}
i++;
break;
case '2':
answer[answerNumber] = 'k';
break;
case '3':
answer[answerNumber] = 's';
break;
case '4':
answer[answerNumber] = 't';
break;
case '5':
answer[answerNumber] = 'n';
break;
case '6':
answer[answerNumber] = 'h';
break;
case '7':
answer[answerNumber] = 'm';
break;
case '8':
answer[answerNumber] = 'y';
break;
case '9':
answer[answerNumber] = 'r';
break;
case '0':
if(inputString[i + 1] == 'U'){
answer[answerNumber] = 'n';
answer[answerNumber + 1] = 'n';
answerNumber++;
i++;
}else{
answer[answerNumber] = 'w';
}
break;
default:
break;
}
answerNumber++;
}else{
switch (inputString[i]){
case 'T':
answer[answerNumber] = 'a';
break;
case 'L':
answer[answerNumber] = 'i';
break;
case 'U':
answer[answerNumber] = 'u';
break;
case 'R':
answer[answerNumber] = 'e';
break;
case 'D':
answer[answerNumber] = 'o';
break;
default:
break;
}
answerNumber++;
}
}
printf("%s\n", answer);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278745/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278745/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%inputString = alloca [1100 x i8], align 16
%answer = alloca [1100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1100, ptr nonnull %inputString) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1100) %inputString, i8 0, i64 1100, i1 false)
call void @llvm.lifetime.start.p0(i64 1100, ptr nonnull %answer) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1100) %answer, i8 0, i64 1100, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %inputString)
%0 = load i8, ptr %inputString, align 16, !tbaa !5
%cmp.not163 = icmp eq i8 %0, 0
br i1 %cmp.not163, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%conv166.in = phi i8 [ %4, %for.inc ], [ %0, %entry ]
%answerNumber.0165 = phi i32 [ %answerNumber.2, %for.inc ], [ 0, %entry ]
%i.0164 = phi i32 [ %inc125, %for.inc ], [ 0, %entry ]
%conv166 = sext i8 %conv166.in to i32
%1 = and i32 %i.0164, 1
%cmp2 = icmp eq i32 %1, 0
br i1 %cmp2, label %if.then, label %if.else102
if.then: ; preds = %for.body
switch i32 %conv166, label %for.inc [
i32 49, label %sw.bb
i32 50, label %sw.bb58
i32 51, label %sw.bb61
i32 52, label %sw.bb64
i32 53, label %sw.bb67
i32 54, label %sw.bb70
i32 55, label %sw.bb73
i32 56, label %sw.bb76
i32 57, label %sw.bb79
i32 48, label %sw.bb82
]
sw.bb: ; preds = %if.then
%add = add nuw nsw i32 %i.0164, 1
%idxprom7 = sext i32 %add to i64
%arrayidx8 = getelementptr inbounds [1100 x i8], ptr %inputString, i64 0, i64 %idxprom7
%2 = load i8, ptr %arrayidx8, align 1, !tbaa !5
switch i8 %2, label %for.inc [
i8 84, label %if.then12
i8 76, label %if.then21
i8 85, label %if.then31
i8 82, label %if.then41
i8 68, label %if.then51
]
if.then12: ; preds = %sw.bb
%idxprom13 = sext i32 %answerNumber.0165 to i64
%arrayidx14 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom13
store i8 97, ptr %arrayidx14, align 1, !tbaa !5
br label %for.inc
if.then21: ; preds = %sw.bb
%idxprom22 = sext i32 %answerNumber.0165 to i64
%arrayidx23 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom22
store i8 105, ptr %arrayidx23, align 1, !tbaa !5
br label %for.inc
if.then31: ; preds = %sw.bb
%idxprom32 = sext i32 %answerNumber.0165 to i64
%arrayidx33 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom32
store i8 117, ptr %arrayidx33, align 1, !tbaa !5
br label %for.inc
if.then41: ; preds = %sw.bb
%idxprom42 = sext i32 %answerNumber.0165 to i64
%arrayidx43 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom42
store i8 101, ptr %arrayidx43, align 1, !tbaa !5
br label %for.inc
if.then51: ; preds = %sw.bb
%idxprom52 = sext i32 %answerNumber.0165 to i64
%arrayidx53 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom52
store i8 111, ptr %arrayidx53, align 1, !tbaa !5
br label %for.inc
sw.bb58: ; preds = %if.then
%idxprom59 = sext i32 %answerNumber.0165 to i64
%arrayidx60 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom59
store i8 107, ptr %arrayidx60, align 1, !tbaa !5
br label %for.inc
sw.bb61: ; preds = %if.then
%idxprom62 = sext i32 %answerNumber.0165 to i64
%arrayidx63 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom62
store i8 115, ptr %arrayidx63, align 1, !tbaa !5
br label %for.inc
sw.bb64: ; preds = %if.then
%idxprom65 = sext i32 %answerNumber.0165 to i64
%arrayidx66 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom65
store i8 116, ptr %arrayidx66, align 1, !tbaa !5
br label %for.inc
sw.bb67: ; preds = %if.then
%idxprom68 = sext i32 %answerNumber.0165 to i64
%arrayidx69 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom68
store i8 110, ptr %arrayidx69, align 1, !tbaa !5
br label %for.inc
sw.bb70: ; preds = %if.then
%idxprom71 = sext i32 %answerNumber.0165 to i64
%arrayidx72 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom71
store i8 104, ptr %arrayidx72, align 1, !tbaa !5
br label %for.inc
sw.bb73: ; preds = %if.then
%idxprom74 = sext i32 %answerNumber.0165 to i64
%arrayidx75 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom74
store i8 109, ptr %arrayidx75, align 1, !tbaa !5
br label %for.inc
sw.bb76: ; preds = %if.then
%idxprom77 = sext i32 %answerNumber.0165 to i64
%arrayidx78 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom77
store i8 121, ptr %arrayidx78, align 1, !tbaa !5
br label %for.inc
sw.bb79: ; preds = %if.then
%idxprom80 = sext i32 %answerNumber.0165 to i64
%arrayidx81 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom80
store i8 114, ptr %arrayidx81, align 1, !tbaa !5
br label %for.inc
sw.bb82: ; preds = %if.then
%add83 = add nuw nsw i32 %i.0164, 1
%idxprom84 = sext i32 %add83 to i64
%arrayidx85 = getelementptr inbounds [1100 x i8], ptr %inputString, i64 0, i64 %idxprom84
%3 = load i8, ptr %arrayidx85, align 1, !tbaa !5
%cmp87 = icmp eq i8 %3, 85
%idxprom90 = sext i32 %answerNumber.0165 to i64
%arrayidx91 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom90
br i1 %cmp87, label %if.then89, label %if.else97
if.then89: ; preds = %sw.bb82
store i8 110, ptr %arrayidx91, align 1, !tbaa !5
%add92 = add nsw i32 %answerNumber.0165, 1
%idxprom93 = sext i32 %add92 to i64
%arrayidx94 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom93
store i8 110, ptr %arrayidx94, align 1, !tbaa !5
br label %for.inc
if.else97: ; preds = %sw.bb82
store i8 119, ptr %arrayidx91, align 1, !tbaa !5
br label %for.inc
if.else102: ; preds = %for.body
switch i32 %conv166, label %for.inc [
i32 84, label %sw.bb106
i32 76, label %sw.bb109
i32 85, label %sw.bb112
i32 82, label %sw.bb115
i32 68, label %sw.bb118
]
sw.bb106: ; preds = %if.else102
%idxprom107 = sext i32 %answerNumber.0165 to i64
%arrayidx108 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom107
store i8 97, ptr %arrayidx108, align 1, !tbaa !5
br label %for.inc
sw.bb109: ; preds = %if.else102
%idxprom110 = sext i32 %answerNumber.0165 to i64
%arrayidx111 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom110
store i8 105, ptr %arrayidx111, align 1, !tbaa !5
br label %for.inc
sw.bb112: ; preds = %if.else102
%idxprom113 = sext i32 %answerNumber.0165 to i64
%arrayidx114 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom113
store i8 117, ptr %arrayidx114, align 1, !tbaa !5
br label %for.inc
sw.bb115: ; preds = %if.else102
%idxprom116 = sext i32 %answerNumber.0165 to i64
%arrayidx117 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom116
store i8 101, ptr %arrayidx117, align 1, !tbaa !5
br label %for.inc
sw.bb118: ; preds = %if.else102
%idxprom119 = sext i32 %answerNumber.0165 to i64
%arrayidx120 = getelementptr inbounds [1100 x i8], ptr %answer, i64 0, i64 %idxprom119
store i8 111, ptr %arrayidx120, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %sw.bb106, %sw.bb109, %sw.bb112, %sw.bb115, %sw.bb118, %if.else102, %sw.bb58, %sw.bb61, %sw.bb64, %sw.bb67, %sw.bb70, %sw.bb73, %sw.bb76, %sw.bb79, %if.else97, %if.then89, %if.then, %sw.bb, %if.then21, %if.then41, %if.then51, %if.then31, %if.then12
%i.2 = phi i32 [ %i.0164, %if.then ], [ %add83, %if.then89 ], [ %i.0164, %if.else97 ], [ %i.0164, %sw.bb79 ], [ %i.0164, %sw.bb76 ], [ %i.0164, %sw.bb73 ], [ %i.0164, %sw.bb70 ], [ %i.0164, %sw.bb67 ], [ %i.0164, %sw.bb64 ], [ %i.0164, %sw.bb61 ], [ %i.0164, %sw.bb58 ], [ %add, %sw.bb ], [ %add, %if.then21 ], [ %add, %if.then41 ], [ %add, %if.then51 ], [ %add, %if.then31 ], [ %add, %if.then12 ], [ %i.0164, %if.else102 ], [ %i.0164, %sw.bb118 ], [ %i.0164, %sw.bb115 ], [ %i.0164, %sw.bb112 ], [ %i.0164, %sw.bb109 ], [ %i.0164, %sw.bb106 ]
%answerNumber.2.in = phi i32 [ %answerNumber.0165, %if.then ], [ %add92, %if.then89 ], [ %answerNumber.0165, %if.else97 ], [ %answerNumber.0165, %sw.bb79 ], [ %answerNumber.0165, %sw.bb76 ], [ %answerNumber.0165, %sw.bb73 ], [ %answerNumber.0165, %sw.bb70 ], [ %answerNumber.0165, %sw.bb67 ], [ %answerNumber.0165, %sw.bb64 ], [ %answerNumber.0165, %sw.bb61 ], [ %answerNumber.0165, %sw.bb58 ], [ %answerNumber.0165, %sw.bb ], [ %answerNumber.0165, %if.then21 ], [ %answerNumber.0165, %if.then41 ], [ %answerNumber.0165, %if.then51 ], [ %answerNumber.0165, %if.then31 ], [ %answerNumber.0165, %if.then12 ], [ %answerNumber.0165, %if.else102 ], [ %answerNumber.0165, %sw.bb118 ], [ %answerNumber.0165, %sw.bb115 ], [ %answerNumber.0165, %sw.bb112 ], [ %answerNumber.0165, %sw.bb109 ], [ %answerNumber.0165, %sw.bb106 ]
%answerNumber.2 = add nsw i32 %answerNumber.2.in, 1
%inc125 = add nsw i32 %i.2, 1
%idxprom = sext i32 %inc125 to i64
%arrayidx = getelementptr inbounds [1100 x i8], ptr %inputString, i64 0, i64 %idxprom
%4 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %4, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.inc, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %answer)
call void @llvm.lifetime.end.p0(i64 1100, ptr nonnull %answer) #5
call void @llvm.lifetime.end.p0(i64 1100, ptr nonnull %inputString) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int n, d1, d2;
int flg = 0;
int max = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d %d", &d1, &d2);
if (d1 == d2)
flg++;
else
{
if (max < flg)
max = flg;
flg = 0;
}
}
if (max < flg)
max = flg;
if (3 <= max)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278789/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278789/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d1 = alloca i32, align 4
%d2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d1) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%flg.0.lcssa = phi i32 [ 0, %entry ], [ %flg.1, %for.body ]
%max.0.lcssa = phi i32 [ 0, %entry ], [ %max.2, %for.body ]
%spec.select = call i32 @llvm.smax.i32(i32 %max.0.lcssa, i32 %flg.0.lcssa)
%cmp10 = icmp sgt i32 %spec.select, 2
%str.4.str = select i1 %cmp10, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d2) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d1) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%i.028 = phi i32 [ %inc6, %for.body ], [ 0, %entry ]
%max.027 = phi i32 [ %max.2, %for.body ], [ 0, %entry ]
%flg.026 = phi i32 [ %flg.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d1, ptr noundef nonnull %d2)
%1 = load i32, ptr %d1, align 4, !tbaa !5
%2 = load i32, ptr %d2, align 4, !tbaa !5
%cmp2 = icmp eq i32 %1, %2
%inc = add nsw i32 %flg.026, 1
%spec.select24 = call i32 @llvm.smax.i32(i32 %max.027, i32 %flg.026)
%flg.1 = select i1 %cmp2, i32 %inc, i32 0
%max.2 = select i1 %cmp2, i32 %max.027, i32 %spec.select24
%inc6 = add nuw nsw i32 %i.028, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc6, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n, i, j;
scanf("%d", &n);
int d[n][2];
for(i=0; i<n; i++){
for(j=0; j<2; j++){
scanf("%d", &d[i][j]);
}
}
int count=0;
for(i=1; i<n-1; i++){
if((d[i-1][0]==d[i-1][1])&&(d[i][0]==d[i][1])&&(d[i+1][0]==d[i+1][1])){
printf("Yes");
return 0;
}
}
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278831/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278831/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [2 x i32], i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %3, 0
br i1 %cmp60, label %for.cond1.preheader, label %cleanup
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%arrayidx5.1 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !9
for.cond10.preheader: ; preds = %for.cond1.preheader
%cmp1162 = icmp sgt i32 %4, 2
br i1 %cmp1162, label %for.body12.preheader, label %cleanup
for.body12.preheader: ; preds = %for.cond10.preheader
%sub = add nsw i32 %4, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body12
for.body12: ; preds = %for.body12.preheader, %for.inc39
%indvars.iv67 = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next68, %for.inc39 ]
%6 = add nsw i64 %indvars.iv67, -1
%arrayidx15 = getelementptr inbounds [2 x i32], ptr %vla, i64 %6
%7 = load i32, ptr %arrayidx15, align 8, !tbaa !5
%arrayidx20 = getelementptr inbounds [2 x i32], ptr %vla, i64 %6, i64 1
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %7, %8
br i1 %cmp21, label %land.lhs.true, label %for.inc39
land.lhs.true: ; preds = %for.body12
%arrayidx23 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv67
%9 = load i32, ptr %arrayidx23, align 8, !tbaa !5
%arrayidx27 = getelementptr inbounds [2 x i32], ptr %vla, i64 %indvars.iv67, i64 1
%10 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28 = icmp eq i32 %9, %10
br i1 %cmp28, label %land.lhs.true29, label %for.inc39
land.lhs.true29: ; preds = %land.lhs.true
%11 = add nuw nsw i64 %indvars.iv67, 1
%arrayidx31 = getelementptr inbounds [2 x i32], ptr %vla, i64 %11
%12 = load i32, ptr %arrayidx31, align 8, !tbaa !5
%arrayidx36 = getelementptr inbounds [2 x i32], ptr %vla, i64 %11, i64 1
%13 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37 = icmp eq i32 %12, %13
br i1 %cmp37, label %cleanup, label %for.inc39
for.inc39: ; preds = %for.body12, %land.lhs.true, %land.lhs.true29
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body12, !llvm.loop !11
cleanup: ; preds = %for.inc39, %land.lhs.true29, %for.cond10.preheader, %entry
%.str.2.sink = phi ptr [ @.str.2, %entry ], [ @.str.2, %for.cond10.preheader ], [ @.str.1, %land.lhs.true29 ], [ @.str.2, %for.inc39 ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
int N_all;
int main(int argc, char* argv[]){
int i,j;
int xx,yy,count;
count=0;
scanf("%d",&N_all);
for(i=1;i<=N_all;i++){
scanf("%d %d",&xx,&yy);
if( xx == yy ){
count++;
}else{
count = 0;
}
if(count >=3){
printf("Yes");
break;
}
}
if(count<=2){
printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278875/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278875/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N_all = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%xx = alloca i32, align 4
%yy = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %xx) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %yy) #3
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N_all)
%0 = load i32, ptr @N_all, align 4, !tbaa !5
%cmp.not15 = icmp slt i32 %0, 1
br i1 %cmp.not15, label %if.end11, label %for.body
for.cond: ; preds = %for.body
%inc7 = add nuw nsw i32 %i.016, 1
%1 = load i32, ptr @N_all, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.016, %1
br i1 %cmp.not.not, label %for.body, label %if.end11, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%count.017 = phi i32 [ %count.1, %for.cond ], [ 0, %entry ]
%i.016 = phi i32 [ %inc7, %for.cond ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %xx, ptr noundef nonnull %yy)
%2 = load i32, ptr %xx, align 4, !tbaa !5
%3 = load i32, ptr %yy, align 4, !tbaa !5
%cmp2 = icmp eq i32 %2, %3
%inc = add nsw i32 %count.017, 1
%count.1 = select i1 %cmp2, i32 %inc, i32 0
%cmp3 = icmp sgt i32 %count.1, 2
br i1 %cmp3, label %if.end11, label %for.cond
if.end11: ; preds = %for.cond, %for.body, %entry
%.str.2.sink = phi ptr [ @.str.3, %entry ], [ @.str.2, %for.body ], [ @.str.3, %for.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %yy) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %xx) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
int main(void){
int n;
int a,b;
int yes=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&a,&b);
if(a==b){yes++;}
else{yes=0;}
if(yes>=3){printf("Yes\n");return 0;}
}
printf("No\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278918/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278918/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not17 = icmp sgt i32 %0, 0
br i1 %cmp.not17, label %for.body, label %cleanup9
for.cond: ; preds = %for.body
%inc7 = add nuw nsw i32 %i.019, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp slt i32 %inc7, %1
br i1 %cmp.not, label %for.body, label %cleanup9, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%i.019 = phi i32 [ %inc7, %for.cond ], [ 0, %entry ]
%yes.018 = phi i32 [ %yes.1, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp eq i32 %2, %3
%inc = add nsw i32 %yes.018, 1
%yes.1 = select i1 %cmp2, i32 %inc, i32 0
%cmp3 = icmp sgt i32 %yes.1, 2
br i1 %cmp3, label %cleanup9, label %for.cond
cleanup9: ; preds = %for.cond, %for.body, %entry
%str.sink = phi ptr [ @str.4, %entry ], [ @str, %for.body ], [ @str.4, %for.cond ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(void){
char str[10];
int i=1,j,f=0;
scanf("%s",str);
if(str[0]=='A'){
if(str[1]<'a'||str[1]>'z'){
f=2;
}
for(i=2;i<(strlen(str)-1);i++){
if(str[i]=='C'){
f++;
}else{
if(str[i]<'a'||str[i]>'z'){
f=2;
}
}
}
if(str[i]<'a'||str[i]>'z'){
f=2;
}
}
if(f==1){
printf("AC");
}else{
printf("WA");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_278961/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_278961/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 65
br i1 %cmp, label %if.then, label %if.else54
if.then: ; preds = %entry
%call13 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%sub = add i64 %call13, -1
%cmp1471 = icmp ugt i64 %sub, 2
br i1 %cmp1471, label %for.body.preheader, label %if.else54
for.body.preheader: ; preds = %if.then
%arrayidx2 = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1
%2 = add i8 %1, -123
%or.cond = icmp ult i8 %2, -26
%spec.select = select i1 %or.cond, i32 2, i32 0
%3 = add i64 %call13, -3
%xtraiter = and i64 %3, 1
%4 = icmp eq i64 %call13, 4
br i1 %4, label %for.end.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %3, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%f.173 = phi i32 [ %spec.select, %for.body.preheader.new ], [ %f.2.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx16 = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx16, align 1, !tbaa !5
%cmp18 = icmp eq i8 %5, 67
%inc = add nsw i32 %f.173, 1
%6 = add i8 %5, -123
%or.cond64 = icmp ult i8 %6, -26
%spec.select66 = select i1 %or.cond64, i32 2, i32 %f.173
%f.2 = select i1 %cmp18, i32 %inc, i32 %spec.select66
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx16.1 = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%7 = load i8, ptr %arrayidx16.1, align 1, !tbaa !5
%cmp18.1 = icmp eq i8 %7, 67
%inc.1 = add nsw i32 %f.2, 1
%8 = add i8 %7, -123
%or.cond64.1 = icmp ult i8 %8, -26
%spec.select66.1 = select i1 %or.cond64.1, i32 2, i32 %f.2
%f.2.1 = select i1 %cmp18.1, i32 %inc.1, i32 %spec.select66.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.unr-lcssa, label %for.body, !llvm.loop !8
for.end.unr-lcssa: ; preds = %for.body, %for.body.preheader
%f.2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %f.2.1, %for.body ]
%indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%f.173.unr = phi i32 [ %spec.select, %for.body.preheader ], [ %f.2.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %indvars.iv.unr
%9 = load i8, ptr %arrayidx16.epil, align 1, !tbaa !5
%cmp18.epil = icmp eq i8 %9, 67
%inc.epil = add nsw i32 %f.173.unr, 1
%10 = add i8 %9, -123
%or.cond64.epil = icmp ult i8 %10, -26
%spec.select66.epil = select i1 %or.cond64.epil, i32 2, i32 %f.173.unr
%f.2.epil = select i1 %cmp18.epil, i32 %inc.epil, i32 %spec.select66.epil
br label %for.end
for.end: ; preds = %for.end.unr-lcssa, %for.body.epil
%f.2.lcssa = phi i32 [ %f.2.lcssa.ph, %for.end.unr-lcssa ], [ %f.2.epil, %for.body.epil ]
%11 = icmp eq i32 %f.2.lcssa, 1
%arrayidx37 = getelementptr inbounds [10 x i8], ptr %str, i64 0, i64 %sub
%12 = load i8, ptr %arrayidx37, align 1, !tbaa !5
%13 = add i8 %12, -97
%or.cond65 = icmp ult i8 %13, 26
%or.cond70 = select i1 %or.cond65, i1 %11, i1 false
br i1 %or.cond70, label %if.end56, label %if.else54
if.else54: ; preds = %if.then, %for.end, %entry
br label %if.end56
if.end56: ; preds = %for.end, %if.else54
%.str.2.sink = phi ptr [ @.str.2, %if.else54 ], [ @.str.1, %for.end ]
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdbool.h>
#define sml(ch) (('a' <= ch && ch <= 'z') ? true : false)
#define TR(flg) ((flg == true) ? 1 : 0)
int main(void)
{
char str[11];
scanf("%s", str);
int i, len, c_pos = -1;
bool flg1 = false, flg2 = false, flg3 = true;
for(len = 0; str[len] != '\0'; ++len);
if( str[0] == 'A') { flg1 = true; }
for(i = 2; i < len-1; ++i) {
if( str[i] == 'C') {
if(flg2) { flg2 = false; break; }
else { flg2 = true; c_pos = i; }
}
}
for(i = 1; i < len; ++i) {
if( (i != c_pos) && (!sml(str[i])) ) { flg3 = false; break; }
}
//printf("c_pos = %d\n", c_pos);
//printf("len = %d\n", len);
//printf("1: %d 2: %d 3: %d\n", TR(flg1), TR(flg2), TR(flg3));
if( flg1 && flg2 && flg3) { printf("AC\n"); }
else { printf("WA\n"); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279003/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279003/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"WA\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%indvars.iv91 = phi i32 [ %indvars.iv.next92, %for.cond ], [ 0, %entry ]
%indvars.iv86 = phi i32 [ %indvars.iv.next87, %for.cond ], [ -1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next87 = add nsw i32 %indvars.iv86, 1
%indvars.iv.next92 = add nuw i32 %indvars.iv91, 1
br i1 %cmp.not, label %for.end, label %for.cond, !llvm.loop !8
for.end: ; preds = %for.cond
%1 = trunc i64 %indvars.iv to i32
%2 = load i8, ptr %str, align 1, !tbaa !5
%cmp4 = icmp ne i8 %2, 65
%cmp774 = icmp ugt i32 %1, 3
br i1 %cmp774, label %for.body9.preheader, label %for.end21
for.body9.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %indvars.iv86 to i64
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.inc19
%indvars.iv84 = phi i64 [ 2, %for.body9.preheader ], [ %indvars.iv.next85, %for.inc19 ]
%flg2.077 = phi i8 [ 0, %for.body9.preheader ], [ %flg2.1, %for.inc19 ]
%c_pos.076 = phi i32 [ -1, %for.body9.preheader ], [ %c_pos.1, %for.inc19 ]
%arrayidx11 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 %indvars.iv84
%3 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%cmp13 = icmp eq i8 %3, 67
br i1 %cmp13, label %if.then15, label %for.inc19
if.then15: ; preds = %for.body9
%4 = and i8 %flg2.077, 1
%tobool.not = icmp eq i8 %4, 0
%5 = trunc i64 %indvars.iv84 to i32
br i1 %tobool.not, label %for.inc19, label %for.end21.loopexit
for.inc19: ; preds = %if.then15, %for.body9
%c_pos.1 = phi i32 [ %c_pos.076, %for.body9 ], [ %5, %if.then15 ]
%flg2.1 = phi i8 [ %flg2.077, %for.body9 ], [ 1, %if.then15 ]
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%exitcond.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count
br i1 %exitcond.not, label %for.end21.loopexit, label %for.body9, !llvm.loop !10
for.end21.loopexit: ; preds = %if.then15, %for.inc19
%c_pos.0.lcssa.ph = phi i32 [ %c_pos.1, %for.inc19 ], [ %c_pos.076, %if.then15 ]
%flg2.2.ph = phi i8 [ %flg2.1, %for.inc19 ], [ 0, %if.then15 ]
%6 = zext i32 %c_pos.0.lcssa.ph to i64
%7 = and i8 %flg2.2.ph, 1
%8 = icmp eq i8 %7, 0
br label %for.end21
for.end21: ; preds = %for.end21.loopexit, %for.end
%c_pos.0.lcssa = phi i64 [ 4294967295, %for.end ], [ %6, %for.end21.loopexit ]
%flg2.2 = phi i1 [ true, %for.end ], [ %8, %for.end21.loopexit ]
%cmp23.not81 = icmp ugt i32 %1, 1
br i1 %cmp23.not81, label %for.body25.preheader, label %for.end43
for.body25.preheader: ; preds = %for.end21
%wide.trip.count93 = zext i32 %indvars.iv91 to i64
br label %for.body25
for.body25: ; preds = %for.body25.preheader, %for.inc41
%indvars.iv88 = phi i64 [ 1, %for.body25.preheader ], [ %indvars.iv.next89, %for.inc41 ]
%cmp26.not = icmp eq i64 %indvars.iv88, %c_pos.0.lcssa
br i1 %cmp26.not, label %for.inc41, label %land.lhs.true
land.lhs.true: ; preds = %for.body25
%arrayidx29 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 %indvars.iv88
%9 = load i8, ptr %arrayidx29, align 1, !tbaa !5
%10 = add i8 %9, -97
%or.cond = icmp ult i8 %10, 26
br i1 %or.cond, label %for.inc41, label %if.else54
for.inc41: ; preds = %land.lhs.true, %for.body25
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond94.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count93
br i1 %exitcond94.not, label %for.end43, label %for.body25, !llvm.loop !11
for.end43: ; preds = %for.inc41, %for.end21
%or.cond70 = select i1 %cmp4, i1 true, i1 %flg2.2
br i1 %or.cond70, label %if.else54, label %if.end56
if.else54: ; preds = %land.lhs.true, %for.end43
br label %if.end56
if.end56: ; preds = %for.end43, %if.else54
%str.sink = phi ptr [ @str, %if.else54 ], [ @str.3, %for.end43 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
|
#include <stdio.h>
#include <string.h>
int main()
{
int i, n, intC=0, extC=0;
char str[20];
scanf("%s", str);
n = strlen(str);
if(str[0]!='A'){
printf("WA");
return 0;
}
for(i=0; i<n; i++){
if(i>=2&&i<n-1){
if(str[i]=='C')intC++;
}
if((i>=0&&i<2)||i==n-1){
if(str[i]=='C')extC++;
}
if(str[i]>='B'&&str[i]<='Z'&&str[i]!='C'){
printf("WA");
return 0;
}
}
if(intC!=1||extC>0){
printf("WA");
return 0;
}
printf("AC");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279061/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%conv = trunc i64 %call2 to i32
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not = icmp eq i8 %0, 65
%cmp694 = icmp sgt i32 %conv, 0
%or.cond = select i1 %cmp.not, i1 %cmp694, i1 false
br i1 %or.cond, label %for.cond.peel, label %cleanup
for.cond.peel: ; preds = %entry
%sub = add nsw i32 %conv, -1
%1 = zext i32 %sub to i64
%2 = zext i32 %sub to i64
%wide.trip.count = and i64 %call2, 4294967295
%exitcond.peel.not = icmp eq i64 %wide.trip.count, 1
br i1 %exitcond.peel.not, label %cleanup, label %if.end37.peel122
if.end37.peel122: ; preds = %for.cond.peel
%arrayidx30.peel118 = getelementptr inbounds [20 x i8], ptr %str, i64 0, i64 1
%3 = load i8, ptr %arrayidx30.peel118, align 1, !tbaa !5
%4 = add i8 %3, -66
%or.cond90.peel125 = icmp ult i8 %4, 25
%cmp53.not.peel126 = icmp ne i8 %3, 67
%or.cond91.peel127.not137 = and i1 %cmp53.not.peel126, %or.cond90.peel125
%exitcond.peel130.not = icmp eq i64 %wide.trip.count, 2
%or.cond135 = or i1 %or.cond91.peel127.not137, %exitcond.peel130.not
br i1 %or.cond135, label %cleanup, label %for.body.peel.next102
for.body.peel.next102: ; preds = %if.end37.peel122
%cmp32.peel119 = icmp eq i8 %3, 67
%inc35.peel120 = zext i1 %cmp32.peel119 to i32
%arrayidx30 = getelementptr inbounds [20 x i8], ptr %str, i64 0, i64 %1
br label %for.body
for.cond: ; preds = %if.end37
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.body: ; preds = %for.body.peel.next102, %for.cond
%indvars.iv = phi i64 [ 2, %for.body.peel.next102 ], [ %indvars.iv.next, %for.cond ]
%extC.097 = phi i32 [ %inc35.peel120, %for.body.peel.next102 ], [ %extC.1, %for.cond ]
%intC.096 = phi i32 [ 0, %for.body.peel.next102 ], [ %intC.1, %for.cond ]
%cmp10 = icmp ult i64 %indvars.iv, %2
br i1 %cmp10, label %if.then12, label %if.end19
if.then12: ; preds = %for.body
%arrayidx13 = getelementptr inbounds [20 x i8], ptr %str, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp15 = icmp eq i8 %5, 67
%inc = zext i1 %cmp15 to i32
%spec.select = add nsw i32 %intC.096, %inc
br label %if.end19
if.end19: ; preds = %if.then12, %for.body
%intC.1 = phi i32 [ %intC.096, %for.body ], [ %spec.select, %if.then12 ]
%cmp26 = icmp eq i64 %indvars.iv, %1
br i1 %cmp26, label %if.then28, label %if.end37
if.then28: ; preds = %if.end19
%6 = load i8, ptr %arrayidx30, align 1, !tbaa !5
%cmp32 = icmp eq i8 %6, 67
%inc35 = zext i1 %cmp32 to i32
%spec.select89 = add nsw i32 %extC.097, %inc35
br label %if.end37
if.end37: ; preds = %if.then28, %if.end19
%extC.1 = phi i32 [ %extC.097, %if.end19 ], [ %spec.select89, %if.then28 ]
%arrayidx39 = getelementptr inbounds [20 x i8], ptr %str, i64 0, i64 %indvars.iv
%7 = load i8, ptr %arrayidx39, align 1, !tbaa !5
%8 = add i8 %7, -91
%or.cond90 = icmp ult i8 %8, -25
%cmp53.not = icmp eq i8 %7, 67
%or.cond91 = or i1 %cmp53.not, %or.cond90
br i1 %or.cond91, label %for.cond, label %cleanup
for.end: ; preds = %for.cond
%9 = icmp ne i32 %intC.1, 1
%10 = icmp sgt i32 %extC.1, 0
%11 = select i1 %9, i1 true, i1 %10
%spec.select136 = select i1 %11, ptr @.str.1, ptr @.str.2
br label %cleanup
cleanup: ; preds = %if.end37, %for.end, %for.cond.peel, %if.end37.peel122, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %if.end37.peel122 ], [ @.str.1, %for.cond.peel ], [ %spec.select136, %for.end ], [ @.str.1, %if.end37 ]
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.peeled.count", i32 2}
|
#include <stdio.h>
#include <ctype.h>
#include <string.h>
typedef enum { false, true } bool;
int main(void)
{
char S[11];
int len;
int i;
int ctr = 0;
bool flag = false;
scanf("%s", S);
len = strlen(S);
if(S[0] == 'A')
{
if(!isupper(S[1]))
{
for(i=2; i<len-1; i++)
{
if(S[i] == 'C')
ctr++;
else if(isupper(S[i]))
break;
}
if(!isupper(S[i]) && ctr == 1)
flag = true;
}
}
if(flag)
printf("AC\n");
else
printf("WA\n");
//system("pause");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279104/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279104/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"WA\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %S) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #7
%conv = trunc i64 %call2 to i32
%0 = load i8, ptr %S, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 65
br i1 %cmp, label %if.then, label %if.else49
if.then: ; preds = %entry
%call5 = tail call ptr @__ctype_b_loc() #8
%1 = load ptr, ptr %call5, align 8, !tbaa !8
%arrayidx6 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 1
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%idxprom = sext i8 %2 to i64
%arrayidx8 = getelementptr inbounds i16, ptr %1, i64 %idxprom
%3 = load i16, ptr %arrayidx8, align 2, !tbaa !10
%4 = and i16 %3, 256
%tobool.not = icmp eq i16 %4, 0
br i1 %tobool.not, label %for.cond.preheader, label %if.else49
for.cond.preheader: ; preds = %if.then
%sub = add i32 %conv, -1
%cmp1158 = icmp sgt i32 %conv, 3
br i1 %cmp1158, label %for.body.preheader, label %if.else49
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%ctr.060 = phi i32 [ 0, %for.body.preheader ], [ %ctr.1, %for.inc ]
%arrayidx14 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 %indvars.iv
%5 = load i8, ptr %arrayidx14, align 1, !tbaa !5
%cmp16 = icmp eq i8 %5, 67
br i1 %cmp16, label %if.then18, label %if.else
if.then18: ; preds = %for.body
%inc = add nsw i32 %ctr.060, 1
br label %for.inc
if.else: ; preds = %for.body
%idxprom23 = sext i8 %5 to i64
%arrayidx24 = getelementptr inbounds i16, ptr %1, i64 %idxprom23
%6 = load i16, ptr %arrayidx24, align 2, !tbaa !10
%7 = and i16 %6, 256
%tobool27.not = icmp eq i16 %7, 0
br i1 %tobool27.not, label %for.inc, label %for.end.split.loop.exit72
for.inc: ; preds = %if.then18, %if.else
%ctr.1 = phi i32 [ %inc, %if.then18 ], [ %ctr.060, %if.else ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end.split.loop.exit72: ; preds = %if.else
%8 = trunc i64 %indvars.iv to i32
br label %for.end
for.end: ; preds = %for.inc, %for.end.split.loop.exit72
%i.0.lcssa.ph = phi i32 [ %8, %for.end.split.loop.exit72 ], [ %sub, %for.inc ]
%ctr.0.lcssa.ph = phi i32 [ %ctr.060, %for.end.split.loop.exit72 ], [ %ctr.1, %for.inc ]
%9 = zext i32 %i.0.lcssa.ph to i64
%10 = icmp ne i32 %ctr.0.lcssa.ph, 1
%arrayidx33 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 %9
%11 = load i8, ptr %arrayidx33, align 1, !tbaa !5
%idxprom35 = sext i8 %11 to i64
%arrayidx36 = getelementptr inbounds i16, ptr %1, i64 %idxprom35
%12 = load i16, ptr %arrayidx36, align 2, !tbaa !10
%13 = and i16 %12, 256
%tobool39 = icmp ne i16 %13, 0
%or.cond.not = select i1 %tobool39, i1 true, i1 %10
br i1 %or.cond.not, label %if.else49, label %if.end51
if.else49: ; preds = %for.cond.preheader, %if.then, %entry, %for.end
br label %if.end51
if.end51: ; preds = %for.end, %if.else49
%str.sink = phi ptr [ @str, %if.else49 ], [ @str.3, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %S) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
char s[11];
scanf("%s",s);
int len = strlen(s);
int i;
int count = 0;
int x=0;
if(s[0] =='A'){
for(i=2;i<len-1;i++){
if(s[i]=='C'){
count++;
}
}
if(count==1){
for(i=0;i<len;i++){
if((s[i]>='a')&&(s[i]<='z')){
x++;
}
}
if(x+2==len){
printf("AC");
return 0;
}
}
}
printf("WA");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"AC\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"WA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 65
%cmp558 = icmp sgt i32 %conv, 3
%or.cond72 = select i1 %cmp, i1 %cmp558, i1 false
br i1 %or.cond72, label %for.body.preheader, label %if.end42
for.body.preheader: ; preds = %entry
%sub = add i64 %call2, 4294967295
%wide.trip.count = and i64 %sub, 4294967295
%1 = add nsw i64 %wide.trip.count, -2
%min.iters.check = icmp ult i64 %1, 8
br i1 %min.iters.check, label %for.body.preheader95, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi73 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%offset.idx = or i64 %index, 2
%2 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %2, align 1, !tbaa !5
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load74 = load <4 x i8>, ptr %3, align 1, !tbaa !5
%4 = icmp eq <4 x i8> %wide.load, <i8 67, i8 67, i8 67, i8 67>
%5 = icmp eq <4 x i8> %wide.load74, <i8 67, i8 67, i8 67, i8 67>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = add <4 x i32> %vec.phi, %6
%9 = add <4 x i32> %vec.phi73, %7
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader95
for.body.preheader95: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 2, %for.body.preheader ], [ %ind.end, %middle.block ]
%count.060.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader95, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader95 ]
%count.060 = phi i32 [ %spec.select, %for.body ], [ %count.060.ph, %for.body.preheader95 ]
%arrayidx7 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv
%12 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %12, 67
%inc = zext i1 %cmp9 to i32
%spec.select = add nuw nsw i32 %count.060, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %11, %middle.block ], [ %spec.select, %for.body ]
%13 = icmp eq i32 %spec.select.lcssa, 1
br i1 %13, label %for.cond16.preheader, label %if.end42
for.cond16.preheader: ; preds = %for.end
%cmp1761 = icmp sgt i32 %conv, 0
br i1 %cmp1761, label %for.body19.preheader, label %for.end35
for.body19.preheader: ; preds = %for.cond16.preheader
%wide.trip.count69 = and i64 %call2, 4294967295
%min.iters.check77 = icmp ult i64 %wide.trip.count69, 8
br i1 %min.iters.check77, label %for.body19.preheader92, label %vector.ph78
vector.ph78: ; preds = %for.body19.preheader
%n.mod.vf79 = and i64 %call2, 7
%n.vec80 = sub nsw i64 %wide.trip.count69, %n.mod.vf79
br label %vector.body83
vector.body83: ; preds = %vector.body83, %vector.ph78
%index84 = phi i64 [ 0, %vector.ph78 ], [ %index.next89, %vector.body83 ]
%vec.phi85 = phi <4 x i32> [ zeroinitializer, %vector.ph78 ], [ %22, %vector.body83 ]
%vec.phi86 = phi <4 x i32> [ zeroinitializer, %vector.ph78 ], [ %23, %vector.body83 ]
%14 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %index84
%wide.load87 = load <4 x i8>, ptr %14, align 1, !tbaa !5
%15 = getelementptr inbounds i8, ptr %14, i64 4
%wide.load88 = load <4 x i8>, ptr %15, align 1, !tbaa !5
%16 = add <4 x i8> %wide.load87, <i8 -97, i8 -97, i8 -97, i8 -97>
%17 = add <4 x i8> %wide.load88, <i8 -97, i8 -97, i8 -97, i8 -97>
%18 = icmp ult <4 x i8> %16, <i8 26, i8 26, i8 26, i8 26>
%19 = icmp ult <4 x i8> %17, <i8 26, i8 26, i8 26, i8 26>
%20 = zext <4 x i1> %18 to <4 x i32>
%21 = zext <4 x i1> %19 to <4 x i32>
%22 = add <4 x i32> %vec.phi85, %20
%23 = add <4 x i32> %vec.phi86, %21
%index.next89 = add nuw i64 %index84, 8
%24 = icmp eq i64 %index.next89, %n.vec80
br i1 %24, label %middle.block75, label %vector.body83, !llvm.loop !13
middle.block75: ; preds = %vector.body83
%bin.rdx90 = add <4 x i32> %23, %22
%25 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx90)
%cmp.n82 = icmp eq i64 %n.mod.vf79, 0
br i1 %cmp.n82, label %for.end35.loopexit, label %for.body19.preheader92
for.body19.preheader92: ; preds = %for.body19.preheader, %middle.block75
%indvars.iv66.ph = phi i64 [ 0, %for.body19.preheader ], [ %n.vec80, %middle.block75 ]
%x.063.ph = phi i32 [ 0, %for.body19.preheader ], [ %25, %middle.block75 ]
br label %for.body19
for.body19: ; preds = %for.body19.preheader92, %for.body19
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body19 ], [ %indvars.iv66.ph, %for.body19.preheader92 ]
%x.063 = phi i32 [ %x.1, %for.body19 ], [ %x.063.ph, %for.body19.preheader92 ]
%arrayidx21 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv66
%26 = load i8, ptr %arrayidx21, align 1, !tbaa !5
%27 = add i8 %26, -97
%or.cond = icmp ult i8 %27, 26
%inc31 = zext i1 %or.cond to i32
%x.1 = add nuw nsw i32 %x.063, %inc31
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end35.loopexit, label %for.body19, !llvm.loop !14
for.end35.loopexit: ; preds = %for.body19, %middle.block75
%x.1.lcssa = phi i32 [ %25, %middle.block75 ], [ %x.1, %for.body19 ]
%28 = add nuw nsw i32 %x.1.lcssa, 2
br label %for.end35
for.end35: ; preds = %for.end35.loopexit, %for.cond16.preheader
%x.0.lcssa = phi i32 [ 2, %for.cond16.preheader ], [ %28, %for.end35.loopexit ]
%cmp36 = icmp eq i32 %x.0.lcssa, %conv
br i1 %cmp36, label %cleanup, label %if.end42
if.end42: ; preds = %for.end, %for.end35, %entry
br label %cleanup
cleanup: ; preds = %for.end35, %if.end42
%.str.2.sink = phi ptr [ @.str.2, %if.end42 ], [ @.str.1, %for.end35 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9, !10, !11}
!14 = distinct !{!14, !9, !11, !10}
|
#include <stdio.h>
int main(){
int n,i=1,j=0;
scanf("%d",&n);
int a[n];
scanf("%d",&a[0]);
while(i<n){
scanf(" %d",&a[i]);
i++;
}
while(j<n){
printf("%d",a[n-j-1]);
if(j<n-1)printf(" ");
j++;
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279212/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279212/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vla)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %3, 1
br i1 %cmp23, label %while.body, label %while.cond4.preheader
while.cond4.preheader: ; preds = %while.body, %entry
%4 = phi i32 [ %3, %entry ], [ %5, %while.body ]
%cmp525 = icmp sgt i32 %4, 0
br i1 %cmp525, label %while.body6, label %while.end15
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 1, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %while.body, label %while.cond4.preheader, !llvm.loop !9
while.body6: ; preds = %while.cond4.preheader, %if.end
%7 = phi i32 [ %11, %if.end ], [ %4, %while.cond4.preheader ]
%j.026 = phi i32 [ %inc14, %if.end ], [ 0, %while.cond4.preheader ]
%8 = xor i32 %j.026, -1
%sub7 = add i32 %7, %8
%idxprom8 = sext i32 %sub7 to i64
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
%10 = load i32, ptr %n, align 4, !tbaa !5
%sub11 = add nsw i32 %10, -1
%cmp12 = icmp slt i32 %j.026, %sub11
br i1 %cmp12, label %if.then, label %if.end
if.then: ; preds = %while.body6
%putchar22 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body6
%11 = phi i32 [ %.pre, %if.then ], [ %10, %while.body6 ]
%inc14 = add nuw nsw i32 %j.026, 1
%cmp5 = icmp slt i32 %inc14, %11
br i1 %cmp5, label %while.body6, label %while.end15, !llvm.loop !11
while.end15: ; preds = %if.end, %while.cond4.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int a[100];
int max;
int i;
scanf("%d", &max);
for (i = 0; i < max; i++){
scanf("%d", &a[i]);
}
for (i = max - 1; i >=
0; i--){
printf("%d", a[i]);
if (i != 0){
printf(" ");
}
}
printf("\n");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279263/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279263/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100 x i32], align 16
%max = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %max) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %max)
%0 = load i32, ptr %max, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end11
for.cond2.preheader: ; preds = %for.body
%cmp323 = icmp sgt i32 %2, 0
br i1 %cmp323, label %for.body4.preheader, label %for.end11
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %max, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc10
%indvars.iv27 = phi i64 [ %1, %for.body4.preheader ], [ %indvars.iv.next28, %for.inc10 ]
%indvars.iv.next28 = add nsw i64 %indvars.iv27, -1
%idxprom5 = and i64 %indvars.iv.next28, 4294967295
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = and i64 %indvars.iv.next28, 4294967295
%cmp8.not = icmp eq i64 %5, 0
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar19 = call i32 @putchar(i32 32)
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%cmp3 = icmp ugt i64 %indvars.iv27, 1
br i1 %cmp3, label %for.body4, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.inc10, %entry, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %max) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void) {
int n, i;
int d[100];
char buf[10000];
fgets(buf, 10, stdin);
n = atoi(buf);
fgets(buf, 10000, stdin);
d[0] = atoi(strtok(buf, " "));
for(i = 1; i < n; i++) {
d[i] = atoi(strtok(NULL, " "));
}
for(i = n - 1; i > 0; i--) {
printf("%d ", d[i]);
}
printf("%d\n", d[0]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279313/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279313/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [2 x i8] c" \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%d = alloca [100 x i32], align 16
%buf = alloca [10000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %buf) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 10, ptr noundef %0)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %buf, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call4 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 10000, ptr noundef %1)
%call6 = call ptr @strtok(ptr noundef nonnull %buf, ptr noundef nonnull @.str) #4
%call.i27 = call i64 @strtol(ptr nocapture noundef nonnull %call6, ptr noundef null, i32 noundef 10) #4
%conv.i28 = trunc i64 %call.i27 to i32
store i32 %conv.i28, ptr %d, align 16, !tbaa !9
%cmp31 = icmp sgt i32 %conv.i, 1
br i1 %cmp31, label %for.body.preheader, label %for.end18
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call.i, 4294967295
br label %for.body
for.cond11.preheader: ; preds = %for.body
br i1 %cmp31, label %for.body13.preheader, label %for.end18
for.body13.preheader: ; preds = %for.cond11.preheader
%2 = and i64 %call.i, 4294967295
br label %for.body13
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call8 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str) #4
%call.i29 = call i64 @strtol(ptr nocapture noundef nonnull %call8, ptr noundef null, i32 noundef 10) #4
%conv.i30 = trunc i64 %call.i29 to i32
%arrayidx10 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 %conv.i30, ptr %arrayidx10, align 4, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond11.preheader, label %for.body, !llvm.loop !11
for.body13: ; preds = %for.body13.preheader, %for.body13
%indvars.iv36 = phi i64 [ %2, %for.body13.preheader ], [ %indvars.iv.next37, %for.body13 ]
%indvars.iv.next37 = add nsw i64 %indvars.iv36, -1
%idxprom14 = and i64 %indvars.iv.next37, 4294967295
%arrayidx15 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %idxprom14
%3 = load i32, ptr %arrayidx15, align 4, !tbaa !9
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%cmp12 = icmp ugt i64 %indvars.iv36, 2
br i1 %cmp12, label %for.body13, label %for.end18, !llvm.loop !13
for.end18: ; preds = %for.body13, %entry, %for.cond11.preheader
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv.i28)
call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %buf) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
void solve(int n)
{
int t;
scanf("%d", &t);
if(n==1)
printf("%d", t);
else
{
solve(n-1);
printf(" %d", t);
}
}
int main(void)
{
int n;
scanf("%d", &n);
solve(n);
puts("");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279364/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279364/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve(i32 noundef %n) local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%cmp = icmp eq i32 %n, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%0 = load i32, ptr %t, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
br label %if.end
if.else: ; preds = %entry
%sub = add nsw i32 %n, -1
call void @solve(i32 noundef %sub)
%1 = load i32, ptr %t, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
call void @solve(i32 noundef %0)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n=0,i=0;
int a[100];
scanf("%d\n",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
printf("%d",a[n-1]);
for(i=n-2;i>=0;i--)printf(" %d",a[i]);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279407/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279407/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%sub = add nsw i32 %.lcssa, -1
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom2
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp722 = icmp sgt i32 %4, 1
br i1 %cmp722, label %for.body8.preheader, label %for.end13
for.body8.preheader: ; preds = %for.end
%sub5 = add nsw i32 %4, -2
%5 = zext i32 %sub5 to i64
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv26 = phi i64 [ %5, %for.body8.preheader ], [ %indvars.iv.next27, %for.body8 ]
%arrayidx10 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv26
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %6)
%indvars.iv.next27 = add nsw i64 %indvars.iv26, -1
%cmp7.not = icmp eq i64 %indvars.iv26, 0
br i1 %cmp7.not, label %for.end13, label %for.body8, !llvm.loop !11
for.end13: ; preds = %for.body8, %for.end
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n, num[100];
int i;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &num[i]);
}
for(i = n - 1; i >= 0; i--){
printf("%d", num[i]);
if(i != 0) printf(" ");
else printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279450/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279450/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%num = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%cmp323 = icmp sgt i32 %2, 0
br i1 %cmp323, label %for.body4.preheader, label %for.end12
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv27 = phi i64 [ %1, %for.body4.preheader ], [ %indvars.iv.next28, %for.body4 ]
%indvars.iv.next28 = add nsw i64 %indvars.iv27, -1
%idxprom5 = and i64 %indvars.iv.next28, 4294967295
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %num, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = and i64 %indvars.iv.next28, 4294967295
%cmp8.not = icmp eq i64 %5, 0
%. = select i1 %cmp8.not, i32 10, i32 32
%putchar19 = call i32 @putchar(i32 %.)
%cmp3 = icmp ugt i64 %indvars.iv27, 1
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.body4, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n, i;
int a[100];
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
i -= 1;
while (i >= 0){
if (i == 0){
printf("%d", a[i]);
}
else {printf("%d ", a[i]);
}
i--;
}
printf ("\n");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279508/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279508/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %while.end
while.cond.preheader: ; preds = %for.body
%1 = trunc i64 %indvars.iv.next to i32
%cmp222 = icmp sgt i32 %1, 0
br i1 %cmp222, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%2 = and i64 %indvars.iv.next, 4294967295
%indvars.iv.next2631 = add nsw i64 %2, -1
%cmp332 = icmp eq i64 %indvars.iv.next2631, 0
br i1 %cmp332, label %while.end.loopexit, label %if.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !9
if.end: ; preds = %while.body.preheader, %if.end
%indvars.iv.next2633 = phi i64 [ %indvars.iv.next26, %if.end ], [ %indvars.iv.next2631, %while.body.preheader ]
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next2633
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next26 = add nsw i64 %indvars.iv.next2633, -1
%cmp3 = icmp eq i64 %indvars.iv.next26, 0
br i1 %cmp3, label %while.end.loopexit, label %if.end, !llvm.loop !11
while.end.loopexit: ; preds = %if.end, %while.body.preheader
%6 = load i32, ptr %a, align 16, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
br label %while.end
while.end: ; preds = %entry, %while.end.loopexit, %while.cond.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int n,m,a[55],b[55],t[55]={},i;
scanf("%d%d",&n,&m);
for(i=0;i<m;i++)
scanf("%d%d",&a[i],&b[i]);
for(i=0;i<m;i++){
t[a[i]-1]++;
t[b[i]-1]++;
}
for(i=0;i<n;i++)
printf("%d\n",t[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279566/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279566/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [55 x i32], align 16
%b = alloca [55 x i32], align 16
%t = alloca [55 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %t) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(220) %t, i8 0, i64 220, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.cond21.preheader
for.cond4.preheader: ; preds = %for.body
%cmp542 = icmp sgt i32 %1, 0
br i1 %cmp542, label %for.body6.preheader, label %for.cond21.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [55 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [55 x i32], ptr %b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %m, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond21.preheader: ; preds = %for.body6, %entry, %for.cond4.preheader
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp2244 = icmp sgt i32 %3, 0
br i1 %cmp2244, label %for.body23, label %for.end29
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv48 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next49, %for.body6 ]
%arrayidx8 = getelementptr inbounds [55 x i32], ptr %a, i64 0, i64 %indvars.iv48
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%sub = add nsw i32 %4, -1
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds [55 x i32], ptr %t, i64 0, i64 %idxprom9
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc11 = add nsw i32 %5, 1
store i32 %inc11, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [55 x i32], ptr %b, i64 0, i64 %indvars.iv48
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%sub14 = add nsw i32 %6, -1
%idxprom15 = sext i32 %sub14 to i64
%arrayidx16 = getelementptr inbounds [55 x i32], ptr %t, i64 0, i64 %idxprom15
%7 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%inc17 = add nsw i32 %7, 1
store i32 %inc17, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count
br i1 %exitcond.not, label %for.cond21.preheader, label %for.body6, !llvm.loop !11
for.body23: ; preds = %for.cond21.preheader, %for.body23
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.body23 ], [ 0, %for.cond21.preheader ]
%arrayidx25 = getelementptr inbounds [55 x i32], ptr %t, i64 0, i64 %indvars.iv51
%8 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp22 = icmp slt i64 %indvars.iv.next52, %10
br i1 %cmp22, label %for.body23, label %for.end29, !llvm.loop !12
for.end29: ; preds = %for.body23, %for.cond21.preheader
call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
// puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
ll N, M, a, b, ans[55]={0};
in2(N, M);
rep(_, M){
in2(a, b);
ans[--a]++;
ans[--b]++;
}
rep(i, N) put(ans[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279623/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279623/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @powll(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%r.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !5
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%r.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i64, align 8
%M = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
%ans = alloca [55 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %ans) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %ans, i8 0, i64 440, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i64, ptr %M, align 8, !tbaa !9
%cmp18 = icmp sgt i64 %0, 0
br i1 %cmp18, label %for.body, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body, %entry
%1 = load i64, ptr %N, align 8, !tbaa !9
%cmp720 = icmp sgt i64 %1, 0
br i1 %cmp720, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%_.019 = phi i64 [ %inc5, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i64, ptr %a, align 8, !tbaa !9
%dec = add nsw i64 %2, -1
store i64 %dec, ptr %a, align 8, !tbaa !9
%arrayidx = getelementptr inbounds [55 x i64], ptr %ans, i64 0, i64 %dec
%3 = load i64, ptr %arrayidx, align 8, !tbaa !9
%inc = add nsw i64 %3, 1
store i64 %inc, ptr %arrayidx, align 8, !tbaa !9
%4 = load i64, ptr %b, align 8, !tbaa !9
%dec2 = add nsw i64 %4, -1
store i64 %dec2, ptr %b, align 8, !tbaa !9
%arrayidx3 = getelementptr inbounds [55 x i64], ptr %ans, i64 0, i64 %dec2
%5 = load i64, ptr %arrayidx3, align 8, !tbaa !9
%inc4 = add nsw i64 %5, 1
store i64 %inc4, ptr %arrayidx3, align 8, !tbaa !9
%inc5 = add nuw nsw i64 %_.019, 1
%6 = load i64, ptr %M, align 8, !tbaa !9
%cmp = icmp slt i64 %inc5, %6
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !13
for.cond.cleanup8: ; preds = %for.body9, %for.cond6.preheader
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %ans) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
ret i32 0
for.body9: ; preds = %for.cond6.preheader, %for.body9
%i.021 = phi i64 [ %inc13, %for.body9 ], [ 0, %for.cond6.preheader ]
%arrayidx10 = getelementptr inbounds [55 x i64], ptr %ans, i64 0, i64 %i.021
%7 = load i64, ptr %arrayidx10, align 8, !tbaa !9
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %7)
%inc13 = add nuw nsw i64 %i.021, 1
%8 = load i64, ptr %N, align 8, !tbaa !9
%cmp7 = icmp slt i64 %inc13, %8
br i1 %cmp7, label %for.body9, label %for.cond.cleanup8, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.unroll.disable"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.mustprogress"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = distinct !{!13, !8}
!14 = distinct !{!14, !8}
|
#include <stdio.h>
int main(void){
int n, m;
scanf("%d%d", &n, &m);
int ans[50] = {0};
for(int i = 0; i < m; i++){
int a, b;
scanf("%d%d", &a, &b);
ans[a - 1]++;
ans[b - 1]++;
}
for(int i = 0; i < n; i++){
printf("%d\n", ans[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279667/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279667/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%ans = alloca [50 x i32], align 16
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %ans) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %ans, i8 0, i64 200, i1 false)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp923 = icmp sgt i32 %1, 0
br i1 %cmp923, label %for.body11, label %for.cond.cleanup10
for.body: ; preds = %entry, %for.body
%i.022 = phi i32 [ %inc6, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i32], ptr %ans, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%sub2 = add nsw i32 %4, -1
%idxprom3 = sext i32 %sub2 to i64
%arrayidx4 = getelementptr inbounds [50 x i32], ptr %ans, i64 0, i64 %idxprom3
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%inc5 = add nsw i32 %5, 1
store i32 %inc5, ptr %arrayidx4, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
%inc6 = add nuw nsw i32 %i.022, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc6, %6
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond.cleanup10: ; preds = %for.body11, %for.cond8.preheader
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %ans) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body11: ; preds = %for.cond8.preheader, %for.body11
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body11 ], [ 0, %for.cond8.preheader ]
%arrayidx13 = getelementptr inbounds [50 x i32], ptr %ans, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp9 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp9, label %for.body11, label %for.cond.cleanup10, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],i,x=0,y=0,b[2000001],t=0;
for(i=0;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<=n;i++)
{
x=a[i]-1;
y=1000000-a[i];
if(x<=y)
{
b[t]=x;
t++;
}
if(y<x)
{
b[t]=y;
t++;
}
x=0;
y=0;
}
int max;
max=b[0];
for(i=0;i<t;i++)
{
if(max<b[i])
{
max=b[i];
}
}
printf("%d",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [2000001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
call void @llvm.lifetime.start.p0(i64 8000004, ptr nonnull %b) #6
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not59 = icmp sgt i32 %3, -1
call void @llvm.assume(i1 %cmp.not59)
br label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not61 = icmp sgt i32 %16, -1
call void @llvm.assume(i1 %cmp3.not61)
%4 = add nuw i32 %16, 1
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %16, 7
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.cond2.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load86 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = add nsw <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
%8 = add nsw <4 x i32> %wide.load86, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = sub nsw <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, %wide.load
%10 = sub nsw <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, %wide.load86
%11 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %7, <4 x i32> %9)
%12 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %8, <4 x i32> %10)
%13 = getelementptr inbounds [2000001 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %11, ptr %13, align 16
%14 = getelementptr inbounds i32, ptr %13, i64 4
store <4 x i32> %12, ptr %14, align 16
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.body26.preheader, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond2.preheader, %middle.block
%indvars.iv71.ph = phi i64 [ 0, %for.cond2.preheader ], [ %n.vec, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %17
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body4 ], [ %indvars.iv71.ph, %for.body4.preheader ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv71
%18 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%sub = add nsw i32 %18, -1
%sub9 = sub nsw i32 1000000, %18
%spec.select85 = call i32 @llvm.smin.i32(i32 %sub, i32 %sub9)
%19 = getelementptr inbounds [2000001 x i32], ptr %b, i64 0, i64 %indvars.iv71
store i32 %spec.select85, ptr %19, align 4
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count
br i1 %exitcond.not, label %for.body26.preheader, label %for.body4, !llvm.loop !14
for.body26.preheader: ; preds = %for.body4, %middle.block
%.pre = load i32, ptr %b, align 16, !tbaa !5
%wide.trip.count79 = zext i32 %4 to i64
%min.iters.check89 = icmp ult i32 %16, 7
br i1 %min.iters.check89, label %for.body26.preheader101, label %vector.ph90
vector.ph90: ; preds = %for.body26.preheader
%n.vec92 = and i64 %wide.trip.count, 4294967288
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body95
vector.body95: ; preds = %vector.body95, %vector.ph90
%index96 = phi i64 [ 0, %vector.ph90 ], [ %index.next100, %vector.body95 ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph90 ], [ %22, %vector.body95 ]
%vec.phi97 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph90 ], [ %23, %vector.body95 ]
%20 = getelementptr inbounds [2000001 x i32], ptr %b, i64 0, i64 %index96
%wide.load98 = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds i32, ptr %20, i64 4
%wide.load99 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load98)
%23 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi97, <4 x i32> %wide.load99)
%index.next100 = add nuw i64 %index96, 8
%24 = icmp eq i64 %index.next100, %n.vec92
br i1 %24, label %middle.block87, label %vector.body95, !llvm.loop !15
middle.block87: ; preds = %vector.body95
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %22, <4 x i32> %23)
%25 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n94 = icmp eq i64 %n.vec92, %wide.trip.count
br i1 %cmp.n94, label %for.end36, label %for.body26.preheader101
for.body26.preheader101: ; preds = %for.body26.preheader, %middle.block87
%indvars.iv76.ph = phi i64 [ 0, %for.body26.preheader ], [ %n.vec92, %middle.block87 ]
%max.067.ph = phi i32 [ %.pre, %for.body26.preheader ], [ %25, %middle.block87 ]
br label %for.body26
for.body26: ; preds = %for.body26.preheader101, %for.body26
%indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body26 ], [ %indvars.iv76.ph, %for.body26.preheader101 ]
%max.067 = phi i32 [ %spec.select, %for.body26 ], [ %max.067.ph, %for.body26.preheader101 ]
%arrayidx28 = getelementptr inbounds [2000001 x i32], ptr %b, i64 0, i64 %indvars.iv76
%26 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %max.067, i32 %26)
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79
br i1 %exitcond80.not, label %for.end36, label %for.body26, !llvm.loop !16
for.end36: ; preds = %for.body26, %middle.block87
%spec.select.lcssa = phi i32 [ %25, %middle.block87 ], [ %spec.select, %for.body26 ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select.lcssa)
call void @llvm.lifetime.end.p0(i64 8000004, ptr nonnull %b) #6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
|
#include <stdio.h>
int main(){
int n,m,a[101]={51},h=0,result,i,j,blank;
scanf("%d %d",&n,&m);
m *= 2;
for(i = 0; i < m; i++) scanf("%d",&a[i]);
for(i = 0; i < m-1; i++){
for(j = 0; j < m-1; j++){
if(a[j] > a[j+1]){
blank=a[j];
a[j]=a[j+1];
a[j+1]=blank;
}
}
}
//for(i = 0; i < m; i++) printf("%d ",a[i]);
//printf("%d ",a[m-1]);
for(i = 1; i <= n; i++){
result=0;
for(j = h; a[j] == i; j++) result++;
h=j;
printf("%d\n",result);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279760/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279760/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %a, i8 0, i64 404, i1 false)
store i32 51, ptr %a, align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %0, 1
store i32 %mul, ptr %m, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %mul, %entry ], [ %8, %for.body ]
%sub = add i32 %.lcssa, -1
%cmp369 = icmp sgt i32 %.lcssa, 1
br i1 %cmp369, label %for.cond5.preheader.us.preheader, label %for.cond30.preheader
for.cond5.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.inc27_crit_edge.us
%i.170.us = phi i32 [ %inc28.us, %for.cond5.for.inc27_crit_edge.us ], [ 0, %for.cond5.preheader.us.preheader ]
%.pre = load i32, ptr %a, align 16, !tbaa !5
br i1 %1, label %for.cond5.for.inc27_crit_edge.us.unr-lcssa, label %for.body8.us
for.body8.us: ; preds = %for.cond5.preheader.us, %for.inc24.us.1
%2 = phi i32 [ %6, %for.inc24.us.1 ], [ %.pre, %for.cond5.preheader.us ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84.1, %for.inc24.us.1 ], [ 0, %for.cond5.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc24.us.1 ], [ 0, %for.cond5.preheader.us ]
%indvars.iv.next84 = or i64 %indvars.iv83, 1
%arrayidx12.us = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next84
%3 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.us = icmp sgt i32 %2, %3
br i1 %cmp13.us, label %if.then.us, label %for.inc24.us
if.then.us: ; preds = %for.body8.us
%arrayidx10.us = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv83
store i32 %3, ptr %arrayidx10.us, align 8, !tbaa !5
store i32 %2, ptr %arrayidx12.us, align 4, !tbaa !5
br label %for.inc24.us
for.inc24.us: ; preds = %if.then.us, %for.body8.us
%4 = phi i32 [ %2, %if.then.us ], [ %3, %for.body8.us ]
%indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 2
%arrayidx12.us.1 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next84.1
%5 = load i32, ptr %arrayidx12.us.1, align 8, !tbaa !5
%cmp13.us.1 = icmp sgt i32 %4, %5
br i1 %cmp13.us.1, label %if.then.us.1, label %for.inc24.us.1
if.then.us.1: ; preds = %for.inc24.us
%arrayidx10.us.1 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next84
store i32 %5, ptr %arrayidx10.us.1, align 4, !tbaa !5
store i32 %4, ptr %arrayidx12.us.1, align 8, !tbaa !5
br label %for.inc24.us.1
for.inc24.us.1: ; preds = %if.then.us.1, %for.inc24.us
%6 = phi i32 [ %4, %if.then.us.1 ], [ %5, %for.inc24.us ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond5.for.inc27_crit_edge.us.unr-lcssa, label %for.body8.us, !llvm.loop !9
for.cond5.for.inc27_crit_edge.us.unr-lcssa: ; preds = %for.inc24.us.1, %for.cond5.preheader.us
%.unr = phi i32 [ %.pre, %for.cond5.preheader.us ], [ %6, %for.inc24.us.1 ]
%indvars.iv83.unr = phi i64 [ 0, %for.cond5.preheader.us ], [ %indvars.iv.next84.1, %for.inc24.us.1 ]
br i1 %lcmp.mod.not, label %for.cond5.for.inc27_crit_edge.us, label %for.body8.us.epil
for.body8.us.epil: ; preds = %for.cond5.for.inc27_crit_edge.us.unr-lcssa
%indvars.iv.next84.epil = add nuw nsw i64 %indvars.iv83.unr, 1
%arrayidx12.us.epil = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next84.epil
%7 = load i32, ptr %arrayidx12.us.epil, align 4, !tbaa !5
%cmp13.us.epil = icmp sgt i32 %.unr, %7
br i1 %cmp13.us.epil, label %if.then.us.epil, label %for.cond5.for.inc27_crit_edge.us
if.then.us.epil: ; preds = %for.body8.us.epil
%arrayidx10.us.epil = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv83.unr
store i32 %7, ptr %arrayidx10.us.epil, align 4, !tbaa !5
store i32 %.unr, ptr %arrayidx12.us.epil, align 4, !tbaa !5
br label %for.cond5.for.inc27_crit_edge.us
for.cond5.for.inc27_crit_edge.us: ; preds = %for.body8.us.epil, %if.then.us.epil, %for.cond5.for.inc27_crit_edge.us.unr-lcssa
%inc28.us = add nuw nsw i32 %i.170.us, 1
%exitcond86.not = icmp eq i32 %inc28.us, %sub
br i1 %exitcond86.not, label %for.cond30.preheader, label %for.cond5.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %m, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !12
for.cond30.preheader: ; preds = %for.cond5.for.inc27_crit_edge.us, %for.cond2.preheader
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp31.not78 = icmp slt i32 %10, 1
br i1 %cmp31.not78, label %for.end45, label %for.cond33.preheader
for.cond33.preheader: ; preds = %for.cond30.preheader, %for.end41
%h.080 = phi i32 [ %j.1.lcssa, %for.end41 ], [ 0, %for.cond30.preheader ]
%i.279 = phi i32 [ %inc44, %for.end41 ], [ 1, %for.cond30.preheader ]
%idxprom3471 = sext i32 %h.080 to i64
%arrayidx3572 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %idxprom3471
%11 = load i32, ptr %arrayidx3572, align 4, !tbaa !5
%cmp3673 = icmp eq i32 %11, %i.279
br i1 %cmp3673, label %for.body37, label %for.end41
for.body37: ; preds = %for.cond33.preheader, %for.body37
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body37 ], [ %idxprom3471, %for.cond33.preheader ]
%result.074 = phi i32 [ %inc38, %for.body37 ], [ 0, %for.cond33.preheader ]
%inc38 = add nuw nsw i32 %result.074, 1
%indvars.iv.next88 = add i64 %indvars.iv87, 1
%arrayidx35 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv.next88
%12 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36 = icmp eq i32 %12, %i.279
br i1 %cmp36, label %for.body37, label %for.end41.loopexit, !llvm.loop !13
for.end41.loopexit: ; preds = %for.body37
%13 = trunc i64 %indvars.iv.next88 to i32
br label %for.end41
for.end41: ; preds = %for.end41.loopexit, %for.cond33.preheader
%result.0.lcssa = phi i32 [ 0, %for.cond33.preheader ], [ %inc38, %for.end41.loopexit ]
%j.1.lcssa = phi i32 [ %h.080, %for.cond33.preheader ], [ %13, %for.end41.loopexit ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %result.0.lcssa)
%inc44 = add nuw nsw i32 %i.279, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%cmp31.not.not = icmp slt i32 %i.279, %14
br i1 %cmp31.not.not, label %for.cond33.preheader, label %for.end45, !llvm.loop !14
for.end45: ; preds = %for.end41, %for.cond30.preheader
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int ans[50];
int main(int argc, char const *argv[]){
int n,m,a,b,i;
scanf("%d %d",&n,&m);
for(i=0;i<m;i++){
scanf("%d %d",&a,&b);
ans[a-1]++;
ans[b-1]++;
}
for(i=0;i<n;i++){
printf("%d\n",ans[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279803/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279803/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@ans = dso_local local_unnamed_addr global [50 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp822 = icmp sgt i32 %1, 0
br i1 %cmp822, label %for.body9, label %for.end15
for.body: ; preds = %entry, %for.body
%i.021 = phi i32 [ %inc6, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [50 x i32], ptr @ans, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%sub2 = add nsw i32 %4, -1
%idxprom3 = sext i32 %sub2 to i64
%arrayidx4 = getelementptr inbounds [50 x i32], ptr @ans, i64 0, i64 %idxprom3
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%inc5 = add nsw i32 %5, 1
store i32 %inc5, ptr %arrayidx4, align 4, !tbaa !5
%inc6 = add nuw nsw i32 %i.021, 1
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc6, %6
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body9 ], [ 0, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds [50 x i32], ptr @ans, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp8 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp8, label %for.body9, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body9, %for.cond7.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
float a,b;
scanf("%f %f",&a,&b);
printf("%f",a/b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279876/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279876/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%f %f\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca float, align 4
%b = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load float, ptr %a, align 4, !tbaa !5
%1 = load float, ptr %b, align 4, !tbaa !5
%div = fdiv float %0, %1
%conv = fpext float %div to double
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int t,x;
scanf("%d %d",&t,&x);
printf("%lf",(double)t/x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279926/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279926/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load i32, ptr %t, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %x, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int T,X;
scanf("%d %d",&T,&X);
printf("%f",(double)(T)/X);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_279977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_279977/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T, ptr noundef nonnull %X)
%0 = load i32, ptr %T, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %X, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int t,x;
scanf("%d%d",&t,&x);
double answer = (double)t / (double)x;
printf("%lf\n",answer);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280018/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280018/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load i32, ptr %t, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %x, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
// Your code here!
float a,b;
scanf("%f %f", &a, &b);
printf("%f", a/b);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%f %f\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca float, align 4
%b = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load float, ptr %a, align 4, !tbaa !5
%1 = load float, ptr %b, align 4, !tbaa !5
%div = fdiv float %0, %1
%conv = fpext float %div to double
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int X;
int T;
double A_time;
scanf("%d %d",&T,&X);
A_time = T / (double)X;
printf("%.10f",A_time);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280111/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280111/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%.10f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
%T = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T, ptr noundef nonnull %X)
%0 = load i32, ptr %T, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %X, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int t,x;
scanf("%d %d", &t, &x);
printf("%lf", t/(double)x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280155/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280155/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load i32, ptr %t, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %x, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int x,t;
scanf("%d %d",&t,&x);
printf("%f\n", (double)t/x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280199/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280199/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %x)
%0 = load i32, ptr %t, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %x, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
//set many funcs template
//Ver.20180717
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
void shuffledget(int x[],int n){
srand(time(0));
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
long long cid(long long x,long long w,long long d){
if(x<w){return 0;}
return ((x-w)/d)+1;
}
int main(void){
long long i,j,n,m,k,a,b,c,h,r=0,l,t;
long long w[131072],d[131072];
long long st=0,fi=llinf,te;
char s[524288];
scanf("%lld%lld",&n,&k);
//l=strlen(s);
for(i=0;i<n;i++){
scanf("%lld%lld",&w[i],&d[i]);
}
while(st<=fi){
te=(st+fi)/2;r=0;
for(i=0;i<n;i++){
r+=cid(te,w[i],d[i]);
if(r>=k){break;}
}
if(r<k){st=te+1;}else{fi=te-1;}
}
//shuffledget(a,n);
//qsort(a,n,sizeof(int),sortfncsj);
printf("%lld\n",st);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280241/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280241/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !16
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !17
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !17
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !22
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #13
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #13
ret i32 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #14
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #14
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #14
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !34
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #14
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !35
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !36
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #14
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #10 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !25
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !37
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !38
%1 = load i32, ptr %b, align 4, !tbaa !38
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @cid(i64 noundef %x, i64 noundef %w, i64 noundef %d) local_unnamed_addr #1 {
entry:
%cmp = icmp slt i64 %x, %w
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%sub = sub nsw i64 %x, %w
%div = sdiv i64 %sub, %d
%add = add nsw i64 %div, 1
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i64 [ %add, %if.end ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #11 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
%w = alloca [131072 x i64], align 16
%d = alloca [131072 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #14
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #14
call void @llvm.lifetime.start.p0(i64 1048576, ptr nonnull %w) #14
call void @llvm.lifetime.start.p0(i64 1048576, ptr nonnull %d) #14
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i64, ptr %n, align 8, !tbaa !29
%cmp34 = icmp sgt i64 %0, 0
br i1 %cmp34, label %for.body, label %while.cond.preheader.thread
while.cond.preheader.thread: ; preds = %entry
%1 = load i64, ptr %k, align 8
%.fr60 = freeze i64 %1
br label %while.cond.preheader.split
while.cond.preheader: ; preds = %for.body
%cmp536 = icmp sgt i64 %5, 0
%2 = load i64, ptr %k, align 8
%.fr = freeze i64 %2
br i1 %cmp536, label %while.body.us, label %while.cond.preheader.split
while.body.us: ; preds = %while.cond.preheader, %for.end14.us
%fi.042.us = phi i64 [ %fi.1.us, %for.end14.us ], [ 4154118101919364364, %while.cond.preheader ]
%st.041.us = phi i64 [ %st.1.us, %for.end14.us ], [ 0, %while.cond.preheader ]
%add.us = add nsw i64 %fi.042.us, %st.041.us
%div.us = sdiv i64 %add.us, 2
br label %for.body6.us
for.body6.us: ; preds = %cid.exit.us, %while.body.us
%i.138.us = phi i64 [ 0, %while.body.us ], [ %inc13.us, %cid.exit.us ]
%r.037.us = phi i64 [ 0, %while.body.us ], [ %add10.us, %cid.exit.us ]
%arrayidx7.us = getelementptr inbounds [131072 x i64], ptr %w, i64 0, i64 %i.138.us
%3 = load i64, ptr %arrayidx7.us, align 8, !tbaa !29
%cmp.i.us = icmp slt i64 %div.us, %3
br i1 %cmp.i.us, label %cid.exit.us, label %if.end.i.us
if.end.i.us: ; preds = %for.body6.us
%arrayidx8.us = getelementptr inbounds [131072 x i64], ptr %d, i64 0, i64 %i.138.us
%4 = load i64, ptr %arrayidx8.us, align 8, !tbaa !29
%sub.i.us = sub nsw i64 %div.us, %3
%div.i.us = sdiv i64 %sub.i.us, %4
%add.i.us = add nsw i64 %div.i.us, 1
br label %cid.exit.us
cid.exit.us: ; preds = %if.end.i.us, %for.body6.us
%retval.0.i.us = phi i64 [ %add.i.us, %if.end.i.us ], [ 0, %for.body6.us ]
%add10.us = add nsw i64 %retval.0.i.us, %r.037.us
%cmp11.not.us = icmp slt i64 %add10.us, %.fr
%inc13.us = add nuw nsw i64 %i.138.us, 1
%cmp5.us = icmp slt i64 %inc13.us, %5
%or.cond = select i1 %cmp11.not.us, i1 %cmp5.us, i1 false
br i1 %or.cond, label %for.body6.us, label %for.end14.us, !llvm.loop !40
for.end14.us: ; preds = %cid.exit.us
%add17.us = add nsw i64 %div.us, 1
%sub.us = add nsw i64 %div.us, -1
%st.1.us = select i1 %cmp11.not.us, i64 %add17.us, i64 %st.041.us
%fi.1.us = select i1 %cmp11.not.us, i64 %fi.042.us, i64 %sub.us
%cmp3.not.us = icmp sgt i64 %st.1.us, %fi.1.us
br i1 %cmp3.not.us, label %while.end, label %while.body.us, !llvm.loop !41
while.cond.preheader.split: ; preds = %while.cond.preheader.thread, %while.cond.preheader
%.fr61 = phi i64 [ %.fr60, %while.cond.preheader.thread ], [ %.fr, %while.cond.preheader ]
%cmp15 = icmp sgt i64 %.fr61, 0
%spec.select = select i1 %cmp15, i64 4154118101919364365, i64 0
br label %while.end
for.body: ; preds = %entry, %for.body
%i.035 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [131072 x i64], ptr %w, i64 0, i64 %i.035
%arrayidx1 = getelementptr inbounds [131072 x i64], ptr %d, i64 0, i64 %i.035
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1)
%inc = add nuw nsw i64 %i.035, 1
%5 = load i64, ptr %n, align 8, !tbaa !29
%cmp = icmp slt i64 %inc, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !42
while.end: ; preds = %for.end14.us, %while.cond.preheader.split
%.us-phi = phi i64 [ %spec.select, %while.cond.preheader.split ], [ %st.1.us, %for.end14.us ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 1048576, ptr nonnull %d) #14
call void @llvm.lifetime.end.p0(i64 1048576, ptr nonnull %w) #14
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #14
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #14
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #12
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = distinct !{!33, !6, !9, !10}
!34 = distinct !{!34, !6, !10, !9}
!35 = distinct !{!35, !6}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = !{!39, !26, i64 0}
!39 = !{!"", !26, i64 0, !26, i64 4}
!40 = distinct !{!40, !6}
!41 = distinct !{!41, !6}
!42 = distinct !{!42, !6}
|
#include<stdio.h>
int main()
{
int n,a[100],c=0,x=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%2==0){
c++;
if(a[i]%3==0||a[i]%5==0) x++;
}
}
if(c==x) printf("APPROVED\n");
else printf("DENIED\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280285/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280285/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
@str.3 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %if.end21
for.cond.cleanup: ; preds = %for.inc
%cmp17 = icmp eq i32 %c.1, %x.1
%spec.select39 = select i1 %cmp17, ptr @str.3, ptr @str
br label %if.end21
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%x.032 = phi i32 [ %x.1, %for.inc ], [ 0, %entry ]
%c.031 = phi i32 [ %c.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp4 = icmp eq i32 %2, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %for.body
%inc = add nsw i32 %c.031, 1
%rem7 = srem i32 %1, 3
%cmp8 = icmp eq i32 %rem7, 0
%rem11 = srem i32 %1, 5
%cmp12 = icmp eq i32 %rem11, 0
%or.cond = or i1 %cmp8, %cmp12
%inc14 = zext i1 %or.cond to i32
%spec.select = add nsw i32 %x.032, %inc14
br label %for.inc
for.inc: ; preds = %if.then, %for.body
%c.1 = phi i32 [ %c.031, %for.body ], [ %inc, %if.then ]
%x.1 = phi i32 [ %x.032, %for.body ], [ %spec.select, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.end21: ; preds = %for.cond.cleanup, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ %spec.select39, %for.cond.cleanup ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int arr[105];
int a;
void solve() {
scanf("%d",&a);
for(int i = 1; i <= a; i = i + 1) {
scanf("%d", &arr[i]);
if(arr[i] % 2 ==0) {
if(arr[i] % 3 != 0 && arr[i] % 5 != 0) {
printf("DENIED\n");
return;
}
}
}
printf("APPROVED\n");
return;
}
int main() {
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280328/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280328/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global i32 0, align 4
@arr = dso_local global [105 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
@str.3 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
%0 = load i32, ptr @a, align 4, !tbaa !5
%cmp.not27 = icmp slt i32 %0, 1
br i1 %cmp.not27, label %return, label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @a, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %return, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [105 x i32], ptr @arr, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp4 = icmp ne i32 %4, 0
%rem7 = srem i32 %3, 3
%cmp8.not = icmp eq i32 %rem7, 0
%or.cond = or i1 %cmp4, %cmp8.not
%rem11 = srem i32 %3, 5
%cmp12.not = icmp eq i32 %rem11, 0
%or.cond23 = or i1 %cmp12.not, %or.cond
br i1 %or.cond23, label %for.cond, label %return
return: ; preds = %for.cond, %for.body, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ @str, %for.body ], [ @str.3, %for.cond ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
%0 = load i32, ptr @a, align 4, !tbaa !5
%cmp.not27.i = icmp slt i32 %0, 1
br i1 %cmp.not27.i, label %solve.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%1 = load i32, ptr @a, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not.i = icmp slt i64 %indvars.iv.i, %2
br i1 %cmp.not.not.i, label %for.body.i, label %solve.exit, !llvm.loop !9
for.body.i: ; preds = %entry, %for.cond.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond.i ], [ 1, %entry ]
%arrayidx.i = getelementptr inbounds [105 x i32], ptr @arr, i64 0, i64 %indvars.iv.i
%call1.i = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.i)
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp4.i = icmp ne i32 %4, 0
%rem7.i = srem i32 %3, 3
%cmp8.not.i = icmp eq i32 %rem7.i, 0
%or.cond.i = or i1 %cmp4.i, %cmp8.not.i
%rem11.i = srem i32 %3, 5
%cmp12.not.i = icmp eq i32 %rem11.i, 0
%or.cond23.i = or i1 %cmp12.not.i, %or.cond.i
br i1 %or.cond23.i, label %for.cond.i, label %solve.exit
solve.exit: ; preds = %for.cond.i, %for.body.i, %entry
%str.sink.i = phi ptr [ @str.3, %entry ], [ @str.3, %for.cond.i ], [ @str, %for.body.i ]
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n;
int a;
int b[100];
scanf("%d",&n);
for (a = 0; a < n; a++) {
scanf("%d", &b[a]);
}
for (a = 0; a < n; a++) {
if (b[a] % 2 == 0 && b[a] % 3 != 0 && b[a] % 5 != 0) {
printf("DENIED");
return 0;
}
}
puts("APPROVED");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280371/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280371/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp334 = icmp sgt i32 %1, 0
br i1 %cmp334, label %for.body4.preheader, label %for.end20
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2: ; preds = %for.body4
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2
%indvars.iv38 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next39, %for.cond2 ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv38
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp7 = icmp ne i32 %4, 0
%rem10 = srem i32 %3, 3
%cmp11.not = icmp eq i32 %rem10, 0
%or.cond = or i1 %cmp7, %cmp11.not
%rem15 = srem i32 %3, 5
%cmp16.not = icmp eq i32 %rem15, 0
%or.cond31 = or i1 %cmp16.not, %or.cond
br i1 %or.cond31, label %for.cond2, label %if.then
if.then: ; preds = %for.body4
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
for.end20: ; preds = %for.cond2, %entry, %for.cond2.preheader
%call21 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
cleanup: ; preds = %for.end20, %if.then
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main (void)
{
int n,i,j,a[101];
scanf("%d\n",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(j=0;j<n;j++){
if(a[j] % 2 == 0 && a[j] % 3 != 0 && a[j] %5 !=0){
printf("DENIED\n");
return 0;
}
}
printf("APPROVED\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280421/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280421/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
@str.4 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %cleanup
for.cond2.preheader: ; preds = %for.body
%cmp335 = icmp sgt i32 %1, 0
br i1 %cmp335, label %for.body4.preheader, label %cleanup
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond2: ; preds = %for.body4
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body4, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %for.cond2
%indvars.iv39 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next40, %for.cond2 ]
%arrayidx6 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv39
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp7 = icmp ne i32 %4, 0
%rem10 = srem i32 %3, 3
%cmp11.not = icmp eq i32 %rem10, 0
%or.cond = or i1 %cmp7, %cmp11.not
%rem15 = srem i32 %3, 5
%cmp16.not = icmp eq i32 %rem15, 0
%or.cond32 = or i1 %cmp16.not, %or.cond
br i1 %or.cond32, label %for.cond2, label %cleanup
cleanup: ; preds = %for.cond2, %for.body4, %for.cond2.preheader, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str, %for.cond2.preheader ], [ @str.4, %for.body4 ], [ @str, %for.cond2 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<string.h>
#include<stdio.h>
int main()
{
int m, n, drawer[2000] = {}, temp, score = 0, check, i;
scanf("%d %d", &m, &n);
while (n--)
{
scanf("%d", &temp);
drawer[temp]++;
check = 1;
for (i = 1; i <= m; i++)
if (drawer[i] < 1)
{
check = 0;
break;
}
if (check == 1)
{
for (i = 1; i <= m; i++)
drawer[i]--;
score++;
}
}
printf("%d\n", score);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28048/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28048/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%drawer = alloca [2000 x i32], align 16
%temp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %drawer) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8000) %drawer, i8 0, i64 8000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec31 = add nsw i32 %0, -1
store i32 %dec31, ptr %n, align 4, !tbaa !5
%tobool.not32 = icmp eq i32 %0, 0
br i1 %tobool.not32, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end18
%score.033 = phi i32 [ %score.1, %if.end18 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %temp)
%1 = load i32, ptr %temp, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [2000 x i32], ptr %drawer, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not27 = icmp slt i32 %3, 1
br i1 %cmp.not27, label %for.end16, label %for.body.preheader
for.body.preheader: ; preds = %while.body
%4 = add i32 %3, 1
%wide.trip.count = zext i32 %4 to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond8.preheader, label %for.body, !llvm.loop !9
for.cond8.preheader: ; preds = %for.cond
br i1 %cmp.not27, label %for.end16, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%5 = add nuw i32 %3, 1
%wide.trip.count38 = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i64 %6, 8
br i1 %min.iters.check, label %for.body10.preheader41, label %vector.ph
vector.ph: ; preds = %for.body10.preheader
%n.vec = and i64 %6, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = or i64 %index, 1
%7 = getelementptr inbounds [2000 x i32], ptr %drawer, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load40 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = add nsw <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = add nsw <4 x i32> %wide.load40, <i32 -1, i32 -1, i32 -1, i32 -1>
store <4 x i32> %9, ptr %7, align 4, !tbaa !5
store <4 x i32> %10, ptr %8, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.end16, label %for.body10.preheader41
for.body10.preheader41: ; preds = %for.body10.preheader, %middle.block
%indvars.iv35.ph = phi i64 [ 1, %for.body10.preheader ], [ %ind.end, %middle.block ]
br label %for.body10
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx3 = getelementptr inbounds [2000 x i32], ptr %drawer, i64 0, i64 %indvars.iv
%12 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp slt i32 %12, 1
br i1 %cmp4, label %if.end18, label %for.cond
for.body10: ; preds = %for.body10.preheader41, %for.body10
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.body10 ], [ %indvars.iv35.ph, %for.body10.preheader41 ]
%arrayidx12 = getelementptr inbounds [2000 x i32], ptr %drawer, i64 0, i64 %indvars.iv35
%13 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%dec13 = add nsw i32 %13, -1
store i32 %dec13, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%exitcond39.not = icmp eq i64 %indvars.iv.next36, %wide.trip.count38
br i1 %exitcond39.not, label %for.end16, label %for.body10, !llvm.loop !14
for.end16: ; preds = %for.body10, %middle.block, %while.body, %for.cond8.preheader
%inc17 = add nsw i32 %score.033, 1
br label %if.end18
if.end18: ; preds = %for.body, %for.end16
%score.1 = phi i32 [ %inc17, %for.end16 ], [ %score.033, %for.body ]
%14 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %14, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %14, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %if.end18, %entry
%score.0.lcssa = phi i32 [ 0, %entry ], [ %score.1, %if.end18 ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %score.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #4
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %drawer) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main()
{
int n,x,i=0;
scanf("%d",&n);
while(i<n)
{
scanf("%d",&x);
if(x%2==0&&(x%3!=0&&x%5!=0))
{
printf("DENIED");
return 0;
}
i++;
}
printf("APPROVED");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280522/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280522/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %while.body, label %cleanup
while.cond: ; preds = %while.body
%inc = add nuw nsw i32 %i.015, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9
while.body: ; preds = %entry, %while.cond
%i.015 = phi i32 [ %inc, %while.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = and i32 %2, 1
%cmp2 = icmp ne i32 %3, 0
%rem3 = srem i32 %2, 3
%cmp4.not = icmp eq i32 %rem3, 0
%or.cond = or i1 %cmp2, %cmp4.not
%rem6 = srem i32 %2, 5
%cmp7.not = icmp eq i32 %rem6, 0
%or.cond13 = or i1 %cmp7.not, %or.cond
br i1 %or.cond13, label %while.cond, label %cleanup
cleanup: ; preds = %while.cond, %while.body, %entry
%.str.2.sink = phi ptr [ @.str.2, %entry ], [ @.str.1, %while.body ], [ @.str.2, %while.cond ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{ int j,i,A[101],d=0,c=0;
scanf("%d",&j);
for(i=1;i<=j;i++)
{
scanf("%d",&A[i]);
if(A[i]%2==0){
c=c+1;
}
}
for(i=1;i<=j;i++)
{
if(A[i]%2==0&&(A[i]%3==0||A[i]%5==0))
{
d=d+1;
}
}
if(c==d)
printf("APPROVED");
else
printf("DENIED");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280566/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280566/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%j = alloca i32, align 4
%A = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%0 = load i32, ptr %j, align 4, !tbaa !5
%cmp.not42 = icmp slt i32 %0, 1
br i1 %cmp.not42, label %if.end30, label %for.body
for.cond5.preheader: ; preds = %for.body
%cmp6.not46 = icmp slt i32 %26, 1
br i1 %cmp6.not46, label %for.end25, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader
%1 = add i32 %26, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i64 %2, 8
br i1 %min.iters.check, label %for.body7.preheader67, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi, %vector.body ]
%vec.phi63 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi65, %vector.body ]
%offset.idx = or i64 %index, 1
%3 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load64 = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%6 = and <4 x i32> %wide.load64, <i32 1, i32 1, i32 1, i32 1>
%7 = icmp eq <4 x i32> %5, zeroinitializer
%8 = icmp eq <4 x i32> %6, zeroinitializer
%9 = srem <4 x i32> %wide.load, <i32 3, i32 3, i32 3, i32 3>
%10 = srem <4 x i32> %wide.load64, <i32 3, i32 3, i32 3, i32 3>
%11 = icmp eq <4 x i32> %9, zeroinitializer
%12 = icmp eq <4 x i32> %10, zeroinitializer
%13 = srem <4 x i32> %wide.load, <i32 5, i32 5, i32 5, i32 5>
%14 = srem <4 x i32> %wide.load64, <i32 5, i32 5, i32 5, i32 5>
%15 = icmp eq <4 x i32> %13, zeroinitializer
%16 = icmp eq <4 x i32> %14, zeroinitializer
%17 = or <4 x i1> %11, %15
%18 = or <4 x i1> %12, %16
%narrow = select <4 x i1> %7, <4 x i1> %17, <4 x i1> zeroinitializer
%19 = zext <4 x i1> %narrow to <4 x i32>
%predphi = add <4 x i32> %vec.phi, %19
%narrow66 = select <4 x i1> %8, <4 x i1> %18, <4 x i1> zeroinitializer
%20 = zext <4 x i1> %narrow66 to <4 x i32>
%predphi65 = add <4 x i32> %vec.phi63, %20
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %predphi65, %predphi
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.end25, label %for.body7.preheader67
for.body7.preheader67: ; preds = %for.body7.preheader, %middle.block
%indvars.iv52.ph = phi i64 [ 1, %for.body7.preheader ], [ %ind.end, %middle.block ]
%d.048.ph = phi i32 [ 0, %for.body7.preheader ], [ %22, %middle.block ]
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%c.044 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%23 = load i32, ptr %arrayidx, align 4, !tbaa !5
%24 = and i32 %23, 1
%25 = xor i32 %24, 1
%spec.select = add i32 %25, %c.044
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%26 = load i32, ptr %j, align 4, !tbaa !5
%27 = sext i32 %26 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %27
br i1 %cmp.not.not, label %for.body, label %for.cond5.preheader, !llvm.loop !13
for.body7: ; preds = %for.body7.preheader67, %for.inc23
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.inc23 ], [ %indvars.iv52.ph, %for.body7.preheader67 ]
%d.048 = phi i32 [ %d.1, %for.inc23 ], [ %d.048.ph, %for.body7.preheader67 ]
%arrayidx9 = getelementptr inbounds [101 x i32], ptr %A, i64 0, i64 %indvars.iv52
%28 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%29 = and i32 %28, 1
%cmp11 = icmp eq i32 %29, 0
br i1 %cmp11, label %land.lhs.true, label %for.inc23
land.lhs.true: ; preds = %for.body7
%rem14 = srem i32 %28, 3
%cmp15 = icmp eq i32 %rem14, 0
%rem18 = srem i32 %28, 5
%cmp19 = icmp eq i32 %rem18, 0
%or.cond = or i1 %cmp15, %cmp19
%add21 = zext i1 %or.cond to i32
%spec.select41 = add nsw i32 %d.048, %add21
br label %for.inc23
for.inc23: ; preds = %land.lhs.true, %for.body7
%d.1 = phi i32 [ %d.048, %for.body7 ], [ %spec.select41, %land.lhs.true ]
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count
br i1 %exitcond.not, label %for.end25, label %for.body7, !llvm.loop !14
for.end25: ; preds = %for.inc23, %middle.block, %for.cond5.preheader
%d.0.lcssa = phi i32 [ 0, %for.cond5.preheader ], [ %22, %middle.block ], [ %d.1, %for.inc23 ]
%cmp26 = icmp eq i32 %spec.select, %d.0.lcssa
%spec.select62 = select i1 %cmp26, ptr @.str.1, ptr @.str.2
br label %if.end30
if.end30: ; preds = %for.end25, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ %spec.select62, %for.end25 ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include<stdio.h>
int main (){
int A[1100];
int N,a,b;
int c=0;
int d=0;
scanf("%d",&N);
for(a=0;a<N;a++){
scanf("%d",&A[a]);
}
for(b=0;b<N;b++){
if(A[b]%2==0){
d++;
}
if(A[b]%2==0 && A[b]%3==0){
c++;
}else if(A[b]%2==0 && A[b]%5==0){
c++;
}
//if(A[b]%15==0){
// --c;
//}
// printf("%d\n",c);
}
if(c==d){
printf("APPROVED");
}else{
printf("DENIED");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280609/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280609/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [1100 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4400, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body, label %if.end40
for.cond2.preheader: ; preds = %for.body
%cmp356 = icmp sgt i32 %26, 0
br i1 %cmp356, label %for.body4.preheader, label %if.end40
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %26 to i64
%min.iters.check = icmp ult i32 %26, 8
br i1 %min.iters.check, label %for.body4.preheader81, label %vector.ph
vector.ph: ; preds = %for.body4.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi73 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi74 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%vec.phi75 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ]
%1 = getelementptr inbounds [1100 x i32], ptr %A, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load76 = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%4 = and <4 x i32> %wide.load76, <i32 1, i32 1, i32 1, i32 1>
%5 = xor <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1>
%6 = xor <4 x i32> %4, <i32 1, i32 1, i32 1, i32 1>
%7 = add <4 x i32> %5, %vec.phi
%8 = add <4 x i32> %6, %vec.phi73
%9 = srem <4 x i32> %wide.load, <i32 3, i32 3, i32 3, i32 3>
%10 = srem <4 x i32> %wide.load76, <i32 3, i32 3, i32 3, i32 3>
%11 = or <4 x i32> %3, %9
%12 = or <4 x i32> %4, %10
%13 = icmp eq <4 x i32> %11, zeroinitializer
%14 = icmp eq <4 x i32> %12, zeroinitializer
%15 = srem <4 x i32> %wide.load, <i32 5, i32 5, i32 5, i32 5>
%16 = srem <4 x i32> %wide.load76, <i32 5, i32 5, i32 5, i32 5>
%17 = or <4 x i32> %3, %15
%18 = or <4 x i32> %4, %16
%19 = icmp eq <4 x i32> %17, zeroinitializer
%20 = icmp eq <4 x i32> %18, zeroinitializer
%narrow = select <4 x i1> %13, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %19
%predphi = zext <4 x i1> %narrow to <4 x i32>
%narrow80 = select <4 x i1> %14, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %20
%predphi77 = zext <4 x i1> %narrow80 to <4 x i32>
%21 = add <4 x i32> %vec.phi74, %predphi
%22 = add <4 x i32> %vec.phi75, %predphi77
%index.next = add nuw i64 %index, 8
%23 = icmp eq i64 %index.next, %n.vec
br i1 %23, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx78 = add <4 x i32> %22, %21
%24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx78)
%bin.rdx = add <4 x i32> %8, %7
%25 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end34, label %for.body4.preheader81
for.body4.preheader81: ; preds = %for.body4.preheader, %middle.block
%indvars.iv64.ph = phi i64 [ 0, %for.body4.preheader ], [ %n.vec, %middle.block ]
%d.059.ph = phi i32 [ 0, %for.body4.preheader ], [ %25, %middle.block ]
%c.058.ph = phi i32 [ 0, %for.body4.preheader ], [ %24, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%26 = load i32, ptr %N, align 4, !tbaa !5
%27 = sext i32 %26 to i64
%cmp = icmp slt i64 %indvars.iv.next, %27
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader81, %for.inc32
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.inc32 ], [ %indvars.iv64.ph, %for.body4.preheader81 ]
%d.059 = phi i32 [ %spec.select, %for.inc32 ], [ %d.059.ph, %for.body4.preheader81 ]
%c.058 = phi i32 [ %spec.select53, %for.inc32 ], [ %c.058.ph, %for.body4.preheader81 ]
%arrayidx6 = getelementptr inbounds [1100 x i32], ptr %A, i64 0, i64 %indvars.iv64
%28 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%29 = and i32 %28, 1
%30 = xor i32 %29, 1
%spec.select = add i32 %30, %d.059
%rem15 = srem i32 %28, 3
%31 = or i32 %29, %rem15
%or.cond = icmp eq i32 %31, 0
br i1 %or.cond, label %for.inc32, label %if.else
if.else: ; preds = %for.body4
%rem26 = srem i32 %28, 5
%32 = or i32 %29, %rem26
%or.cond52 = icmp eq i32 %32, 0
%inc29 = zext i1 %or.cond52 to i32
br label %for.inc32
for.inc32: ; preds = %for.body4, %if.else
%inc29.sink = phi i32 [ %inc29, %if.else ], [ 1, %for.body4 ]
%spec.select53 = add nuw nsw i32 %c.058, %inc29.sink
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
br i1 %exitcond.not, label %for.end34, label %for.body4, !llvm.loop !14
for.end34: ; preds = %for.inc32, %middle.block
%spec.select53.lcssa = phi i32 [ %24, %middle.block ], [ %spec.select53, %for.inc32 ]
%spec.select.lcssa = phi i32 [ %25, %middle.block ], [ %spec.select, %for.inc32 ]
%cmp35 = icmp eq i32 %spec.select53.lcssa, %spec.select.lcssa
%spec.select72 = select i1 %cmp35, ptr @.str.1, ptr @.str.2
br label %if.end40
if.end40: ; preds = %for.end34, %for.cond2.preheader, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.cond2.preheader ], [ %spec.select72, %for.end34 ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4400, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include<stdio.h>
#include<stdbool.h>
int main(void){
int n;
scanf("%d",&n);
int a[n];
bool flag = true;
for(int i=0;i<n;++i){
scanf("%d",a+i);
}
for(int j=0;j<n;++j){
if(a[j]%2==0){
if(a[j]%3!=0&&a[j]%5!=0){
flag = false;
}
}
}
if(flag){
printf("APPROVED");
}else{
printf("DENIED");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280652/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280652/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %3, 0
br i1 %cmp31, label %for.body, label %if.end23
for.cond2.preheader: ; preds = %for.body
%cmp333 = icmp sgt i32 %4, 0
br i1 %cmp333, label %for.body5.preheader, label %if.end23
for.body5.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %4 to i64
br label %for.body5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond.cleanup4: ; preds = %for.body5
%6 = and i8 %flag.1, 1
%7 = icmp eq i8 %6, 0
%spec.select = select i1 %7, ptr @.str.2, ptr @.str.1
br label %if.end23
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv39 = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next40, %for.body5 ]
%flag.034 = phi i8 [ 1, %for.body5.preheader ], [ %flag.1, %for.body5 ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%9 = and i32 %8, 1
%cmp6 = icmp ne i32 %9, 0
%rem9 = srem i32 %8, 3
%cmp10.not = icmp eq i32 %rem9, 0
%or.cond = or i1 %cmp6, %cmp10.not
%rem13 = srem i32 %8, 5
%cmp14.not = icmp eq i32 %rem13, 0
%or.cond30 = or i1 %cmp14.not, %or.cond
%flag.1 = select i1 %or.cond30, i8 %flag.034, i8 0
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup4, label %for.body5, !llvm.loop !11
if.end23: ; preds = %for.cond.cleanup4, %for.cond2.preheader, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.cond2.preheader ], [ %spec.select, %for.cond.cleanup4 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int i,n,a,ans;
scanf("%d",&n);
for (ans=i=0;i<n;i++) {
scanf("%d",&a);
if (a%2==0 && (a%3==0 || a%5==0)) ans++;
else if (a%2==1) ans++;
}
if (ans==n) puts("APPROVED");
else puts("DENIED");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280696/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280696/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"APPROVED\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"DENIED\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%ans.024 = phi i32 [ %spec.select, %for.inc ], [ 0, %entry ]
%i.023 = phi i32 [ %inc12, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp2 = icmp eq i32 %2, 0
br i1 %cmp2, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %for.body
%rem3 = srem i32 %1, 3
%cmp4 = icmp eq i32 %rem3, 0
%rem5 = srem i32 %1, 5
%cmp6 = icmp eq i32 %rem5, 0
%or.cond = or i1 %cmp4, %cmp6
br i1 %or.cond, label %for.inc, label %if.else
if.else: ; preds = %land.lhs.true, %for.body
%3 = and i32 %1, -2147483647
%cmp8 = icmp eq i32 %3, 1
%inc10 = zext i1 %cmp8 to i32
br label %for.inc
for.inc: ; preds = %land.lhs.true, %if.else
%inc10.sink = phi i32 [ %inc10, %if.else ], [ 1, %land.lhs.true ]
%spec.select = add nuw nsw i32 %ans.024, %inc10.sink
%inc12 = add nuw nsw i32 %i.023, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc12, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.inc ]
%.lcssa = phi i32 [ %0, %entry ], [ %4, %for.inc ]
%cmp13 = icmp eq i32 %ans.0.lcssa, %.lcssa
%.str.1..str.2 = select i1 %cmp13, ptr @.str.1, ptr @.str.2
%call17 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#define N 1000
typedef struct array{
int *a;
int num;
}array;
int main(){
int n,q,i,com,x,y;
array S[N];
scanf("%d %d",&n,&q);
for(i=0;i<n;i++){
S[i].a=malloc(sizeof(int)*q);
S[i].num=0;
}
for(i=0;i<q;i++){
scanf("%d",&com);
if(com==0){
scanf("%d %d",&x,&y);
S[x].a[S[x].num++]=y;
}
if(com==1){
scanf("%d",&x);
if(S[x].num==0)printf("\n");
else {
for(int j=0;j<S[x].num-1;j++)printf("%d ",S[x].a[j]);
printf("%d\n",S[x].a[S[x].num-1]);
}
}
if(com==2){
scanf("%d",&x);
free(S[x].a);
S[x].a=malloc(sizeof(int)*(q-i));
S[x].num=0;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280739/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280739/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.array = type { ptr, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%com = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%S = alloca [1000 x %struct.array], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %com) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.start.p0(i64 16000, ptr nonnull %S) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp89 = icmp sgt i32 %0, 0
%.pre = load i32, ptr %q, align 4, !tbaa !5
br i1 %cmp89, label %for.body.lr.ph, label %for.cond4.preheader
for.body.lr.ph: ; preds = %entry
%conv = sext i32 %.pre to i64
%mul = shl nsw i64 %conv, 2
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond4.preheader: ; preds = %for.body, %entry
%cmp599 = icmp sgt i32 %.pre, 0
br i1 %cmp599, label %for.body7, label %for.end80
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%arrayidx = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %indvars.iv
store ptr %call1, ptr %arrayidx, align 16, !tbaa !9
%num = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %indvars.iv, i32 1
store i32 0, ptr %num, align 8, !tbaa !12
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond4.preheader, label %for.body, !llvm.loop !13
for.body7: ; preds = %for.cond4.preheader, %for.inc78
%i.1100 = phi i32 [ %inc79, %for.inc78 ], [ 0, %for.cond4.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com)
%1 = load i32, ptr %com, align 4, !tbaa !5
%cmp9 = icmp eq i32 %1, 0
br i1 %cmp9, label %if.then, label %if.end
if.then: ; preds = %for.body7
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i32, ptr %y, align 4, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !5
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom12
%4 = load ptr, ptr %arrayidx13, align 16, !tbaa !9
%num17 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom12, i32 1
%5 = load i32, ptr %num17, align 8, !tbaa !12
%inc18 = add nsw i32 %5, 1
store i32 %inc18, ptr %num17, align 8, !tbaa !12
%idxprom19 = sext i32 %5 to i64
%arrayidx20 = getelementptr inbounds i32, ptr %4, i64 %idxprom19
store i32 %2, ptr %arrayidx20, align 4, !tbaa !5
%.pr = load i32, ptr %com, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body7
%6 = phi i32 [ %.pr, %if.then ], [ %1, %for.body7 ]
%cmp21 = icmp eq i32 %6, 1
br i1 %cmp21, label %if.then23, label %if.end59
if.then23: ; preds = %if.end
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%7 = load i32, ptr %x, align 4, !tbaa !5
%idxprom25 = sext i32 %7 to i64
%num27 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom25, i32 1
%8 = load i32, ptr %num27, align 8, !tbaa !12
%cmp28 = icmp eq i32 %8, 0
br i1 %cmp28, label %if.then30, label %for.cond32.preheader
for.cond32.preheader: ; preds = %if.then23
%arrayidx3492 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom25
%cmp3695 = icmp sgt i32 %8, 1
br i1 %cmp3695, label %for.body38, label %for.cond32.preheader.for.cond.cleanup_crit_edge
for.cond32.preheader.for.cond.cleanup_crit_edge: ; preds = %for.cond32.preheader
%sub94 = add nsw i32 %8, -1
%.pre108 = sext i32 %sub94 to i64
br label %for.cond.cleanup
if.then30: ; preds = %if.then23
%putchar = call i32 @putchar(i32 10)
br label %if.end59
for.cond.cleanup: ; preds = %for.body38, %for.cond32.preheader.for.cond.cleanup_crit_edge
%idxprom55.pre-phi = phi i64 [ %.pre108, %for.cond32.preheader.for.cond.cleanup_crit_edge ], [ %15, %for.body38 ]
%arrayidx34.lcssa = phi ptr [ %arrayidx3492, %for.cond32.preheader.for.cond.cleanup_crit_edge ], [ %arrayidx34, %for.body38 ]
%9 = load ptr, ptr %arrayidx34.lcssa, align 16, !tbaa !9
%arrayidx56 = getelementptr inbounds i32, ptr %9, i64 %idxprom55.pre-phi
%10 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %10)
br label %if.end59
for.body38: ; preds = %for.cond32.preheader, %for.body38
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.body38 ], [ 0, %for.cond32.preheader ]
%arrayidx3497 = phi ptr [ %arrayidx34, %for.body38 ], [ %arrayidx3492, %for.cond32.preheader ]
%11 = load ptr, ptr %arrayidx3497, align 16, !tbaa !9
%arrayidx43 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv104
%12 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%13 = load i32, ptr %x, align 4, !tbaa !5
%idxprom33 = sext i32 %13 to i64
%arrayidx34 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom33
%num35 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom33, i32 1
%14 = load i32, ptr %num35, align 8, !tbaa !12
%sub = add nsw i32 %14, -1
%15 = sext i32 %sub to i64
%cmp36 = icmp slt i64 %indvars.iv.next105, %15
br i1 %cmp36, label %for.body38, label %for.cond.cleanup, !llvm.loop !15
if.end59: ; preds = %if.then30, %for.cond.cleanup, %if.end
%16 = load i32, ptr %com, align 4, !tbaa !5
%cmp60 = icmp eq i32 %16, 2
br i1 %cmp60, label %if.then62, label %if.end59.for.inc78_crit_edge
if.end59.for.inc78_crit_edge: ; preds = %if.end59
%.pre107 = load i32, ptr %q, align 4, !tbaa !5
br label %for.inc78
if.then62: ; preds = %if.end59
%call63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%17 = load i32, ptr %x, align 4, !tbaa !5
%idxprom64 = sext i32 %17 to i64
%arrayidx65 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom64
%18 = load ptr, ptr %arrayidx65, align 16, !tbaa !9
call void @free(ptr noundef %18) #6
%19 = load i32, ptr %q, align 4, !tbaa !5
%sub67 = sub nsw i32 %19, %i.1100
%conv68 = sext i32 %sub67 to i64
%mul69 = shl nsw i64 %conv68, 2
%call70 = call noalias ptr @malloc(i64 noundef %mul69) #7
%20 = load i32, ptr %x, align 4, !tbaa !5
%idxprom71 = sext i32 %20 to i64
%arrayidx72 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom71
store ptr %call70, ptr %arrayidx72, align 16, !tbaa !9
%num76 = getelementptr inbounds [1000 x %struct.array], ptr %S, i64 0, i64 %idxprom71, i32 1
store i32 0, ptr %num76, align 8, !tbaa !12
br label %for.inc78
for.inc78: ; preds = %if.end59.for.inc78_crit_edge, %if.then62
%21 = phi i32 [ %.pre107, %if.end59.for.inc78_crit_edge ], [ %19, %if.then62 ]
%inc79 = add nuw nsw i32 %i.1100, 1
%cmp5 = icmp slt i32 %inc79, %21
br i1 %cmp5, label %for.body7, label %for.end80, !llvm.loop !16
for.end80: ; preds = %for.inc78, %for.cond4.preheader
call void @llvm.lifetime.end.p0(i64 16000, ptr nonnull %S) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %com) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"array", !11, i64 0, !6, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
|
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
int h, w, i, j, k;
char s[20][21];
u_int d[400][400];
memset(d, -1, sizeof(d));
scanf("%d%d", &h, &w);
for(i=0; i<h; i++){
scanf("%s", s+i);
}
for(i=0; i<h; i++){
for(j=0; j<w; j++){
if(s[i][j]=='.'){
d[i*w+j][i*w+j]=0;
}
if(i!=h-1 && s[i][j]=='.' && s[i+1][j]=='.'){
d[i*w+j][(i+1)*w+j]=1;
d[(i+1)*w+j][i*w+j]=1;
}
if(j!=w-1 && s[i][j]=='.' && s[i][j+1]=='.'){
d[i*w+j][i*w+j+1]=1;
d[i*w+j+1][i*w+j]=1;
}
}
}
int l=h*w;
for(k=0; k<l; k++){
for(i=0; i<l; i++){
for(j=0; j<l; j++){
if(d[i][k]!=UINT_MAX && d[k][j]!=UINT_MAX
&& d[i][k]+d[k][j]<d[i][j]){
d[i][j] = d[i][k]+d[k][j];
}
}
}
}
int max=0;
for(i=0; i<l; i++){
for(j=0; j<l; j++){
if(d[i][j]!=UINT_MAX && d[i][j]>max)
max = d[i][j];
}
}
printf("%d\n", max);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280782/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [20 x [21 x i8]], align 16
%d = alloca [400 x [400 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 640000, ptr nonnull %d) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(640000) %d, i8 -1, i64 640000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp282 = icmp sgt i32 %0, 0
br i1 %cmp282, label %for.body, label %for.cond3.preheader.thread
for.cond3.preheader.thread: ; preds = %entry
%.pre398 = load i32, ptr %w, align 4, !tbaa !5
br label %for.end102
for.cond3.preheader: ; preds = %for.body
%cmp4286 = icmp sgt i32 %20, 0
%.pre = load i32, ptr %w, align 4, !tbaa !5
%cmp7284 = icmp sgt i32 %.pre, 0
%or.cond = select i1 %cmp4286, i1 %cmp7284, i1 false
br i1 %or.cond, label %for.cond6.preheader.us.preheader, label %for.end102
for.cond6.preheader.us.preheader: ; preds = %for.cond3.preheader
%sub57 = add nsw i32 %.pre, -1
%sub = add nsw i32 %20, -1
%1 = zext i32 %sub57 to i64
%2 = zext i32 %.pre to i64
%3 = zext i32 %sub to i64
%wide.trip.count367 = zext i32 %20 to i64
%wide.trip.count = zext i32 %.pre to i64
%wide.trip.count358 = zext i32 %.pre to i64
br label %for.cond6.preheader.us
for.cond6.preheader.us: ; preds = %for.cond6.preheader.us.preheader, %for.cond6.for.inc100_crit_edge.us
%indvars.iv360 = phi i64 [ 0, %for.cond6.preheader.us.preheader ], [ %indvars.iv.next361, %for.cond6.for.inc100_crit_edge.us ]
%4 = mul nsw i64 %indvars.iv360, %2
%cmp19.not.us = icmp eq i64 %indvars.iv360, %3
%indvars.iv.next361 = add nuw nsw i64 %indvars.iv360, 1
%5 = mul nsw i64 %indvars.iv.next361, %2
%cmp19.not.fr.us = freeze i1 %cmp19.not.us
br i1 %cmp19.not.fr.us, label %for.body8.us.us, label %for.body8.us288
for.body8.us288: ; preds = %for.cond6.preheader.us, %for.inc97.us312
%indvars.iv342 = phi i64 [ %indvars.iv.next343.pre-phi, %for.inc97.us312 ], [ 0, %for.cond6.preheader.us ]
%arrayidx10.us291 = getelementptr inbounds [20 x [21 x i8]], ptr %s, i64 0, i64 %indvars.iv360, i64 %indvars.iv342
%6 = load i8, ptr %arrayidx10.us291, align 1, !tbaa !9
%cmp11.us292 = icmp ne i8 %6, 46
br i1 %cmp11.us292, label %if.end56.us297.for.inc97.us312_crit_edge, label %if.end.us293
if.end.us293: ; preds = %for.body8.us288
%7 = add nsw i64 %4, %indvars.iv342
%arrayidx18.us296 = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %7, i64 %7
store i32 0, ptr %arrayidx18.us296, align 4, !tbaa !5
%arrayidx33.us = getelementptr inbounds [20 x [21 x i8]], ptr %s, i64 0, i64 %indvars.iv.next361, i64 %indvars.iv342
%8 = load i8, ptr %arrayidx33.us, align 1, !tbaa !9
%cmp35.us = icmp eq i8 %8, 46
br i1 %cmp35.us, label %if.then37.us, label %if.end56.us297
if.then37.us: ; preds = %if.end.us293
%9 = add nsw i64 %5, %indvars.iv342
%arrayidx46.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %7, i64 %9
store i32 1, ptr %arrayidx46.us, align 4, !tbaa !5
%arrayidx55.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %9, i64 %7
store i32 1, ptr %arrayidx55.us, align 4, !tbaa !5
br label %if.end56.us297
if.end56.us297: ; preds = %if.then37.us, %if.end.us293
%cmp58.not.us298 = icmp eq i64 %indvars.iv342, %1
%brmerge.us299 = or i1 %cmp58.not.us298, %cmp11.us292
br i1 %brmerge.us299, label %if.end56.us297.for.inc97.us312_crit_edge, label %land.lhs.true68.us300
if.end56.us297.for.inc97.us312_crit_edge: ; preds = %for.body8.us288, %if.end56.us297
%.pre395 = add nuw nsw i64 %indvars.iv342, 1
br label %for.inc97.us312
land.lhs.true68.us300: ; preds = %if.end56.us297
%10 = add nuw nsw i64 %indvars.iv342, 1
%arrayidx73.us303 = getelementptr inbounds [20 x [21 x i8]], ptr %s, i64 0, i64 %indvars.iv360, i64 %10
%11 = load i8, ptr %arrayidx73.us303, align 1, !tbaa !9
%cmp75.us304 = icmp eq i8 %11, 46
br i1 %cmp75.us304, label %if.then77.us305, label %for.inc97.us312
if.then77.us305: ; preds = %land.lhs.true68.us300
%12 = add nsw i64 %4, %indvars.iv342
%13 = add nsw i64 %12, 1
%arrayidx86.us310 = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %12, i64 %13
store i32 1, ptr %arrayidx86.us310, align 4, !tbaa !5
%arrayidx95.us311 = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %13, i64 %12
store i32 1, ptr %arrayidx95.us311, align 4, !tbaa !5
br label %for.inc97.us312
for.inc97.us312: ; preds = %if.end56.us297.for.inc97.us312_crit_edge, %if.then77.us305, %land.lhs.true68.us300
%indvars.iv.next343.pre-phi = phi i64 [ %.pre395, %if.end56.us297.for.inc97.us312_crit_edge ], [ %10, %if.then77.us305 ], [ %10, %land.lhs.true68.us300 ]
%exitcond.not = icmp eq i64 %indvars.iv.next343.pre-phi, %wide.trip.count
br i1 %exitcond.not, label %for.cond6.for.inc100_crit_edge.us, label %for.body8.us288, !llvm.loop !10
for.cond6.for.inc100_crit_edge.us: ; preds = %for.inc97.us312, %for.inc97.us.us
%exitcond368.not = icmp eq i64 %indvars.iv.next361, %wide.trip.count367
br i1 %exitcond368.not, label %for.end102, label %for.cond6.preheader.us, !llvm.loop !12
for.body8.us.us: ; preds = %for.cond6.preheader.us, %for.inc97.us.us
%indvars.iv351 = phi i64 [ %indvars.iv.next352.pre-phi, %for.inc97.us.us ], [ 0, %for.cond6.preheader.us ]
%arrayidx10.us.us = getelementptr inbounds [20 x [21 x i8]], ptr %s, i64 0, i64 %indvars.iv360, i64 %indvars.iv351
%14 = load i8, ptr %arrayidx10.us.us, align 1, !tbaa !9
%cmp11.us.us = icmp ne i8 %14, 46
br i1 %cmp11.us.us, label %if.end56.us.us.for.inc97.us.us_crit_edge, label %if.end56.us.us
if.end56.us.us: ; preds = %for.body8.us.us
%15 = add nsw i64 %4, %indvars.iv351
%arrayidx18.us.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %15, i64 %15
store i32 0, ptr %arrayidx18.us.us, align 4, !tbaa !5
%cmp58.not.us.us = icmp eq i64 %indvars.iv351, %1
%brmerge.us.us = or i1 %cmp58.not.us.us, %cmp11.us.us
br i1 %brmerge.us.us, label %if.end56.us.us.for.inc97.us.us_crit_edge, label %land.lhs.true68.us.us
if.end56.us.us.for.inc97.us.us_crit_edge: ; preds = %for.body8.us.us, %if.end56.us.us
%.pre394 = add nuw nsw i64 %indvars.iv351, 1
br label %for.inc97.us.us
land.lhs.true68.us.us: ; preds = %if.end56.us.us
%16 = add nuw nsw i64 %indvars.iv351, 1
%arrayidx73.us.us = getelementptr inbounds [20 x [21 x i8]], ptr %s, i64 0, i64 %indvars.iv360, i64 %16
%17 = load i8, ptr %arrayidx73.us.us, align 1, !tbaa !9
%cmp75.us.us = icmp eq i8 %17, 46
br i1 %cmp75.us.us, label %if.then77.us.us, label %for.inc97.us.us
if.then77.us.us: ; preds = %land.lhs.true68.us.us
%18 = add nsw i64 %4, %indvars.iv351
%19 = add nsw i64 %18, 1
%arrayidx86.us.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %18, i64 %19
store i32 1, ptr %arrayidx86.us.us, align 4, !tbaa !5
%arrayidx95.us.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %19, i64 %18
store i32 1, ptr %arrayidx95.us.us, align 4, !tbaa !5
br label %for.inc97.us.us
for.inc97.us.us: ; preds = %if.end56.us.us.for.inc97.us.us_crit_edge, %if.then77.us.us, %land.lhs.true68.us.us
%indvars.iv.next352.pre-phi = phi i64 [ %.pre394, %if.end56.us.us.for.inc97.us.us_crit_edge ], [ %16, %if.then77.us.us ], [ %16, %land.lhs.true68.us.us ]
%exitcond359.not = icmp eq i64 %indvars.iv.next352.pre-phi, %wide.trip.count358
br i1 %exitcond359.not, label %for.cond6.for.inc100_crit_edge.us, label %for.body8.us.us, !llvm.loop !10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds [21 x i8], ptr %s, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = load i32, ptr %h, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp = icmp slt i64 %indvars.iv.next, %21
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !13
for.end102: ; preds = %for.cond6.for.inc100_crit_edge.us, %for.cond3.preheader.thread, %for.cond3.preheader
%.pre400 = phi i32 [ %.pre398, %for.cond3.preheader.thread ], [ %.pre, %for.cond3.preheader ], [ %.pre, %for.cond6.for.inc100_crit_edge.us ]
%.lcssa399 = phi i32 [ %0, %for.cond3.preheader.thread ], [ %20, %for.cond3.preheader ], [ %20, %for.cond6.for.inc100_crit_edge.us ]
%mul103 = mul nsw i32 %.pre400, %.lcssa399
%cmp105327 = icmp sgt i32 %mul103, 0
br i1 %cmp105327, label %for.cond108.preheader.us.preheader, label %for.end201
for.cond108.preheader.us.preheader: ; preds = %for.end102
%wide.trip.count382 = zext i32 %mul103 to i64
br label %for.cond108.preheader.us
for.cond108.preheader.us: ; preds = %for.cond108.preheader.us.preheader, %for.cond108.for.inc166_crit_edge.split.us.us
%indvars.iv379 = phi i64 [ 0, %for.cond108.preheader.us.preheader ], [ %indvars.iv.next380, %for.cond108.for.inc166_crit_edge.split.us.us ]
br label %for.cond112.preheader.us.us
for.cond112.preheader.us.us: ; preds = %for.cond112.for.inc163_crit_edge.us.us, %for.cond108.preheader.us
%indvars.iv374 = phi i64 [ %indvars.iv.next375, %for.cond112.for.inc163_crit_edge.us.us ], [ 0, %for.cond108.preheader.us ]
%arrayidx119.us.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %indvars.iv374, i64 %indvars.iv379
%22 = load i32, ptr %arrayidx119.us.us, align 4, !tbaa !5
%23 = icmp eq i32 %22, -1
br i1 %23, label %for.cond112.for.inc163_crit_edge.us.us, label %for.body115.us321.us
for.body115.us321.usthread-pre-split: ; preds = %for.inc160.us.us
%.pr = load i32, ptr %arrayidx119.us.us, align 4, !tbaa !5
br label %for.body115.us321.us
for.body115.us321.us: ; preds = %for.cond112.preheader.us.us, %for.body115.us321.usthread-pre-split
%24 = phi i32 [ %.pr, %for.body115.us321.usthread-pre-split ], [ %22, %for.cond112.preheader.us.us ]
%indvars.iv369 = phi i64 [ %indvars.iv.next370, %for.body115.us321.usthread-pre-split ], [ 0, %for.cond112.preheader.us.us ]
%cmp120.not.us.us = icmp eq i32 %24, -1
br i1 %cmp120.not.us.us, label %for.inc160.us.us, label %land.lhs.true122.us.us
land.lhs.true122.us.us: ; preds = %for.body115.us321.us
%arrayidx126.us.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %indvars.iv379, i64 %indvars.iv369
%25 = load i32, ptr %arrayidx126.us.us, align 4, !tbaa !5
%cmp127.not.us.us = icmp eq i32 %25, -1
br i1 %cmp127.not.us.us, label %for.inc160.us.us, label %land.lhs.true129.us.us
land.lhs.true129.us.us: ; preds = %land.lhs.true122.us.us
%add138.us.us = add i32 %25, %24
%arrayidx142.us.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %indvars.iv374, i64 %indvars.iv369
%26 = load i32, ptr %arrayidx142.us.us, align 4, !tbaa !5
%spec.store.select.us.us = call i32 @llvm.umin.i32(i32 %add138.us.us, i32 %26)
store i32 %spec.store.select.us.us, ptr %arrayidx142.us.us, align 4
br label %for.inc160.us.us
for.inc160.us.us: ; preds = %land.lhs.true129.us.us, %land.lhs.true122.us.us, %for.body115.us321.us
%indvars.iv.next370 = add nuw nsw i64 %indvars.iv369, 1
%exitcond373.not = icmp eq i64 %indvars.iv.next370, %wide.trip.count382
br i1 %exitcond373.not, label %for.cond112.for.inc163_crit_edge.us.us, label %for.body115.us321.usthread-pre-split, !llvm.loop !14
for.cond112.for.inc163_crit_edge.us.us: ; preds = %for.inc160.us.us, %for.cond112.preheader.us.us
%indvars.iv.next375 = add nuw nsw i64 %indvars.iv374, 1
%exitcond378.not = icmp eq i64 %indvars.iv.next375, %wide.trip.count382
br i1 %exitcond378.not, label %for.cond108.for.inc166_crit_edge.split.us.us, label %for.cond112.preheader.us.us, !llvm.loop !16
for.cond108.for.inc166_crit_edge.split.us.us: ; preds = %for.cond112.for.inc163_crit_edge.us.us
%indvars.iv.next380 = add nuw nsw i64 %indvars.iv379, 1
%exitcond383.not = icmp eq i64 %indvars.iv.next380, %wide.trip.count382
br i1 %exitcond383.not, label %for.cond169.preheader, label %for.cond108.preheader.us, !llvm.loop !17
for.cond169.preheader: ; preds = %for.cond108.for.inc166_crit_edge.split.us.us
br i1 %cmp105327, label %for.cond173.preheader.us.preheader, label %for.end201
for.cond173.preheader.us.preheader: ; preds = %for.cond169.preheader
%wide.trip.count392 = zext i32 %mul103 to i64
%xtraiter = and i64 %wide.trip.count382, 1
%27 = icmp eq i32 %mul103, 1
%unroll_iter = and i64 %wide.trip.count382, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond173.preheader.us
for.cond173.preheader.us: ; preds = %for.cond173.preheader.us.preheader, %for.cond173.for.inc199_crit_edge.us
%indvars.iv389 = phi i64 [ 0, %for.cond173.preheader.us.preheader ], [ %indvars.iv.next390, %for.cond173.for.inc199_crit_edge.us ]
%max.0335.us = phi i32 [ 0, %for.cond173.preheader.us.preheader ], [ %max.2.us.lcssa, %for.cond173.for.inc199_crit_edge.us ]
br i1 %27, label %for.cond173.for.inc199_crit_edge.us.unr-lcssa, label %for.body176.us
for.body176.us: ; preds = %for.cond173.preheader.us, %for.body176.us
%indvars.iv384 = phi i64 [ %indvars.iv.next385.1, %for.body176.us ], [ 0, %for.cond173.preheader.us ]
%max.1331.us = phi i32 [ %max.2.us.1, %for.body176.us ], [ %max.0335.us, %for.cond173.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.body176.us ], [ 0, %for.cond173.preheader.us ]
%arrayidx180.us = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %indvars.iv389, i64 %indvars.iv384
%28 = load i32, ptr %arrayidx180.us, align 8, !tbaa !5
%cmp181.not.us = icmp ne i32 %28, -1
%cmp188.us = icmp ugt i32 %28, %max.1331.us
%or.cond.us = select i1 %cmp181.not.us, i1 %cmp188.us, i1 false
%max.2.us = select i1 %or.cond.us, i32 %28, i32 %max.1331.us
%indvars.iv.next385 = or i64 %indvars.iv384, 1
%arrayidx180.us.1 = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %indvars.iv389, i64 %indvars.iv.next385
%29 = load i32, ptr %arrayidx180.us.1, align 4, !tbaa !5
%cmp181.not.us.1 = icmp ne i32 %29, -1
%cmp188.us.1 = icmp ugt i32 %29, %max.2.us
%or.cond.us.1 = select i1 %cmp181.not.us.1, i1 %cmp188.us.1, i1 false
%max.2.us.1 = select i1 %or.cond.us.1, i32 %29, i32 %max.2.us
%indvars.iv.next385.1 = add nuw nsw i64 %indvars.iv384, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond173.for.inc199_crit_edge.us.unr-lcssa, label %for.body176.us, !llvm.loop !18
for.cond173.for.inc199_crit_edge.us.unr-lcssa: ; preds = %for.body176.us, %for.cond173.preheader.us
%max.2.us.lcssa.ph = phi i32 [ undef, %for.cond173.preheader.us ], [ %max.2.us.1, %for.body176.us ]
%indvars.iv384.unr = phi i64 [ 0, %for.cond173.preheader.us ], [ %indvars.iv.next385.1, %for.body176.us ]
%max.1331.us.unr = phi i32 [ %max.0335.us, %for.cond173.preheader.us ], [ %max.2.us.1, %for.body176.us ]
br i1 %lcmp.mod.not, label %for.cond173.for.inc199_crit_edge.us, label %for.body176.us.epil
for.body176.us.epil: ; preds = %for.cond173.for.inc199_crit_edge.us.unr-lcssa
%arrayidx180.us.epil = getelementptr inbounds [400 x [400 x i32]], ptr %d, i64 0, i64 %indvars.iv389, i64 %indvars.iv384.unr
%30 = load i32, ptr %arrayidx180.us.epil, align 4, !tbaa !5
%cmp181.not.us.epil = icmp ne i32 %30, -1
%cmp188.us.epil = icmp ugt i32 %30, %max.1331.us.unr
%or.cond.us.epil = select i1 %cmp181.not.us.epil, i1 %cmp188.us.epil, i1 false
%max.2.us.epil = select i1 %or.cond.us.epil, i32 %30, i32 %max.1331.us.unr
br label %for.cond173.for.inc199_crit_edge.us
for.cond173.for.inc199_crit_edge.us: ; preds = %for.cond173.for.inc199_crit_edge.us.unr-lcssa, %for.body176.us.epil
%max.2.us.lcssa = phi i32 [ %max.2.us.lcssa.ph, %for.cond173.for.inc199_crit_edge.us.unr-lcssa ], [ %max.2.us.epil, %for.body176.us.epil ]
%indvars.iv.next390 = add nuw nsw i64 %indvars.iv389, 1
%exitcond393.not = icmp eq i64 %indvars.iv.next390, %wide.trip.count392
br i1 %exitcond393.not, label %for.end201, label %for.cond173.preheader.us, !llvm.loop !19
for.end201: ; preds = %for.cond173.for.inc199_crit_edge.us, %for.end102, %for.cond169.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond169.preheader ], [ 0, %for.end102 ], [ %max.2.us.lcssa, %for.cond173.for.inc199_crit_edge.us ]
%call202 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 640000, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
|
#include <stdio.h>
long gojo(long a, long b){
if(a % b)
gojo(b, a%b);
else
return b;
}
int main(){
long a, b, c, d; scanf("%ld%ld%ld%ld", &a, &b, &c, &d);
long ans = b - a + 1;
ans = ans - ((b/c) - (a-1)/c);
ans = ans - ((b/d) - (a-1)/d);
long g = c/gojo(c, d)*d;
ans = ans + ((b/g) - (a-1)/g);
printf("%ld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280832/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280832/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%ld%ld%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gojo(i64 noundef %a, i64 noundef returned %b) local_unnamed_addr #0 {
entry:
%rem7 = srem i64 %a, %b
%tobool.not8.not = icmp eq i64 %rem7, 0
br i1 %tobool.not8.not, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%rem12 = phi i64 [ %rem, %if.then ], [ %rem7, %entry ]
%b.tr9 = phi i64 [ %rem12, %if.then ], [ %b, %entry ]
%rem = srem i64 %b.tr9, %rem12
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret i64 %b
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = load i64, ptr %c, align 8, !tbaa !5
%.fr = freeze i64 %2
%3 = load i64, ptr %d, align 8, !tbaa !5
%rem7.i = srem i64 %.fr, %3
%tobool.not8.not.i = icmp eq i64 %rem7.i, 0
br i1 %tobool.not8.not.i, label %gojo.exit, label %if.then.i
if.then.i: ; preds = %entry, %if.then.i
%rem12.i = phi i64 [ %rem.i, %if.then.i ], [ %rem7.i, %entry ]
%b.tr9.i = phi i64 [ %rem12.i, %if.then.i ], [ %3, %entry ]
%rem.i = srem i64 %b.tr9.i, %rem12.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gojo.exit, label %if.then.i
gojo.exit: ; preds = %if.then.i, %entry
%sub1 = add nsw i64 %1, -1
%div7 = sdiv i64 %sub1, %3
%div5 = sdiv i64 %0, %3
%div2 = sdiv i64 %sub1, %.fr
%div = sdiv i64 %0, %.fr
%mul = sub nsw i64 %.fr, %rem7.i
%div12 = sdiv i64 %0, %mul
%div14 = sdiv i64 %sub1, %mul
%sub15 = add i64 %0, 1
%4 = add i64 %sub15, %div7
%5 = add i64 %1, %div5
%6 = add i64 %4, %div2
%7 = add i64 %5, %div
%8 = add i64 %6, %div12
%9 = add i64 %7, %div14
%add16 = sub i64 %8, %9
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add16)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
typedef long long ll;
ll gcd(ll a, ll b);
long long lcm(long long a, long long b);
long long gD(long long a, long long b, long long c);
int main()
{
long long a, b, c, d, diff, ans;
scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
diff = b-a+1;
ans = diff - (gD(a, b, c) + gD(a, b, d) - gD(a, b, lcm(c, d)));
//printf("%lld, %lld, %lld, %lld\n", diff, gD(a, b, c), gD(a, b, d), gD(a, b, lcm(c, d)));
printf("%lld\n", ans);
return 0;
}
ll gcd(ll a, ll b)
{
if (!b) return a;
if(!a) return b;
a = a%b;
return gcd(b, a);
}
long long lcm(long long a, long long b)
{
return (a*b)/gcd(a,b);
}
long long gD(long long a, long long b, long long c)
{
if (a%c) a = ( ( a / c ) + 1 ) * c;
if (b%c) b = ( b / c ) * c;
//printf("[*] inside gD: %lld %lld for %lld\n", a, b, c);
return (b-a)/c + 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280876/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280876/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = load i64, ptr %c, align 8, !tbaa !5
%rem.i = srem i64 %1, %2
%div.i = sdiv i64 %1, %2
%tobool.not.i = icmp eq i64 %rem.i, 0
%add.i = add nsw i64 %div.i, 1
%mul.i = mul nsw i64 %add.i, %2
%a.addr.0.i = select i1 %tobool.not.i, i64 %1, i64 %mul.i
%3 = load i64, ptr %d, align 8, !tbaa !5
%rem.i9 = srem i64 %1, %3
%div.i12 = sdiv i64 %1, %3
%tobool.not.i10 = icmp eq i64 %rem.i9, 0
%add.i13 = add nsw i64 %div.i12, 1
%mul.i14 = mul nsw i64 %add.i13, %3
%a.addr.0.i15 = select i1 %tobool.not.i10, i64 %1, i64 %mul.i14
%tobool.not10.i.i = icmp eq i64 %3, 0
br i1 %tobool.not10.i.i, label %lcm.exit, label %if.end.i.i
if.end.i.i: ; preds = %entry, %if.end3.i.i
%b.tr12.i.i = phi i64 [ %rem.i.i, %if.end3.i.i ], [ %3, %entry ]
%a.tr11.i.i = phi i64 [ %b.tr12.i.i, %if.end3.i.i ], [ %2, %entry ]
%tobool1.not.i.i = icmp eq i64 %a.tr11.i.i, 0
br i1 %tobool1.not.i.i, label %lcm.exit, label %if.end3.i.i
if.end3.i.i: ; preds = %if.end.i.i
%rem.i.i = srem i64 %a.tr11.i.i, %b.tr12.i.i
%tobool.not.i.i = icmp eq i64 %rem.i.i, 0
br i1 %tobool.not.i.i, label %lcm.exit, label %if.end.i.i
lcm.exit: ; preds = %if.end.i.i, %if.end3.i.i, %entry
%retval.0.i.i = phi i64 [ %2, %entry ], [ %b.tr12.i.i, %if.end3.i.i ], [ %b.tr12.i.i, %if.end.i.i ]
%mul.i21 = mul nsw i64 %3, %2
%div.i22 = sdiv i64 %mul.i21, %retval.0.i.i
%rem.i23 = srem i64 %1, %div.i22
%div.i26 = sdiv i64 %1, %div.i22
%tobool.not.i24 = icmp eq i64 %rem.i23, 0
%add.i27 = add nsw i64 %div.i26, 1
%mul.i28 = mul nsw i64 %add.i27, %div.i22
%a.addr.0.i29 = select i1 %tobool.not.i24, i64 %1, i64 %mul.i28
%rem1.i16 = srem i64 %0, %3
%4 = add i64 %a.addr.0.i15, %rem1.i16
%sub.i17 = sub i64 %0, %4
%div7.i18 = sdiv i64 %sub.i17, %3
%rem1.i = srem i64 %0, %2
%5 = add i64 %a.addr.0.i, %rem1.i
%sub.i = sub i64 %0, %5
%div7.i = sdiv i64 %sub.i, %2
%add8.i19 = add i64 %div7.i, %div7.i18
%rem1.i30 = srem i64 %0, %div.i22
%6 = add i64 %a.addr.0.i29, %rem1.i30
%sub.i31 = sub i64 %0, %6
%div7.i32 = sdiv i64 %sub.i31, %div.i22
%7 = xor i64 %add8.i19, -1
%sub6.neg = add i64 %0, 1
%sub = sub i64 %sub6.neg, %1
%add = add i64 %sub, %7
%sub7 = add i64 %add, %div7.i32
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub7)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @gD(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #3 {
entry:
%rem = srem i64 %a, %c
%div = sdiv i64 %a, %c
%tobool.not = icmp eq i64 %rem, 0
%add = add nsw i64 %div, 1
%mul = mul nsw i64 %add, %c
%a.addr.0 = select i1 %tobool.not, i64 %a, i64 %mul
%rem1 = srem i64 %b, %c
%0 = add i64 %a.addr.0, %rem1
%sub = sub i64 %b, %0
%div7 = sdiv i64 %sub, %c
%add8 = add nsw i64 %div7, 1
ret i64 %add8
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not10.i = icmp eq i64 %b, 0
br i1 %tobool.not10.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end3.i
%b.tr12.i = phi i64 [ %rem.i, %if.end3.i ], [ %b, %entry ]
%a.tr11.i = phi i64 [ %b.tr12.i, %if.end3.i ], [ %a, %entry ]
%tobool1.not.i = icmp eq i64 %a.tr11.i, 0
br i1 %tobool1.not.i, label %gcd.exit, label %if.end3.i
if.end3.i: ; preds = %if.end.i
%rem.i = srem i64 %a.tr11.i, %b.tr12.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %if.end3.i, %entry
%retval.0.i = phi i64 [ %a, %entry ], [ %b.tr12.i, %if.end3.i ], [ %b.tr12.i, %if.end.i ]
%mul = mul nsw i64 %b, %a
%div = sdiv i64 %mul, %retval.0.i
ret i64 %div
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not10 = icmp eq i64 %b, 0
br i1 %tobool.not10, label %return, label %if.end
if.end: ; preds = %entry, %if.end3
%b.tr12 = phi i64 [ %rem, %if.end3 ], [ %b, %entry ]
%a.tr11 = phi i64 [ %b.tr12, %if.end3 ], [ %a, %entry ]
%tobool1.not = icmp eq i64 %a.tr11, 0
br i1 %tobool1.not, label %return, label %if.end3
if.end3: ; preds = %if.end
%rem = srem i64 %a.tr11, %b.tr12
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end3, %if.end, %entry
%retval.0 = phi i64 [ %a, %entry ], [ %b.tr12, %if.end ], [ %b.tr12, %if.end3 ]
ret i64 %retval.0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int gcd(int a, int b);
int main(){
long long int a, b, c, d;
long int i = 0;
long long int cnt, cnt1;
scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
cnt = b;
cnt -= b / c;
cnt -= b / d;
cnt += b / ((c * d) / gcd(c, d));
cnt1 = a - 1;
cnt1 -= (a - 1) / c;
cnt1 -= (a - 1) / d;
cnt1 += (a - 1) / ((c * d) / gcd(c, d));
cnt -= cnt1;
printf("%lld\n", cnt);
return 0;
}
int gcd(int a, int b){
int temp;
if(a<b){
temp = a;
a = b;
b = temp;
}
int r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280919/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280919/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %c, align 8, !tbaa !5
%2 = load i64, ptr %d, align 8, !tbaa !5
%conv = trunc i64 %1 to i32
%conv3 = trunc i64 %2 to i32
%spec.select.i = call i32 @llvm.smin.i32(i32 %conv, i32 %conv3)
%spec.select12.i = call i32 @llvm.smax.i32(i32 %conv, i32 %conv3)
%rem.i = srem i32 %spec.select12.i, %spec.select.i
%cmp1.not13.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.not13.i, label %gcd.exit.thread, label %while.body.i
gcd.exit.thread: ; preds = %entry
%3 = load i64, ptr %a, align 8, !tbaa !5
br label %gcd.exit43
while.body.i: ; preds = %entry, %while.body.i
%r.015.i = phi i32 [ %rem2.i, %while.body.i ], [ %rem.i, %entry ]
%b.addr.114.i = phi i32 [ %r.015.i, %while.body.i ], [ %spec.select.i, %entry ]
%rem2.i = srem i32 %b.addr.114.i, %r.015.i
%cmp1.not.i = icmp eq i32 %rem2.i, 0
br i1 %cmp1.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !9
gcd.exit: ; preds = %while.body.i
%4 = load i64, ptr %a, align 8, !tbaa !5
br i1 %cmp1.not13.i, label %gcd.exit43, label %while.body.i37
while.body.i37: ; preds = %gcd.exit, %while.body.i37
%r.015.i38 = phi i32 [ %rem2.i40, %while.body.i37 ], [ %rem.i, %gcd.exit ]
%b.addr.114.i39 = phi i32 [ %r.015.i38, %while.body.i37 ], [ %spec.select.i, %gcd.exit ]
%rem2.i40 = srem i32 %b.addr.114.i39, %r.015.i38
%cmp1.not.i41 = icmp eq i32 %rem2.i40, 0
br i1 %cmp1.not.i41, label %gcd.exit43, label %while.body.i37, !llvm.loop !9
gcd.exit43: ; preds = %while.body.i37, %gcd.exit.thread, %gcd.exit
%5 = phi i64 [ %4, %gcd.exit ], [ %3, %gcd.exit.thread ], [ %4, %while.body.i37 ]
%b.addr.1.lcssa.i46 = phi i32 [ %r.015.i, %gcd.exit ], [ %spec.select.i, %gcd.exit.thread ], [ %r.015.i, %while.body.i37 ]
%b.addr.1.lcssa.i42 = phi i32 [ %spec.select.i, %gcd.exit ], [ %spec.select.i, %gcd.exit.thread ], [ %r.015.i38, %while.body.i37 ]
%sub8 = add nsw i64 %5, -1
%div10 = sdiv i64 %sub8, %1
%div13 = sdiv i64 %sub8, %2
%mul = mul nsw i64 %2, %1
%conv5 = sext i32 %b.addr.1.lcssa.i46 to i64
%div6 = sdiv i64 %mul, %conv5
%div7 = sdiv i64 %0, %div6
%div = sdiv i64 %0, %1
%div1 = sdiv i64 %0, %2
%conv20 = sext i32 %b.addr.1.lcssa.i42 to i64
%div21 = sdiv i64 %mul, %conv20
%div22 = sdiv i64 %sub8, %div21
%reass.sub = sub i64 %0, %5
%.neg.neg = add i64 %reass.sub, 1
%sub14.neg = add i64 %.neg.neg, %div10
%add23.neg = add i64 %sub14.neg, %div13
%.neg44 = add i64 %add23.neg, %div7
%6 = add i64 %div, %div1
%7 = add i64 %6, %div22
%sub24 = sub i64 %.neg44, %7
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub24)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%spec.select12 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select12, %spec.select
%cmp1.not13 = icmp eq i32 %rem, 0
br i1 %cmp1.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.015 = phi i32 [ %rem2, %while.body ], [ %rem, %entry ]
%b.addr.114 = phi i32 [ %r.015, %while.body ], [ %spec.select, %entry ]
%rem2 = srem i32 %b.addr.114, %r.015
%cmp1.not = icmp eq i32 %rem2, 0
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %r.015, %while.body ]
ret i32 %b.addr.1.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
unsigned long long int a,b,c,d,c1,d1,leng,ans,x,y,r,tmp;
scanf("%llu %llu %llu %llu",&a,&b,&c,&d);
c1=c,d1=d;
x=c*d;
if(c<d){
tmp = c;
c = d;
c = tmp;
}
/* ユークリッドの互除法 */
r = c % d;
while(r!=0){
c = d;
d = r;
r = c % d;
}
y=x/d;
ans=(b-a+1)-(b/c1-(a-1)/c1)-(b/d1-(a-1)/d1)+(b/y-(a-1)/y);
printf("%llu",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_280962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_280962/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%llu %llu %llu %llu\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i64, ptr %c, align 8, !tbaa !5
%1 = load i64, ptr %d, align 8, !tbaa !5
%rem = urem i64 %0, %1
%cmp1.not24 = icmp eq i64 %rem, 0
br i1 %cmp1.not24, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.026 = phi i64 [ %rem2, %while.body ], [ %rem, %entry ]
%r.02325 = phi i64 [ %r.026, %while.body ], [ %1, %entry ]
%rem2 = urem i64 %r.02325, %r.026
%cmp1.not = icmp eq i64 %rem2, 0
br i1 %cmp1.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i64 %r.02325, ptr %c, align 8, !tbaa !5
store i64 %r.026, ptr %d, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%2 = phi i64 [ %r.026, %while.cond.while.end_crit_edge ], [ %1, %entry ]
%mul = mul i64 %1, %0
%div = udiv i64 %mul, %2
%3 = load i64, ptr %b, align 8, !tbaa !5
%4 = load i64, ptr %a, align 8, !tbaa !5
%div3 = udiv i64 %3, %0
%sub4 = add i64 %4, -1
%div5 = udiv i64 %sub4, %0
%div8 = udiv i64 %3, %1
%div10 = udiv i64 %sub4, %1
%div13 = udiv i64 %3, %div
%div15 = udiv i64 %sub4, %div
%sub16 = add i64 %3, 1
%5 = add i64 %4, %div3
%6 = add i64 %sub16, %div5
%7 = add i64 %5, %div8
%add = sub i64 %6, %7
%sub7 = add i64 %add, %div10
%sub12 = add i64 %sub7, %div13
%add17 = sub i64 %sub12, %div15
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add17)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))
ll GCD(ll x,ll y){
return y==0?x:GCD(y,x%y);
}
int main(void){
ll A,B,C,D,ans=0;
scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
ll c,d,cd;
ll l=C*D/GCD(C,D);
c = B/C -(A-1)/C;
d = B/D -(A-1)/D;
cd = B/l -(A-1)/l;
ans=(B-A+1)-(c+d-cd);
printf("%lld",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281004/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281004/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @GCD(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i64 %y, 0
br i1 %cmp4, label %cond.end, label %cond.false
cond.false: ; preds = %entry, %cond.false
%y.tr6 = phi i64 [ %rem, %cond.false ], [ %y, %entry ]
%x.tr5 = phi i64 [ %y.tr6, %cond.false ], [ %x, %entry ]
%rem = srem i64 %x.tr5, %y.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %cond.end, label %cond.false
cond.end: ; preds = %cond.false, %entry
%x.tr.lcssa = phi i64 [ %x, %entry ], [ %y.tr6, %cond.false ]
ret i64 %x.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%C = alloca i64, align 8
%D = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %D) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%0 = load i64, ptr %C, align 8, !tbaa !5
%1 = load i64, ptr %D, align 8, !tbaa !5
%cmp4.i = icmp eq i64 %1, 0
br i1 %cmp4.i, label %GCD.exit, label %cond.false.i
cond.false.i: ; preds = %entry, %cond.false.i
%y.tr6.i = phi i64 [ %rem.i, %cond.false.i ], [ %1, %entry ]
%x.tr5.i = phi i64 [ %y.tr6.i, %cond.false.i ], [ %0, %entry ]
%rem.i = srem i64 %x.tr5.i, %y.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %GCD.exit, label %cond.false.i
GCD.exit: ; preds = %cond.false.i, %entry
%x.tr.lcssa.i = phi i64 [ %0, %entry ], [ %y.tr6.i, %cond.false.i ]
%mul = mul nsw i64 %1, %0
%div = sdiv i64 %mul, %x.tr.lcssa.i
%2 = load i64, ptr %B, align 8, !tbaa !5
%div2 = sdiv i64 %2, %0
%3 = load i64, ptr %A, align 8, !tbaa !5
%sub = add nsw i64 %3, -1
%div3 = sdiv i64 %sub, %0
%div5 = sdiv i64 %2, %1
%div7 = sdiv i64 %sub, %1
%div9 = sdiv i64 %2, %div
%div11 = sdiv i64 %sub, %div
%sub12.neg.neg = add i64 %2, 1
%4 = add i64 %div2, %3
%5 = add i64 %sub12.neg.neg, %div3
%6 = add i64 %4, %div5
%sub15.neg = sub i64 %5, %6
%sub13 = add i64 %sub15.neg, %div7
%add = add i64 %sub13, %div9
%sub16 = sub i64 %add, %div11
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub16)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int n,m;
scanf("%d %d", &n, &m);
int a[m],b[m];
for (int i = 0; i < m; i++) {
scanf("%d %d", &a[i], &b[i]);
}
int permutation[n];
for (int i = 0; i < n; i++) {
permutation[i] = i+1;
}
int check[n+1];
for (int j = 1; j <= n; j++) {
check[j] = 1;
}
int path = 0;
int flag;
for (int i = 0; ; i++) {
for (int j = 1; j < n; j++) {
flag = 0;
for (int k = 0; k < m; k++) {
if (a[k] == permutation[j-1] && b[k] == permutation[j]) {
flag = 1;
break;
} else if (a[k] == permutation[j] && b[k] == permutation[j-1]) {
flag = 1;
break;
}
}
if (flag == 0) {
break;
}
}
if (flag == 1) {
path++;
}
for (int j = n-1; j > 0; j--) {
check[permutation[j]] = 0;
if (permutation[j] > permutation[j-1]) {
check[permutation[j-1]] = 0;
for (int k = permutation[j-1]+1; k <= n; k++) {
if (check[k] == 0) {
check[k] = 1;
permutation[j-1] = k;
break;
}
}
for (int k = j; k < n; k++) {
for (int l = 1; l <= n; l++) {
if (check[l] == 0) {
check[l] = 1;
permutation[k] = l;
break;
}
}
}
break;
}
}
if (permutation[0] != 1) {
break;
}
}
printf("%d\n", path);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281055/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281055/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %m, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp216 = icmp sgt i32 %3, 0
br i1 %cmp216, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa215 = phi i32 [ %3, %entry ], [ %15, %for.body ]
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%vla5 = alloca i32, i64 %6, align 16
%cmp8218 = icmp sgt i32 %5, 0
br i1 %cmp8218, label %for.body10.preheader, label %for.cond.cleanup9.thread
for.body10.preheader: ; preds = %for.cond.cleanup
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body10.preheader319, label %vector.ph
vector.ph: ; preds = %for.body10.preheader
%n.vec = and i64 %6, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%7 = getelementptr inbounds i32, ptr %vla5, i64 %index
%8 = trunc <4 x i64> %vec.ind to <4 x i32>
%9 = add <4 x i32> %8, <i32 1, i32 1, i32 1, i32 1>
%10 = trunc <4 x i64> %vec.ind to <4 x i32>
%11 = add <4 x i32> %10, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %9, ptr %7, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> %11, ptr %12, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %6
br i1 %cmp.n, label %for.cond.cleanup9, label %for.body10.preheader319
for.body10.preheader319: ; preds = %for.body10.preheader, %middle.block
%indvars.iv240.ph = phi i64 [ 0, %for.body10.preheader ], [ %n.vec, %middle.block ]
br label %for.body10
for.cond.cleanup9.thread: ; preds = %for.cond.cleanup
%add16281 = add nsw i32 %5, 1
%14 = zext i32 %add16281 to i64
%vla17282 = alloca i32, i64 %14, align 16
br label %for.cond28.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %m, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup9: ; preds = %for.body10, %middle.block
%add16 = add i32 %5, 1
%17 = zext i32 %add16 to i64
%vla17 = alloca i32, i64 %17, align 16
%cmp19.not220 = icmp slt i32 %5, 1
br i1 %cmp19.not220, label %for.cond28.preheader, label %for.body21.preheader
for.body21.preheader: ; preds = %for.cond.cleanup9
%18 = add nsw i64 %17, -1
%min.iters.check304 = icmp ult i64 %18, 8
br i1 %min.iters.check304, label %for.body21.preheader318, label %vector.ph305
vector.ph305: ; preds = %for.body21.preheader
%n.vec307 = and i64 %18, -8
%ind.end = or i64 %n.vec307, 1
br label %vector.body310
vector.body310: ; preds = %vector.body310, %vector.ph305
%index311 = phi i64 [ 0, %vector.ph305 ], [ %index.next312, %vector.body310 ]
%offset.idx = or i64 %index311, 1
%19 = getelementptr inbounds i32, ptr %vla17, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %20, align 4, !tbaa !5
%index.next312 = add nuw i64 %index311, 8
%21 = icmp eq i64 %index.next312, %n.vec307
br i1 %21, label %middle.block302, label %vector.body310, !llvm.loop !14
middle.block302: ; preds = %vector.body310
%cmp.n309 = icmp eq i64 %18, %n.vec307
br i1 %cmp.n309, label %for.cond28.preheader, label %for.body21.preheader318
for.body21.preheader318: ; preds = %for.body21.preheader, %middle.block302
%indvars.iv243.ph = phi i64 [ 1, %for.body21.preheader ], [ %ind.end, %middle.block302 ]
br label %for.body21
for.body10: ; preds = %for.body10.preheader319, %for.body10
%indvars.iv240 = phi i64 [ %indvars.iv.next241, %for.body10 ], [ %indvars.iv240.ph, %for.body10.preheader319 ]
%indvars.iv.next241 = add nuw nsw i64 %indvars.iv240, 1
%arrayidx12 = getelementptr inbounds i32, ptr %vla5, i64 %indvars.iv240
%22 = trunc i64 %indvars.iv.next241 to i32
store i32 %22, ptr %arrayidx12, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next241, %6
br i1 %exitcond.not, label %for.cond.cleanup9, label %for.body10, !llvm.loop !15
for.cond28.preheader: ; preds = %for.body21, %middle.block302, %for.cond.cleanup9.thread, %for.cond.cleanup9
%cmp19.not220285 = phi i1 [ true, %for.cond.cleanup9.thread ], [ true, %for.cond.cleanup9 ], [ %cmp19.not220, %middle.block302 ], [ %cmp19.not220, %for.body21 ]
%vla17284 = phi ptr [ %vla17282, %for.cond.cleanup9.thread ], [ %vla17, %for.cond.cleanup9 ], [ %vla17, %middle.block302 ], [ %vla17, %for.body21 ]
%23 = phi i64 [ %14, %for.cond.cleanup9.thread ], [ %17, %for.cond.cleanup9 ], [ %17, %middle.block302 ], [ %17, %for.body21 ]
%cmp31224 = icmp sgt i32 %5, 1
%cmp35.not222 = icmp sgt i32 %.lcssa215, 0
%24 = add i32 %5, -1
%25 = sext i32 %24 to i64
%wide.trip.count251 = zext i32 %.lcssa215 to i64
br label %for.cond28
for.body21: ; preds = %for.body21.preheader318, %for.body21
%indvars.iv243 = phi i64 [ %indvars.iv.next244, %for.body21 ], [ %indvars.iv243.ph, %for.body21.preheader318 ]
%arrayidx23 = getelementptr inbounds i32, ptr %vla17, i64 %indvars.iv243
store i32 1, ptr %arrayidx23, align 4, !tbaa !5
%indvars.iv.next244 = add nuw nsw i64 %indvars.iv243, 1
%exitcond247.not = icmp eq i64 %indvars.iv.next244, %17
br i1 %exitcond247.not, label %for.cond28.preheader, label %for.body21, !llvm.loop !16
for.cond28: ; preds = %for.cond28.preheader, %cleanup149
%path.0 = phi i32 [ %30, %cleanup149 ], [ 0, %for.cond28.preheader ]
%flag.0 = phi i32 [ %flag.3208, %cleanup149 ], [ 0, %for.cond28.preheader ]
br i1 %cmp31224, label %for.cond34.preheader.lr.ph, label %cleanup70
for.cond34.preheader.lr.ph: ; preds = %for.cond28
br i1 %cmp35.not222, label %for.cond34.preheader.preheader, label %cleanup70.thread
for.cond34.preheader.preheader: ; preds = %for.cond34.preheader.lr.ph
%.pre = load i32, ptr %vla5, align 16, !tbaa !5
br label %for.cond34.preheader
for.cond34.preheader: ; preds = %for.cond34.preheader.preheader, %for.inc68
%26 = phi i32 [ %.pre, %for.cond34.preheader.preheader ], [ %.pre280.pre, %for.inc68 ]
%indvars.iv253 = phi i64 [ 1, %for.cond34.preheader.preheader ], [ %indvars.iv.next254, %for.inc68 ]
%arrayidx46 = getelementptr inbounds i32, ptr %vla5, i64 %indvars.iv253
%.pre280.pre = load i32, ptr %arrayidx46, align 4, !tbaa !5
br label %for.body37
for.body37: ; preds = %for.cond34.preheader, %for.inc62
%indvars.iv248 = phi i64 [ 0, %for.cond34.preheader ], [ %indvars.iv.next249, %for.inc62 ]
%arrayidx39 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv248
%27 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp42 = icmp eq i32 %27, %26
br i1 %cmp42, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %for.body37
%arrayidx44 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv248
%28 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%cmp47 = icmp eq i32 %28, %.pre280.pre
br i1 %cmp47, label %for.inc68, label %if.else
if.else: ; preds = %land.lhs.true, %for.body37
%cmp52 = icmp eq i32 %27, %.pre280.pre
br i1 %cmp52, label %land.lhs.true53, label %for.inc62
land.lhs.true53: ; preds = %if.else
%arrayidx55 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv248
%29 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%cmp59 = icmp eq i32 %29, %26
br i1 %cmp59, label %for.inc68, label %for.inc62
for.inc62: ; preds = %land.lhs.true53, %if.else
%indvars.iv.next249 = add nuw nsw i64 %indvars.iv248, 1
%exitcond252.not = icmp eq i64 %indvars.iv.next249, %wide.trip.count251
br i1 %exitcond252.not, label %cleanup70.thread, label %for.body37, !llvm.loop !17
for.inc68: ; preds = %land.lhs.true, %land.lhs.true53
%indvars.iv.next254 = add nuw nsw i64 %indvars.iv253, 1
%exitcond258.not = icmp eq i64 %indvars.iv.next254, %6
br i1 %exitcond258.not, label %cleanup70, label %for.cond34.preheader, !llvm.loop !18
cleanup70: ; preds = %for.inc68, %for.cond28
%flag.1.lcssa = phi i32 [ %flag.0, %for.cond28 ], [ 1, %for.inc68 ]
%cmp72 = icmp eq i32 %flag.1.lcssa, 1
%inc74 = zext i1 %cmp72 to i32
%spec.select = add nsw i32 %path.0, %inc74
br label %cleanup70.thread
cleanup70.thread: ; preds = %for.inc62, %for.cond34.preheader.lr.ph, %cleanup70
%flag.3208 = phi i32 [ %flag.1.lcssa, %cleanup70 ], [ 0, %for.cond34.preheader.lr.ph ], [ 0, %for.inc62 ]
%30 = phi i32 [ %spec.select, %cleanup70 ], [ %path.0, %for.cond34.preheader.lr.ph ], [ %path.0, %for.inc62 ]
br label %for.cond78
for.cond78: ; preds = %for.body81, %cleanup70.thread
%indvars.iv273 = phi i64 [ %indvars.iv.next274, %for.body81 ], [ %25, %cleanup70.thread ]
%indvars.iv259 = phi i64 [ %32, %for.body81 ], [ %6, %cleanup70.thread ]
%31 = trunc i64 %indvars.iv259 to i32
%cmp79 = icmp sgt i32 %31, 1
br i1 %cmp79, label %for.body81, label %cleanup149
for.body81: ; preds = %for.cond78
%32 = add nsw i64 %indvars.iv259, -1
%arrayidx83 = getelementptr inbounds i32, ptr %vla5, i64 %32
%33 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%idxprom84 = sext i32 %33 to i64
%arrayidx85 = getelementptr inbounds i32, ptr %vla17284, i64 %idxprom84
store i32 0, ptr %arrayidx85, align 4, !tbaa !5
%sub88 = add i64 %indvars.iv259, 4294967294
%idxprom89 = and i64 %sub88, 4294967295
%arrayidx90 = getelementptr inbounds i32, ptr %vla5, i64 %idxprom89
%34 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%cmp91 = icmp sgt i32 %33, %34
%indvars.iv.next274 = add nsw i64 %indvars.iv273, -1
br i1 %cmp91, label %if.then92, label %for.cond78, !llvm.loop !19
if.then92: ; preds = %for.body81
%arrayidx90.le = getelementptr inbounds i32, ptr %vla5, i64 %idxprom89
%idxprom96 = sext i32 %34 to i64
%arrayidx97 = getelementptr inbounds i32, ptr %vla17284, i64 %idxprom96
store i32 0, ptr %arrayidx97, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %34, i32 %5)
%wide.trip.count266 = sext i32 %smax to i64
br label %for.cond103
for.cond103: ; preds = %for.body106, %if.then92
%indvars.iv263 = phi i64 [ %indvars.iv.next264, %for.body106 ], [ %idxprom96, %if.then92 ]
%exitcond267.not = icmp eq i64 %indvars.iv263, %wide.trip.count266
br i1 %exitcond267.not, label %cleanup119, label %for.body106
for.body106: ; preds = %for.cond103
%indvars.iv.next264 = add nsw i64 %indvars.iv263, 1
%arrayidx108 = getelementptr inbounds i32, ptr %vla17284, i64 %indvars.iv.next264
%35 = load i32, ptr %arrayidx108, align 4, !tbaa !5
%cmp109 = icmp eq i32 %35, 0
br i1 %cmp109, label %if.then110, label %for.cond103, !llvm.loop !20
if.then110: ; preds = %for.body106
%arrayidx108.le = getelementptr inbounds i32, ptr %vla17284, i64 %indvars.iv.next264
%36 = trunc i64 %indvars.iv.next264 to i32
store i32 1, ptr %arrayidx108.le, align 4, !tbaa !5
store i32 %36, ptr %arrayidx90.le, align 4, !tbaa !5
br label %cleanup119
cleanup119: ; preds = %for.cond103, %if.then110
%cmp123229.not = icmp slt i32 %5, %31
%brmerge = or i1 %cmp123229.not, %cmp19.not220285
br i1 %brmerge, label %cleanup149, label %for.cond126.preheader
for.cond126.preheader: ; preds = %cleanup119, %cleanup141
%indvars.iv276 = phi i64 [ %indvars.iv.next277, %cleanup141 ], [ %indvars.iv273, %cleanup119 ]
br label %for.body129
for.body129: ; preds = %for.cond126.preheader, %for.inc139
%indvars.iv268 = phi i64 [ 1, %for.cond126.preheader ], [ %indvars.iv.next269, %for.inc139 ]
%arrayidx131 = getelementptr inbounds i32, ptr %vla17284, i64 %indvars.iv268
%37 = load i32, ptr %arrayidx131, align 4, !tbaa !5
%cmp132 = icmp eq i32 %37, 0
br i1 %cmp132, label %if.then133, label %for.inc139
if.then133: ; preds = %for.body129
%arrayidx131.le = getelementptr inbounds i32, ptr %vla17284, i64 %indvars.iv268
%38 = trunc i64 %indvars.iv268 to i32
store i32 1, ptr %arrayidx131.le, align 4, !tbaa !5
%arrayidx137 = getelementptr inbounds i32, ptr %vla5, i64 %indvars.iv276
store i32 %38, ptr %arrayidx137, align 4, !tbaa !5
br label %cleanup141
for.inc139: ; preds = %for.body129
%indvars.iv.next269 = add nuw nsw i64 %indvars.iv268, 1
%exitcond272.not = icmp eq i64 %indvars.iv.next269, %23
br i1 %exitcond272.not, label %cleanup141, label %for.body129, !llvm.loop !21
cleanup141: ; preds = %for.inc139, %if.then133
%indvars.iv.next277 = add nsw i64 %indvars.iv276, 1
%lftr.wideiv = trunc i64 %indvars.iv.next277 to i32
%exitcond279.not = icmp eq i32 %5, %lftr.wideiv
br i1 %exitcond279.not, label %cleanup149, label %for.cond126.preheader, !llvm.loop !22
cleanup149: ; preds = %for.cond78, %cleanup141, %cleanup119
%39 = load i32, ptr %vla5, align 16, !tbaa !5
%cmp152.not = icmp eq i32 %39, 1
br i1 %cmp152.not, label %for.cond28, label %if.then153
if.then153: ; preds = %cleanup149
%call159 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %30)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
#define REP(i, n) for(i = 0; i < n; ++i)
#define FOR(i, a, b) for(i = a; i < b; ++i)
#define BORDER 400
int cnt = 0;
typedef struct{
char node[8];
}list;
void search(int nownode, list visited, int N, char matrix[N][N]){
int i;
char finish = 1;
REP(i, N){
if(visited.node[i] != 1){
finish = 0;
break;
}
}
if(finish){
cnt++;
return;
}
REP(i, N){
if(matrix[nownode][i] && visited.node[i] != 1){
visited.node[i] = 1;
search(i, visited, N, matrix);
visited.node[i] = 0;
}
}
return;
}
int main(){
int i, j;
int a, b;
int N = 0, M = 0;
scanf("%d %d", &N, &M);
char matrix[N][N];
list visited;
REP(i, N){
visited.node[i] = (i == 0 ? 1 : 0);
REP(j, N){
matrix[i][j] = (i == j)? 1 : 0;
}
}
REP(i, M){
scanf("%d %d", &a, &b);
matrix[a - 1][b - 1] = 1;
matrix[b - 1][a - 1] = 1;
}
search(0, visited, N, matrix);
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281099/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281099/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.list = type { [8 x i8] }
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @search(i32 noundef %nownode, i64 %visited.coerce, i32 noundef %N, ptr nocapture noundef readonly %matrix) local_unnamed_addr #0 {
entry:
%visited = alloca %struct.list, align 8
store i64 %visited.coerce, ptr %visited, align 8
%0 = zext i32 %N to i64
%cmp49 = icmp sgt i32 %N, 0
br i1 %cmp49, label %for.body, label %if.then3
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %if.then3, label %for.body, !llvm.loop !5
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [8 x i8], ptr %visited, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !7
%cmp1.not = icmp eq i8 %1, 1
br i1 %cmp1.not, label %for.cond, label %for.body9.lr.ph
for.body9.lr.ph: ; preds = %for.body
%idxprom10 = sext i32 %nownode to i64
%2 = mul nsw i64 %0, %idxprom10
%arrayidx11 = getelementptr inbounds i8, ptr %matrix, i64 %2
br label %for.body9
if.then3: ; preds = %for.cond, %entry
%3 = load i32, ptr @cnt, align 4, !tbaa !10
%inc4 = add nsw i32 %3, 1
store i32 %inc4, ptr @cnt, align 4, !tbaa !10
br label %cleanup
for.body9: ; preds = %for.body9.lr.ph, %for.inc31
%indvars.iv54 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next55, %for.inc31 ]
%arrayidx13 = getelementptr inbounds i8, ptr %arrayidx11, i64 %indvars.iv54
%4 = load i8, ptr %arrayidx13, align 1, !tbaa !7
%tobool15.not = icmp eq i8 %4, 0
br i1 %tobool15.not, label %for.inc31, label %land.lhs.true
land.lhs.true: ; preds = %for.body9
%arrayidx18 = getelementptr inbounds [8 x i8], ptr %visited, i64 0, i64 %indvars.iv54
%5 = load i8, ptr %arrayidx18, align 1, !tbaa !7
%cmp20.not = icmp eq i8 %5, 1
br i1 %cmp20.not, label %for.inc31, label %if.then22
if.then22: ; preds = %land.lhs.true
store i8 1, ptr %arrayidx18, align 1, !tbaa !7
%6 = load i64, ptr %visited, align 8
%7 = trunc i64 %indvars.iv54 to i32
tail call void @search(i32 noundef %7, i64 %6, i32 noundef %N, ptr noundef nonnull %matrix)
store i8 0, ptr %arrayidx18, align 1, !tbaa !7
br label %for.inc31
for.inc31: ; preds = %for.body9, %land.lhs.true, %if.then22
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond58.not = icmp eq i64 %indvars.iv.next55, %0
br i1 %exitcond58.not, label %cleanup, label %for.body9, !llvm.loop !12
cleanup: ; preds = %for.inc31, %if.then3
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%N = alloca i32, align 4
%M = alloca i32, align 4
%visited = alloca %struct.list, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
store i32 0, ptr %N, align 4, !tbaa !10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
store i32 0, ptr %M, align 4, !tbaa !10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !10
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%3 = mul nuw i64 %1, %1
%vla = alloca i8, i64 %3, align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %visited) #5
%4 = load i32, ptr %N, align 4, !tbaa !10
%cmp49 = icmp sgt i32 %4, 0
br i1 %cmp49, label %for.body.us.preheader, label %for.cond17.preheader
for.body.us.preheader: ; preds = %entry
%wide.trip.count57 = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 8
%min.iters.check59 = icmp ult i32 %4, 16
%n.vec = and i64 %wide.trip.count57, 4294967280
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count57
%n.vec.remaining = and i64 %wide.trip.count57, 8
%min.epilog.iters.check.not.not = icmp eq i64 %n.vec.remaining, 0
%n.vec61 = and i64 %wide.trip.count57, 4294967288
%cmp.n63 = icmp eq i64 %n.vec61, %wide.trip.count57
br label %iter.check
iter.check: ; preds = %for.body.us.preheader, %for.cond2.for.inc14_crit_edge.us
%indvars.iv54 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next55, %for.cond2.for.inc14_crit_edge.us ]
%cmp1.us = icmp eq i64 %indvars.iv54, 0
%conv.us = zext i1 %cmp1.us to i8
%arrayidx.us = getelementptr inbounds [8 x i8], ptr %visited, i64 0, i64 %indvars.iv54
store i8 %conv.us, ptr %arrayidx.us, align 1, !tbaa !7
%5 = mul nuw nsw i64 %indvars.iv54, %1
%arrayidx11.us = getelementptr inbounds i8, ptr %vla, i64 %5
br i1 %min.iters.check, label %for.body5.us.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
br i1 %min.iters.check59, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%broadcast.splatinsert = insertelement <16 x i64> poison, i64 %indvars.iv54, i64 0
%broadcast.splat = shufflevector <16 x i64> %broadcast.splatinsert, <16 x i64> poison, <16 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <16 x i64> [ <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%6 = icmp eq <16 x i64> %broadcast.splat, %vec.ind
%7 = zext <16 x i1> %6 to <16 x i8>
%8 = getelementptr inbounds i8, ptr %arrayidx11.us, i64 %index
store <16 x i8> %7, ptr %8, align 1, !tbaa !7
%index.next = add nuw i64 %index, 16
%vec.ind.next = add <16 x i64> %vec.ind, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond2.for.inc14_crit_edge.us, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
br i1 %min.epilog.iters.check.not.not, label %for.body5.us.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%.splatinsert = insertelement <8 x i64> poison, i64 %vec.epilog.resume.val, i64 0
%.splat = shufflevector <8 x i64> %.splatinsert, <8 x i64> poison, <8 x i32> zeroinitializer
%induction = or <8 x i64> %.splat, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7>
%broadcast.splatinsert67 = insertelement <8 x i64> poison, i64 %indvars.iv54, i64 0
%broadcast.splat68 = shufflevector <8 x i64> %broadcast.splatinsert67, <8 x i64> poison, <8 x i32> zeroinitializer
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index64 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next69, %vec.epilog.vector.body ]
%vec.ind65 = phi <8 x i64> [ %induction, %vec.epilog.ph ], [ %vec.ind.next66, %vec.epilog.vector.body ]
%10 = icmp eq <8 x i64> %broadcast.splat68, %vec.ind65
%11 = zext <8 x i1> %10 to <8 x i8>
%12 = getelementptr inbounds i8, ptr %arrayidx11.us, i64 %index64
store <8 x i8> %11, ptr %12, align 1, !tbaa !7
%index.next69 = add nuw i64 %index64, 8
%vec.ind.next66 = add <8 x i64> %vec.ind65, <i64 8, i64 8, i64 8, i64 8, i64 8, i64 8, i64 8, i64 8>
%13 = icmp eq i64 %index.next69, %n.vec61
br i1 %13, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !16
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
br i1 %cmp.n63, label %for.cond2.for.inc14_crit_edge.us, label %for.body5.us.preheader
for.body5.us.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec61, %vec.epilog.middle.block ]
br label %for.body5.us
for.body5.us: ; preds = %for.body5.us.preheader, %for.body5.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5.us ], [ %indvars.iv.ph, %for.body5.us.preheader ]
%cmp6.us = icmp eq i64 %indvars.iv54, %indvars.iv
%conv9.us = zext i1 %cmp6.us to i8
%arrayidx13.us = getelementptr inbounds i8, ptr %arrayidx11.us, i64 %indvars.iv
store i8 %conv9.us, ptr %arrayidx13.us, align 1, !tbaa !7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count57
br i1 %exitcond.not, label %for.cond2.for.inc14_crit_edge.us, label %for.body5.us, !llvm.loop !17
for.cond2.for.inc14_crit_edge.us: ; preds = %for.body5.us, %vec.epilog.middle.block, %middle.block
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
br i1 %exitcond58.not, label %for.cond17.preheader, label %iter.check, !llvm.loop !18
for.cond17.preheader: ; preds = %for.cond2.for.inc14_crit_edge.us, %entry
%14 = load i32, ptr %M, align 4, !tbaa !10
%cmp1851 = icmp sgt i32 %14, 0
br i1 %cmp1851, label %for.body20, label %for.end35
for.body20: ; preds = %for.cond17.preheader, %for.body20
%i.152 = phi i32 [ %inc34, %for.body20 ], [ 0, %for.cond17.preheader ]
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%15 = load i32, ptr %a, align 4, !tbaa !10
%sub = add nsw i32 %15, -1
%idxprom22 = sext i32 %sub to i64
%16 = mul nsw i64 %idxprom22, %1
%arrayidx23 = getelementptr inbounds i8, ptr %vla, i64 %16
%17 = load i32, ptr %b, align 4, !tbaa !10
%sub24 = add nsw i32 %17, -1
%idxprom25 = sext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds i8, ptr %arrayidx23, i64 %idxprom25
store i8 1, ptr %arrayidx26, align 1, !tbaa !7
%18 = mul nsw i64 %idxprom25, %1
%arrayidx29 = getelementptr inbounds i8, ptr %vla, i64 %18
%arrayidx32 = getelementptr inbounds i8, ptr %arrayidx29, i64 %idxprom22
store i8 1, ptr %arrayidx32, align 1, !tbaa !7
%inc34 = add nuw nsw i32 %i.152, 1
%19 = load i32, ptr %M, align 4, !tbaa !10
%cmp18 = icmp slt i32 %inc34, %19
br i1 %cmp18, label %for.body20, label %for.end35.loopexit, !llvm.loop !19
for.end35.loopexit: ; preds = %for.body20
%.pre = load i32, ptr %N, align 4, !tbaa !10
br label %for.end35
for.end35: ; preds = %for.end35.loopexit, %for.cond17.preheader
%20 = phi i32 [ %.pre, %for.end35.loopexit ], [ %4, %for.cond17.preheader ]
%21 = load i64, ptr %visited, align 8
call void @search(i32 noundef 0, i64 %21, i32 noundef %20, ptr noundef nonnull %vla)
%22 = load i32, ptr @cnt, align 4, !tbaa !10
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %visited) #5
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !6, !14, !15}
!17 = distinct !{!17, !6, !15, !14}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
|
#include<stdio.h>
#include<string.h>
#include<math.h>
#define DECIMAL_POINT 9
#define UPPER_DECIMAL 0
#define UNDER_DECIMAL -1
#define element_num_max 19
long long int array[200001];
int main()
{
int n = 0;
long long int t;
int d_p, d_c;
long long int mul = 0;
long long int answer = 0;
char num_arrray[20];
int ele_two_ind, ele_five_ind;
long long int element_array[element_num_max][element_num_max];
for (int i = 0; i<element_num_max; i++)
{
for (int j = 0; j<element_num_max; j++)
{
element_array[i][j] = 0;
}
}
scanf("%d", &n);
for (int i = 0; i<n; i++)
{
scanf("%s", num_arrray);
d_p = DECIMAL_POINT;
d_c = UPPER_DECIMAL;
t = 0;
for (int j = 0; j<strlen(num_arrray); j++)
{
int current_num = 0;
if (num_arrray[j] == '.')
{
d_c = UNDER_DECIMAL;
continue;
}
current_num = num_arrray[j] - '0';
if (d_c == UPPER_DECIMAL)
{
t = t * 10 + current_num;
}
else {
t = t * 10 + current_num;
d_p += UNDER_DECIMAL;
}
}
for (int k = 0; k<d_p; k++)
{
t *= 10;
}
array[i] = t;
for (ele_two_ind = 0; (t % 2) == 0; ele_two_ind++)
{
t /= 2;
}
if (ele_two_ind >= element_num_max)
ele_two_ind = (element_num_max - 1);
for (ele_five_ind = 0; (t % 5) == 0; ele_five_ind++)
{
t /= 5;
}
if (ele_five_ind >= element_num_max)
ele_five_ind = (element_num_max - 1);
element_array[ele_two_ind][ele_five_ind] ++;
}
for (int i = 0; i<element_num_max; i++)
{
for (int j = 0; j<element_num_max; j++)
{
for (int i_s = (element_num_max - 1 - i); (i_s<element_num_max); i_s++)
{
int j_s = (element_num_max - 1 - j);
if (i > i_s)
i_s = i;
if ((i == i_s)&&(j > j_s))
{
j_s = j;
}
for (; (j_s<element_num_max); j_s++)
{
if ((i == i_s) && (j == j_s))
{
answer += element_array[i][j] * (element_array[i_s][j_s] - 1) / 2;
}
else {
answer += element_array[i][j] * element_array[i_s][j_s];
}
}
}
}
}
printf("%lld", answer);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281141/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281141/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@array = dso_local local_unnamed_addr global [200001 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%num_arrray = alloca [20 x i8], align 16
%element_array = alloca [19 x [19 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %num_arrray) #6
call void @llvm.lifetime.start.p0(i64 2888, ptr nonnull %element_array) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2888) %element_array, i8 0, i64 2888, i1 false), !tbaa !9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp12256 = icmp sgt i32 %0, 0
br i1 %cmp12256, label %for.body14, label %for.body102.us.preheader.preheader
for.body14: ; preds = %entry, %for.end77
%indvars.iv289 = phi i64 [ %indvars.iv.next290, %for.end77 ], [ 0, %entry ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num_arrray)
%call19 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num_arrray) #7
%cmp20235.not = icmp eq i64 %call19, 0
br i1 %cmp20235.not, label %for.body50.preheader, label %for.body23.preheader
for.body23.preheader: ; preds = %for.body14
%xtraiter = and i64 %call19, 1
%1 = icmp eq i64 %call19, 1
br i1 %1, label %for.cond46.preheader.unr-lcssa, label %for.body23.preheader.new
for.body23.preheader.new: ; preds = %for.body23.preheader
%unroll_iter = and i64 %call19, -2
br label %for.body23
for.cond46.preheader.unr-lcssa: ; preds = %cleanup.1, %for.body23.preheader
%t.2.lcssa.ph = phi i64 [ undef, %for.body23.preheader ], [ %t.2.1, %cleanup.1 ]
%d_p.2.lcssa.ph = phi i32 [ undef, %for.body23.preheader ], [ %d_p.2.1, %cleanup.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next.1, %cleanup.1 ]
%d_c.0238.unr = phi i32 [ 0, %for.body23.preheader ], [ %d_c.1.1, %cleanup.1 ]
%d_p.0237.unr = phi i32 [ 9, %for.body23.preheader ], [ %d_p.2.1, %cleanup.1 ]
%t.0236.unr = phi i64 [ 0, %for.body23.preheader ], [ %t.2.1, %cleanup.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond46.preheader, label %for.body23.epil
for.body23.epil: ; preds = %for.cond46.preheader.unr-lcssa
%arrayidx25.epil = getelementptr inbounds [20 x i8], ptr %num_arrray, i64 0, i64 %indvars.iv.unr
%2 = load i8, ptr %arrayidx25.epil, align 1, !tbaa !11
%cmp27.epil = icmp eq i8 %2, 46
br i1 %cmp27.epil, label %for.cond46.preheader, label %if.end.epil
if.end.epil: ; preds = %for.body23.epil
%conv26.epil = sext i8 %2 to i64
%sub.epil = add nsw i64 %conv26.epil, -48
%cmp32.epil = icmp ne i32 %d_c.0238.unr, 0
%mul35.epil = mul nsw i64 %t.0236.unr, 10
%add.epil = add nsw i64 %mul35.epil, %sub.epil
%add40.epil = sext i1 %cmp32.epil to i32
%spec.select.epil = add nsw i32 %d_p.0237.unr, %add40.epil
br label %for.cond46.preheader
for.cond46.preheader: ; preds = %for.body23.epil, %if.end.epil, %for.cond46.preheader.unr-lcssa
%t.2.lcssa = phi i64 [ %t.2.lcssa.ph, %for.cond46.preheader.unr-lcssa ], [ %t.0236.unr, %for.body23.epil ], [ %add.epil, %if.end.epil ]
%d_p.2.lcssa = phi i32 [ %d_p.2.lcssa.ph, %for.cond46.preheader.unr-lcssa ], [ %d_p.0237.unr, %for.body23.epil ], [ %spec.select.epil, %if.end.epil ]
%cmp47242 = icmp sgt i32 %d_p.2.lcssa, 0
br i1 %cmp47242, label %for.body50.preheader, label %for.cond.cleanup49
for.body50.preheader: ; preds = %for.body14, %for.cond46.preheader
%d_p.0.lcssa315 = phi i32 [ %d_p.2.lcssa, %for.cond46.preheader ], [ 9, %for.body14 ]
%t.0.lcssa314 = phi i64 [ %t.2.lcssa, %for.cond46.preheader ], [ 0, %for.body14 ]
%xtraiter325 = and i32 %d_p.0.lcssa315, 7
%3 = icmp ult i32 %d_p.0.lcssa315, 8
br i1 %3, label %for.cond.cleanup49.loopexit.unr-lcssa, label %for.body50.preheader.new
for.body50.preheader.new: ; preds = %for.body50.preheader
%unroll_iter328 = and i32 %d_p.0.lcssa315, 2147483640
br label %for.body50
for.body23: ; preds = %cleanup.1, %for.body23.preheader.new
%indvars.iv = phi i64 [ 0, %for.body23.preheader.new ], [ %indvars.iv.next.1, %cleanup.1 ]
%d_c.0238 = phi i32 [ 0, %for.body23.preheader.new ], [ %d_c.1.1, %cleanup.1 ]
%d_p.0237 = phi i32 [ 9, %for.body23.preheader.new ], [ %d_p.2.1, %cleanup.1 ]
%t.0236 = phi i64 [ 0, %for.body23.preheader.new ], [ %t.2.1, %cleanup.1 ]
%niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.1, %cleanup.1 ]
%arrayidx25 = getelementptr inbounds [20 x i8], ptr %num_arrray, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx25, align 2, !tbaa !11
%cmp27 = icmp eq i8 %4, 46
br i1 %cmp27, label %cleanup, label %if.end
if.end: ; preds = %for.body23
%conv26 = sext i8 %4 to i64
%sub = add nsw i64 %conv26, -48
%cmp32 = icmp ne i32 %d_c.0238, 0
%mul35 = mul nsw i64 %t.0236, 10
%add = add nsw i64 %mul35, %sub
%add40 = sext i1 %cmp32 to i32
%spec.select = add nsw i32 %d_p.0237, %add40
br label %cleanup
cleanup: ; preds = %if.end, %for.body23
%t.2 = phi i64 [ %t.0236, %for.body23 ], [ %add, %if.end ]
%d_p.2 = phi i32 [ %d_p.0237, %for.body23 ], [ %spec.select, %if.end ]
%d_c.1 = phi i32 [ -1, %for.body23 ], [ %d_c.0238, %if.end ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx25.1 = getelementptr inbounds [20 x i8], ptr %num_arrray, i64 0, i64 %indvars.iv.next
%5 = load i8, ptr %arrayidx25.1, align 1, !tbaa !11
%cmp27.1 = icmp eq i8 %5, 46
br i1 %cmp27.1, label %cleanup.1, label %if.end.1
if.end.1: ; preds = %cleanup
%conv26.1 = sext i8 %5 to i64
%sub.1 = add nsw i64 %conv26.1, -48
%cmp32.1 = icmp ne i32 %d_c.1, 0
%mul35.1 = mul nsw i64 %t.2, 10
%add.1 = add nsw i64 %mul35.1, %sub.1
%add40.1 = sext i1 %cmp32.1 to i32
%spec.select.1 = add nsw i32 %d_p.2, %add40.1
br label %cleanup.1
cleanup.1: ; preds = %if.end.1, %cleanup
%t.2.1 = phi i64 [ %t.2, %cleanup ], [ %add.1, %if.end.1 ]
%d_p.2.1 = phi i32 [ %d_p.2, %cleanup ], [ %spec.select.1, %if.end.1 ]
%d_c.1.1 = phi i32 [ -1, %cleanup ], [ %d_c.1, %if.end.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond46.preheader.unr-lcssa, label %for.body23, !llvm.loop !12
for.cond.cleanup49.loopexit.unr-lcssa: ; preds = %for.body50, %for.body50.preheader
%mul51.lcssa.ph = phi i64 [ undef, %for.body50.preheader ], [ %mul51.7, %for.body50 ]
%t.3243.unr = phi i64 [ %t.0.lcssa314, %for.body50.preheader ], [ %mul51.7, %for.body50 ]
%lcmp.mod326.not = icmp eq i32 %xtraiter325, 0
br i1 %lcmp.mod326.not, label %for.cond.cleanup49, label %for.body50.epil
for.body50.epil: ; preds = %for.cond.cleanup49.loopexit.unr-lcssa, %for.body50.epil
%t.3243.epil = phi i64 [ %mul51.epil, %for.body50.epil ], [ %t.3243.unr, %for.cond.cleanup49.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body50.epil ], [ 0, %for.cond.cleanup49.loopexit.unr-lcssa ]
%mul51.epil = mul nsw i64 %t.3243.epil, 10
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter325
br i1 %epil.iter.cmp.not, label %for.cond.cleanup49, label %for.body50.epil, !llvm.loop !14
for.cond.cleanup49: ; preds = %for.cond.cleanup49.loopexit.unr-lcssa, %for.body50.epil, %for.cond46.preheader
%t.3.lcssa = phi i64 [ %t.2.lcssa, %for.cond46.preheader ], [ %mul51.lcssa.ph, %for.cond.cleanup49.loopexit.unr-lcssa ], [ %mul51.epil, %for.body50.epil ]
%arrayidx57 = getelementptr inbounds [200001 x i64], ptr @array, i64 0, i64 %indvars.iv289
store i64 %t.3.lcssa, ptr %arrayidx57, align 8, !tbaa !9
%6 = and i64 %t.3.lcssa, 1
%cmp59246 = icmp eq i64 %6, 0
br i1 %cmp59246, label %for.body61, label %for.end64
for.body50: ; preds = %for.body50, %for.body50.preheader.new
%t.3243 = phi i64 [ %t.0.lcssa314, %for.body50.preheader.new ], [ %mul51.7, %for.body50 ]
%niter329 = phi i32 [ 0, %for.body50.preheader.new ], [ %niter329.next.7, %for.body50 ]
%mul51.7 = mul i64 %t.3243, 100000000
%niter329.next.7 = add i32 %niter329, 8
%niter329.ncmp.7 = icmp eq i32 %niter329.next.7, %unroll_iter328
br i1 %niter329.ncmp.7, label %for.cond.cleanup49.loopexit.unr-lcssa, label %for.body50, !llvm.loop !16
for.body61: ; preds = %for.cond.cleanup49, %for.body61
%ele_two_ind.0248 = phi i32 [ %inc63, %for.body61 ], [ 0, %for.cond.cleanup49 ]
%t.4247 = phi i64 [ %div, %for.body61 ], [ %t.3.lcssa, %for.cond.cleanup49 ]
%div = sdiv i64 %t.4247, 2
%inc63 = add nuw nsw i32 %ele_two_ind.0248, 1
%7 = and i64 %div, 1
%cmp59 = icmp eq i64 %7, 0
br i1 %cmp59, label %for.body61, label %for.end64, !llvm.loop !17
for.end64: ; preds = %for.body61, %for.cond.cleanup49
%t.4.lcssa = phi i64 [ %t.3.lcssa, %for.cond.cleanup49 ], [ %div, %for.body61 ]
%ele_two_ind.0.lcssa = phi i32 [ 0, %for.cond.cleanup49 ], [ %inc63, %for.body61 ]
%spec.store.select = call i32 @llvm.umin.i32(i32 %ele_two_ind.0.lcssa, i32 18)
%rem70251 = srem i64 %t.4.lcssa, 5
%cmp71252 = icmp eq i64 %rem70251, 0
br i1 %cmp71252, label %for.body73, label %for.end77
for.body73: ; preds = %for.end64, %for.body73
%ele_five_ind.0254 = phi i32 [ %inc76, %for.body73 ], [ 0, %for.end64 ]
%t.5253 = phi i64 [ %div74, %for.body73 ], [ %t.4.lcssa, %for.end64 ]
%div74 = sdiv i64 %t.5253, 5
%inc76 = add nuw nsw i32 %ele_five_ind.0254, 1
%rem70 = srem i64 %div74, 5
%cmp71 = icmp eq i64 %rem70, 0
br i1 %cmp71, label %for.body73, label %for.end77, !llvm.loop !18
for.end77: ; preds = %for.body73, %for.end64
%ele_five_ind.0.lcssa = phi i32 [ 0, %for.end64 ], [ %inc76, %for.body73 ]
%spec.store.select180 = call i32 @llvm.umin.i32(i32 %ele_five_ind.0.lcssa, i32 18)
%idxprom82 = zext i32 %spec.store.select to i64
%idxprom84 = zext i32 %spec.store.select180 to i64
%arrayidx85 = getelementptr inbounds [19 x [19 x i64]], ptr %element_array, i64 0, i64 %idxprom82, i64 %idxprom84
%8 = load i64, ptr %arrayidx85, align 8, !tbaa !9
%inc86 = add nsw i64 %8, 1
store i64 %inc86, ptr %arrayidx85, align 8, !tbaa !9
%indvars.iv.next290 = add nuw nsw i64 %indvars.iv289, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp12 = icmp slt i64 %indvars.iv.next290, %10
br i1 %cmp12, label %for.body14, label %for.body102.us.preheader.preheader, !llvm.loop !19
for.body102.us.preheader.preheader: ; preds = %for.end77, %entry
br label %for.body102.us.preheader
for.body102.us.preheader: ; preds = %for.body102.us.preheader.preheader, %for.cond.cleanup101
%indvars.iv306 = phi i64 [ %indvars.iv.next307, %for.cond.cleanup101 ], [ 0, %for.body102.us.preheader.preheader ]
%answer.0281 = phi i64 [ %answer.3.lcssa.us, %for.cond.cleanup101 ], [ 0, %for.body102.us.preheader.preheader ]
%11 = trunc i64 %indvars.iv306 to i32
%12 = sub i32 18, %11
%13 = trunc i64 %indvars.iv306 to i32
br label %for.body102.us
for.body102.us: ; preds = %for.body102.us.preheader, %for.cond104.for.cond.cleanup107_crit_edge.us
%indvars.iv301 = phi i64 [ 0, %for.body102.us.preheader ], [ %indvars.iv.next302, %for.cond104.for.cond.cleanup107_crit_edge.us ]
%answer.1266.us = phi i64 [ %answer.0281, %for.body102.us.preheader ], [ %answer.3.lcssa.us, %for.cond104.for.cond.cleanup107_crit_edge.us ]
%indvars304 = trunc i64 %indvars.iv301 to i32
%sub109.us = sub nuw nsw i32 18, %indvars304
%14 = zext i32 %sub109.us to i64
%cmp116.us = icmp ugt i64 %indvars.iv301, %14
%arrayidx146.us = getelementptr inbounds [19 x [19 x i64]], ptr %element_array, i64 0, i64 %indvars.iv306, i64 %indvars.iv301
br label %for.body108.us
for.body108.us: ; preds = %for.body102.us, %for.end156.us
%i_s.0264.us = phi i32 [ %12, %for.body102.us ], [ %inc158.us, %for.end156.us ]
%answer.2263.us = phi i64 [ %answer.1266.us, %for.body102.us ], [ %answer.3.lcssa.us, %for.end156.us ]
%spec.select.us = call i32 @llvm.smax.i32(i32 %13, i32 %i_s.0264.us)
%15 = sext i32 %i_s.0264.us to i64
%cmp114.us = icmp sge i64 %indvars.iv306, %15
%cmp114.fr.us = freeze i1 %cmp114.us
%or.cond.us = select i1 %cmp114.fr.us, i1 %cmp116.us, i1 false
%j_s.0.us = select i1 %or.cond.us, i32 %indvars304, i32 %sub109.us
%cmp121258.us = icmp slt i32 %j_s.0.us, 19
br i1 %cmp121258.us, label %for.body123.lr.ph.us, label %for.end156.us
for.end156.us: ; preds = %for.body123.us.us, %for.inc154.us, %middle.block, %for.body108.us
%answer.3.lcssa.us = phi i64 [ %answer.2263.us, %for.body108.us ], [ %43, %middle.block ], [ %answer.4.us274, %for.inc154.us ], [ %answer.4.us.us, %for.body123.us.us ]
%inc158.us = add nuw nsw i32 %spec.select.us, 1
%cmp105.us = icmp ult i32 %spec.select.us, 18
br i1 %cmp105.us, label %for.body108.us, label %for.cond104.for.cond.cleanup107_crit_edge.us, !llvm.loop !20
for.body123.us268: ; preds = %for.body123.us268.preheader, %for.inc154.us
%indvars.iv296 = phi i64 [ %20, %for.body123.us268.preheader ], [ %indvars.iv.next297, %for.inc154.us ]
%answer.3259.us270 = phi i64 [ %answer.2263.us, %for.body123.us268.preheader ], [ %answer.4.us274, %for.inc154.us ]
%16 = icmp eq i64 %indvars.iv296, %indvars.iv301
br i1 %16, label %if.then129.us, label %if.else142.us
if.else142.us: ; preds = %for.body123.us268
%arrayidx150.us272 = getelementptr inbounds [19 x [19 x i64]], ptr %element_array, i64 0, i64 %idxprom147.us, i64 %indvars.iv296
%17 = load i64, ptr %arrayidx150.us272, align 8, !tbaa !9
%mul151.us273 = mul nsw i64 %17, %21
br label %for.inc154.us
if.then129.us: ; preds = %for.body123.us268
%18 = load i64, ptr %arrayidx137.us, align 8, !tbaa !9
%sub138.us = add nsw i64 %18, -1
%mul139.us = mul nsw i64 %sub138.us, %21
%div140.us = sdiv i64 %mul139.us, 2
br label %for.inc154.us
for.inc154.us: ; preds = %if.then129.us, %if.else142.us
%div140.pn.us = phi i64 [ %div140.us, %if.then129.us ], [ %mul151.us273, %if.else142.us ]
%answer.4.us274 = add nsw i64 %div140.pn.us, %answer.3259.us270
%indvars.iv.next297 = add nsw i64 %indvars.iv296, 1
%19 = and i64 %indvars.iv.next297, 4294967295
%exitcond300.not = icmp eq i64 %19, 19
br i1 %exitcond300.not, label %for.end156.us, label %for.body123.us268, !llvm.loop !21
for.body123.lr.ph.us: ; preds = %for.body108.us
%idxprom147.us = zext i32 %spec.select.us to i64
br i1 %cmp114.fr.us, label %for.body123.us268.preheader, label %for.body123.lr.ph.split.us.us
for.body123.us268.preheader: ; preds = %for.body123.lr.ph.us
%20 = sext i32 %j_s.0.us to i64
%arrayidx137.us = getelementptr inbounds [19 x [19 x i64]], ptr %element_array, i64 0, i64 %idxprom147.us, i64 %indvars.iv301
%21 = load i64, ptr %arrayidx146.us, align 8, !tbaa !9
br label %for.body123.us268
for.body123.lr.ph.split.us.us: ; preds = %for.body123.lr.ph.us
%22 = load i64, ptr %arrayidx146.us, align 8, !tbaa !9
%23 = sext i32 %j_s.0.us to i64
%24 = add i32 %j_s.0.us, 1
%25 = zext i32 %24 to i64
%26 = sub nsw i64 20, %25
%min.iters.check = icmp ult i64 %26, 10
br i1 %min.iters.check, label %for.body123.us.us.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body123.lr.ph.split.us.us
%27 = add i32 %j_s.0.us, 1
%28 = zext i32 %27 to i64
%29 = sub nsw i64 19, %28
%30 = trunc i64 %29 to i32
%31 = sub i32 -2, %j_s.0.us
%32 = icmp ult i32 %31, %30
%33 = icmp ugt i64 %29, 4294967295
%34 = or i1 %32, %33
br i1 %34, label %for.body123.us.us.preheader, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %26, -4
%ind.end = add nsw i64 %n.vec, %23
%35 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %answer.2263.us, i64 0
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %22, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %35, %vector.ph ], [ %40, %vector.body ]
%vec.phi319 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %41, %vector.body ]
%offset.idx = add i64 %index, %23
%36 = getelementptr inbounds [19 x [19 x i64]], ptr %element_array, i64 0, i64 %idxprom147.us, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %36, align 8, !tbaa !9
%37 = getelementptr inbounds i64, ptr %36, i64 2
%wide.load320 = load <2 x i64>, ptr %37, align 8, !tbaa !9
%38 = mul nsw <2 x i64> %wide.load, %broadcast.splat
%39 = mul nsw <2 x i64> %wide.load320, %broadcast.splat
%40 = add <2 x i64> %38, %vec.phi
%41 = add <2 x i64> %39, %vec.phi319
%index.next = add nuw i64 %index, 4
%42 = icmp eq i64 %index.next, %n.vec
br i1 %42, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %41, %40
%43 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %26, %n.vec
br i1 %cmp.n, label %for.end156.us, label %for.body123.us.us.preheader
for.body123.us.us.preheader: ; preds = %vector.scevcheck, %for.body123.lr.ph.split.us.us, %middle.block
%indvars.iv292.ph = phi i64 [ %23, %vector.scevcheck ], [ %23, %for.body123.lr.ph.split.us.us ], [ %ind.end, %middle.block ]
%answer.3259.us.us.ph = phi i64 [ %answer.2263.us, %vector.scevcheck ], [ %answer.2263.us, %for.body123.lr.ph.split.us.us ], [ %43, %middle.block ]
br label %for.body123.us.us
for.body123.us.us: ; preds = %for.body123.us.us.preheader, %for.body123.us.us
%indvars.iv292 = phi i64 [ %indvars.iv.next293, %for.body123.us.us ], [ %indvars.iv292.ph, %for.body123.us.us.preheader ]
%answer.3259.us.us = phi i64 [ %answer.4.us.us, %for.body123.us.us ], [ %answer.3259.us.us.ph, %for.body123.us.us.preheader ]
%arrayidx150.us.us = getelementptr inbounds [19 x [19 x i64]], ptr %element_array, i64 0, i64 %idxprom147.us, i64 %indvars.iv292
%44 = load i64, ptr %arrayidx150.us.us, align 8, !tbaa !9
%mul151.us.us = mul nsw i64 %44, %22
%answer.4.us.us = add nsw i64 %mul151.us.us, %answer.3259.us.us
%indvars.iv.next293 = add nsw i64 %indvars.iv292, 1
%45 = and i64 %indvars.iv.next293, 4294967295
%exitcond295.not = icmp eq i64 %45, 19
br i1 %exitcond295.not, label %for.end156.us, label %for.body123.us.us, !llvm.loop !25
for.cond104.for.cond.cleanup107_crit_edge.us: ; preds = %for.end156.us
%indvars.iv.next302 = add nuw nsw i64 %indvars.iv301, 1
%exitcond305.not = icmp eq i64 %indvars.iv.next302, 19
br i1 %exitcond305.not, label %for.cond.cleanup101, label %for.body102.us, !llvm.loop !26
for.cond.cleanup95: ; preds = %for.cond.cleanup101
%call169 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %answer.3.lcssa.us)
call void @llvm.lifetime.end.p0(i64 2888, ptr nonnull %element_array) #6
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %num_arrray) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.cond.cleanup101: ; preds = %for.cond104.for.cond.cleanup107_crit_edge.us
%indvars.iv.next307 = add nuw nsw i64 %indvars.iv306, 1
%exitcond310.not = icmp eq i64 %indvars.iv.next307, 19
br i1 %exitcond310.not, label %for.cond.cleanup95, label %for.body102.us.preheader, !llvm.loop !27
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13, !23, !24}
!23 = !{!"llvm.loop.isvectorized", i32 1}
!24 = !{!"llvm.loop.unroll.runtime.disable"}
!25 = distinct !{!25, !13, !23}
!26 = distinct !{!26, !13}
!27 = distinct !{!27, !13}
|
#include<stdio.h>
int main(){
int a,b,n,m;
scanf("%d %d %d %d",&n,&m,&a,&b);
int ans=0,temp,temp2,temp3;
temp2 = n*a;
ans = (n/m);
temp3 = (ans + 1)*b;
temp = n-(ans*m);
ans*=b;
ans = ans + (temp*a);
if(temp2<ans)
ans = temp2;
if(temp3<ans)
ans = temp3;
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2812/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2812/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %m, align 4, !tbaa !5
%div = sdiv i32 %0, %2
%add = add nsw i32 %div, 1
%3 = load i32, ptr %b, align 4, !tbaa !5
%mul1 = mul nsw i32 %add, %3
%mul2 = mul nsw i32 %div, %2
%sub.recomposed = srem i32 %0, %2
%mul3 = mul nsw i32 %3, %div
%mul4 = mul nsw i32 %sub.recomposed, %1
%add5 = add nsw i32 %mul4, %mul3
%spec.select = call i32 @llvm.smin.i32(i32 %mul, i32 %add5)
%ans.1 = call i32 @llvm.smin.i32(i32 %mul1, i32 %spec.select)
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int counter(int x){
if(x==0) return 0;
else return counter(x>>1)+(x&1);
}
int main(void){
// Your code here!
int n,i,j,k;
scanf("%d",&n);
int a[n],x[20][20],y[20][20];
a[0]=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
for(j=0;j<a[i];j++)
scanf("%d %d",&x[i][j],&y[i][j]);
}
int max=0;
for(i=0;i<(1<<n);i++){
char flag='T';
for(j=0;j<n;j++){
if(!(i&(1<<j))) continue;
for(k=0;k<a[j];k++){
if((i>>(x[j][k]-1)&1)^y[j][k]){
flag='F';
break;
}
}
}
if(flag=='T'){
if(max<counter(i))
max = counter(i);
}
}
printf("%d\n",max);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281242/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281242/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @counter(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp3 = icmp eq i32 %x, 0
br i1 %cmp3, label %return, label %if.else
if.else: ; preds = %entry, %if.else
%x.tr5 = phi i32 [ %shr, %if.else ], [ %x, %entry ]
%accumulator.tr4 = phi i32 [ %add, %if.else ], [ 0, %entry ]
%shr = ashr i32 %x.tr5, 1
%and = and i32 %x.tr5, 1
%add = add nuw nsw i32 %and, %accumulator.tr4
%cmp = icmp ult i32 %x.tr5, 2
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.else, %entry
%accumulator.tr.lcssa = phi i32 [ 0, %entry ], [ %add, %if.else ]
ret i32 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%x = alloca [20 x [20 x i32]], align 16
%y = alloca [20 x [20 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %y) #6
store i32 0, ptr %vla, align 16, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp102 = icmp sgt i32 %3, 0
br i1 %cmp102, label %for.body, label %for.cond23.preheader.lr.ph.thread
for.cond23.preheader.lr.ph.thread: ; preds = %entry
%shl133 = shl nuw nsw i32 1, %3
br label %for.cond23.preheader.preheader
for.cond20.preheader: ; preds = %for.inc17
%shl = shl nuw i32 1, %11
%cmp21112.not = icmp eq i32 %11, 31
br i1 %cmp21112.not, label %for.end62, label %for.cond23.preheader.lr.ph
for.cond23.preheader.lr.ph: ; preds = %for.cond20.preheader
%cmp24108 = icmp sgt i32 %11, 0
br i1 %cmp24108, label %for.cond23.preheader.us.preheader, label %for.cond23.preheader.preheader
for.cond23.preheader.preheader: ; preds = %for.cond23.preheader.lr.ph.thread, %for.cond23.preheader.lr.ph
%shl136140 = phi i32 [ %shl133, %for.cond23.preheader.lr.ph.thread ], [ %shl, %for.cond23.preheader.lr.ph ]
%smax = call i32 @llvm.smax.i32(i32 %shl136140, i32 1)
br label %for.cond23.preheader
for.cond23.preheader.us.preheader: ; preds = %for.cond23.preheader.lr.ph
%smax130 = call i32 @llvm.smax.i32(i32 %shl, i32 1)
%wide.trip.count128 = zext i32 %11 to i64
br label %for.cond23.preheader.us
for.cond23.preheader.us: ; preds = %for.cond23.preheader.us.preheader, %if.end59.us
%max.0114.us = phi i32 [ %max.1.us, %if.end59.us ], [ 0, %for.cond23.preheader.us.preheader ]
%i.1113.us = phi i32 [ %inc61.us, %if.end59.us ], [ 0, %for.cond23.preheader.us.preheader ]
br label %for.body25.us.outer
if.then52.us: ; preds = %for.cond23.for.end49_crit_edge.us
%cmp3.i.us = icmp eq i32 %i.1113.us, 0
br i1 %cmp3.i.us, label %counter.exit.thread.us, label %if.else.i.us
if.else.i.us: ; preds = %if.then52.us, %if.else.i.us
%x.tr5.i.us = phi i32 [ %shr.i.us, %if.else.i.us ], [ %i.1113.us, %if.then52.us ]
%accumulator.tr4.i.us = phi i32 [ %add.i.us, %if.else.i.us ], [ 0, %if.then52.us ]
%shr.i.us = lshr i32 %x.tr5.i.us, 1
%and.i.us = and i32 %x.tr5.i.us, 1
%add.i.us = add nuw nsw i32 %and.i.us, %accumulator.tr4.i.us
%cmp.i.us = icmp ult i32 %x.tr5.i.us, 2
br i1 %cmp.i.us, label %counter.exit.us, label %if.else.i.us
counter.exit.us: ; preds = %if.else.i.us
%cmp54.us.not = icmp slt i32 %max.0114.us, %add.i.us
br i1 %cmp54.us.not, label %if.else.i89.us, label %if.end59.us
if.else.i89.us: ; preds = %counter.exit.us, %if.else.i89.us
%x.tr5.i90.us = phi i32 [ %shr.i92.us, %if.else.i89.us ], [ %i.1113.us, %counter.exit.us ]
%accumulator.tr4.i91.us = phi i32 [ %add.i94.us, %if.else.i89.us ], [ 0, %counter.exit.us ]
%shr.i92.us = lshr i32 %x.tr5.i90.us, 1
%and.i93.us = and i32 %x.tr5.i90.us, 1
%add.i94.us = add nuw nsw i32 %and.i93.us, %accumulator.tr4.i91.us
%cmp.i95.us = icmp ult i32 %x.tr5.i90.us, 2
br i1 %cmp.i95.us, label %if.end59.us, label %if.else.i89.us
counter.exit.thread.us: ; preds = %if.then52.us
%spec.select.us = call i32 @llvm.smax.i32(i32 %max.0114.us, i32 0)
br label %if.end59.us
if.end59.us: ; preds = %for.inc47.us.thread, %if.else.i89.us, %counter.exit.thread.us, %counter.exit.us, %for.cond23.for.end49_crit_edge.us
%max.1.us = phi i32 [ %max.0114.us, %counter.exit.us ], [ %max.0114.us, %for.cond23.for.end49_crit_edge.us ], [ %spec.select.us, %counter.exit.thread.us ], [ %add.i94.us, %if.else.i89.us ], [ %max.0114.us, %for.inc47.us.thread ]
%inc61.us = add nuw nsw i32 %i.1113.us, 1
%exitcond131.not = icmp eq i32 %inc61.us, %smax130
br i1 %exitcond131.not, label %for.end62, label %for.cond23.preheader.us, !llvm.loop !9
for.body25.us: ; preds = %for.body25.us.outer, %for.inc47.us
%indvars.iv126 = phi i64 [ %indvars.iv.next127, %for.inc47.us ], [ %indvars.iv126.ph, %for.body25.us.outer ]
%4 = trunc i64 %indvars.iv126 to i32
%shl26.us = shl nuw i32 1, %4
%and.us = and i32 %shl26.us, %i.1113.us
%tobool.not.us = icmp eq i32 %and.us, 0
br i1 %tobool.not.us, label %for.inc47.us, label %for.cond27.preheader.us
for.cond27.us: ; preds = %for.body31.us
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%exitcond125.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count
br i1 %exitcond125.not, label %for.inc47.us, label %for.body31.us, !llvm.loop !11
for.body31.us: ; preds = %for.body31.us.preheader, %for.cond27.us
%indvars.iv122 = phi i64 [ 0, %for.body31.us.preheader ], [ %indvars.iv.next123, %for.cond27.us ]
%arrayidx35.us = getelementptr inbounds [20 x [20 x i32]], ptr %x, i64 0, i64 %indvars.iv126, i64 %indvars.iv122
%5 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%sub.us = add nsw i32 %5, -1
%shr.us = lshr i32 %i.1113.us, %sub.us
%and36.us = and i32 %shr.us, 1
%arrayidx40.us = getelementptr inbounds [20 x [20 x i32]], ptr %y, i64 0, i64 %indvars.iv126, i64 %indvars.iv122
%6 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%tobool41.not.us = icmp eq i32 %and36.us, %6
br i1 %tobool41.not.us, label %for.cond27.us, label %for.inc47.us.thread
for.inc47.us: ; preds = %for.cond27.us, %for.cond27.preheader.us, %for.body25.us
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%exitcond129.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count128
br i1 %exitcond129.not, label %for.cond23.for.end49_crit_edge.us, label %for.body25.us, !llvm.loop !12
for.inc47.us.thread: ; preds = %for.body31.us
%indvars.iv.next127142 = add nuw nsw i64 %indvars.iv126, 1
%exitcond129.not143 = icmp eq i64 %indvars.iv.next127142, %wide.trip.count128
br i1 %exitcond129.not143, label %if.end59.us, label %for.body25.us.outer, !llvm.loop !12
for.body25.us.outer: ; preds = %for.inc47.us.thread, %for.cond23.preheader.us
%indvars.iv126.ph = phi i64 [ %indvars.iv.next127142, %for.inc47.us.thread ], [ 0, %for.cond23.preheader.us ]
%cmp50.us = phi i1 [ false, %for.inc47.us.thread ], [ true, %for.cond23.preheader.us ]
br label %for.body25.us
for.cond27.preheader.us: ; preds = %for.body25.us
%arrayidx29.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv126
%7 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%cmp30104.us = icmp sgt i32 %7, 0
br i1 %cmp30104.us, label %for.body31.us.preheader, label %for.inc47.us
for.body31.us.preheader: ; preds = %for.cond27.preheader.us
%wide.trip.count = zext i32 %7 to i64
br label %for.body31.us
for.cond23.for.end49_crit_edge.us: ; preds = %for.inc47.us
br i1 %cmp50.us, label %if.then52.us, label %if.end59.us
for.body: ; preds = %entry, %for.inc17
%indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.inc17 ], [ 0, %entry ]
%arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv119
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%8 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp6100 = icmp sgt i32 %8, 0
br i1 %cmp6100, label %for.body7, label %for.inc17
for.body7: ; preds = %for.body, %for.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ 0, %for.body ]
%arrayidx11 = getelementptr inbounds [20 x [20 x i32]], ptr %x, i64 0, i64 %indvars.iv119, i64 %indvars.iv
%arrayidx15 = getelementptr inbounds [20 x [20 x i32]], ptr %y, i64 0, i64 %indvars.iv119, i64 %indvars.iv
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11, ptr noundef nonnull %arrayidx15)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp6 = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp6, label %for.body7, label %for.inc17, !llvm.loop !13
for.inc17: ; preds = %for.body7, %for.body
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next120, %12
br i1 %cmp, label %for.body, label %for.cond20.preheader, !llvm.loop !14
for.cond23.preheader: ; preds = %for.cond23.preheader.preheader, %if.end59
%max.0114 = phi i32 [ %max.1, %if.end59 ], [ 0, %for.cond23.preheader.preheader ]
%i.1113 = phi i32 [ %inc61, %if.end59 ], [ 0, %for.cond23.preheader.preheader ]
%cmp3.i = icmp eq i32 %i.1113, 0
br i1 %cmp3.i, label %counter.exit.thread, label %if.else.i
if.else.i: ; preds = %for.cond23.preheader, %if.else.i
%x.tr5.i = phi i32 [ %shr.i, %if.else.i ], [ %i.1113, %for.cond23.preheader ]
%accumulator.tr4.i = phi i32 [ %add.i, %if.else.i ], [ 0, %for.cond23.preheader ]
%shr.i = lshr i32 %x.tr5.i, 1
%and.i = and i32 %x.tr5.i, 1
%add.i = add nuw nsw i32 %and.i, %accumulator.tr4.i
%cmp.i = icmp ult i32 %x.tr5.i, 2
br i1 %cmp.i, label %counter.exit, label %if.else.i
counter.exit: ; preds = %if.else.i
%cmp54.not = icmp slt i32 %max.0114, %add.i
br i1 %cmp54.not, label %if.else.i89, label %if.end59
counter.exit.thread: ; preds = %for.cond23.preheader
%spec.select = call i32 @llvm.smax.i32(i32 %max.0114, i32 0)
br label %if.end59
if.else.i89: ; preds = %counter.exit, %if.else.i89
%x.tr5.i90 = phi i32 [ %shr.i92, %if.else.i89 ], [ %i.1113, %counter.exit ]
%accumulator.tr4.i91 = phi i32 [ %add.i94, %if.else.i89 ], [ 0, %counter.exit ]
%shr.i92 = lshr i32 %x.tr5.i90, 1
%and.i93 = and i32 %x.tr5.i90, 1
%add.i94 = add nuw nsw i32 %and.i93, %accumulator.tr4.i91
%cmp.i95 = icmp ult i32 %x.tr5.i90, 2
br i1 %cmp.i95, label %if.end59, label %if.else.i89
if.end59: ; preds = %if.else.i89, %counter.exit.thread, %counter.exit
%max.1 = phi i32 [ %max.0114, %counter.exit ], [ %spec.select, %counter.exit.thread ], [ %add.i94, %if.else.i89 ]
%inc61 = add nuw nsw i32 %i.1113, 1
%exitcond.not = icmp eq i32 %inc61, %smax
br i1 %exitcond.not, label %for.end62, label %for.cond23.preheader, !llvm.loop !9
for.end62: ; preds = %if.end59, %if.end59.us, %for.cond20.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond20.preheader ], [ %max.1.us, %if.end59.us ], [ %max.1, %if.end59 ]
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %x) #6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(void)
{
char str[500];
int i;
int j;
int len;
scanf("%s", str);
len = 0;
while (str[len] != '\0')
len++;
i = 0;
while (i < len - 1)
{
j = i + 1;
while (j < len)
{
if (str[i] == str[j])
{
printf("no");
return (0);
}
j++;
}
i++;
}
printf("yes");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281293/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281293/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"no\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [500 x i8], align 16
call void @llvm.lifetime.start.p0(i64 500, ptr nonnull %str) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv48 = phi i32 [ %indvars.iv.next49, %while.cond ], [ -1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next49 = add nsw i32 %indvars.iv48, 1
br i1 %cmp.not, label %while.cond2.preheader, label %while.cond, !llvm.loop !8
while.cond2.preheader: ; preds = %while.cond
%1 = and i64 %indvars.iv, 4294967294
%cmp337.not = icmp eq i64 %1, 0
br i1 %cmp337.not, label %cleanup, label %while.body5.preheader
while.body5.preheader: ; preds = %while.cond2.preheader
%2 = and i64 %indvars.iv, 4294967295
%wide.trip.count = zext i32 %indvars.iv48 to i64
br label %while.body5
while.cond2.loopexit: ; preds = %while.cond6, %while.body5
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %while.body5, !llvm.loop !10
while.body5: ; preds = %while.body5.preheader, %while.cond2.loopexit
%indvars.iv45 = phi i64 [ 0, %while.body5.preheader ], [ %indvars.iv.next46, %while.cond2.loopexit ]
%indvars.iv40 = phi i64 [ 1, %while.body5.preheader ], [ %indvars.iv.next41, %while.cond2.loopexit ]
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%cmp735 = icmp ult i64 %indvars.iv.next46, %2
br i1 %cmp735, label %while.body9.lr.ph, label %while.cond2.loopexit
while.body9.lr.ph: ; preds = %while.body5
%arrayidx11 = getelementptr inbounds [500 x i8], ptr %str, i64 0, i64 %indvars.iv45
%3 = load i8, ptr %arrayidx11, align 1, !tbaa !5
br label %while.body9
while.cond6: ; preds = %while.body9
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%cmp7 = icmp ult i64 %indvars.iv.next43, %2
br i1 %cmp7, label %while.body9, label %while.cond2.loopexit, !llvm.loop !11
while.body9: ; preds = %while.body9.lr.ph, %while.cond6
%indvars.iv42 = phi i64 [ %indvars.iv40, %while.body9.lr.ph ], [ %indvars.iv.next43, %while.cond6 ]
%arrayidx14 = getelementptr inbounds [500 x i8], ptr %str, i64 0, i64 %indvars.iv42
%4 = load i8, ptr %arrayidx14, align 1, !tbaa !5
%cmp16 = icmp eq i8 %3, %4
br i1 %cmp16, label %cleanup, label %while.cond6
cleanup: ; preds = %while.cond2.loopexit, %while.body9, %while.cond2.preheader
%.str.2.sink = phi ptr [ @.str.2, %while.cond2.preheader ], [ @.str.1, %while.body9 ], [ @.str.2, %while.cond2.loopexit ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 500, ptr nonnull %str) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
|
// ABC063 B - Varied
#include <stdio.h>
#include <string.h>
int main(void) {
char S[27];
scanf("%s", S);
int slen = strlen(S);
int flag[26] = {0};
for (int i = 0; i < slen; i++) {
if (flag[S[i] - 97] == 1) {
printf("no\n");
return 0;
} else {
flag[S[i] - 97] = 1;
}
}
printf("yes\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281336/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281336/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [27 x i8], align 16
%flag = alloca [26 x i32], align 16
call void @llvm.lifetime.start.p0(i64 27, ptr nonnull %S) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #7
%conv = trunc i64 %call2 to i32
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %flag) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(104) %flag, i8 0, i64 104, i1 false)
%cmp.not24 = icmp sgt i32 %conv, 0
br i1 %cmp.not24, label %for.body.preheader, label %cleanup17
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
br label %for.body
for.body: ; preds = %for.body.preheader, %if.else
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.else ]
%arrayidx = getelementptr inbounds [27 x i8], ptr %S, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv4 = sext i8 %0 to i64
%sub = add nsw i64 %conv4, -97
%arrayidx6 = getelementptr inbounds [26 x i32], ptr %flag, i64 0, i64 %sub
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !8
%cmp7 = icmp eq i32 %1, 1
br i1 %cmp7, label %cleanup17, label %if.else
if.else: ; preds = %for.body
store i32 1, ptr %arrayidx6, align 4, !tbaa !8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup17, label %for.body, !llvm.loop !10
cleanup17: ; preds = %if.else, %for.body, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ @str, %for.body ], [ @str.3, %if.else ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %flag) #6
call void @llvm.lifetime.end.p0(i64 27, ptr nonnull %S) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
char A[26], c;
int main(){
c=getchar();
while(c!=10){
if(A[c-'a']){
printf("no\n");
return 0;
}
A[c-'a']=1;
c=getchar();
}
printf("yes\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281387/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281387/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i8 0, align 1
@A = dso_local local_unnamed_addr global [26 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@str.2 = private unnamed_addr constant [3 x i8] c"no\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %0)
%storemerge14 = trunc i32 %call.i to i8
store i8 %storemerge14, ptr @c, align 1, !tbaa !9
%sext15 = shl i32 %call.i, 24
%cmp.not16 = icmp eq i32 %sext15, 167772160
br i1 %cmp.not16, label %return, label %while.body
while.body: ; preds = %entry, %if.end
%sext17 = phi i32 [ %sext, %if.end ], [ %sext15, %entry ]
%conv1 = ashr exact i32 %sext17, 24
%sub = add nsw i32 %conv1, -97
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [26 x i8], ptr @A, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%tobool.not = icmp eq i8 %1, 0
br i1 %tobool.not, label %if.end, label %return
if.end: ; preds = %while.body
store i8 1, ptr %arrayidx, align 1, !tbaa !9
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i13 = tail call i32 @getc(ptr noundef %2)
%storemerge = trunc i32 %call.i13 to i8
store i8 %storemerge, ptr @c, align 1, !tbaa !9
%sext = shl i32 %call.i13, 24
%cmp.not = icmp eq i32 %sext, 167772160
br i1 %cmp.not, label %return, label %while.body, !llvm.loop !10
return: ; preds = %if.end, %while.body, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str.2, %while.body ], [ @str, %if.end ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIG 2000000007
#define MOD 1000000007
typedef unsigned long long ull;
typedef signed long long sll;
typedef struct {
int a;
int b;
} hw;
#define N_MAX 100000
#define M_MAX 100000
ull n, m, k;
ull h, w;
ull va, vb, vc, vd;
ull a[N_MAX];
// sll a[N_MAX];
ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
void swap_adj(ull *a, ull *b){
ull tmp = *b;
*b = *a;
*a = tmp;
return;
}
ull divide(ull a, ull b){
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int digits(ull x){
int i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
int min(ull x, ull y){
return (x < y) ? x : y;
}
ull gcd(ull x, ull y){
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow(ull a, ull x){
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= MOD;
}
x /= 2;
a = (a * a) % MOD;
}
return result;
}
int comp(const void *left, const void *right){
if ((*(int*)left) < (*(int*)right)) {
return -1;
} else if ((*(int*)left) > (*(int*)right)) {
return +1;
} else {
return 0;
}
}
// int nextroute(int arr[]){
// int i = n - 1;
// int j, x;
// while (arr[i - 1] > arr[i]) i--;
// x = n;
// for (j = i; j < n; j++) {
// if (arr[j] < arr[i - 1]) continue;
// if (x == n || arr[x] > arr[j]) x = j;
// }
// arr[i - 1] ^= arr[x];
// arr[x] ^= arr[i - 1];
// arr[i - 1] ^= arr[x];
// qsort(&arr[i], n - i, sizeof(int), comp);
// return 0;
// }
ull solve(){
int i, j;
int x[256] = {0};
for (i = 0; s[i]; i++) {
if (x[s[i]]) {
puts("no");
return 0;
}
x[s[i]] = 1;
}
puts("yes");
return 0;
}
int main(void){
int i, j;
int x;
scanf("%s", s);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@s = dso_local global [100001 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@n = dso_local local_unnamed_addr global i64 0, align 8
@m = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@a = dso_local local_unnamed_addr global [100000 x i64] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [100000 x i64] zeroinitializer, align 16
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap_adj(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
br label %while.body
while.body: ; preds = %entry, %if.end
%ans.014 = phi i64 [ 1, %entry ], [ %ans.1, %if.end ]
%x.013 = phi i64 [ 1000000005, %entry ], [ %div11, %if.end ]
%b.addr.012 = phi i64 [ %b, %entry ], [ %rem3, %if.end ]
%and = and i64 %x.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %ans.014, %b.addr.012
%rem = urem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.014, %while.body ]
%mul2 = mul i64 %b.addr.012, %b.addr.012
%rem3 = urem i64 %mul2, 1000000007
%div11 = lshr i64 %x.013, 1
%tobool.not = icmp ult i64 %x.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end
%mul4 = mul i64 %ans.1, %a
%rem5 = urem i64 %mul4, 1000000007
ret i64 %rem5
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @digits(i64 noundef %x) local_unnamed_addr #2 {
entry:
%cmp3 = icmp ugt i64 %x, 9
br i1 %cmp3, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%i.05 = phi i32 [ %inc, %while.body ], [ 1, %entry ]
%x.addr.04 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%div = udiv i64 %x.addr.04, 10
%inc = add nuw nsw i32 %i.05, 1
%cmp = icmp ugt i64 %x.addr.04, 99
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 1, %entry ], [ %inc, %while.body ]
ret i32 %i.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i64 noundef %x, i64 noundef %y) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
%conv = trunc i64 %cond to i32
ret i32 %conv
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not11 = icmp eq i64 %x, 0
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.014 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%x.addr.013 = phi i64 [ %div10, %if.end ], [ %x, %entry ]
%a.addr.012 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.014, %a.addr.012
%rem = urem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.014, %while.body ]
%div10 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.012, %a.addr.012
%rem3 = urem i64 %mul2, 1000000007
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !13
%1 = load i32, ptr %right, align 4, !tbaa !13
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #5 {
entry:
%x = alloca [256 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %x) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %x, i8 0, i64 1024, i1 false)
%0 = load i8, ptr @s, align 16, !tbaa !15
%tobool.not16 = icmp eq i8 %0, 0
br i1 %tobool.not16, label %cleanup, label %for.body
for.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%1 = phi i8 [ %3, %if.end ], [ %0, %entry ]
%idxprom3 = sext i8 %1 to i64
%arrayidx4 = getelementptr inbounds [256 x i32], ptr %x, i64 0, i64 %idxprom3
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !13
%tobool5.not = icmp eq i32 %2, 0
br i1 %tobool5.not, label %if.end, label %cleanup
if.end: ; preds = %for.body
store i32 1, ptr %arrayidx4, align 4, !tbaa !13
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !15
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %cleanup, label %for.body, !llvm.loop !16
cleanup: ; preds = %if.end, %for.body, %entry
%.str.1.sink = phi ptr [ @.str.1, %entry ], [ @.str, %for.body ], [ @.str.1, %if.end ]
%call10 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %x) #9
ret i64 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%x.i = alloca [256 x i32], align 16
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @s)
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %x.i) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %x.i, i8 0, i64 1024, i1 false)
%0 = load i8, ptr @s, align 16, !tbaa !15
%tobool.not16.i = icmp eq i8 %0, 0
br i1 %tobool.not16.i, label %solve.exit, label %for.body.i
for.body.i: ; preds = %entry, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 0, %entry ]
%1 = phi i8 [ %3, %if.end.i ], [ %0, %entry ]
%idxprom3.i = sext i8 %1 to i64
%arrayidx4.i = getelementptr inbounds [256 x i32], ptr %x.i, i64 0, i64 %idxprom3.i
%2 = load i32, ptr %arrayidx4.i, align 4, !tbaa !13
%tobool5.not.i = icmp eq i32 %2, 0
br i1 %tobool5.not.i, label %if.end.i, label %solve.exit
if.end.i: ; preds = %for.body.i
store i32 1, ptr %arrayidx4.i, align 4, !tbaa !13
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv.next.i
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !15
%tobool.not.i = icmp eq i8 %3, 0
br i1 %tobool.not.i, label %solve.exit, label %for.body.i, !llvm.loop !16
solve.exit: ; preds = %for.body.i, %if.end.i, %entry
%.str.1.sink.i = phi ptr [ @.str.1, %entry ], [ @.str.1, %if.end.i ], [ @.str, %for.body.i ]
%call10.i = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink.i)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %x.i) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <string.h>
int main(void){
char s[26];
int i,j,k=0;
scanf("%s",s);
for(i=0;i<strlen(s);i++){
for(j=0;j<strlen(s);j++){
if(s[i]==s[j]){
if(i==j) k+=0;
else k++;
}
else k+=0;
}
}
if(k==0) printf("yes\n");
else printf("no\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281501/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [26 x i8], align 16
call void @llvm.lifetime.start.p0(i64 26, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%cmp47.not = icmp eq i64 %call2, 0
br i1 %cmp47.not, label %if.end33, label %for.cond4.preheader.preheader
for.cond4.preheader.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %call2, 8
%n.vec = and i64 %call2, -8
%cmp.n = icmp eq i64 %call2, %n.vec
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc24
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.inc24 ], [ 0, %for.cond4.preheader.preheader ]
%k.049 = phi i32 [ %k.2.lcssa, %for.inc24 ], [ 0, %for.cond4.preheader.preheader ]
%arrayidx = getelementptr inbounds [26 x i8], ptr %s, i64 0, i64 %indvars.iv52
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.cond4.preheader
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %k.049, i64 0
%broadcast.splatinsert = insertelement <4 x i8> poison, i8 %0, i64 0
%broadcast.splat = shufflevector <4 x i8> %broadcast.splatinsert, <4 x i8> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert60 = insertelement <4 x i64> poison, i64 %indvars.iv52, i64 0
%broadcast.splat61 = shufflevector <4 x i64> %broadcast.splatinsert60, <4 x i64> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %1, %vector.ph ], [ %12, %vector.body ]
%vec.phi58 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
%2 = getelementptr inbounds [26 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %2, align 8, !tbaa !5
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load59 = load <4 x i8>, ptr %3, align 4, !tbaa !5
%4 = icmp eq <4 x i8> %broadcast.splat, %wide.load
%5 = icmp eq <4 x i8> %broadcast.splat, %wide.load59
%6 = icmp ne <4 x i64> %broadcast.splat61, %vec.ind
%7 = icmp ne <4 x i64> %broadcast.splat61, %step.add
%8 = and <4 x i1> %6, %4
%9 = and <4 x i1> %7, %5
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = add <4 x i32> %vec.phi, %10
%13 = add <4 x i32> %vec.phi58, %11
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.inc24, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond4.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond4.preheader ], [ %n.vec, %middle.block ]
%k.145.ph = phi i32 [ %k.049, %for.cond4.preheader ], [ %15, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body10 ], [ %indvars.iv.ph, %for.body10.preheader ]
%k.145 = phi i32 [ %k.2, %for.body10 ], [ %k.145.ph, %for.body10.preheader ]
%arrayidx13 = getelementptr inbounds [26 x i8], ptr %s, i64 0, i64 %indvars.iv
%16 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp15 = icmp eq i8 %0, %16
%cmp17 = icmp ne i64 %indvars.iv52, %indvars.iv
%or.cond.not = and i1 %cmp17, %cmp15
%inc = zext i1 %or.cond.not to i32
%k.2 = add nsw i32 %k.145, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call2
br i1 %exitcond.not, label %for.inc24, label %for.body10, !llvm.loop !12
for.inc24: ; preds = %for.body10, %middle.block
%k.2.lcssa = phi i32 [ %15, %middle.block ], [ %k.2, %for.body10 ]
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next53, %call2
br i1 %exitcond55.not, label %for.end26, label %for.cond4.preheader, !llvm.loop !13
for.end26: ; preds = %for.inc24
%17 = icmp eq i32 %k.2.lcssa, 0
%spec.select = select i1 %17, ptr @str.3, ptr @str
br label %if.end33
if.end33: ; preds = %for.end26, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ %spec.select, %for.end26 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 26, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9}
|
#include <stdio.h>
int main () {
int c,d,n,m,count;
scanf("%d", &n);
int a[n];
for (c = 0; c < n; c++) {
scanf("%d", &a[c]);
}
count = 0;
for (c = 0; c < (n - 1); c++) {
if (a[c] > a[c + 1]) {
d = c;
while (a[d] > a[d + 1]) {
m = a[d];
a[d] = a[d + 1];
a[d + 1] = m;
if (d != 0) {
d--;
}
count++;
}
}
}
for (c = 0; c < n; c++) {
if (c == (n - 1)) {
printf("%d\n", a[c]);
}else {
printf("%d ", a[c]);
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281574/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281574/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %3, 0
br i1 %cmp72, label %for.body, label %for.end48
for.cond2.preheader: ; preds = %for.body
%cmp385 = icmp sgt i32 %4, 1
br i1 %cmp385, label %for.body4.preheader, label %for.cond33.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %4, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond33.preheader: ; preds = %for.inc30, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %count.2, %for.inc30 ]
%cmp3489 = icmp sgt i32 %4, 0
br i1 %cmp3489, label %for.body35, label %for.end48
for.body4: ; preds = %for.body4.preheader, %for.inc30
%indvars.iv93 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next94, %for.inc30 ]
%count.086 = phi i32 [ 0, %for.body4.preheader ], [ %count.2, %for.inc30 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv93
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next94
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %6, %7
br i1 %cmp9, label %while.body.preheader, label %for.inc30
while.body.preheader: ; preds = %for.body4
%8 = trunc i64 %indvars.iv93 to i32
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%9 = phi i32 [ %12, %while.body ], [ %7, %while.body.preheader ]
%arrayidx1483 = phi ptr [ %arrayidx14, %while.body ], [ %arrayidx8, %while.body.preheader ]
%10 = phi i32 [ %11, %while.body ], [ %6, %while.body.preheader ]
%arrayidx1182 = phi ptr [ %arrayidx11, %while.body ], [ %arrayidx6, %while.body.preheader ]
%count.181 = phi i32 [ %inc28, %while.body ], [ %count.086, %while.body.preheader ]
%d.080 = phi i32 [ %spec.select, %while.body ], [ %8, %while.body.preheader ]
store i32 %9, ptr %arrayidx1182, align 4, !tbaa !5
store i32 %10, ptr %arrayidx1483, align 4, !tbaa !5
%spec.select = call i32 @llvm.usub.sat.i32(i32 %d.080, i32 1)
%inc28 = add nsw i32 %count.181, 1
%idxprom10 = sext i32 %spec.select to i64
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10
%11 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add12 = add nuw nsw i32 %spec.select, 1
%idxprom13 = sext i32 %add12 to i64
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %idxprom13
%12 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %11, %12
br i1 %cmp15, label %while.body, label %for.inc30, !llvm.loop !11
for.inc30: ; preds = %while.body, %for.body4
%count.2 = phi i32 [ %count.086, %for.body4 ], [ %inc28, %while.body ]
%exitcond.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count
br i1 %exitcond.not, label %for.cond33.preheader, label %for.body4, !llvm.loop !12
for.body35: ; preds = %for.cond33.preheader, %for.body35
%indvars.iv97 = phi i64 [ %indvars.iv.next98, %for.body35 ], [ 0, %for.cond33.preheader ]
%13 = phi i32 [ %16, %for.body35 ], [ %4, %for.cond33.preheader ]
%sub36 = add nsw i32 %13, -1
%14 = zext i32 %sub36 to i64
%cmp37 = icmp eq i64 %indvars.iv97, %14
%arrayidx40 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv97
%15 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp37, ptr @.str.1, ptr @.str.2
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %15)
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp34 = icmp slt i64 %indvars.iv.next98, %17
br i1 %cmp34, label %for.body35, label %for.end48, !llvm.loop !13
for.end48: ; preds = %for.body35, %entry, %for.cond33.preheader
%count.0.lcssa103 = phi i32 [ %count.0.lcssa, %for.cond33.preheader ], [ 0, %entry ], [ %count.0.lcssa, %for.body35 ]
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa103)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.usub.sat.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
void swap(int *a, int *b){
int temp = *a;
*a = *b;
*b = temp;
}
int bubbleSort(int A[],int N){
int i,j;
int sw = 0;
int flag = 1;
for(i=0;flag;i++){
flag=0;
for(j=N-1;j>=i+1;j--){
if(A[j]<A[j-1]){
swap(&A[j],&A[j-1]);
flag=1;
sw++;
}
}
}
return sw;
}
int main(void){
int i, N=0, sw;
int A[100];
scanf("%d", &N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
sw=bubbleSort(A,N);
for(i=0;i<N;i++){
if(i){
printf(" ");
}
printf("%d",A[i]);
}
printf("\n%d\n", sw);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281617/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281617/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #2 {
entry:
%0 = sext i32 %N to i64
%invariant.gep = getelementptr i32, ptr %A, i64 -2
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc
%tobool.not = icmp eq i32 %flag.2, 0
br i1 %tobool.not, label %for.end14, label %for.cond1.preheader, !llvm.loop !9
for.cond1.preheader: ; preds = %entry, %for.cond.loopexit
%indvars.iv37 = phi i64 [ 0, %entry ], [ %indvars.iv.next38, %for.cond.loopexit ]
%sw.034 = phi i32 [ 0, %entry ], [ %sw.2, %for.cond.loopexit ]
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%cmp.not.not26 = icmp slt i64 %indvars.iv.next38, %0
br i1 %cmp.not.not26, label %for.body2, label %for.end14
for.body2: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ]
%flag.129 = phi i32 [ %flag.2, %for.inc ], [ 0, %for.cond1.preheader ]
%sw.128 = phi i32 [ %sw.2, %for.inc ], [ %sw.034, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%2 = load i32, ptr %gep, align 4, !tbaa !5
%cmp6 = icmp slt i32 %1, %2
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.body2
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
store i32 %1, ptr %gep, align 4, !tbaa !5
%inc = add nsw i32 %sw.128, 1
br label %for.inc
for.inc: ; preds = %for.body2, %if.then
%sw.2 = phi i32 [ %inc, %if.then ], [ %sw.128, %for.body2 ]
%flag.2 = phi i32 [ 1, %if.then ], [ %flag.129, %for.body2 ]
%cmp.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next38
br i1 %cmp.not.not, label %for.body2, label %for.cond.loopexit, !llvm.loop !11
for.end14: ; preds = %for.cond1.preheader, %for.cond.loopexit
%sw.1.lcssa43 = phi i32 [ %sw.2, %for.cond.loopexit ], [ %sw.034, %for.cond1.preheader ]
ret i32 %sw.1.lcssa43
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre30 = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !12
for.end.loopexit: ; preds = %for.body
%3 = icmp sgt i32 %1, 0
br label %for.end
for.end: ; preds = %entry.for.end_crit_edge, %for.end.loopexit
%.pre-phi = phi i64 [ %.pre30, %entry.for.end_crit_edge ], [ %2, %for.end.loopexit ]
%cmp422 = phi i1 [ false, %entry.for.end_crit_edge ], [ %3, %for.end.loopexit ]
%invariant.gep.i = getelementptr i32, ptr %A, i64 -2
%smax = call i64 @llvm.smax.i64(i64 %.pre-phi, i64 1)
%4 = add nsw i64 %smax, -1
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i
%tobool.not.i = icmp eq i32 %flag.2.i, 0
br i1 %tobool.not.i, label %bubbleSort.exit, label %for.cond1.preheader.i, !llvm.loop !9
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.end
%indvars.iv37.i = phi i64 [ 0, %for.end ], [ %indvars.iv.next38.i, %for.cond.loopexit.i ]
%sw.034.i = phi i32 [ 0, %for.end ], [ %sw.2.i, %for.cond.loopexit.i ]
%indvars.iv.next38.i = add nuw nsw i64 %indvars.iv37.i, 1
%exitcond.not = icmp eq i64 %indvars.iv37.i, %4
br i1 %exitcond.not, label %bubbleSort.exit, label %for.body2.i
for.body2.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %.pre-phi, %for.cond1.preheader.i ]
%flag.129.i = phi i32 [ %flag.2.i, %for.inc.i ], [ 0, %for.cond1.preheader.i ]
%sw.128.i = phi i32 [ %sw.2.i, %for.inc.i ], [ %sw.034.i, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%6 = load i32, ptr %gep.i, align 4, !tbaa !5
%cmp6.i = icmp slt i32 %5, %6
br i1 %cmp6.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body2.i
store i32 %6, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %5, ptr %gep.i, align 4, !tbaa !5
%inc.i = add nsw i32 %sw.128.i, 1
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body2.i
%sw.2.i = phi i32 [ %inc.i, %if.then.i ], [ %sw.128.i, %for.body2.i ]
%flag.2.i = phi i32 [ 1, %if.then.i ], [ %flag.129.i, %for.body2.i ]
%cmp.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next38.i
br i1 %cmp.not.not.i, label %for.body2.i, label %for.cond.loopexit.i, !llvm.loop !11
bubbleSort.exit: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.i
%sw.1.lcssa43.i = phi i32 [ %sw.2.i, %for.cond.loopexit.i ], [ %sw.034.i, %for.cond1.preheader.i ]
br i1 %cmp422, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %bubbleSort.exit
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%7 = load i32, ptr %N, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %7, 1
br i1 %cmp4.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv26
%8 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp4 = icmp slt i64 %indvars.iv.next27, %10
br i1 %cmp4, label %if.end, label %for.end12, !llvm.loop !13
for.end12: ; preds = %if.end, %if.end.peel, %bubbleSort.exit
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sw.1.lcssa43.i)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
int main(void){
int num,n,i,j,a[100],flag,count=0;
scanf("%d",&num);
for(i=0;i<num;i++){
scanf("%d",&a[i]);
}
for(i=0;i<num;i++){
for(j=num-1;j>i-1;j--){
if(a[j]<a[j-1]){
n=a[j];
a[j]=a[j-1];
a[j-1]=n;
count+=1;
}
}
}
for ( i=0; i<num; i++){
if(i!=num-1) printf("%d ",a[i]);
else printf("%d",a[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281682/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281682/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp69 = icmp sgt i32 %0, 0
br i1 %cmp69, label %for.body, label %for.end45
for.cond2.preheader: ; preds = %for.body
%cmp375 = icmp sgt i32 %2, 0
br i1 %cmp375, label %for.cond5.preheader.lr.ph, label %for.end45
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%1 = zext i32 %2 to i64
%wide.trip.count = zext i32 %2 to i64
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc27
%indvars.iv87 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next88, %for.inc27 ]
%count.077 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %count.2, %for.inc27 ]
br label %for.body8
for.cond30.preheader: ; preds = %for.inc27
br i1 %cmp375, label %for.body32, label %for.end45
for.body8: ; preds = %for.cond5.preheader, %for.inc25
%indvars.iv83 = phi i64 [ %1, %for.cond5.preheader ], [ %indvars.iv.next84, %for.inc25 ]
%count.173 = phi i32 [ %count.077, %for.cond5.preheader ], [ %count.2, %for.inc25 ]
%indvars.iv.next84 = add nsw i64 %indvars.iv83, -1
%arrayidx10 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next84
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%5 = add nsw i64 %indvars.iv83, -2
%arrayidx13 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %5
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp slt i32 %4, %6
br i1 %cmp14, label %if.then, label %for.inc25
if.then: ; preds = %for.body8
store i32 %6, ptr %arrayidx10, align 4, !tbaa !5
store i32 %4, ptr %arrayidx13, align 4, !tbaa !5
%add = add nsw i32 %count.173, 1
br label %for.inc25
for.inc25: ; preds = %for.body8, %if.then
%count.2 = phi i32 [ %add, %if.then ], [ %count.173, %for.body8 ]
%cmp7 = icmp sgt i64 %indvars.iv.next84, %indvars.iv87
br i1 %cmp7, label %for.body8, label %for.inc27, !llvm.loop !11
for.inc27: ; preds = %for.inc25
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%exitcond.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count
br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !12
for.body32: ; preds = %for.cond30.preheader, %for.body32
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body32 ], [ 0, %for.cond30.preheader ]
%7 = phi i32 [ %10, %for.body32 ], [ %2, %for.cond30.preheader ]
%sub33 = add nsw i32 %7, -1
%8 = zext i32 %sub33 to i64
%cmp34.not = icmp eq i64 %indvars.iv90, %8
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv90
%9 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp34.not, ptr @.str, ptr @.str.1
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %9)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%10 = load i32, ptr %num, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp31 = icmp slt i64 %indvars.iv.next91, %11
br i1 %cmp31, label %for.body32, label %for.end45, !llvm.loop !13
for.end45: ; preds = %for.body32, %entry, %for.cond2.preheader, %for.cond30.preheader
%count.0.lcssa97 = phi i32 [ %count.2, %for.cond30.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.2, %for.body32 ]
%putchar = call i32 @putchar(i32 10)
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa97)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <string.h>
#define N 100
int main(void){
int flag,A[N],i,j,n,v,count=0;
scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d",&A[j]);
}
flag = 1;
i = 0;
flag = 0;
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(A[j]<A[j-1]){
v=A[j];
A[j]=A[j-1];
A[j-1]=v;
count++;
flag = 1;
}
}
}
for(j=0;j<n-1;j++){
printf("%d ",A[j]);
}
printf("%d", A[n-1]);
printf("\n");
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281725/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281725/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body, label %for.cond30.preheader.thread
for.cond2.preheader: ; preds = %for.body
%cmp372 = icmp sgt i32 %5, 0
br i1 %cmp372, label %for.cond5.preheader.lr.ph, label %for.cond30.preheader.thread
for.cond30.preheader.thread: ; preds = %for.cond2.preheader, %entry
%1 = phi i32 [ %5, %for.cond2.preheader ], [ %0, %entry ]
%.pre = add nsw i32 %1, -1
br label %for.cond30.preheader.for.end39_crit_edge
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%j.166 = add nsw i32 %5, -1
%2 = zext i32 %5 to i64
%3 = add nsw i64 %2, -1
%4 = zext i32 %j.166 to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc27
%indvars.iv91 = phi i64 [ 0, %for.cond5.preheader.lr.ph ], [ %indvars.iv.next92, %for.inc27 ]
%count.074 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %count.1.lcssa, %for.inc27 ]
%cmp667 = icmp ult i64 %indvars.iv91, %4
br i1 %cmp667, label %for.body7, label %for.inc27
for.cond30.preheader: ; preds = %for.inc27
%cmp3277 = icmp sgt i32 %5, 1
br i1 %cmp3277, label %for.body33, label %for.cond30.preheader.for.end39_crit_edge
for.cond30.preheader.for.end39_crit_edge: ; preds = %for.cond30.preheader.thread, %for.cond30.preheader
%count.0.lcssa104 = phi i32 [ 0, %for.cond30.preheader.thread ], [ %count.1.lcssa, %for.cond30.preheader ]
%sub3176.pre-phi102 = phi i32 [ %.pre, %for.cond30.preheader.thread ], [ %j.166, %for.cond30.preheader ]
%.pre97 = sext i32 %sub3176.pre-phi102 to i64
br label %for.end39
for.body7: ; preds = %for.cond5.preheader, %for.inc25
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.inc25 ], [ %2, %for.cond5.preheader ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc25 ], [ %3, %for.cond5.preheader ]
%count.169 = phi i32 [ %count.2, %for.inc25 ], [ %count.074, %for.cond5.preheader ]
%indvars.iv.next86 = add nsw i64 %indvars.iv85, -1
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv83
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%8 = add nsw i64 %indvars.iv85, -2
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %8
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %7, %9
br i1 %cmp13, label %if.then, label %for.inc25
if.then: ; preds = %for.body7
store i32 %9, ptr %arrayidx9, align 4, !tbaa !5
store i32 %7, ptr %arrayidx12, align 4, !tbaa !5
%inc24 = add nsw i32 %count.169, 1
br label %for.inc25
for.inc25: ; preds = %for.body7, %if.then
%count.2 = phi i32 [ %inc24, %if.then ], [ %count.169, %for.body7 ]
%indvars.iv.next84 = add nsw i64 %indvars.iv83, -1
%cmp6 = icmp sgt i64 %indvars.iv.next84, %indvars.iv91
br i1 %cmp6, label %for.body7, label %for.inc27, !llvm.loop !11
for.inc27: ; preds = %for.inc25, %for.cond5.preheader
%count.1.lcssa = phi i32 [ %count.074, %for.cond5.preheader ], [ %count.2, %for.inc25 ]
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count
br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !12
for.body33: ; preds = %for.cond30.preheader, %for.body33
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.body33 ], [ 0, %for.cond30.preheader ]
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv94
%10 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%sub31 = add nsw i32 %11, -1
%12 = sext i32 %sub31 to i64
%cmp32 = icmp slt i64 %indvars.iv.next95, %12
br i1 %cmp32, label %for.body33, label %for.end39, !llvm.loop !13
for.end39: ; preds = %for.body33, %for.cond30.preheader.for.end39_crit_edge
%count.0.lcssa103 = phi i32 [ %count.0.lcssa104, %for.cond30.preheader.for.end39_crit_edge ], [ %count.1.lcssa, %for.body33 ]
%idxprom41.pre-phi = phi i64 [ %.pre97, %for.cond30.preheader.for.end39_crit_edge ], [ %12, %for.body33 ]
%arrayidx42 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom41.pre-phi
%13 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%putchar = call i32 @putchar(i32 10)
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa103)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#define N 100
int main(){
int n,i,j,x[N],temp,count=0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&x[i]);
for (i = 0; i < n - 1; i++) {
for (j = n - 1; j > i; j--) {
if (x[j - 1] > x[j]) { /* 前の要素の方が大きかったら */
temp = x[j]; /* 交換する */
x[j] = x[j - 1];
x[j - 1]= temp;
count++;
}
}
}
for(i=0;i<n-1;i++) printf("%d ",x[i]);
printf("%d\n",x[n-1]);
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281769/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281769/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp63 = icmp sgt i32 %0, 0
br i1 %cmp63, label %for.body, label %for.cond2.preheader.thread
for.cond2.preheader.thread: ; preds = %entry
%sub88 = add i32 %0, -1
br label %for.cond31.preheader.for.end40_crit_edge
for.cond2.preheader: ; preds = %for.body
%sub = add i32 %3, -1
%cmp367 = icmp sgt i32 %3, 1
br i1 %cmp367, label %for.cond6.preheader.preheader, label %for.cond31.preheader.for.end40_crit_edge
for.cond6.preheader.preheader: ; preds = %for.cond2.preheader
%1 = zext i32 %3 to i64
%2 = add nsw i64 %1, -1
%wide.trip.count = zext i32 %sub to i64
%arrayidx13.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %2
br label %for.cond6.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc28
%indvars.iv81 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next82, %for.inc28 ]
%count.069 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %count.2, %for.inc28 ]
%.pre = load i32, ptr %arrayidx13.phi.trans.insert, align 4, !tbaa !5
br label %for.body8
for.cond31.preheader: ; preds = %for.inc28
br i1 %cmp367, label %for.body34, label %for.cond31.preheader.for.end40_crit_edge
for.cond31.preheader.for.end40_crit_edge: ; preds = %for.cond2.preheader.thread, %for.cond2.preheader, %for.cond31.preheader
%count.0.lcssa97 = phi i32 [ %count.2, %for.cond31.preheader ], [ 0, %for.cond2.preheader ], [ 0, %for.cond2.preheader.thread ]
%sub9095 = phi i32 [ %sub, %for.cond31.preheader ], [ %sub, %for.cond2.preheader ], [ %sub88, %for.cond2.preheader.thread ]
%.pre87 = sext i32 %sub9095 to i64
br label %for.end40
for.body8: ; preds = %for.cond6.preheader, %for.inc26
%5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %7, %for.inc26 ]
%indvars.iv78 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next79, %for.inc26 ]
%count.166 = phi i32 [ %count.069, %for.cond6.preheader ], [ %count.2, %for.inc26 ]
%indvars.iv.next79 = add nsw i64 %indvars.iv78, -1
%arrayidx11 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv.next79
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %6, %5
br i1 %cmp14, label %if.then, label %for.inc26
if.then: ; preds = %for.body8
%arrayidx13 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv78
store i32 %6, ptr %arrayidx13, align 4, !tbaa !5
store i32 %5, ptr %arrayidx11, align 4, !tbaa !5
%inc25 = add nsw i32 %count.166, 1
br label %for.inc26
for.inc26: ; preds = %for.body8, %if.then
%7 = phi i32 [ %5, %if.then ], [ %6, %for.body8 ]
%count.2 = phi i32 [ %inc25, %if.then ], [ %count.166, %for.body8 ]
%cmp7 = icmp sgt i64 %indvars.iv.next79, %indvars.iv81
br i1 %cmp7, label %for.body8, label %for.inc28, !llvm.loop !11
for.inc28: ; preds = %for.inc26
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count
br i1 %exitcond.not, label %for.cond31.preheader, label %for.cond6.preheader, !llvm.loop !12
for.body34: ; preds = %for.cond31.preheader, %for.body34
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body34 ], [ 0, %for.cond31.preheader ]
%arrayidx36 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv84
%8 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%sub32 = add nsw i32 %9, -1
%10 = sext i32 %sub32 to i64
%cmp33 = icmp slt i64 %indvars.iv.next85, %10
br i1 %cmp33, label %for.body34, label %for.end40, !llvm.loop !13
for.end40: ; preds = %for.body34, %for.cond31.preheader.for.end40_crit_edge
%count.0.lcssa96 = phi i32 [ %count.0.lcssa97, %for.cond31.preheader.for.end40_crit_edge ], [ %count.2, %for.body34 ]
%idxprom42.pre-phi = phi i64 [ %.pre87, %for.cond31.preheader.for.end40_crit_edge ], [ %10, %for.body34 ]
%arrayidx43 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom42.pre-phi
%11 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa96)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main()
{
int A[100],N,flag=1,j,i,temp,count;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
i=0;
while(flag){
flag=0;
for(j=N-1;j>=i+1;j--){
if(A[j]<A[j-1]){
temp = A[j];
A[j] = A[j-1];
A[j-1] = temp;
flag=1;
count++;
}
}
if(flag==1){
i+=1;
}
}
for(i=0;i<N-1;i++){
printf("%d ",A[i]);
}
printf("%d",A[N-1]);
printf("\n");
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281819/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281819/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [100 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body, label %entry.while.cond.preheader_crit_edge
entry.while.cond.preheader_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry.while.cond.preheader_crit_edge
%.pre-phi = phi i64 [ %.pre, %entry.while.cond.preheader_crit_edge ], [ %3, %for.body ]
%1 = phi i32 [ %0, %entry.while.cond.preheader_crit_edge ], [ %2, %for.body ]
br label %for.cond2.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !9
for.cond2.preheader: ; preds = %while.cond.preheader, %for.end23
%count.073 = phi i32 [ undef, %while.cond.preheader ], [ %count.2, %for.end23 ]
%i.172 = phi i32 [ 0, %while.cond.preheader ], [ %spec.select, %for.end23 ]
%add = add nsw i32 %i.172, 1
%cmp3.not.not64 = icmp sgt i32 %1, %add
br i1 %cmp3.not.not64, label %for.body4.preheader, label %for.cond28.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%4 = sext i32 %add to i64
br label %for.body4
for.cond28.preheader: ; preds = %for.cond2.preheader, %for.end23
%count.1.lcssa9498 = phi i32 [ %count.2, %for.end23 ], [ %count.073, %for.cond2.preheader ]
%cmp3075 = icmp sgt i32 %1, 1
br i1 %cmp3075, label %for.body31, label %for.cond28.preheader.for.end37_crit_edge
for.cond28.preheader.for.end37_crit_edge: ; preds = %for.cond28.preheader
%sub2974 = add nsw i32 %1, -1
%.pre88 = sext i32 %sub2974 to i64
br label %for.end37
for.body4: ; preds = %for.body4.preheader, %for.inc22
%indvars.iv81 = phi i64 [ %.pre-phi, %for.body4.preheader ], [ %indvars.iv.next82, %for.inc22 ]
%count.167 = phi i32 [ %count.073, %for.body4.preheader ], [ %count.2, %for.inc22 ]
%flag.166 = phi i32 [ 0, %for.body4.preheader ], [ %flag.2, %for.inc22 ]
%indvars.iv.next82 = add nsw i64 %indvars.iv81, -1
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next82
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%6 = add nsw i64 %indvars.iv81, -2
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %6
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp slt i32 %5, %7
br i1 %cmp10, label %if.then, label %for.inc22
if.then: ; preds = %for.body4
store i32 %7, ptr %arrayidx6, align 4, !tbaa !5
store i32 %5, ptr %arrayidx9, align 4, !tbaa !5
%inc21 = add nsw i32 %count.167, 1
br label %for.inc22
for.inc22: ; preds = %for.body4, %if.then
%flag.2 = phi i32 [ 1, %if.then ], [ %flag.166, %for.body4 ]
%count.2 = phi i32 [ %inc21, %if.then ], [ %count.167, %for.body4 ]
%cmp3.not.not = icmp sgt i64 %indvars.iv.next82, %4
br i1 %cmp3.not.not, label %for.body4, label %for.end23, !llvm.loop !11
for.end23: ; preds = %for.inc22
%cmp24 = icmp eq i32 %flag.2, 1
%spec.select = select i1 %cmp24, i32 %add, i32 %i.172
%tobool.not = icmp eq i32 %flag.2, 0
br i1 %tobool.not, label %for.cond28.preheader, label %for.cond2.preheader, !llvm.loop !12
for.body31: ; preds = %for.cond28.preheader, %for.body31
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body31 ], [ 0, %for.cond28.preheader ]
%arrayidx33 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv85
%8 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%sub29 = add nsw i32 %9, -1
%10 = sext i32 %sub29 to i64
%cmp30 = icmp slt i64 %indvars.iv.next86, %10
br i1 %cmp30, label %for.body31, label %for.end37, !llvm.loop !13
for.end37: ; preds = %for.body31, %for.cond28.preheader.for.end37_crit_edge
%idxprom39.pre-phi = phi i64 [ %.pre88, %for.cond28.preheader.for.end37_crit_edge ], [ %10, %for.body31 ]
%arrayidx40 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom39.pre-phi
%11 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%putchar = call i32 @putchar(i32 10)
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.1.lcssa9498)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main()
{
int N, i, flag=1, work, count=0, A[100];
//inpput number that is used this program
scanf("%d", &N);
for(i=0;i<N;i++){
scanf("%d", &A[i]);
}
//do babble sort
while(flag==1){
flag=0;
for(i=N-1;i>0;i--){
if(A[i]<A[i-1]){
work=A[i];
A[i]=A[i-1];
A[i-1]=work;
flag=1;
count++;
}
}
}
//output this sort's result
for(i=0;i<N;i++){
if(i==N-1){
printf("%d",A[i]);
break;
}
printf("%d ", A[i]);
}
printf("\n%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281862/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281862/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp61 = icmp sgt i32 %0, 0
br i1 %cmp61, label %for.body, label %for.end40
while.cond.preheader: ; preds = %for.body
%cmp464 = icmp sgt i32 %4, 1
br i1 %cmp464, label %for.cond3.preheader.us.preheader, label %for.cond25.preheader
for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %4 to i64
br label %for.body5.us
for.body5.us: ; preds = %for.body5.us.backedge, %for.cond3.preheader.us.preheader
%indvars.iv77 = phi i64 [ %1, %for.cond3.preheader.us.preheader ], [ %indvars.iv77.be, %for.body5.us.backedge ]
%count.167.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %count.2.us, %for.body5.us.backedge ]
%flag.165.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %flag.165.us.be, %for.body5.us.backedge ]
%indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
%idxprom6.us = and i64 %indvars.iv.next78, 4294967295
%arrayidx7.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom6.us
%2 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5
%sub8.us = add i64 %indvars.iv77, 4294967294
%idxprom9.us = and i64 %sub8.us, 4294967295
%arrayidx10.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom9.us
%3 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%cmp11.us = icmp slt i32 %2, %3
br i1 %cmp11.us, label %if.then.us, label %for.inc23.us
if.then.us: ; preds = %for.body5.us
store i32 %3, ptr %arrayidx7.us, align 4, !tbaa !5
store i32 %2, ptr %arrayidx10.us, align 4, !tbaa !5
%inc22.us = add nsw i32 %count.167.us, 1
br label %for.inc23.us
for.inc23.us: ; preds = %if.then.us, %for.body5.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.165.us, %for.body5.us ]
%count.2.us = phi i32 [ %inc22.us, %if.then.us ], [ %count.167.us, %for.body5.us ]
%cmp4.us = icmp sgt i64 %indvars.iv77, 2
br i1 %cmp4.us, label %for.body5.us.backedge, label %for.cond3.while.cond.loopexit_crit_edge.us
for.body5.us.backedge: ; preds = %for.inc23.us, %for.cond3.while.cond.loopexit_crit_edge.us
%indvars.iv77.be = phi i64 [ %indvars.iv.next78, %for.inc23.us ], [ %1, %for.cond3.while.cond.loopexit_crit_edge.us ]
%flag.165.us.be = phi i32 [ %flag.2.us, %for.inc23.us ], [ 0, %for.cond3.while.cond.loopexit_crit_edge.us ]
br label %for.body5.us, !llvm.loop !9
for.cond3.while.cond.loopexit_crit_edge.us: ; preds = %for.inc23.us
%cmp2.us = icmp eq i32 %flag.2.us, 1
br i1 %cmp2.us, label %for.body5.us.backedge, label %for.cond25.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond25.preheader: ; preds = %for.cond3.while.cond.loopexit_crit_edge.us, %while.cond.preheader
%.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %count.2.us, %for.cond3.while.cond.loopexit_crit_edge.us ]
%cmp2672 = icmp sgt i32 %4, 0
br i1 %cmp2672, label %for.body27, label %for.end40
for.body27: ; preds = %for.cond25.preheader, %if.end34
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %if.end34 ], [ 0, %for.cond25.preheader ]
%6 = phi i32 [ %10, %if.end34 ], [ %4, %for.cond25.preheader ]
%sub28 = add nsw i32 %6, -1
%7 = zext i32 %sub28 to i64
%cmp29 = icmp eq i64 %indvars.iv80, %7
br i1 %cmp29, label %if.then30, label %if.end34
if.then30: ; preds = %for.body27
%idxprom31 = and i64 %indvars.iv80, 4294967295
%arrayidx32 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom31
%8 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
br label %for.end40
if.end34: ; preds = %for.body27
%arrayidx36 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv80
%9 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%10 = load i32, ptr %N, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp26 = icmp slt i64 %indvars.iv.next81, %11
br i1 %cmp26, label %for.body27, label %for.end40, !llvm.loop !12
for.end40: ; preds = %if.end34, %entry, %for.cond25.preheader, %if.then30
%.us-phi87 = phi i32 [ %.us-phi, %for.cond25.preheader ], [ %.us-phi, %if.then30 ], [ 0, %entry ], [ %.us-phi, %if.end34 ]
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi87)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int bsort(int a[],int n){
int i,j,num=0;
for(i=0;i<n-1;i++){
for(j=0;j<n-i-1;j++){
if(a[j+1]<a[j]){
int temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
num++;
}
}
}
return num;
}
int main(void){
int i,n,num,x[100];
scanf("%d",&n);
for(i=0;i<n;i++){scanf("%d",&x[i]);}
num=bsort(x,n);
printf("%d",x[0]);
for (i=1;i<n;i++){printf(" %d",x[i]);}
printf("\n%d\n",num);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281905/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281905/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bsort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%sub = add i32 %n, -1
%cmp43 = icmp sgt i32 %n, 1
br i1 %cmp43, label %for.cond1.preheader.preheader, label %for.end22
for.cond1.preheader.preheader: ; preds = %entry
%invariant.gep = getelementptr i32, ptr %a, i64 1
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc20
%indvars.iv48 = phi i32 [ %indvars.iv.next49, %for.inc20 ], [ %sub, %for.cond1.preheader.preheader ]
%i.045 = phi i32 [ %inc21, %for.inc20 ], [ 0, %for.cond1.preheader.preheader ]
%num.044 = phi i32 [ %num.1.lcssa, %for.inc20 ], [ 0, %for.cond1.preheader.preheader ]
%0 = zext i32 %indvars.iv48 to i64
%1 = xor i32 %i.045, -1
%sub3 = add i32 %1, %n
%cmp440 = icmp sgt i32 %sub3, 0
br i1 %cmp440, label %for.body5.preheader, label %for.inc20
for.body5.preheader: ; preds = %for.cond1.preheader
%.pre = load i32, ptr %a, align 4, !tbaa !5
%xtraiter = and i64 %0, 1
%2 = icmp eq i32 %indvars.iv48, 1
br i1 %2, label %for.inc20.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %0, 4294967294
br label %for.body5
for.body5: ; preds = %for.inc.1, %for.body5.preheader.new
%3 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %7, %for.inc.1 ]
%indvars.iv = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%num.142 = phi i32 [ %num.044, %for.body5.preheader.new ], [ %num.2.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp8 = icmp slt i32 %4, %3
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body5
%arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
store i32 %4, ptr %arrayidx7, align 4, !tbaa !5
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %num.142, 1
br label %for.inc
for.inc: ; preds = %for.body5, %if.then
%5 = phi i32 [ %3, %if.then ], [ %4, %for.body5 ]
%num.2 = phi i32 [ %inc, %if.then ], [ %num.142, %for.body5 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1
%6 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp8.1 = icmp slt i32 %6, %5
br i1 %cmp8.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%arrayidx7.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
store i32 %6, ptr %arrayidx7.1, align 4, !tbaa !5
store i32 %5, ptr %arrayidx.1, align 4, !tbaa !5
%inc.1 = add nsw i32 %num.2, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%7 = phi i32 [ %5, %if.then.1 ], [ %6, %for.inc ]
%num.2.1 = phi i32 [ %inc.1, %if.then.1 ], [ %num.2, %for.inc ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.inc20.loopexit.unr-lcssa, label %for.body5, !llvm.loop !9
for.inc20.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body5.preheader
%num.2.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %num.2.1, %for.inc.1 ]
%.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %7, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%num.142.unr = phi i32 [ %num.044, %for.body5.preheader ], [ %num.2.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc20, label %for.body5.epil
for.body5.epil: ; preds = %for.inc20.loopexit.unr-lcssa
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.unr
%8 = load i32, ptr %gep, align 4, !tbaa !5
%cmp8.epil = icmp slt i32 %8, %.unr
br i1 %cmp8.epil, label %if.then.epil, label %for.inc20
if.then.epil: ; preds = %for.body5.epil
%arrayidx7.epil = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.unr
store i32 %8, ptr %arrayidx7.epil, align 4, !tbaa !5
store i32 %.unr, ptr %gep, align 4, !tbaa !5
%inc.epil = add nsw i32 %num.142.unr, 1
br label %for.inc20
for.inc20: ; preds = %for.inc20.loopexit.unr-lcssa, %if.then.epil, %for.body5.epil, %for.cond1.preheader
%num.1.lcssa = phi i32 [ %num.044, %for.cond1.preheader ], [ %num.2.lcssa.ph, %for.inc20.loopexit.unr-lcssa ], [ %inc.epil, %if.then.epil ], [ %num.142.unr, %for.body5.epil ]
%inc21 = add nuw nsw i32 %i.045, 1
%indvars.iv.next49 = add i32 %indvars.iv48, -1
%exitcond50.not = icmp eq i32 %inc21, %sub
br i1 %exitcond50.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc20, %entry
%num.0.lcssa = phi i32 [ 0, %entry ], [ %num.1.lcssa, %for.inc20 ]
ret i32 %num.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %bsort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body
%sub.i = add i32 %1, -1
%cmp43.i = icmp sgt i32 %1, 1
br i1 %cmp43.i, label %for.cond1.preheader.i.preheader, label %bsort.exit
for.cond1.preheader.i.preheader: ; preds = %for.end
%invariant.gep = getelementptr i32, ptr %x, i64 1
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.cond1.preheader.i.preheader, %for.inc20.i
%indvars.iv48.i = phi i32 [ %indvars.iv.next49.i, %for.inc20.i ], [ %sub.i, %for.cond1.preheader.i.preheader ]
%i.045.i = phi i32 [ %inc21.i, %for.inc20.i ], [ 0, %for.cond1.preheader.i.preheader ]
%num.044.i = phi i32 [ %num.1.lcssa.i, %for.inc20.i ], [ 0, %for.cond1.preheader.i.preheader ]
%3 = zext i32 %indvars.iv48.i to i64
%4 = xor i32 %i.045.i, -1
%sub3.i = add i32 %1, %4
%cmp440.i = icmp sgt i32 %sub3.i, 0
br i1 %cmp440.i, label %for.body5.preheader.i, label %for.inc20.i
for.body5.preheader.i: ; preds = %for.cond1.preheader.i
%.pre.i = load i32, ptr %x, align 16, !tbaa !5
%xtraiter = and i64 %3, 1
%5 = icmp eq i32 %indvars.iv48.i, 1
br i1 %5, label %for.inc20.i.loopexit.unr-lcssa, label %for.body5.preheader.i.new
for.body5.preheader.i.new: ; preds = %for.body5.preheader.i
%unroll_iter = and i64 %3, 4294967294
br label %for.body5.i
for.body5.i: ; preds = %for.inc.i.1, %for.body5.preheader.i.new
%6 = phi i32 [ %.pre.i, %for.body5.preheader.i.new ], [ %10, %for.inc.i.1 ]
%indvars.iv.i = phi i64 [ 0, %for.body5.preheader.i.new ], [ %indvars.iv.next.i.1, %for.inc.i.1 ]
%num.142.i = phi i32 [ %num.044.i, %for.body5.preheader.i.new ], [ %num.2.i.1, %for.inc.i.1 ]
%niter = phi i64 [ 0, %for.body5.preheader.i.new ], [ %niter.next.1, %for.inc.i.1 ]
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.next.i
%7 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %7, %6
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body5.i
%arrayidx7.i = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.i
store i32 %7, ptr %arrayidx7.i, align 8, !tbaa !5
store i32 %6, ptr %arrayidx.i, align 4, !tbaa !5
%inc.i = add nsw i32 %num.142.i, 1
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body5.i
%8 = phi i32 [ %6, %if.then.i ], [ %7, %for.body5.i ]
%num.2.i = phi i32 [ %inc.i, %if.then.i ], [ %num.142.i, %for.body5.i ]
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%arrayidx.i.1 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.next.i.1
%9 = load i32, ptr %arrayidx.i.1, align 8, !tbaa !5
%cmp8.i.1 = icmp slt i32 %9, %8
br i1 %cmp8.i.1, label %if.then.i.1, label %for.inc.i.1
if.then.i.1: ; preds = %for.inc.i
%arrayidx7.i.1 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.next.i
store i32 %9, ptr %arrayidx7.i.1, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.i.1, align 8, !tbaa !5
%inc.i.1 = add nsw i32 %num.2.i, 1
br label %for.inc.i.1
for.inc.i.1: ; preds = %if.then.i.1, %for.inc.i
%10 = phi i32 [ %8, %if.then.i.1 ], [ %9, %for.inc.i ]
%num.2.i.1 = phi i32 [ %inc.i.1, %if.then.i.1 ], [ %num.2.i, %for.inc.i ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.inc20.i.loopexit.unr-lcssa, label %for.body5.i, !llvm.loop !9
for.inc20.i.loopexit.unr-lcssa: ; preds = %for.inc.i.1, %for.body5.preheader.i
%num.2.i.lcssa.ph = phi i32 [ undef, %for.body5.preheader.i ], [ %num.2.i.1, %for.inc.i.1 ]
%.unr = phi i32 [ %.pre.i, %for.body5.preheader.i ], [ %10, %for.inc.i.1 ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body5.preheader.i ], [ %indvars.iv.next.i.1, %for.inc.i.1 ]
%num.142.i.unr = phi i32 [ %num.044.i, %for.body5.preheader.i ], [ %num.2.i.1, %for.inc.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc20.i, label %for.body5.i.epil
for.body5.i.epil: ; preds = %for.inc20.i.loopexit.unr-lcssa
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.i.unr
%11 = load i32, ptr %gep, align 4, !tbaa !5
%cmp8.i.epil = icmp slt i32 %11, %.unr
br i1 %cmp8.i.epil, label %if.then.i.epil, label %for.inc20.i
if.then.i.epil: ; preds = %for.body5.i.epil
%arrayidx7.i.epil = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.i.unr
store i32 %11, ptr %arrayidx7.i.epil, align 4, !tbaa !5
store i32 %.unr, ptr %gep, align 4, !tbaa !5
%inc.i.epil = add nsw i32 %num.142.i.unr, 1
br label %for.inc20.i
for.inc20.i: ; preds = %for.inc20.i.loopexit.unr-lcssa, %if.then.i.epil, %for.body5.i.epil, %for.cond1.preheader.i
%num.1.lcssa.i = phi i32 [ %num.044.i, %for.cond1.preheader.i ], [ %num.2.i.lcssa.ph, %for.inc20.i.loopexit.unr-lcssa ], [ %inc.i.epil, %if.then.i.epil ], [ %num.142.i.unr, %for.body5.i.epil ]
%inc21.i = add nuw nsw i32 %i.045.i, 1
%indvars.iv.next49.i = add i32 %indvars.iv48.i, -1
%exitcond50.not.i = icmp eq i32 %inc21.i, %sub.i
br i1 %exitcond50.not.i, label %bsort.exit, label %for.cond1.preheader.i, !llvm.loop !11
bsort.exit: ; preds = %for.inc20.i, %entry, %for.end
%num.0.lcssa.i = phi i32 [ 0, %for.end ], [ 0, %entry ], [ %num.1.lcssa.i, %for.inc20.i ]
%12 = load i32, ptr %x, align 16, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp622 = icmp sgt i32 %13, 1
br i1 %cmp622, label %for.body7, label %for.end13
for.body7: ; preds = %bsort.exit, %for.body7
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.body7 ], [ 1, %bsort.exit ]
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv26
%14 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp6 = icmp slt i64 %indvars.iv.next27, %16
br i1 %cmp6, label %for.body7, label %for.end13, !llvm.loop !13
for.end13: ; preds = %for.body7, %bsort.exit
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %num.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
void bubbleSort(int A[], const int N)
{
int i;
int flag = 1, cnt = 0;
int j;
for(j = 0; flag; ++j){
flag = 0;
for(i = N-1; j < i; --i)
if(A[i] < A[i-1])
{int tmp = A[i]; A[i] = A[i-1]; A[i-1] = tmp; flag = 1; ++cnt;} }
for(i = 0; i < N; ++i){
if(0 < i)
printf(" ");
printf("%d", A[i]);}
printf("\n%d\n", cnt);}
int main(){
int i; int N;
scanf("%d", &N);
int A[N];
for(i = 0; i < N; ++i)
scanf("%d", &A[i]);
bubbleSort(A, N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281949/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281949/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%i.054 = add nsw i32 %N, -1
%0 = sext i32 %N to i64
%1 = add nsw i64 %0, -1
%2 = sext i32 %i.054 to i64
%invariant.gep = getelementptr i32, ptr %A, i64 -2
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc17
%indvars.iv71 = phi i64 [ 0, %entry ], [ %indvars.iv.next72, %for.inc17 ]
%cnt.061 = phi i32 [ 0, %entry ], [ %cnt.2, %for.inc17 ]
%cmp55 = icmp slt i64 %indvars.iv71, %2
br i1 %cmp55, label %for.body2, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond1.preheader, %for.inc17
%cnt.1.lcssa82 = phi i32 [ %cnt.2, %for.inc17 ], [ %cnt.061, %for.cond1.preheader ]
%cmp2163 = icmp sgt i32 %N, 0
br i1 %cmp2163, label %if.end25.peel, label %for.end31
if.end25.peel: ; preds = %for.cond20.preheader
%wide.trip.count = zext i32 %N to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call28.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end31, label %if.end25
for.body2: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%cnt.157 = phi i32 [ %cnt.2, %for.inc ], [ %cnt.061, %for.cond1.preheader ]
%flag.156 = phi i32 [ %flag.2, %for.inc ], [ 0, %for.cond1.preheader ]
%indvars.iv.next66 = add nsw i64 %indvars.iv65, -1
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv65
%4 = load i32, ptr %gep, align 4, !tbaa !5
%cmp6 = icmp slt i32 %3, %4
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.body2
store i32 %4, ptr %arrayidx, align 4, !tbaa !5
store i32 %3, ptr %gep, align 4, !tbaa !5
%inc = add nsw i32 %cnt.157, 1
br label %for.inc
for.inc: ; preds = %for.body2, %if.then
%flag.2 = phi i32 [ 1, %if.then ], [ %flag.156, %for.body2 ]
%cnt.2 = phi i32 [ %inc, %if.then ], [ %cnt.157, %for.body2 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp = icmp slt i64 %indvars.iv71, %indvars.iv.next
br i1 %cmp, label %for.body2, label %for.inc17, !llvm.loop !9
for.inc17: ; preds = %for.inc
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%tobool.not = icmp eq i32 %flag.2, 0
br i1 %tobool.not, label %for.cond20.preheader, label %for.cond1.preheader, !llvm.loop !11
if.end25: ; preds = %if.end25.peel, %if.end25
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %if.end25 ], [ 1, %if.end25.peel ]
%putchar = tail call i32 @putchar(i32 32)
%arrayidx27 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv74
%5 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%call28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%exitcond.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count
br i1 %exitcond.not, label %for.end31, label %if.end25, !llvm.loop !12
for.end31: ; preds = %if.end25, %if.end25.peel, %for.cond20.preheader
%call32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.1.lcssa82)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %3, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %3, %entry ], [ %4, %for.body ]
call void @bubbleSort(ptr noundef nonnull %vla, i32 noundef %.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(void)
{
int N, i, j, t, flag, c = 0;
scanf("%d", &N);
int A[N];
for(i = 0; i < N; i++)
{
scanf("%d", &A[i]);
}
for(i = 0; i < N; i++)
{
flag = 1;
while(flag)
{
flag = 0;
for(j = N - 1; j > 0; j--)
{
if(A[j] < A[j - 1])
{
t = A[j];
A[j] = A[j-1];
A[j-1] = t;
flag = 1;
c++;
break;
}
}
}
}
for(i = 0; i < N - 1; i++)
{
printf("%d ", A[i]);
}
printf("%d\n%d\n", A[N - 1], c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_281992/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_281992/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %3, 0
br i1 %cmp62, label %for.body, label %for.cond30.preheader.for.end39_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp365 = icmp sgt i32 %5, 0
br i1 %cmp365, label %while.cond.preheader.preheader, label %for.cond30.preheader.for.end39_crit_edge
while.cond.preheader.preheader: ; preds = %for.cond2.preheader
%4 = zext i32 %5 to i64
br label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.inc27
%i.167 = phi i32 [ %inc28, %for.inc27 ], [ 0, %while.cond.preheader.preheader ]
%c.066 = phi i32 [ %c.164, %for.inc27 ], [ 0, %while.cond.preheader.preheader ]
br label %for.cond5.preheader
for.cond30.preheader: ; preds = %for.inc27
%cmp3270 = icmp sgt i32 %5, 1
br i1 %cmp3270, label %for.body33, label %for.cond30.preheader.for.end39_crit_edge
for.cond30.preheader.for.end39_crit_edge: ; preds = %entry, %for.cond2.preheader, %for.cond30.preheader
%c.0.lcssa90 = phi i32 [ %c.164, %for.cond30.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ]
%7 = phi i32 [ %5, %for.cond30.preheader ], [ %5, %for.cond2.preheader ], [ %3, %entry ]
%sub3169 = add nsw i32 %7, -1
%.pre = sext i32 %sub3169 to i64
br label %for.end39
for.cond5.preheader: ; preds = %for.end26, %while.cond.preheader
%c.164 = phi i32 [ %c.066, %while.cond.preheader ], [ %inc24, %for.end26 ]
br label %for.cond5
for.cond5: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv79 = phi i64 [ %4, %for.cond5.preheader ], [ %indvars.iv.next80, %for.body7 ]
%cmp6 = icmp slt i64 %indvars.iv79, 2
br i1 %cmp6, label %for.inc27, label %for.body7
for.body7: ; preds = %for.cond5
%indvars.iv.next80 = add nsw i64 %indvars.iv79, -1
%idxprom8 = and i64 %indvars.iv.next80, 4294967295
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub10 = add nuw i64 %indvars.iv79, 4294967294
%idxprom11 = and i64 %sub10, 4294967295
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %idxprom11
%9 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %8, %9
br i1 %cmp13, label %for.end26, label %for.cond5, !llvm.loop !11
for.end26: ; preds = %for.body7
%arrayidx9.le = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%arrayidx12.le = getelementptr inbounds i32, ptr %vla, i64 %idxprom11
store i32 %9, ptr %arrayidx9.le, align 4, !tbaa !5
store i32 %8, ptr %arrayidx12.le, align 4, !tbaa !5
%inc24 = add nsw i32 %c.164, 1
br label %for.cond5.preheader, !llvm.loop !12
for.inc27: ; preds = %for.cond5
%inc28 = add nuw nsw i32 %i.167, 1
%exitcond.not = icmp eq i32 %inc28, %5
br i1 %exitcond.not, label %for.cond30.preheader, label %while.cond.preheader, !llvm.loop !13
for.body33: ; preds = %for.cond30.preheader, %for.body33
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.body33 ], [ 0, %for.cond30.preheader ]
%arrayidx35 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv82
%10 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%11 = load i32, ptr %N, align 4, !tbaa !5
%sub31 = add nsw i32 %11, -1
%12 = sext i32 %sub31 to i64
%cmp32 = icmp slt i64 %indvars.iv.next83, %12
br i1 %cmp32, label %for.body33, label %for.end39, !llvm.loop !14
for.end39: ; preds = %for.body33, %for.cond30.preheader.for.end39_crit_edge
%c.0.lcssa89 = phi i32 [ %c.0.lcssa90, %for.cond30.preheader.for.end39_crit_edge ], [ %c.164, %for.body33 ]
%idxprom41.pre-phi = phi i64 [ %.pre, %for.cond30.preheader.for.end39_crit_edge ], [ %12, %for.body33 ]
%arrayidx42 = getelementptr inbounds i32, ptr %vla, i64 %idxprom41.pre-phi
%13 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13, i32 noundef %c.0.lcssa89)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define MAX 100
int main() {
int n, i, j, flag, tmp, cnt = 0;
int array[MAX];
scanf("%d\n", &n);
i = 0;
while ((scanf("%d", &array[i])) != EOF) {
i++;
}
flag = 1;
i = 0;
while (flag) {
flag = 0;
for (j = n-1; j >= i+1; j--) {
if (array[j] < array[j-1]) {
tmp = array[j];
array[j] = array[j-1];
array[j-1] = tmp;
flag = 1;
cnt++;
}
}
i++;
}
for (i = 0; i < n; i++) {
if (i == n-1) {
printf("%d\n", array[i]);
break;
}
printf("%d ", array[i]);
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282034/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282034/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%array = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %array) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%cmp.not = icmp eq i32 %call1, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.cond2.preheader, label %while.cond, !llvm.loop !5
while.cond2.preheader: ; preds = %while.cond
%0 = load i32, ptr %n, align 4, !tbaa !7
%1 = sext i32 %0 to i64
br label %while.body3
while.cond2.loopexit: ; preds = %for.inc
%tobool.not = icmp eq i32 %flag.2, 0
br i1 %tobool.not, label %for.cond24.preheader, label %while.body3, !llvm.loop !11
for.cond24.preheader: ; preds = %while.body3, %while.cond2.loopexit
%cnt.1.lcssa87 = phi i32 [ %cnt.2, %while.cond2.loopexit ], [ %cnt.069, %while.body3 ]
%cmp2570 = icmp sgt i32 %0, 0
br i1 %cmp2570, label %for.body26, label %for.end39
while.body3: ; preds = %while.cond2.preheader, %while.cond2.loopexit
%indvars.iv78 = phi i64 [ 0, %while.cond2.preheader ], [ %indvars.iv.next79, %while.cond2.loopexit ]
%cnt.069 = phi i32 [ 0, %while.cond2.preheader ], [ %cnt.2, %while.cond2.loopexit ]
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%cmp4.not.not61 = icmp slt i64 %indvars.iv.next79, %1
br i1 %cmp4.not.not61, label %for.body, label %for.cond24.preheader
for.body: ; preds = %while.body3, %for.inc
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.inc ], [ %1, %while.body3 ]
%cnt.164 = phi i32 [ %cnt.2, %for.inc ], [ %cnt.069, %while.body3 ]
%flag.163 = phi i32 [ %flag.2, %for.inc ], [ 0, %while.body3 ]
%indvars.iv.next75 = add nsw i64 %indvars.iv74, -1
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %indvars.iv.next75
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !7
%3 = add nsw i64 %indvars.iv74, -2
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %3
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !7
%cmp10 = icmp slt i32 %2, %4
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i32 %4, ptr %arrayidx6, align 4, !tbaa !7
store i32 %2, ptr %arrayidx9, align 4, !tbaa !7
%inc21 = add nsw i32 %cnt.164, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%flag.2 = phi i32 [ 1, %if.then ], [ %flag.163, %for.body ]
%cnt.2 = phi i32 [ %inc21, %if.then ], [ %cnt.164, %for.body ]
%cmp4.not.not = icmp sgt i64 %indvars.iv.next75, %indvars.iv.next79
br i1 %cmp4.not.not, label %for.body, label %while.cond2.loopexit, !llvm.loop !12
for.body26: ; preds = %for.cond24.preheader, %if.end33
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %if.end33 ], [ 0, %for.cond24.preheader ]
%5 = phi i32 [ %9, %if.end33 ], [ %0, %for.cond24.preheader ]
%sub27 = add nsw i32 %5, -1
%6 = zext i32 %sub27 to i64
%cmp28 = icmp eq i64 %indvars.iv81, %6
br i1 %cmp28, label %if.then29, label %if.end33
if.then29: ; preds = %for.body26
%idxprom30 = and i64 %indvars.iv81, 4294967295
%arrayidx31 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %idxprom30
%7 = load i32, ptr %arrayidx31, align 4, !tbaa !7
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
br label %for.end39
if.end33: ; preds = %for.body26
%arrayidx35 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %indvars.iv81
%8 = load i32, ptr %arrayidx35, align 4, !tbaa !7
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%9 = load i32, ptr %n, align 4, !tbaa !7
%10 = sext i32 %9 to i64
%cmp25 = icmp slt i64 %indvars.iv.next82, %10
br i1 %cmp25, label %for.body26, label %for.end39, !llvm.loop !13
for.end39: ; preds = %if.end33, %for.cond24.preheader, %if.then29
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cnt.1.lcssa87)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %array) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
|
#include <stdio.h>
static const int N = 1000;
int main(){
int i, j, A[N], length, swap, count = 0;
scanf("%d",&length);
for(i = 0; i < length; i++){
scanf("%d",&A[i]);
}
for(i = 0; i < length-1; i++){
for(j = length-1; j >= i+1; j--){
if(A[j] < A[j-1]){
swap = A[j];
A[j] = A[j-1];
A[j-1] = swap;
count++;
}
}
}
for(i = 0; i < length; i++){
printf("%d",A[i]);
if(i <= length-2) printf(" ");
}
printf("\n");
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282078/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282078/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%length = alloca i32, align 4
%vla65 = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %length) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %length)
%0 = load i32, ptr %length, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.end44
for.cond2.preheader: ; preds = %for.body
%cmp371 = icmp sgt i32 %3, 1
br i1 %cmp371, label %for.cond6.preheader.preheader, label %for.cond31.preheader
for.cond6.preheader.preheader: ; preds = %for.cond2.preheader
%sub = add nsw i32 %3, -1
%1 = zext i32 %3 to i64
%2 = add nsw i64 %1, -1
%wide.trip.count = zext i32 %sub to i64
%arrayidx10.phi.trans.insert = getelementptr inbounds i32, ptr %vla65, i64 %2
br label %for.cond6.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla65, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %length, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc28
%indvars.iv82 = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next83, %for.inc28 ]
%count.073 = phi i32 [ 0, %for.cond6.preheader.preheader ], [ %count.2, %for.inc28 ]
%.pre = load i32, ptr %arrayidx10.phi.trans.insert, align 4, !tbaa !5
br label %for.body8
for.cond31.preheader: ; preds = %for.inc28, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %count.2, %for.inc28 ]
%cmp3275 = icmp sgt i32 %3, 0
br i1 %cmp3275, label %for.body33, label %for.end44
for.body8: ; preds = %for.cond6.preheader, %for.inc26
%5 = phi i32 [ %.pre, %for.cond6.preheader ], [ %7, %for.inc26 ]
%indvars.iv79 = phi i64 [ %2, %for.cond6.preheader ], [ %indvars.iv.next80, %for.inc26 ]
%count.170 = phi i32 [ %count.073, %for.cond6.preheader ], [ %count.2, %for.inc26 ]
%indvars.iv.next80 = add nsw i64 %indvars.iv79, -1
%arrayidx13 = getelementptr inbounds i32, ptr %vla65, i64 %indvars.iv.next80
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp slt i32 %5, %6
br i1 %cmp14, label %if.then, label %for.inc26
if.then: ; preds = %for.body8
%arrayidx10 = getelementptr inbounds i32, ptr %vla65, i64 %indvars.iv79
store i32 %6, ptr %arrayidx10, align 4, !tbaa !5
store i32 %5, ptr %arrayidx13, align 4, !tbaa !5
%inc25 = add nsw i32 %count.170, 1
br label %for.inc26
for.inc26: ; preds = %for.body8, %if.then
%7 = phi i32 [ %5, %if.then ], [ %6, %for.body8 ]
%count.2 = phi i32 [ %inc25, %if.then ], [ %count.170, %for.body8 ]
%cmp7.not.not = icmp sgt i64 %indvars.iv.next80, %indvars.iv82
br i1 %cmp7.not.not, label %for.body8, label %for.inc28, !llvm.loop !11
for.inc28: ; preds = %for.inc26
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count
br i1 %exitcond.not, label %for.cond31.preheader, label %for.cond6.preheader, !llvm.loop !12
for.body33: ; preds = %for.cond31.preheader, %for.inc42
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.inc42 ], [ 0, %for.cond31.preheader ]
%arrayidx35 = getelementptr inbounds i32, ptr %vla65, i64 %indvars.iv85
%8 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%9 = load i32, ptr %length, align 4, !tbaa !5
%sub37 = add nsw i32 %9, -2
%10 = sext i32 %sub37 to i64
%cmp38.not = icmp sgt i64 %indvars.iv85, %10
br i1 %cmp38.not, label %for.inc42, label %if.then39
if.then39: ; preds = %for.body33
%putchar66 = call i32 @putchar(i32 32)
%.pre88 = load i32, ptr %length, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body33, %if.then39
%11 = phi i32 [ %9, %for.body33 ], [ %.pre88, %if.then39 ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%12 = sext i32 %11 to i64
%cmp32 = icmp slt i64 %indvars.iv.next86, %12
br i1 %cmp32, label %for.body33, label %for.end44, !llvm.loop !13
for.end44: ; preds = %for.inc42, %entry, %for.cond31.preheader
%count.0.lcssa92 = phi i32 [ %count.0.lcssa, %for.cond31.preheader ], [ 0, %entry ], [ %count.0.lcssa, %for.inc42 ]
%putchar = call i32 @putchar(i32 10)
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa92)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %length) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main () {
int i,j,n,c,len,array[100];
scanf("%d",&len);
for(i=0 ; i<len ; i++)
scanf("%d",&array[i]);
for(i=0 ; i<len ; i++){
for(j=len-1 ; j>i ; j--){
if(array[j] < array[j-1]){
n = array[j-1];
array[j-1] = array[j];
array[j] = n;
c++;
}
}
}
for(i=0 ; i<len ; i++){
if(i==len-1)
printf("%d",array[i]);
else
printf("%d ",array[i]);
}
printf("\n%d\n",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%len = alloca i32, align 4
%array = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %len) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %array) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len)
%0 = load i32, ptr %len, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp68)
br label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp376 = icmp sgt i32 %4, 0
call void @llvm.assume(i1 %cmp376)
%j.070 = add nsw i32 %4, -1
%1 = zext i32 %4 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.070 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %len, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.inc27
%indvars.iv92 = phi i64 [ 0, %for.cond2.preheader ], [ %indvars.iv.next93, %for.inc27 ]
%c.078 = phi i32 [ undef, %for.cond2.preheader ], [ %c.1.lcssa, %for.inc27 ]
%cmp671 = icmp ult i64 %indvars.iv92, %3
br i1 %cmp671, label %for.body7, label %for.inc27
for.cond30.preheader: ; preds = %for.inc27
br i1 %cmp376, label %for.body32, label %for.end45
for.body7: ; preds = %for.cond5.preheader, %for.inc25
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.inc25 ], [ %1, %for.cond5.preheader ]
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.inc25 ], [ %2, %for.cond5.preheader ]
%c.173 = phi i32 [ %c.2, %for.inc25 ], [ %c.078, %for.cond5.preheader ]
%indvars.iv.next87 = add nsw i64 %indvars.iv86, -1
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %indvars.iv84
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%7 = add nsw i64 %indvars.iv86, -2
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %7
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp slt i32 %6, %8
br i1 %cmp13, label %if.then, label %for.inc25
if.then: ; preds = %for.body7
store i32 %6, ptr %arrayidx12, align 4, !tbaa !5
store i32 %8, ptr %arrayidx9, align 4, !tbaa !5
%inc24 = add nsw i32 %c.173, 1
br label %for.inc25
for.inc25: ; preds = %for.body7, %if.then
%c.2 = phi i32 [ %inc24, %if.then ], [ %c.173, %for.body7 ]
%indvars.iv.next85 = add nsw i64 %indvars.iv84, -1
%cmp6 = icmp sgt i64 %indvars.iv.next85, %indvars.iv92
br i1 %cmp6, label %for.body7, label %for.inc27, !llvm.loop !11
for.inc27: ; preds = %for.inc25, %for.cond5.preheader
%c.1.lcssa = phi i32 [ %c.078, %for.cond5.preheader ], [ %c.2, %for.inc25 ]
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
br i1 %exitcond.not, label %for.cond30.preheader, label %for.cond5.preheader, !llvm.loop !12
for.body32: ; preds = %for.cond30.preheader, %for.body32
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body32 ], [ 0, %for.cond30.preheader ]
%9 = phi i32 [ %12, %for.body32 ], [ %4, %for.cond30.preheader ]
%sub33 = add nsw i32 %9, -1
%10 = zext i32 %sub33 to i64
%cmp34 = icmp eq i64 %indvars.iv95, %10
%arrayidx37 = getelementptr inbounds [100 x i32], ptr %array, i64 0, i64 %indvars.iv95
%11 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp34, ptr @.str, ptr @.str.1
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %11)
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%12 = load i32, ptr %len, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp31 = icmp slt i64 %indvars.iv.next96, %13
br i1 %cmp31, label %for.body32, label %for.end45, !llvm.loop !13
for.end45: ; preds = %for.body32, %for.cond30.preheader
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c.1.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %array) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %len) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int handan=1,a,i,j,k,kaisuu=0;
int N,suuretu[100];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&suuretu[i]);
}
while(handan){
handan=0;
for(j=N-1;j>=1;j--){
if(suuretu[j]<suuretu[j-1]){
k=suuretu[j];
suuretu[j]=suuretu[j-1];
suuretu[j-1]=k;
handan=1;
kaisuu++;
}
}
}
for(i=0;i<N-1;i++){
printf("%d ",suuretu[i]);
}
printf("%d\n",suuretu[N-1]);
printf("%d\n",kaisuu);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282164/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282164/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%suuretu = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %suuretu) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.cond24.preheader.for.end33_crit_edge
while.cond.preheader: ; preds = %for.body
%cmp356 = icmp sgt i32 %4, 1
br i1 %cmp356, label %for.cond2.preheader.us.preheader, label %for.cond24.preheader.for.end33_crit_edge
for.cond2.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %4 to i64
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.backedge, %for.cond2.preheader.us.preheader
%indvars.iv71 = phi i64 [ %1, %for.cond2.preheader.us.preheader ], [ %indvars.iv71.be, %for.body4.us.backedge ]
%kaisuu.159.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %kaisuu.2.us, %for.body4.us.backedge ]
%handan.158.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %handan.158.us.be, %for.body4.us.backedge ]
%indvars.iv.next72 = add nsw i64 %indvars.iv71, -1
%idxprom5.us = and i64 %indvars.iv.next72, 4294967295
%arrayidx6.us = getelementptr inbounds [100 x i32], ptr %suuretu, i64 0, i64 %idxprom5.us
%2 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5
%sub7.us = add i64 %indvars.iv71, 4294967294
%idxprom8.us = and i64 %sub7.us, 4294967295
%arrayidx9.us = getelementptr inbounds [100 x i32], ptr %suuretu, i64 0, i64 %idxprom8.us
%3 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%cmp10.us = icmp slt i32 %2, %3
br i1 %cmp10.us, label %if.then.us, label %for.inc22.us
if.then.us: ; preds = %for.body4.us
store i32 %3, ptr %arrayidx6.us, align 4, !tbaa !5
store i32 %2, ptr %arrayidx9.us, align 4, !tbaa !5
%inc21.us = add nsw i32 %kaisuu.159.us, 1
br label %for.inc22.us
for.inc22.us: ; preds = %if.then.us, %for.body4.us
%handan.2.us = phi i32 [ 1, %if.then.us ], [ %handan.158.us, %for.body4.us ]
%kaisuu.2.us = phi i32 [ %inc21.us, %if.then.us ], [ %kaisuu.159.us, %for.body4.us ]
%cmp3.us = icmp sgt i64 %indvars.iv71, 2
br i1 %cmp3.us, label %for.body4.us.backedge, label %for.cond2.while.cond.loopexit_crit_edge.us
for.body4.us.backedge: ; preds = %for.inc22.us, %for.cond2.while.cond.loopexit_crit_edge.us
%indvars.iv71.be = phi i64 [ %indvars.iv.next72, %for.inc22.us ], [ %1, %for.cond2.while.cond.loopexit_crit_edge.us ]
%handan.158.us.be = phi i32 [ %handan.2.us, %for.inc22.us ], [ 0, %for.cond2.while.cond.loopexit_crit_edge.us ]
br label %for.body4.us, !llvm.loop !9
for.cond2.while.cond.loopexit_crit_edge.us: ; preds = %for.inc22.us
%tobool.not.us = icmp eq i32 %handan.2.us, 0
br i1 %tobool.not.us, label %for.cond24.preheader, label %for.body4.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %suuretu, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond24.preheader: ; preds = %for.cond2.while.cond.loopexit_crit_edge.us
br i1 %cmp356, label %for.body27, label %for.cond24.preheader.for.end33_crit_edge
for.cond24.preheader.for.end33_crit_edge: ; preds = %entry, %while.cond.preheader, %for.cond24.preheader
%.us-phi83 = phi i32 [ %kaisuu.2.us, %for.cond24.preheader ], [ 0, %while.cond.preheader ], [ 0, %entry ]
%6 = phi i32 [ %4, %for.cond24.preheader ], [ %4, %while.cond.preheader ], [ %0, %entry ]
%sub2564 = add nsw i32 %6, -1
%.pre = sext i32 %sub2564 to i64
br label %for.end33
for.body27: ; preds = %for.cond24.preheader, %for.body27
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body27 ], [ 0, %for.cond24.preheader ]
%arrayidx29 = getelementptr inbounds [100 x i32], ptr %suuretu, i64 0, i64 %indvars.iv74
%7 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%8 = load i32, ptr %N, align 4, !tbaa !5
%sub25 = add nsw i32 %8, -1
%9 = sext i32 %sub25 to i64
%cmp26 = icmp slt i64 %indvars.iv.next75, %9
br i1 %cmp26, label %for.body27, label %for.end33, !llvm.loop !12
for.end33: ; preds = %for.body27, %for.cond24.preheader.for.end33_crit_edge
%.us-phi82 = phi i32 [ %.us-phi83, %for.cond24.preheader.for.end33_crit_edge ], [ %kaisuu.2.us, %for.body27 ]
%idxprom35.pre-phi = phi i64 [ %.pre, %for.cond24.preheader.for.end33_crit_edge ], [ %9, %for.body27 ]
%arrayidx36 = getelementptr inbounds [100 x i32], ptr %suuretu, i64 0, i64 %idxprom35.pre-phi
%10 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi82)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %suuretu) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
void
swap(int *x, int *y)
{
int tmp = *x;
*x = *y;
*y = tmp;
}
void
bsort(int *list,int n)
{
int i,j;
int count = 0;
for(i=0; i<n; i++){
for(j=n-1; i<j; j--){
if(list[j-1] > list[j]){
swap(&list[j-1],&list[j]);
count++;
}
}
}
for(i=0; i<n; i++){
printf("%d",list[i]);
if(i != (n-1)){
printf(" ");
}
}
printf("\n%d\n", count);
}
int
main()
{
int n;
scanf("%d",&n);
int *list = (int *)malloc(n * sizeof(int));
int i;
for(i=0; i<n; i++){
scanf("%d", &list[i]);
}
bsort(list,n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282207/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @bsort(ptr nocapture noundef %list, i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp54 = icmp sgt i32 %n, 0
br i1 %cmp54, label %for.cond1.preheader.lr.ph, label %for.end28
for.cond1.preheader.lr.ph: ; preds = %entry
%j.049 = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.049 to i64
%wide.trip.count = zext i32 %n to i64
%invariant.gep = getelementptr i32, ptr %list, i64 -2
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc13
%indvars.iv66 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next67, %for.inc13 ]
%count.056 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %count.1.lcssa, %for.inc13 ]
%cmp250 = icmp ult i64 %indvars.iv66, %2
br i1 %cmp250, label %for.body3, label %for.inc13
for.cond16.preheader: ; preds = %for.inc13
br i1 %cmp54, label %for.body18.lr.ph, label %for.end28
for.body18.lr.ph: ; preds = %for.cond16.preheader
%sub21 = add nsw i32 %n, -1
%3 = zext i32 %sub21 to i64
%wide.trip.count72 = zext i32 %n to i64
br label %for.body18
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%count.152 = phi i32 [ %count.2, %for.inc ], [ %count.056, %for.cond1.preheader ]
%indvars.iv.next61 = add nsw i64 %indvars.iv60, -1
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv60
%4 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds i32, ptr %list, i64 %indvars.iv
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %4, %5
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %for.body3
store i32 %5, ptr %gep, align 4, !tbaa !5
store i32 %4, ptr %arrayidx6, align 4, !tbaa !5
%inc = add nsw i32 %count.152, 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%count.2 = phi i32 [ %inc, %if.then ], [ %count.152, %for.body3 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp slt i64 %indvars.iv66, %indvars.iv.next
br i1 %cmp2, label %for.body3, label %for.inc13, !llvm.loop !9
for.inc13: ; preds = %for.inc, %for.cond1.preheader
%count.1.lcssa = phi i32 [ %count.056, %for.cond1.preheader ], [ %count.2, %for.inc ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %for.cond16.preheader, label %for.cond1.preheader, !llvm.loop !11
for.body18: ; preds = %for.body18.lr.ph, %for.inc26
%indvars.iv69 = phi i64 [ 0, %for.body18.lr.ph ], [ %indvars.iv.next70, %for.inc26 ]
%arrayidx20 = getelementptr inbounds i32, ptr %list, i64 %indvars.iv69
%6 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%cmp22.not = icmp eq i64 %indvars.iv69, %3
br i1 %cmp22.not, label %for.inc26, label %if.then23
if.then23: ; preds = %for.body18
%putchar = tail call i32 @putchar(i32 32)
br label %for.inc26
for.inc26: ; preds = %for.body18, %if.then23
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond73.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count72
br i1 %exitcond73.not, label %for.end28, label %for.body18, !llvm.loop !12
for.end28: ; preds = %for.inc26, %entry, %for.cond16.preheader
%count.0.lcssa75 = phi i32 [ %count.1.lcssa, %for.cond16.preheader ], [ 0, %entry ], [ %count.1.lcssa, %for.inc26 ]
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa75)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %bsort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%1 = sext i32 %.pr to i64
%cmp = icmp slt i64 %indvars.iv.next, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp54.i = icmp sgt i32 %.pr, 0
br i1 %cmp54.i, label %for.cond1.preheader.lr.ph.i, label %bsort.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end
%j.049.i = add nsw i32 %.pr, -1
%2 = zext i32 %.pr to i64
%3 = add nsw i64 %2, -1
%4 = zext i32 %j.049.i to i64
%invariant.gep.i = getelementptr i32, ptr %call1, i64 -2
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc13.i, %for.cond1.preheader.lr.ph.i
%indvars.iv66.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next67.i, %for.inc13.i ]
%count.056.i = phi i32 [ 0, %for.cond1.preheader.lr.ph.i ], [ %count.1.lcssa.i, %for.inc13.i ]
%cmp250.i = icmp ult i64 %indvars.iv66.i, %4
br i1 %cmp250.i, label %for.body3.i, label %for.inc13.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv60.i = phi i64 [ %indvars.iv.next61.i, %for.inc.i ], [ %2, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %3, %for.cond1.preheader.i ]
%count.152.i = phi i32 [ %count.2.i, %for.inc.i ], [ %count.056.i, %for.cond1.preheader.i ]
%indvars.iv.next61.i = add nsw i64 %indvars.iv60.i, -1
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv60.i
%5 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx6.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%cmp7.i = icmp sgt i32 %5, %6
br i1 %cmp7.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
store i32 %6, ptr %gep.i, align 4, !tbaa !5
store i32 %5, ptr %arrayidx6.i, align 4, !tbaa !5
%inc.i = add nsw i32 %count.152.i, 1
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%count.2.i = phi i32 [ %inc.i, %if.then.i ], [ %count.152.i, %for.body3.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%cmp2.i = icmp slt i64 %indvars.iv66.i, %indvars.iv.next.i
br i1 %cmp2.i, label %for.body3.i, label %for.inc13.i, !llvm.loop !9
for.inc13.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%count.1.lcssa.i = phi i32 [ %count.056.i, %for.cond1.preheader.i ], [ %count.2.i, %for.inc.i ]
%indvars.iv.next67.i = add nuw nsw i64 %indvars.iv66.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next67.i, %2
br i1 %exitcond.not.i, label %for.body18.i, label %for.cond1.preheader.i, !llvm.loop !11
for.body18.i: ; preds = %for.inc13.i, %for.inc26.i
%indvars.iv69.i = phi i64 [ %indvars.iv.next70.i, %for.inc26.i ], [ 0, %for.inc13.i ]
%arrayidx20.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv69.i
%7 = load i32, ptr %arrayidx20.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%cmp22.not.i = icmp eq i64 %indvars.iv69.i, %4
br i1 %cmp22.not.i, label %for.inc26.i, label %if.then23.i
if.then23.i: ; preds = %for.body18.i
%putchar.i = call i32 @putchar(i32 32)
br label %for.inc26.i
for.inc26.i: ; preds = %if.then23.i, %for.body18.i
%indvars.iv.next70.i = add nuw nsw i64 %indvars.iv69.i, 1
%exitcond73.not.i = icmp eq i64 %indvars.iv.next70.i, %2
br i1 %exitcond73.not.i, label %bsort.exit, label %for.body18.i, !llvm.loop !12
bsort.exit: ; preds = %for.inc26.i, %entry, %for.end
%count.0.lcssa75.i = phi i32 [ 0, %for.end ], [ 0, %entry ], [ %count.1.lcssa.i, %for.inc26.i ]
%call29.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa75.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
void bubbleSort(int A[100], int n){
int j, flag, swap;
int cnt = 0;
flag = 1;
while(flag){
flag = 0;
for(j=n-1; j>0; j--){
if(A[j] < A[j-1]){
swap = A[j-1];
A[j-1] = A[j];
A[j] = swap;
flag = 1;
cnt++;
}
}
}
printf("%d", A[0]);
for(j=1; j<n; j++){
printf(" %d", A[j]);
}
printf("\n");
printf("%d\n", cnt);
}
int main(){
int i, N, A[100];
scanf("%d", &N);
for(i=0; i<N; i++){
scanf("%d", &A[i]);
}
bubbleSort(A,N);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @bubbleSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp48 = icmp sgt i32 %n, 1
br i1 %cmp48, label %for.cond.preheader.us.preheader, label %while.end.thread
while.end.thread: ; preds = %entry
%0 = load i32, ptr %A, align 4, !tbaa !5
%call63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
br label %for.end24
for.cond.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %n to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader
%indvars.iv = phi i64 [ %1, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ]
%cnt.151.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %cnt.2.us, %for.body.us.backedge ]
%flag.149.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.149.us.be, %for.body.us.backedge ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom.us = and i64 %indvars.iv.next, 4294967295
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
%2 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%sub1.us = add i64 %indvars.iv, 4294967294
%idxprom2.us = and i64 %sub1.us, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %A, i64 %idxprom2.us
%3 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %2, %3
br i1 %cmp4.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body.us
store i32 %2, ptr %arrayidx3.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx.us, align 4, !tbaa !5
%inc.us = add nsw i32 %cnt.151.us, 1
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.149.us, %for.body.us ]
%cnt.2.us = phi i32 [ %inc.us, %if.then.us ], [ %cnt.151.us, %for.body.us ]
%cmp.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us
for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %1, %for.cond.while.cond.loopexit_crit_edge.us ]
%flag.149.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ]
br label %for.body.us, !llvm.loop !9
for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %while.end, label %for.body.us.backedge
while.end: ; preds = %for.cond.while.cond.loopexit_crit_edge.us
%4 = load i32, ptr %A, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
br i1 %cmp48, label %for.body18.preheader, label %for.end24
for.body18.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %n to i64
br label %for.body18
for.body18: ; preds = %for.body18.preheader, %for.body18
%indvars.iv58 = phi i64 [ 1, %for.body18.preheader ], [ %indvars.iv.next59, %for.body18 ]
%arrayidx20 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv58
%5 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count
br i1 %exitcond.not, label %for.end24, label %for.body18, !llvm.loop !11
for.end24: ; preds = %for.body18, %while.end.thread, %while.end
%.us-phi64 = phi i32 [ 0, %while.end.thread ], [ %cnt.2.us, %while.end ], [ %cnt.2.us, %for.body18 ]
%putchar = tail call i32 @putchar(i32 10)
%call26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi64)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @bubbleSort(ptr noundef nonnull %A, i32 noundef %.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
void bubblesort(int num[], int array_size){
int flag,counter,i,j,temp;
counter=0;
flag=1;
while(flag==1){
flag=0;
for(i=array_size-1;i>0;i--){
if(num[i]<num[i-1]){
temp=num[i];
num[i]=num[i-1];
num[i-1]=temp;
flag = 1;
counter++;
}
}
}
for(j=0;j<array_size;j++){
if(j>0)printf(" ");
printf("%d", num[j]);
}
printf("\n%d\n",counter);
}
int main(){
int i,j,n;
scanf("%d",&n);
int A[n];
for(i=0;i<n;i++){
scanf("%d", &A[i]);
}
bubblesort(A,n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282294/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282294/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @bubblesort(ptr nocapture noundef %num, i32 noundef %array_size) local_unnamed_addr #0 {
entry:
%cmp149 = icmp sgt i32 %array_size, 1
br i1 %cmp149, label %for.cond.preheader.us.preheader, label %for.cond16.preheader
for.cond.preheader.us.preheader: ; preds = %entry
%0 = zext i32 %array_size to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader
%indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ]
%flag.152.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.152.us.be, %for.body.us.backedge ]
%counter.150.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %counter.2.us, %for.body.us.backedge ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom.us = and i64 %indvars.iv.next, 4294967295
%arrayidx.us = getelementptr inbounds i32, ptr %num, i64 %idxprom.us
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%sub2.us = add i64 %indvars.iv, 4294967294
%idxprom3.us = and i64 %sub2.us, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %num, i64 %idxprom3.us
%2 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %1, %2
br i1 %cmp5.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body.us
store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5
store i32 %1, ptr %arrayidx4.us, align 4, !tbaa !5
%inc.us = add nsw i32 %counter.150.us, 1
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body.us
%counter.2.us = phi i32 [ %inc.us, %if.then.us ], [ %counter.150.us, %for.body.us ]
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.152.us, %for.body.us ]
%cmp1.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp1.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us
for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ]
%flag.152.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ]
br label %for.body.us, !llvm.loop !9
for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us
%cmp.us = icmp eq i32 %flag.2.us, 1
br i1 %cmp.us, label %for.body.us.backedge, label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry
%.us-phi = phi i32 [ 0, %entry ], [ %counter.2.us, %for.cond.while.cond.loopexit_crit_edge.us ]
%cmp1756 = icmp sgt i32 %array_size, 0
br i1 %cmp1756, label %if.end21.peel, label %for.end27
if.end21.peel: ; preds = %for.cond16.preheader
%wide.trip.count = zext i32 %array_size to i64
%.pre = load i32, ptr %num, align 4, !tbaa !5
%call24.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %array_size, 1
br i1 %exitcond.peel.not, label %for.end27, label %if.end21
if.end21: ; preds = %if.end21.peel, %if.end21
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %if.end21 ], [ 1, %if.end21.peel ]
%putchar = tail call i32 @putchar(i32 32)
%arrayidx23 = getelementptr inbounds i32, ptr %num, i64 %indvars.iv59
%3 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%call24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.end27, label %if.end21, !llvm.loop !11
for.end27: ; preds = %if.end21, %if.end21.peel, %for.cond16.preheader
%call28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %3, 0
br i1 %cmp4, label %for.body, label %bubblesort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp149.i = icmp sgt i32 %4, 1
br i1 %cmp149.i, label %for.cond.preheader.us.preheader.i, label %for.cond16.preheader.i
for.cond.preheader.us.preheader.i: ; preds = %for.end
%6 = zext i32 %4 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i
%indvars.iv.i = phi i64 [ %6, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ]
%flag.152.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.152.us.i.be, %for.body.us.i.backedge ]
%counter.150.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %counter.2.us.i, %for.body.us.i.backedge ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295
%arrayidx.us.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom.us.i
%7 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
%sub2.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294
%idxprom3.us.i = and i64 %sub2.us.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom3.us.i
%8 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp slt i32 %7, %8
br i1 %cmp5.us.i, label %if.then.us.i, label %for.inc.us.i
if.then.us.i: ; preds = %for.body.us.i
store i32 %8, ptr %arrayidx.us.i, align 4, !tbaa !5
store i32 %7, ptr %arrayidx4.us.i, align 4, !tbaa !5
%inc.us.i = add nsw i32 %counter.150.us.i, 1
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i
%counter.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %counter.150.us.i, %for.body.us.i ]
%flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.152.us.i, %for.body.us.i ]
%cmp1.us.i = icmp sgt i64 %indvars.iv.i, 2
br i1 %cmp1.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i
for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i
%indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %6, %for.cond.while.cond.loopexit_crit_edge.us.i ]
%flag.152.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ]
br label %for.body.us.i, !llvm.loop !9
for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i
%cmp.us.i = icmp eq i32 %flag.2.us.i, 1
br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond16.preheader.i
for.cond16.preheader.i: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end
%.us-phi.i = phi i32 [ 0, %for.end ], [ %counter.2.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i ]
%cmp1756.i = icmp sgt i32 %4, 0
br i1 %cmp1756.i, label %if.end21.peel.i, label %bubblesort.exit
if.end21.peel.i: ; preds = %for.cond16.preheader.i
%wide.trip.count.i = zext i32 %4 to i64
%.pre.i = load i32, ptr %vla, align 16, !tbaa !5
%call24.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %4, 1
br i1 %exitcond.peel.not.i, label %bubblesort.exit, label %if.end21.i
if.end21.i: ; preds = %if.end21.peel.i, %if.end21.i
%indvars.iv59.i = phi i64 [ %indvars.iv.next60.i, %if.end21.i ], [ 1, %if.end21.peel.i ]
%putchar.i = call i32 @putchar(i32 32)
%arrayidx23.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv59.i
%9 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%call24.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next60.i = add nuw nsw i64 %indvars.iv59.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next60.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %bubblesort.exit, label %if.end21.i, !llvm.loop !11
bubblesort.exit: ; preds = %if.end21.i, %entry, %for.cond16.preheader.i, %if.end21.peel.i
%.us-phi.i14 = phi i32 [ %.us-phi.i, %for.cond16.preheader.i ], [ %.us-phi.i, %if.end21.peel.i ], [ 0, %entry ], [ %.us-phi.i, %if.end21.i ]
%call28.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i14)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void){
int n;
scanf("%d", &n);
int a[111];
int i;
for(i=0;i<n;i++) scanf("%d",a+i);
int flg = 1, cnt = 0;
while(flg){
flg = 0;
int j;
for(j = n - 1; j > 0; j--){
if(a[j] < a[j - 1]){
int tmp = a[j - 1];
a[j - 1] = a[j];
a[j] = tmp;
flg = 1;
cnt = cnt + 1;
}
}
}
for(i=0;i < n;i++) printf("%d%c",a[i]," \n"[i==n - 1]);
printf("%d\n", cnt);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282337/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282337/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c" \0A\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [111 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 444, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end34
while.cond.preheader: ; preds = %for.body
%cmp355 = icmp sgt i32 %4, 1
br i1 %cmp355, label %for.cond2.preheader.us.preheader, label %for.cond21.preheader
for.cond2.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %4 to i64
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.backedge, %for.cond2.preheader.us.preheader
%indvars.iv67 = phi i64 [ %1, %for.cond2.preheader.us.preheader ], [ %indvars.iv67.be, %for.body4.us.backedge ]
%cnt.157.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %cnt.2.us, %for.body4.us.backedge ]
%flg.156.us = phi i32 [ 0, %for.cond2.preheader.us.preheader ], [ %flg.156.us.be, %for.body4.us.backedge ]
%indvars.iv.next68 = add nsw i64 %indvars.iv67, -1
%idxprom.us = and i64 %indvars.iv.next68, 4294967295
%arrayidx.us = getelementptr inbounds [111 x i32], ptr %a, i64 0, i64 %idxprom.us
%2 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%sub5.us = add i64 %indvars.iv67, 4294967294
%idxprom6.us = and i64 %sub5.us, 4294967295
%arrayidx7.us = getelementptr inbounds [111 x i32], ptr %a, i64 0, i64 %idxprom6.us
%3 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5
%cmp8.us = icmp slt i32 %2, %3
br i1 %cmp8.us, label %if.then.us, label %for.inc19.us
if.then.us: ; preds = %for.body4.us
store i32 %2, ptr %arrayidx7.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx.us, align 4, !tbaa !5
%add.us = add nsw i32 %cnt.157.us, 1
br label %for.inc19.us
for.inc19.us: ; preds = %if.then.us, %for.body4.us
%flg.2.us = phi i32 [ 1, %if.then.us ], [ %flg.156.us, %for.body4.us ]
%cnt.2.us = phi i32 [ %add.us, %if.then.us ], [ %cnt.157.us, %for.body4.us ]
%cmp3.us = icmp sgt i64 %indvars.iv67, 2
br i1 %cmp3.us, label %for.body4.us.backedge, label %for.cond2.while.cond.loopexit_crit_edge.us
for.body4.us.backedge: ; preds = %for.inc19.us, %for.cond2.while.cond.loopexit_crit_edge.us
%indvars.iv67.be = phi i64 [ %indvars.iv.next68, %for.inc19.us ], [ %1, %for.cond2.while.cond.loopexit_crit_edge.us ]
%flg.156.us.be = phi i32 [ %flg.2.us, %for.inc19.us ], [ 0, %for.cond2.while.cond.loopexit_crit_edge.us ]
br label %for.body4.us, !llvm.loop !9
for.cond2.while.cond.loopexit_crit_edge.us: ; preds = %for.inc19.us
%tobool.not.us = icmp eq i32 %flg.2.us, 0
br i1 %tobool.not.us, label %for.cond21.preheader, label %for.body4.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond21.preheader: ; preds = %for.cond2.while.cond.loopexit_crit_edge.us, %while.cond.preheader
%.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %cnt.2.us, %for.cond2.while.cond.loopexit_crit_edge.us ]
%cmp2263 = icmp sgt i32 %4, 0
br i1 %cmp2263, label %for.body23, label %for.end34
for.body23: ; preds = %for.cond21.preheader, %for.body23
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body23 ], [ 0, %for.cond21.preheader ]
%6 = phi i32 [ %10, %for.body23 ], [ %4, %for.cond21.preheader ]
%arrayidx25 = getelementptr inbounds [111 x i32], ptr %a, i64 0, i64 %indvars.iv70
%7 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%sub26 = add nsw i32 %6, -1
%8 = zext i32 %sub26 to i64
%cmp27 = icmp eq i64 %indvars.iv70, %8
%idxprom28 = zext i1 %cmp27 to i64
%arrayidx29 = getelementptr inbounds [3 x i8], ptr @.str.2, i64 0, i64 %idxprom28
%9 = load i8, ptr %arrayidx29, align 1, !tbaa !12
%conv30 = sext i8 %9 to i32
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7, i32 noundef %conv30)
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp22 = icmp slt i64 %indvars.iv.next71, %11
br i1 %cmp22, label %for.body23, label %for.end34, !llvm.loop !13
for.end34: ; preds = %for.body23, %entry, %for.cond21.preheader
%.us-phi77 = phi i32 [ %.us-phi, %for.cond21.preheader ], [ 0, %entry ], [ %.us-phi, %for.body23 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi77)
call void @llvm.lifetime.end.p0(i64 444, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
|
// AOJ ALDS1_2_A Bubble Sort
// 2018.4.27 bal4u
#include <stdio.h>
int bubble_sort(int n, int *a)
{
int i, f, x;
int ans = 0;
do {
f = 0;
for (i = n-1; i > 0; i--) {
if (a[i] < a[i-1]) {
x = a[i], a[i] = a[i-1], a[i-1] = x;
ans++;
f = 1;
}
}
} while (f);
return ans;
}
//#define getchar_unlocked() getchar()
int in()
{
int n = 0, c = getchar_unlocked();
do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
return n;
}
int a[102];
int main()
{
int N, i, k;
N = in();
for (i = 0; i < N; i++) a[i] = in();
k = bubble_sort(N, a);
printf("%d", a[0]);
for (i = 1; i < N; i++) printf(" %d", a[i]);
putchar('\n');
printf("%d\n", k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282380/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@a = dso_local local_unnamed_addr global [102 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bubble_sort(i32 noundef %n, ptr nocapture noundef %a) local_unnamed_addr #0 {
entry:
%cmp30 = icmp sgt i32 %n, 1
br i1 %cmp30, label %do.body.us.preheader, label %do.end
do.body.us.preheader: ; preds = %entry
%0 = zext i32 %n to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.backedge, %do.body.us.preheader
%indvars.iv = phi i64 [ %0, %do.body.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ]
%ans.133.us = phi i32 [ 0, %do.body.us.preheader ], [ %ans.2.us, %for.body.us.backedge ]
%f.031.us = phi i32 [ 0, %do.body.us.preheader ], [ %f.031.us.be, %for.body.us.backedge ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom.us = and i64 %indvars.iv.next, 4294967295
%arrayidx.us = getelementptr inbounds i32, ptr %a, i64 %idxprom.us
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%sub1.us = add i64 %indvars.iv, 4294967294
%idxprom2.us = and i64 %sub1.us, 4294967295
%arrayidx3.us = getelementptr inbounds i32, ptr %a, i64 %idxprom2.us
%2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5
%cmp4.us = icmp slt i32 %1, %2
br i1 %cmp4.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body.us
store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5
store i32 %1, ptr %arrayidx3.us, align 4, !tbaa !5
%inc.us = add nsw i32 %ans.133.us, 1
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body.us
%f.1.us = phi i32 [ 1, %if.then.us ], [ %f.031.us, %for.body.us ]
%ans.2.us = phi i32 [ %inc.us, %if.then.us ], [ %ans.133.us, %for.body.us ]
%cmp.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp.us, label %for.body.us.backedge, label %for.cond.do.cond_crit_edge.us
for.body.us.backedge: ; preds = %for.inc.us, %for.cond.do.cond_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.do.cond_crit_edge.us ]
%f.031.us.be = phi i32 [ %f.1.us, %for.inc.us ], [ 0, %for.cond.do.cond_crit_edge.us ]
br label %for.body.us, !llvm.loop !9
for.cond.do.cond_crit_edge.us: ; preds = %for.inc.us
%tobool.not.us = icmp eq i32 %f.1.us, 0
br i1 %tobool.not.us, label %do.end, label %for.body.us.backedge
do.end: ; preds = %for.cond.do.cond_crit_edge.us, %entry
%.us-phi = phi i32 [ 0, %entry ], [ %ans.2.us, %for.cond.do.cond_crit_edge.us ]
ret i32 %.us-phi
}
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !11
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !13
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !17
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !18
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !11
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !13
%3 = load i8, ptr %1, align 1, !tbaa !19
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !13
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !17
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !18
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre = load ptr, ptr @stdin, align 8, !tbaa !11
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !13
%7 = load i8, ptr %5, align 1, !tbaa !19
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !20
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !11
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !13
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !17
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !18
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !11
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !13
%3 = load i8, ptr %1, align 1, !tbaa !19
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph72 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%4 = phi ptr [ %8, %getchar_unlocked.exit13.i ], [ %.ph72, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !13
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !17
%cmp.not.i6.i = icmp ult ptr %5, %6
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !18
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !11
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !13
%7 = load i8, ptr %5, align 1, !tbaa !19
%conv3.i12.i = zext i8 %7 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%8 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i, label %do.body.i, label %for.cond.preheader, !llvm.loop !20
for.cond.preheader: ; preds = %getchar_unlocked.exit13.i
%cmp53 = icmp sgt i32 %add.i, 0
br i1 %cmp53, label %for.body.preheader, label %bubble_sort.exit.thread
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %add.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %in.exit52
%9 = phi ptr [ %8, %for.body.preheader ], [ %18, %in.exit52 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %in.exit52 ]
%_IO_read_ptr.i.i22 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 1
%10 = load ptr, ptr %_IO_read_ptr.i.i22, align 8, !tbaa !13
%_IO_read_end.i.i23 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 2
%11 = load ptr, ptr %_IO_read_end.i.i23, align 8, !tbaa !17
%cmp.not.i.i24 = icmp ult ptr %10, %11
br i1 %cmp.not.i.i24, label %cond.false.i.i49, label %cond.true.i.i25, !prof !18
cond.true.i.i25: ; preds = %for.body
%call.i.i26 = tail call i32 @__uflow(ptr noundef nonnull %9) #4
%.pre14.pre.i27 = load ptr, ptr @stdin, align 8, !tbaa !11
br label %do.body.i31.preheader
cond.false.i.i49: ; preds = %for.body
%incdec.ptr.i.i50 = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i.i50, ptr %_IO_read_ptr.i.i22, align 8, !tbaa !13
%12 = load i8, ptr %10, align 1, !tbaa !19
%conv3.i.i51 = zext i8 %12 to i32
br label %do.body.i31.preheader
do.body.i31.preheader: ; preds = %cond.false.i.i49, %cond.true.i.i25
%.ph71 = phi ptr [ %9, %cond.false.i.i49 ], [ %.pre14.pre.i27, %cond.true.i.i25 ]
%c.0.i33.ph = phi i32 [ %conv3.i.i51, %cond.false.i.i49 ], [ %call.i.i26, %cond.true.i.i25 ]
br label %do.body.i31
do.body.i31: ; preds = %do.body.i31.preheader, %getchar_unlocked.exit13.i43
%13 = phi ptr [ %18, %getchar_unlocked.exit13.i43 ], [ %.ph71, %do.body.i31.preheader ]
%14 = phi ptr [ %19, %getchar_unlocked.exit13.i43 ], [ %.ph71, %do.body.i31.preheader ]
%n.0.i32 = phi i32 [ %add.i36, %getchar_unlocked.exit13.i43 ], [ 0, %do.body.i31.preheader ]
%c.0.i33 = phi i32 [ %cond.i9.i44, %getchar_unlocked.exit13.i43 ], [ %c.0.i33.ph, %do.body.i31.preheader ]
%mul.i34 = mul nsw i32 %n.0.i32, 10
%and.i35 = and i32 %c.0.i33, 15
%add.i36 = add nsw i32 %and.i35, %mul.i34
%_IO_read_ptr.i4.i37 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 1
%15 = load ptr, ptr %_IO_read_ptr.i4.i37, align 8, !tbaa !13
%_IO_read_end.i5.i38 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 2
%16 = load ptr, ptr %_IO_read_end.i5.i38, align 8, !tbaa !17
%cmp.not.i6.i39 = icmp ult ptr %15, %16
br i1 %cmp.not.i6.i39, label %cond.false.i10.i46, label %cond.true.i7.i40, !prof !18
cond.true.i7.i40: ; preds = %do.body.i31
%call.i8.i41 = tail call i32 @__uflow(ptr noundef nonnull %14) #4
%.pre.i42 = load ptr, ptr @stdin, align 8, !tbaa !11
br label %getchar_unlocked.exit13.i43
cond.false.i10.i46: ; preds = %do.body.i31
%incdec.ptr.i11.i47 = getelementptr inbounds i8, ptr %15, i64 1
store ptr %incdec.ptr.i11.i47, ptr %_IO_read_ptr.i4.i37, align 8, !tbaa !13
%17 = load i8, ptr %15, align 1, !tbaa !19
%conv3.i12.i48 = zext i8 %17 to i32
br label %getchar_unlocked.exit13.i43
getchar_unlocked.exit13.i43: ; preds = %cond.false.i10.i46, %cond.true.i7.i40
%18 = phi ptr [ %.pre.i42, %cond.true.i7.i40 ], [ %13, %cond.false.i10.i46 ]
%19 = phi ptr [ %.pre.i42, %cond.true.i7.i40 ], [ %14, %cond.false.i10.i46 ]
%cond.i9.i44 = phi i32 [ %call.i8.i41, %cond.true.i7.i40 ], [ %conv3.i12.i48, %cond.false.i10.i46 ]
%cmp.i45 = icmp sgt i32 %cond.i9.i44, 47
br i1 %cmp.i45, label %do.body.i31, label %in.exit52, !llvm.loop !20
in.exit52: ; preds = %getchar_unlocked.exit13.i43
%arrayidx = getelementptr inbounds [102 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %add.i36, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !21
for.end: ; preds = %in.exit52
%cmp30.i = icmp sgt i32 %add.i, 1
br i1 %cmp30.i, label %do.body.us.preheader.i, label %bubble_sort.exit.thread
do.body.us.preheader.i: ; preds = %for.end
%20 = zext i32 %add.i to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.body.us.i.backedge, %do.body.us.preheader.i
%indvars.iv.i = phi i64 [ %20, %do.body.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ]
%ans.133.us.i = phi i32 [ 0, %do.body.us.preheader.i ], [ %ans.2.us.i, %for.body.us.i.backedge ]
%f.031.us.i = phi i32 [ 0, %do.body.us.preheader.i ], [ %f.031.us.i.be, %for.body.us.i.backedge ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295
%arrayidx.us.i = getelementptr inbounds i32, ptr @a, i64 %idxprom.us.i
%21 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
%sub1.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294
%idxprom2.us.i = and i64 %sub1.us.i, 4294967295
%arrayidx3.us.i = getelementptr inbounds i32, ptr @a, i64 %idxprom2.us.i
%22 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5
%cmp4.us.i = icmp slt i32 %21, %22
br i1 %cmp4.us.i, label %if.then.us.i, label %for.inc.us.i
if.then.us.i: ; preds = %for.body.us.i
store i32 %22, ptr %arrayidx.us.i, align 4, !tbaa !5
store i32 %21, ptr %arrayidx3.us.i, align 4, !tbaa !5
%inc.us.i = add nsw i32 %ans.133.us.i, 1
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i
%f.1.us.i = phi i32 [ 1, %if.then.us.i ], [ %f.031.us.i, %for.body.us.i ]
%ans.2.us.i = phi i32 [ %inc.us.i, %if.then.us.i ], [ %ans.133.us.i, %for.body.us.i ]
%cmp.us.i = icmp sgt i64 %indvars.iv.i, 2
br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond.do.cond_crit_edge.us.i
for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.do.cond_crit_edge.us.i
%indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %20, %for.cond.do.cond_crit_edge.us.i ]
%f.031.us.i.be = phi i32 [ %f.1.us.i, %for.inc.us.i ], [ 0, %for.cond.do.cond_crit_edge.us.i ]
br label %for.body.us.i, !llvm.loop !9
for.cond.do.cond_crit_edge.us.i: ; preds = %for.inc.us.i
%tobool.not.us.i = icmp eq i32 %f.1.us.i, 0
br i1 %tobool.not.us.i, label %bubble_sort.exit, label %for.body.us.i.backedge
bubble_sort.exit.thread: ; preds = %for.end, %for.cond.preheader
%23 = load i32, ptr @a, align 16, !tbaa !5
%call367 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23)
br label %for.end12
bubble_sort.exit: ; preds = %for.cond.do.cond_crit_edge.us.i
%24 = load i32, ptr @a, align 16, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %24)
br i1 %cmp30.i, label %for.body6.preheader, label %for.end12
for.body6.preheader: ; preds = %bubble_sort.exit
%wide.trip.count61 = zext i32 %add.i to i64
br label %for.body6
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv58 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next59, %for.body6 ]
%arrayidx8 = getelementptr inbounds [102 x i32], ptr @a, i64 0, i64 %indvars.iv58
%25 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %25)
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
br i1 %exitcond62.not, label %for.end12, label %for.body6, !llvm.loop !22
for.end12: ; preds = %for.body6, %bubble_sort.exit.thread, %bubble_sort.exit
%.us-phi.i68 = phi i32 [ 0, %bubble_sort.exit.thread ], [ %ans.2.us.i, %bubble_sort.exit ], [ %ans.2.us.i, %for.body6 ]
%26 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i = tail call i32 @putc(i32 noundef 10, ptr noundef %26)
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i68)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_IO_FILE", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !6, i64 112, !6, i64 116, !15, i64 120, !16, i64 128, !7, i64 130, !7, i64 131, !12, i64 136, !15, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !15, i64 184, !6, i64 192, !7, i64 196}
!15 = !{!"long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!14, !12, i64 16}
!18 = !{!"branch_weights", i32 2000, i32 1}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
#include <stdlib.h>
void printArray(int array[], int length) {
for (int ixArray = 0; ixArray < length; ixArray++) {
if (ixArray != 0) printf(" ");
printf("%d", array[ixArray]);
}
}
int bubbleSort(int array[], int length) {
int swapCount = 0;
int temp;
for (int i = 0; i < length; i++)
for (int j = length - 1; j > i; j--)
if (array[j] < array[j-1]) {
temp = array[j];
array[j] = array[j-1];
array[j-1] = temp;
swapCount++;
}
return swapCount;
}
int main(int argc, char** argv) {
int length;
scanf("%d", &length);
const int nxArray = length;
int array[nxArray];
for (int ixArray = 0; ixArray < nxArray; ixArray++)
scanf("%d", &array[ixArray]);
// for (int ixArray = 0; ixArray < nxArray; ixArray++) {
// if (ixArray != 0) printf(" ");
// printf("%d", array[ixArray]);
// }
int nos = bubbleSort(array, nxArray);
printArray(array, nxArray);
printf("\n");
printf("%d\n", nos);
return (EXIT_SUCCESS);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282423/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282423/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printArray(ptr nocapture noundef readonly %array, i32 noundef %length) local_unnamed_addr #0 {
entry:
%cmp6 = icmp sgt i32 %length, 0
br i1 %cmp6, label %if.end.peel, label %for.cond.cleanup
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %length to i64
%.pre = load i32, ptr %array, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %length, 1
br i1 %exitcond.peel.not, label %for.cond.cleanup, label %if.end
for.cond.cleanup: ; preds = %if.end, %if.end.peel, %entry
ret void
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %if.end, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bubbleSort(ptr nocapture noundef %array, i32 noundef %length) local_unnamed_addr #3 {
entry:
%cmp44 = icmp sgt i32 %length, 0
br i1 %cmp44, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%j.039 = add nsw i32 %length, -1
%0 = zext i32 %length to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.039 to i64
%wide.trip.count = zext i32 %length to i64
%invariant.gep = getelementptr i32, ptr %array, i64 -2
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.cleanup3
%indvars.iv54 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next55, %for.cond.cleanup3 ]
%swapCount.045 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %swapCount.1.lcssa, %for.cond.cleanup3 ]
%cmp240 = icmp ult i64 %indvars.iv54, %2
br i1 %cmp240, label %for.body4, label %for.cond.cleanup3
for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry
%swapCount.0.lcssa = phi i32 [ 0, %entry ], [ %swapCount.1.lcssa, %for.cond.cleanup3 ]
ret i32 %swapCount.0.lcssa
for.cond.cleanup3: ; preds = %for.inc, %for.cond1.preheader
%swapCount.1.lcssa = phi i32 [ %swapCount.045, %for.cond1.preheader ], [ %swapCount.2, %for.inc ]
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !12
for.body4: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond1.preheader ]
%swapCount.141 = phi i32 [ %swapCount.2, %for.inc ], [ %swapCount.045, %for.cond1.preheader ]
%indvars.iv.next49 = add nsw i64 %indvars.iv48, -1
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv48
%4 = load i32, ptr %gep, align 4, !tbaa !5
%cmp8 = icmp slt i32 %3, %4
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body4
store i32 %4, ptr %arrayidx, align 4, !tbaa !5
store i32 %3, ptr %gep, align 4, !tbaa !5
%inc = add nsw i32 %swapCount.141, 1
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%swapCount.2 = phi i32 [ %inc, %if.then ], [ %swapCount.141, %for.body4 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp2 = icmp sgt i64 %indvars.iv.next, %indvars.iv54
br i1 %cmp2, label %for.body4, label %for.cond.cleanup3, !llvm.loop !13
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%length = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %length) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %length)
%0 = load i32, ptr %length, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %printArray.exit
for.cond.cleanup: ; preds = %for.body
br i1 %cmp17, label %for.cond1.preheader.lr.ph.i, label %printArray.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.cond.cleanup
%j.039.i = add nsw i32 %0, -1
%3 = add nsw i64 %1, -1
%4 = zext i32 %j.039.i to i64
%invariant.gep.i = getelementptr i32, ptr %vla, i64 -2
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.cond.cleanup3.i, %for.cond1.preheader.lr.ph.i
%indvars.iv54.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next55.i, %for.cond.cleanup3.i ]
%swapCount.045.i = phi i32 [ 0, %for.cond1.preheader.lr.ph.i ], [ %swapCount.1.lcssa.i, %for.cond.cleanup3.i ]
%cmp240.i = icmp ult i64 %indvars.iv54.i, %4
br i1 %cmp240.i, label %for.body4.i, label %for.cond.cleanup3.i
for.cond.cleanup3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%swapCount.1.lcssa.i = phi i32 [ %swapCount.045.i, %for.cond1.preheader.i ], [ %swapCount.2.i, %for.inc.i ]
%indvars.iv.next55.i = add nuw nsw i64 %indvars.iv54.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next55.i, %1
br i1 %exitcond.not.i, label %if.end.peel.i, label %for.cond1.preheader.i, !llvm.loop !12
for.body4.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv48.i = phi i64 [ %indvars.iv.next49.i, %for.inc.i ], [ %1, %for.cond1.preheader.i ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %3, %for.cond1.preheader.i ]
%swapCount.141.i = phi i32 [ %swapCount.2.i, %for.inc.i ], [ %swapCount.045.i, %for.cond1.preheader.i ]
%indvars.iv.next49.i = add nsw i64 %indvars.iv48.i, -1
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv48.i
%6 = load i32, ptr %gep.i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %5, %6
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
store i32 %6, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %5, ptr %gep.i, align 4, !tbaa !5
%inc.i = add nsw i32 %swapCount.141.i, 1
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%swapCount.2.i = phi i32 [ %inc.i, %if.then.i ], [ %swapCount.141.i, %for.body4.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%cmp2.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv54.i
br i1 %cmp2.i, label %for.body4.i, label %for.cond.cleanup3.i, !llvm.loop !13
if.end.peel.i: ; preds = %for.cond.cleanup3.i
%.pre.i = load i32, ptr %vla, align 16, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %0, 1
br i1 %exitcond.peel.not.i, label %printArray.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i11 = phi i64 [ %indvars.iv.next.i13, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar.i = call i32 @putchar(i32 32)
%arrayidx.i12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i11
%7 = load i32, ptr %arrayidx.i12, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next.i13 = add nuw nsw i64 %indvars.iv.i11, 1
%exitcond.not.i14 = icmp eq i64 %indvars.iv.next.i13, %1
br i1 %exitcond.not.i14, label %printArray.exit, label %if.end.i, !llvm.loop !9
printArray.exit: ; preds = %if.end.i, %entry, %for.cond.cleanup, %if.end.peel.i
%swapCount.0.lcssa.i16 = phi i32 [ %swapCount.1.lcssa.i, %if.end.peel.i ], [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %swapCount.1.lcssa.i, %if.end.i ]
%putchar = call i32 @putchar(i32 10)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %swapCount.0.lcssa.i16)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %length) #6
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int i;
int j;
int change;
int num = 0;
int count = 0;
int flag = 1;
int *data;
while(1){
scanf("%d",&num);
if(1 <= num && num <= 100){
break;
}
}
data = (int *)malloc(sizeof(int)*num);
for(j = 0;j < num;j++){
while(1){
scanf("%d",&data[j]);
if(data[j] >= 0 && data[j] <= 100){
break;
}
}
}
while(flag){
flag = 0;
for(i = num - 1;i > 0;i--){
if(data[i] < data[i - 1]){
change = data[i];
data[i] = data[i - 1];
data[i - 1] = change;
flag = 1;
count++;
}
}
}
for(i = 0;i < num-1;i++){
printf("%d ",data[i]);
}
printf("%d",data[num - 1]);
printf("\n");
printf("%d",count);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282467/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282467/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
store i32 0, ptr %num, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 100
br i1 %or.cond, label %while.cond5.preheader.preheader, label %while.cond
while.cond5.preheader.preheader: ; preds = %while.cond
%conv = zext i32 %0 to i64
%mul = shl nuw nsw i64 %conv, 2
%call2 = call noalias ptr @malloc(i64 noundef %mul) #6
br label %while.cond5.preheader
while.cond5.preheader: ; preds = %while.cond5.preheader.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %while.cond5.preheader.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv
br label %while.cond5
while.cond20.preheader: ; preds = %for.inc
%cmp23101 = icmp sgt i32 %6, 1
br i1 %cmp23101, label %for.cond22.preheader.us.preheader, label %for.cond49.preheader.for.end59_crit_edge
for.cond22.preheader.us.preheader: ; preds = %while.cond20.preheader
%2 = zext i32 %6 to i64
br label %for.body25.us
for.body25.us: ; preds = %for.body25.us.backedge, %for.cond22.preheader.us.preheader
%indvars.iv117 = phi i64 [ %2, %for.cond22.preheader.us.preheader ], [ %indvars.iv117.be, %for.body25.us.backedge ]
%flag.1103.us = phi i32 [ 0, %for.cond22.preheader.us.preheader ], [ %flag.1103.us.be, %for.body25.us.backedge ]
%count.1102.us = phi i32 [ 0, %for.cond22.preheader.us.preheader ], [ %count.2.us, %for.body25.us.backedge ]
%indvars.iv.next118 = add nsw i64 %indvars.iv117, -1
%idxprom26.us = and i64 %indvars.iv.next118, 4294967295
%arrayidx27.us = getelementptr inbounds i32, ptr %call2, i64 %idxprom26.us
%3 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5
%sub28.us = add i64 %indvars.iv117, 4294967294
%idxprom29.us = and i64 %sub28.us, 4294967295
%arrayidx30.us = getelementptr inbounds i32, ptr %call2, i64 %idxprom29.us
%4 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%cmp31.us = icmp slt i32 %3, %4
br i1 %cmp31.us, label %if.then33.us, label %for.inc46.us
if.then33.us: ; preds = %for.body25.us
store i32 %4, ptr %arrayidx27.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx30.us, align 4, !tbaa !5
%inc44.us = add nsw i32 %count.1102.us, 1
br label %for.inc46.us
for.inc46.us: ; preds = %if.then33.us, %for.body25.us
%count.2.us = phi i32 [ %inc44.us, %if.then33.us ], [ %count.1102.us, %for.body25.us ]
%flag.2.us = phi i32 [ 1, %if.then33.us ], [ %flag.1103.us, %for.body25.us ]
%cmp23.us = icmp sgt i64 %indvars.iv117, 2
br i1 %cmp23.us, label %for.body25.us.backedge, label %for.cond22.while.cond20.loopexit_crit_edge.us
for.body25.us.backedge: ; preds = %for.inc46.us, %for.cond22.while.cond20.loopexit_crit_edge.us
%indvars.iv117.be = phi i64 [ %indvars.iv.next118, %for.inc46.us ], [ %2, %for.cond22.while.cond20.loopexit_crit_edge.us ]
%flag.1103.us.be = phi i32 [ %flag.2.us, %for.inc46.us ], [ 0, %for.cond22.while.cond20.loopexit_crit_edge.us ]
br label %for.body25.us, !llvm.loop !9
for.cond22.while.cond20.loopexit_crit_edge.us: ; preds = %for.inc46.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %for.cond49.preheader, label %for.body25.us.backedge
while.cond5: ; preds = %while.cond5.preheader, %while.cond5
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%or.cond96 = icmp ult i32 %5, 101
br i1 %or.cond96, label %for.inc, label %while.cond5
for.inc: ; preds = %while.cond5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %num, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp3, label %while.cond5.preheader, label %while.cond20.preheader, !llvm.loop !11
for.cond49.preheader: ; preds = %for.cond22.while.cond20.loopexit_crit_edge.us
br i1 %cmp23101, label %for.body53, label %for.cond49.preheader.for.end59_crit_edge
for.cond49.preheader.for.end59_crit_edge: ; preds = %while.cond20.preheader, %for.cond49.preheader
%.us-phi126 = phi i32 [ %count.2.us, %for.cond49.preheader ], [ 0, %while.cond20.preheader ]
%sub50109 = add nsw i32 %6, -1
%.pre = sext i32 %sub50109 to i64
br label %for.end59
for.body53: ; preds = %for.cond49.preheader, %for.body53
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body53 ], [ 0, %for.cond49.preheader ]
%arrayidx55 = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv120
%8 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%9 = load i32, ptr %num, align 4, !tbaa !5
%sub50 = add nsw i32 %9, -1
%10 = sext i32 %sub50 to i64
%cmp51 = icmp slt i64 %indvars.iv.next121, %10
br i1 %cmp51, label %for.body53, label %for.end59, !llvm.loop !12
for.end59: ; preds = %for.body53, %for.cond49.preheader.for.end59_crit_edge
%.us-phi125 = phi i32 [ %.us-phi126, %for.cond49.preheader.for.end59_crit_edge ], [ %count.2.us, %for.body53 ]
%idxprom61.pre-phi = phi i64 [ %.pre, %for.cond49.preheader.for.end59_crit_edge ], [ %10, %for.body53 ]
%arrayidx62 = getelementptr inbounds i32, ptr %call2, i64 %idxprom61.pre-phi
%11 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%putchar = call i32 @putchar(i32 10)
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.us-phi125)
%putchar95 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int T,break_flag;
scanf("%d",&T);
while(T--){
int l,r;
scanf("%d %d",&l,&r);
printf("%d %d\n",l,2*l);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_28251/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_28251/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !5
%dec3 = add nsw i32 %0, -1
store i32 %dec3, ptr %T, align 4, !tbaa !5
%tobool.not4 = icmp eq i32 %0, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l, ptr noundef nonnull %r)
%1 = load i32, ptr %l, align 4, !tbaa !5
%mul = shl nsw i32 %1, 1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1, i32 noundef %mul)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #3
%2 = load i32, ptr %T, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %T, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define M 100
int count=0;
void bubbleSort(int *A,int N){
int y,i,j,flag = 1;
while(flag==1){
flag=0;
for(j=N-1;j>0;j--){
if(A[j] < A[j-1]){
y = A[j];
A[j] = A[j-1];
A[j-1] = y;
flag = 1;
count++;
}
}
}
for(i=0;i<N;i++){
if(i==N-1) printf("%d",A[i]);
else printf("%d ",A[i]);
}
printf("\n");
printf("%d\n",count);
}
int main(){
int x,i,j,A[M],B[M];
scanf("%d",&x);
for(i=0;i<x;i++){
scanf("%d",&A[i]);
}
bubbleSort(A,x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282553/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282553/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @bubbleSort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp155 = icmp sgt i32 %N, 1
br i1 %cmp155, label %for.cond.preheader.us.preheader, label %for.cond16.preheader
for.cond.preheader.us.preheader: ; preds = %entry
%0 = zext i32 %N to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.backedge, %for.cond.preheader.us.preheader
%indvars.iv = phi i64 [ %0, %for.cond.preheader.us.preheader ], [ %indvars.iv.be, %for.body.us.backedge ]
%flag.157.us = phi i32 [ 0, %for.cond.preheader.us.preheader ], [ %flag.157.us.be, %for.body.us.backedge ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom.us = and i64 %indvars.iv.next, 4294967295
%arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%sub2.us = add i64 %indvars.iv, 4294967294
%idxprom3.us = and i64 %sub2.us, 4294967295
%arrayidx4.us = getelementptr inbounds i32, ptr %A, i64 %idxprom3.us
%2 = load i32, ptr %arrayidx4.us, align 4, !tbaa !5
%cmp5.us = icmp slt i32 %1, %2
br i1 %cmp5.us, label %if.then.us, label %for.inc.us
if.then.us: ; preds = %for.body.us
store i32 %2, ptr %arrayidx.us, align 4, !tbaa !5
store i32 %1, ptr %arrayidx4.us, align 4, !tbaa !5
%3 = load i32, ptr @count, align 4, !tbaa !5
%inc.us = add nsw i32 %3, 1
store i32 %inc.us, ptr @count, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.157.us, %for.body.us ]
%cmp1.us = icmp sgt i64 %indvars.iv, 2
br i1 %cmp1.us, label %for.body.us.backedge, label %for.cond.while.cond.loopexit_crit_edge.us
for.body.us.backedge: ; preds = %for.inc.us, %for.cond.while.cond.loopexit_crit_edge.us
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc.us ], [ %0, %for.cond.while.cond.loopexit_crit_edge.us ]
%flag.157.us.be = phi i32 [ %flag.2.us, %for.inc.us ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us ]
br label %for.body.us, !llvm.loop !9
for.cond.while.cond.loopexit_crit_edge.us: ; preds = %for.inc.us
%cmp.us = icmp eq i32 %flag.2.us, 1
br i1 %cmp.us, label %for.body.us.backedge, label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond.while.cond.loopexit_crit_edge.us, %entry
%cmp1759 = icmp sgt i32 %N, 0
br i1 %cmp1759, label %for.body18.lr.ph, label %for.end30
for.body18.lr.ph: ; preds = %for.cond16.preheader
%sub19 = add nsw i32 %N, -1
%4 = zext i32 %sub19 to i64
%wide.trip.count = zext i32 %N to i64
br label %for.body18
for.body18: ; preds = %for.body18.lr.ph, %for.body18
%indvars.iv62 = phi i64 [ 0, %for.body18.lr.ph ], [ %indvars.iv.next63, %for.body18 ]
%cmp20 = icmp eq i64 %indvars.iv62, %4
%arrayidx23.sink = getelementptr inbounds i32, ptr %A, i64 %indvars.iv62
%.str.sink = select i1 %cmp20, ptr @.str, ptr @.str.1
%5 = load i32, ptr %arrayidx23.sink, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink, i32 noundef %5)
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count
br i1 %exitcond.not, label %for.end30, label %for.body18, !llvm.loop !11
for.end30: ; preds = %for.body18, %for.cond16.preheader
%putchar = tail call i32 @putchar(i32 10)
%6 = load i32, ptr @count, align 4, !tbaa !5
%call32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %6)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %bubbleSort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body
%cmp155.i = icmp sgt i32 %1, 1
br i1 %cmp155.i, label %for.cond.preheader.us.preheader.i, label %for.cond16.preheader.i
for.cond.preheader.us.preheader.i: ; preds = %for.end
%3 = zext i32 %1 to i64
%count.promoted8 = load i32, ptr @count, align 4, !tbaa !5
br label %for.body.us.i
for.body.us.i: ; preds = %for.body.us.i.backedge, %for.cond.preheader.us.preheader.i
%count.promoted10 = phi i32 [ %count.promoted8, %for.cond.preheader.us.preheader.i ], [ %count.promoted9, %for.body.us.i.backedge ]
%inc.us.i7 = phi i32 [ %count.promoted8, %for.cond.preheader.us.preheader.i ], [ %inc.us.i7.be, %for.body.us.i.backedge ]
%indvars.iv.i = phi i64 [ %3, %for.cond.preheader.us.preheader.i ], [ %indvars.iv.i.be, %for.body.us.i.backedge ]
%flag.157.us.i = phi i32 [ 0, %for.cond.preheader.us.preheader.i ], [ %flag.157.us.i.be, %for.body.us.i.backedge ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%idxprom.us.i = and i64 %indvars.iv.next.i, 4294967295
%arrayidx.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.us.i
%4 = load i32, ptr %arrayidx.us.i, align 4, !tbaa !5
%sub2.us.i = add nuw nsw i64 %indvars.iv.i, 4294967294
%idxprom3.us.i = and i64 %sub2.us.i, 4294967295
%arrayidx4.us.i = getelementptr inbounds i32, ptr %A, i64 %idxprom3.us.i
%5 = load i32, ptr %arrayidx4.us.i, align 4, !tbaa !5
%cmp5.us.i = icmp slt i32 %4, %5
br i1 %cmp5.us.i, label %if.then.us.i, label %for.inc.us.i
if.then.us.i: ; preds = %for.body.us.i
store i32 %5, ptr %arrayidx.us.i, align 4, !tbaa !5
store i32 %4, ptr %arrayidx4.us.i, align 4, !tbaa !5
%inc.us.i = add nsw i32 %inc.us.i7, 1
store i32 %inc.us.i, ptr @count, align 4, !tbaa !5
br label %for.inc.us.i
for.inc.us.i: ; preds = %if.then.us.i, %for.body.us.i
%count.promoted9 = phi i32 [ %inc.us.i, %if.then.us.i ], [ %count.promoted10, %for.body.us.i ]
%inc.us.i6 = phi i32 [ %inc.us.i, %if.then.us.i ], [ %inc.us.i7, %for.body.us.i ]
%flag.2.us.i = phi i32 [ 1, %if.then.us.i ], [ %flag.157.us.i, %for.body.us.i ]
%cmp1.us.i = icmp sgt i64 %indvars.iv.i, 2
br i1 %cmp1.us.i, label %for.body.us.i.backedge, label %for.cond.while.cond.loopexit_crit_edge.us.i
for.body.us.i.backedge: ; preds = %for.inc.us.i, %for.cond.while.cond.loopexit_crit_edge.us.i
%inc.us.i7.be = phi i32 [ %inc.us.i6, %for.inc.us.i ], [ %count.promoted9, %for.cond.while.cond.loopexit_crit_edge.us.i ]
%indvars.iv.i.be = phi i64 [ %indvars.iv.next.i, %for.inc.us.i ], [ %3, %for.cond.while.cond.loopexit_crit_edge.us.i ]
%flag.157.us.i.be = phi i32 [ %flag.2.us.i, %for.inc.us.i ], [ 0, %for.cond.while.cond.loopexit_crit_edge.us.i ]
br label %for.body.us.i, !llvm.loop !9
for.cond.while.cond.loopexit_crit_edge.us.i: ; preds = %for.inc.us.i
%cmp.us.i = icmp eq i32 %flag.2.us.i, 1
br i1 %cmp.us.i, label %for.body.us.i.backedge, label %for.cond16.preheader.i
for.cond16.preheader.i: ; preds = %for.cond.while.cond.loopexit_crit_edge.us.i, %for.end
%cmp1759.i = icmp sgt i32 %1, 0
br i1 %cmp1759.i, label %for.body18.lr.ph.i, label %bubbleSort.exit
for.body18.lr.ph.i: ; preds = %for.cond16.preheader.i
%sub19.i = add nsw i32 %1, -1
%6 = zext i32 %sub19.i to i64
%wide.trip.count.i = zext i32 %1 to i64
br label %for.body18.i
for.body18.i: ; preds = %for.body18.i, %for.body18.lr.ph.i
%indvars.iv62.i = phi i64 [ 0, %for.body18.lr.ph.i ], [ %indvars.iv.next63.i, %for.body18.i ]
%cmp20.i = icmp eq i64 %indvars.iv62.i, %6
%arrayidx23.sink.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv62.i
%.str.sink.i = select i1 %cmp20.i, ptr @.str, ptr @.str.1
%7 = load i32, ptr %arrayidx23.sink.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink.i, i32 noundef %7)
%indvars.iv.next63.i = add nuw nsw i64 %indvars.iv62.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next63.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %bubbleSort.exit, label %for.body18.i, !llvm.loop !11
bubbleSort.exit: ; preds = %for.body18.i, %entry, %for.cond16.preheader.i
%putchar.i = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call32.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
int i,j,frag = 1,n,A[100],tmp,count = 0;
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
scanf("%d",&A[i]);
}
while(frag != 0){
frag = 0;
for(j = n - 1 ; j > 0 ; j--){
if(A[j] < A[j - 1]){
tmp = A[j];
A[j] = A[j - 1];
A[j - 1] = tmp;
frag = 1;
count += 1;
}
}
}
for(i = 0 ; i < n ; i++){
if(i == n - 1)printf("%d",A[i]);
else printf("%d ",A[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_282597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_282597/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body, label %for.end39
while.cond.preheader: ; preds = %for.body
%cmp462 = icmp sgt i32 %4, 1
br i1 %cmp462, label %for.cond3.preheader.us.preheader, label %for.cond24.preheader
for.cond3.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %4 to i64
br label %for.body5.us
for.body5.us: ; preds = %for.body5.us.backedge, %for.cond3.preheader.us.preheader
%indvars.iv74 = phi i64 [ %1, %for.cond3.preheader.us.preheader ], [ %indvars.iv74.be, %for.body5.us.backedge ]
%count.165.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %count.2.us, %for.body5.us.backedge ]
%frag.164.us = phi i32 [ 0, %for.cond3.preheader.us.preheader ], [ %frag.164.us.be, %for.body5.us.backedge ]
%indvars.iv.next75 = add nsw i64 %indvars.iv74, -1
%idxprom6.us = and i64 %indvars.iv.next75, 4294967295
%arrayidx7.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom6.us
%2 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5
%sub8.us = add i64 %indvars.iv74, 4294967294
%idxprom9.us = and i64 %sub8.us, 4294967295
%arrayidx10.us = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %idxprom9.us
%3 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%cmp11.us = icmp slt i32 %2, %3
br i1 %cmp11.us, label %if.then.us, label %for.inc22.us
if.then.us: ; preds = %for.body5.us
store i32 %3, ptr %arrayidx7.us, align 4, !tbaa !5
store i32 %2, ptr %arrayidx10.us, align 4, !tbaa !5
%add.us = add nsw i32 %count.165.us, 1
br label %for.inc22.us
for.inc22.us: ; preds = %if.then.us, %for.body5.us
%frag.2.us = phi i32 [ 1, %if.then.us ], [ %frag.164.us, %for.body5.us ]
%count.2.us = phi i32 [ %add.us, %if.then.us ], [ %count.165.us, %for.body5.us ]
%cmp4.us = icmp sgt i64 %indvars.iv74, 2
br i1 %cmp4.us, label %for.body5.us.backedge, label %for.cond3.while.cond.loopexit_crit_edge.us
for.body5.us.backedge: ; preds = %for.inc22.us, %for.cond3.while.cond.loopexit_crit_edge.us
%indvars.iv74.be = phi i64 [ %indvars.iv.next75, %for.inc22.us ], [ %1, %for.cond3.while.cond.loopexit_crit_edge.us ]
%frag.164.us.be = phi i32 [ %frag.2.us, %for.inc22.us ], [ 0, %for.cond3.while.cond.loopexit_crit_edge.us ]
br label %for.body5.us, !llvm.loop !9
for.cond3.while.cond.loopexit_crit_edge.us: ; preds = %for.inc22.us
%cmp2.not.us = icmp eq i32 %frag.2.us, 0
br i1 %cmp2.not.us, label %for.cond24.preheader, label %for.body5.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond24.preheader: ; preds = %for.cond3.while.cond.loopexit_crit_edge.us, %while.cond.preheader
%.us-phi = phi i32 [ 0, %while.cond.preheader ], [ %count.2.us, %for.cond3.while.cond.loopexit_crit_edge.us ]
%cmp2570 = icmp sgt i32 %4, 0
br i1 %cmp2570, label %for.body26, label %for.end39
for.body26: ; preds = %for.cond24.preheader, %for.body26
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body26 ], [ 0, %for.cond24.preheader ]
%6 = phi i32 [ %9, %for.body26 ], [ %4, %for.cond24.preheader ]
%sub27 = add nsw i32 %6, -1
%7 = zext i32 %sub27 to i64
%cmp28 = icmp eq i64 %indvars.iv77, %7
%arrayidx31 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv77
%8 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp28, ptr @.str, ptr @.str.1
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %8)
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp25 = icmp slt i64 %indvars.iv.next78, %10
br i1 %cmp25, label %for.body26, label %for.end39, !llvm.loop !12
for.end39: ; preds = %for.body26, %entry, %for.cond24.preheader
%.us-phi84 = phi i32 [ %.us-phi, %for.cond24.preheader ], [ 0, %entry ], [ %.us-phi, %for.body26 ]
%putchar = call i32 @putchar(i32 10)
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.us-phi84)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.