Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(void)
{
int s1,s2=0,e;
for(e=0;e<10;e++){
scanf("%d",&s1);
s2=s1+s2;
}
printf("%d\n",s2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_272747/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_272747/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:
%s1 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s1) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%0 = load i32, ptr %s1, align 4, !tbaa !5
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%1 = load i32, ptr %s1, align 4, !tbaa !5
%add.1 = add nsw i32 %1, %0
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%2 = load i32, ptr %s1, align 4, !tbaa !5
%add.2 = add nsw i32 %2, %add.1
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%3 = load i32, ptr %s1, align 4, !tbaa !5
%add.3 = add nsw i32 %3, %add.2
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%4 = load i32, ptr %s1, align 4, !tbaa !5
%add.4 = add nsw i32 %4, %add.3
%call.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%5 = load i32, ptr %s1, align 4, !tbaa !5
%add.5 = add nsw i32 %5, %add.4
%call.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%6 = load i32, ptr %s1, align 4, !tbaa !5
%add.6 = add nsw i32 %6, %add.5
%call.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%7 = load i32, ptr %s1, align 4, !tbaa !5
%add.7 = add nsw i32 %7, %add.6
%call.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%8 = load i32, ptr %s1, align 4, !tbaa !5
%add.8 = add nsw i32 %8, %add.7
%call.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s1)
%9 = load i32, ptr %s1, align 4, !tbaa !5
%add.9 = add nsw i32 %9, %add.8
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s1) #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 n,d,x,i,j,c;
scanf("%d%d%d",&n,&d,&x);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
c=0;
for(i=0;i<n;i++){
for(j=0;a[i]*j+1<=d;j++){
c++;
}
}
printf("%d\n",c+x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_272790/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_272790/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.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
%d = alloca i32, align 4
%x = 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 %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d, ptr noundef nonnull %x)
%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
%cmp26 = icmp sgt i32 %3, 0
br i1 %cmp26, label %for.body, label %for.end16
for.cond2.preheader: ; preds = %for.body
%cmp332 = icmp sgt i32 %14, 0
br i1 %cmp332, label %for.cond5.preheader.lr.ph, label %for.end16
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%4 = load i32, ptr %d, align 4, !tbaa !5
%cmp8.not.not28 = icmp sgt i32 %4, 0
br i1 %cmp8.not.not28, label %for.cond5.preheader.us.preheader, label %for.end16
for.cond5.preheader.us.preheader: ; preds = %for.cond5.preheader.lr.ph
%wide.trip.count = zext i32 %14 to i64
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.inc14_crit_edge.us
%indvars.iv39 = phi i64 [ 0, %for.cond5.preheader.us.preheader ], [ %indvars.iv.next40, %for.cond5.for.inc14_crit_edge.us ]
%c.033.us = phi i32 [ 0, %for.cond5.preheader.us.preheader ], [ %inc10.us.lcssa, %for.cond5.for.inc14_crit_edge.us ]
%arrayidx7.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39
%5 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %5, i32 %4)
%6 = add i32 %smax, -1
%7 = udiv i32 %6, %5
%8 = add i32 %7, 1
%min.iters.check = icmp ult i32 %8, 8
br i1 %min.iters.check, label %for.body9.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond5.preheader.us
%n.vec = and i32 %8, -8
%9 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.033.us, i64 0
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> [ %9, %vector.ph ], [ %10, %vector.body ]
%vec.phi44 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%10 = add <4 x i32> %vec.phi, <i32 1, i32 1, i32 1, i32 1>
%11 = add <4 x i32> %vec.phi44, <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i32 %index, 8
%12 = icmp eq i32 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %11, %10
%13 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %8, %n.vec
br i1 %cmp.n, label %for.cond5.for.inc14_crit_edge.us, label %for.body9.us.preheader
for.body9.us.preheader: ; preds = %for.cond5.preheader.us, %middle.block
%c.130.us.ph = phi i32 [ %c.033.us, %for.cond5.preheader.us ], [ %13, %middle.block ]
%j.029.us.ph = phi i32 [ 0, %for.cond5.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body9.us
for.body9.us: ; preds = %for.body9.us.preheader, %for.body9.us
%c.130.us = phi i32 [ %inc10.us, %for.body9.us ], [ %c.130.us.ph, %for.body9.us.preheader ]
%j.029.us = phi i32 [ %inc12.us, %for.body9.us ], [ %j.029.us.ph, %for.body9.us.preheader ]
%inc10.us = add nsw i32 %c.130.us, 1
%inc12.us = add nuw nsw i32 %j.029.us, 1
%mul.us = mul nsw i32 %5, %inc12.us
%cmp8.not.not.us = icmp slt i32 %mul.us, %4
br i1 %cmp8.not.not.us, label %for.body9.us, label %for.cond5.for.inc14_crit_edge.us, !llvm.loop !13
for.cond5.for.inc14_crit_edge.us: ; preds = %for.body9.us, %middle.block
%inc10.us.lcssa = phi i32 [ %13, %middle.block ], [ %inc10.us, %for.body9.us ]
%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.end16, label %for.cond5.preheader.us, !llvm.loop !14
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
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !15
for.end16: ; preds = %for.cond5.for.inc14_crit_edge.us, %entry, %for.cond5.preheader.lr.ph, %for.cond2.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %for.cond5.preheader.lr.ph ], [ 0, %entry ], [ %inc10.us.lcssa, %for.cond5.for.inc14_crit_edge.us ]
%16 = load i32, ptr %x, align 4, !tbaa !5
%add17 = add nsw i32 %16, %c.0.lcssa
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add17)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #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: 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.smax.i32(i32, i32) #4
; 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 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, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>
int main() {
int n;
scanf("%d", &n);
int d, x, a[n];
scanf("%d%d", &d, &x);
for (int i=0; i<n; i++) scanf("%d", a+i);
int ans = x;
for (int i=0; i<n; i++) ans += (d-1)/a[i] + 1;
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_272833/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_272833/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%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
%d = alloca i32, align 4
%x = 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)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%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.1, ptr noundef nonnull %d, ptr noundef nonnull %x)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %3, 0
br i1 %cmp18, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%4 = load i32, ptr %x, align 4, !tbaa !5
br label %for.cond.cleanup6
for.cond.cleanup: ; preds = %for.body
%5 = load i32, ptr %x, align 4, !tbaa !5
%cmp520 = icmp sgt i32 %8, 0
br i1 %cmp520, label %for.body7.lr.ph, label %for.cond.cleanup6
for.body7.lr.ph: ; preds = %for.cond.cleanup
%6 = load i32, ptr %d, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%wide.trip.count = zext i32 %8 to i64
%xtraiter = and i64 %wide.trip.count, 1
%7 = icmp eq i32 %8, 1
br i1 %7, label %for.cond.cleanup6.loopexit.unr-lcssa, label %for.body7.lr.ph.new
for.body7.lr.ph.new: ; preds = %for.body7.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body7
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
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%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
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup6.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.lr.ph
%add8.lcssa.ph = phi i32 [ undef, %for.body7.lr.ph ], [ %add8.1, %for.body7 ]
%indvars.iv26.unr = phi i64 [ 0, %for.body7.lr.ph ], [ %indvars.iv.next27.1, %for.body7 ]
%ans.021.unr = phi i32 [ %5, %for.body7.lr.ph ], [ %add8.1, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup6, label %for.body7.epil
for.body7.epil: ; preds = %for.cond.cleanup6.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv26.unr
%10 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%div.epil = sdiv i32 %sub, %10
%add.epil = add i32 %ans.021.unr, 1
%add8.epil = add i32 %add.epil, %div.epil
br label %for.cond.cleanup6
for.cond.cleanup6: ; preds = %for.body7.epil, %for.cond.cleanup6.loopexit.unr-lcssa, %for.cond.cleanup.thread, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ %5, %for.cond.cleanup ], [ %4, %for.cond.cleanup.thread ], [ %add8.lcssa.ph, %for.cond.cleanup6.loopexit.unr-lcssa ], [ %add8.epil, %for.body7.epil ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body7: ; preds = %for.body7, %for.body7.lr.ph.new
%indvars.iv26 = phi i64 [ 0, %for.body7.lr.ph.new ], [ %indvars.iv.next27.1, %for.body7 ]
%ans.021 = phi i32 [ %5, %for.body7.lr.ph.new ], [ %add8.1, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.lr.ph.new ], [ %niter.next.1, %for.body7 ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv26
%11 = load i32, ptr %arrayidx, align 8, !tbaa !5
%div = sdiv i32 %sub, %11
%add = add i32 %ans.021, 1
%add8 = add i32 %add, %div
%indvars.iv.next27 = or i64 %indvars.iv26, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next27
%12 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%div.1 = sdiv i32 %sub, %12
%add.1 = add i32 %add8, 1
%add8.1 = add i32 %add.1, %div.1
%indvars.iv.next27.1 = add nuw nsw i64 %indvars.iv26, 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.cond.cleanup6.loopexit.unr-lcssa, label %for.body7, !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 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(void){
int n, d, x, i, j;
scanf("%d", &n);
scanf("%d%d", &d, &x);
int a[n];
int ans = x;
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
for(i = 0; i < n; i++){
for(j = 0; d >= a[i] * j + 1; j++){
ans++;
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_272877/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_272877/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%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
%d = alloca i32, align 4
%x = 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 %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d, ptr noundef nonnull %x)
%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 %x, align 4, !tbaa !5
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %4, 0
br i1 %cmp26, label %for.body, label %for.end17
for.cond3.preheader: ; preds = %for.body
%cmp432 = icmp sgt i32 %15, 0
br i1 %cmp432, label %for.cond6.preheader.lr.ph, label %for.end17
for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader
%5 = load i32, ptr %d, align 4, !tbaa !5
%cmp9.not.not28 = icmp sgt i32 %5, 0
br i1 %cmp9.not.not28, label %for.cond6.preheader.us.preheader, label %for.end17
for.cond6.preheader.us.preheader: ; preds = %for.cond6.preheader.lr.ph
%wide.trip.count = zext i32 %15 to i64
br label %for.cond6.preheader.us
for.cond6.preheader.us: ; preds = %for.cond6.preheader.us.preheader, %for.cond6.for.inc15_crit_edge.us
%indvars.iv39 = phi i64 [ 0, %for.cond6.preheader.us.preheader ], [ %indvars.iv.next40, %for.cond6.for.inc15_crit_edge.us ]
%ans.034.us = phi i32 [ %3, %for.cond6.preheader.us.preheader ], [ %inc11.us.lcssa, %for.cond6.for.inc15_crit_edge.us ]
%arrayidx8.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39
%6 = load i32, ptr %arrayidx8.us, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %6, i32 %5)
%7 = add i32 %smax, -1
%8 = udiv i32 %7, %6
%9 = add i32 %8, 1
%min.iters.check = icmp ult i32 %9, 8
br i1 %min.iters.check, label %for.body10.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond6.preheader.us
%n.vec = and i32 %9, -8
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.034.us, i64 0
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> [ %10, %vector.ph ], [ %11, %vector.body ]
%vec.phi44 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%11 = add <4 x i32> %vec.phi, <i32 1, i32 1, i32 1, i32 1>
%12 = add <4 x i32> %vec.phi44, <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i32 %index, 8
%13 = icmp eq i32 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %9, %n.vec
br i1 %cmp.n, label %for.cond6.for.inc15_crit_edge.us, label %for.body10.us.preheader
for.body10.us.preheader: ; preds = %for.cond6.preheader.us, %middle.block
%ans.130.us.ph = phi i32 [ %ans.034.us, %for.cond6.preheader.us ], [ %14, %middle.block ]
%j.029.us.ph = phi i32 [ 0, %for.cond6.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body10.us
for.body10.us: ; preds = %for.body10.us.preheader, %for.body10.us
%ans.130.us = phi i32 [ %inc11.us, %for.body10.us ], [ %ans.130.us.ph, %for.body10.us.preheader ]
%j.029.us = phi i32 [ %inc13.us, %for.body10.us ], [ %j.029.us.ph, %for.body10.us.preheader ]
%inc11.us = add nsw i32 %ans.130.us, 1
%inc13.us = add nuw nsw i32 %j.029.us, 1
%mul.us = mul nsw i32 %6, %inc13.us
%cmp9.not.not.us = icmp sgt i32 %5, %mul.us
br i1 %cmp9.not.not.us, label %for.body10.us, label %for.cond6.for.inc15_crit_edge.us, !llvm.loop !13
for.cond6.for.inc15_crit_edge.us: ; preds = %for.body10.us, %middle.block
%inc11.us.lcssa = phi i32 [ %14, %middle.block ], [ %inc11.us, %for.body10.us ]
%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.end17, label %for.cond6.preheader.us, !llvm.loop !14
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
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %n, 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.cond3.preheader, !llvm.loop !15
for.end17: ; preds = %for.cond6.for.inc15_crit_edge.us, %entry, %for.cond6.preheader.lr.ph, %for.cond3.preheader
%ans.0.lcssa = phi i32 [ %3, %for.cond3.preheader ], [ %3, %for.cond6.preheader.lr.ph ], [ %3, %entry ], [ %inc11.us.lcssa, %for.cond6.for.inc15_crit_edge.us ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #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: 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 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 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, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
void filltill(char a[3][12], int n){
int i;
for(i=0;i<n;i++){
a[0][i] = 'O';
a[1][i] = 'O';
a[2][i] = 'O';
}
}
int main(){
int n;
char a[3][12];
int till;
scanf("%d",&n);
int i,j;
for(i=0;i<12;i++){
for(j=0;j<3;j++){
a[j][i] = '#';
}
}
char odd = '#';
if(n == 0){
}
else
if(n == 1){
a[0][0] = 'O';
}
else
if(n==2){
a[0][0] = 'O';
a[1][0] = 'O';
}
else
if(n==3){
a[0][0] = 'O';
a[1][0] = 'O';
odd = 'O';
}
else
if(n==4){
a[0][0] = 'O';
a[1][0] = 'O';
a[2][0] = 'O';
odd = 'O';
}else
if(n%3 == 2){
till = (n)/3;
filltill(a,till);
odd = 'O';
a[0][till] = 'O';
}
else{
till = n/3 - 1;
filltill(a,till);
odd = 'O';
if(n%3 == 0){
a[0][till] = 'O';
a[1][till] = 'O';
}
else{
a[0][till] = 'O';
a[1][till] = 'O';
a[2][till] = 'O';
}
odd = 'O';
}
printf("+------------------------+\n");
printf("|");
for(i=0;i<11;i++){
printf("%c.", a[0][i]);
}
printf("|D|)\n");
printf("|");
for(i=0;i<11;i++){
printf("%c.", a[1][i]);
}
printf("|.|\n");
printf("|%c.......................|\n", odd);
printf("|");
for(i=0;i<11;i++){
printf("%c.", a[2][i]);
}
printf("|.|)\n");
printf("+------------------------+");
/*
printf("|%c.%c.%c.%c.%c.%c.%c.%c.%c.%c.%c.|D|\n", );
printf("|%c.%c.%c.%c.%c.%c.%c.%c.%c.%c.%c.|.|\n", );
printf("|%c.......................|\n", &odd);
printf("|%c.%c.%c.%c.%c.%c.%c.%c.%c.%c.%c.|.|\n", );
printf("+------------------------+\n"); */
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27292/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27292/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"%c.\00", align 1
@.str.6 = private unnamed_addr constant [29 x i8] c"|%c.......................|\0A\00", align 1
@str = private unnamed_addr constant [27 x i8] c"+------------------------+\00", align 1
@str.9 = private unnamed_addr constant [5 x i8] c"|D|)\00", align 1
@str.10 = private unnamed_addr constant [4 x i8] c"|.|\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"|.|)\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @filltill(ptr nocapture noundef writeonly %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp14 = icmp sgt i32 %n, 0
br i1 %cmp14, label %for.body.preheader, label %for.end
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.preheader17, 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 ]
%0 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %index
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %0, align 1, !tbaa !5
%1 = getelementptr inbounds [12 x i8], ptr %a, i64 1, i64 %index
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %1, align 1, !tbaa !5
%2 = getelementptr inbounds [12 x i8], ptr %a, i64 2, i64 %index
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %2, align 1, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader17
for.body.preheader17: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader17, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader17 ]
%arrayidx1 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %indvars.iv
store i8 79, ptr %arrayidx1, align 1, !tbaa !5
%arrayidx4 = getelementptr inbounds [12 x i8], ptr %a, i64 1, i64 %indvars.iv
store i8 79, ptr %arrayidx4, align 1, !tbaa !5
%arrayidx7 = getelementptr inbounds [12 x i8], ptr %a, i64 2, i64 %indvars.iv
store i8 79, ptr %arrayidx7, align 1, !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 !12
for.end: ; preds = %for.body, %middle.block, %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 i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%a = alloca [3 x [12 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%scevgep = getelementptr inbounds i8, ptr %a, i64 12
%scevgep157 = getelementptr inbounds i8, ptr %a, i64 24
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %a, i8 35, i64 36, i1 false)
%0 = load i32, ptr %n, align 4, !tbaa !13
switch i32 %0, label %if.else37 [
i32 0, label %if.end70
i32 1, label %if.then11
i32 2, label %if.then16
i32 3, label %if.then23
i32 4, label %if.then30
]
if.then11: ; preds = %entry
store i8 79, ptr %a, align 16, !tbaa !5
br label %if.end70
if.then16: ; preds = %entry
store i8 79, ptr %a, align 16, !tbaa !5
store i8 79, ptr %scevgep, align 4, !tbaa !5
br label %if.end70
if.then23: ; preds = %entry
store i8 79, ptr %a, align 16, !tbaa !5
store i8 79, ptr %scevgep, align 4, !tbaa !5
br label %if.end70
if.then30: ; preds = %entry
store i8 79, ptr %a, align 16, !tbaa !5
store i8 79, ptr %scevgep, align 4, !tbaa !5
store i8 79, ptr %scevgep157, align 8, !tbaa !5
br label %if.end70
if.else37: ; preds = %entry
%rem = srem i32 %0, 3
%cmp38 = icmp eq i32 %rem, 2
%div = sdiv i32 %0, 3
br i1 %cmp38, label %if.then39, label %if.else43
if.then39: ; preds = %if.else37
%cmp14.i = icmp sgt i32 %0, 2
br i1 %cmp14.i, label %for.body.preheader.i, label %filltill.exit
for.body.preheader.i: ; preds = %if.then39
%wide.trip.count.i = zext i32 %div to i64
%min.iters.check168 = icmp ult i32 %div, 8
br i1 %min.iters.check168, label %for.body.i.preheader, label %vector.ph169
vector.ph169: ; preds = %for.body.preheader.i
%n.vec171 = and i64 %wide.trip.count.i, 4294967288
br label %vector.body174
vector.body174: ; preds = %vector.body174, %vector.ph169
%index175 = phi i64 [ 0, %vector.ph169 ], [ %index.next176, %vector.body174 ]
%1 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %index175
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds [12 x i8], ptr %a, i64 1, i64 %index175
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds [12 x i8], ptr %a, i64 2, i64 %index175
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %3, align 8, !tbaa !5
%index.next176 = add nuw i64 %index175, 8
%4 = icmp eq i64 %index.next176, %n.vec171
br i1 %4, label %middle.block166, label %vector.body174, !llvm.loop !15
middle.block166: ; preds = %vector.body174
%cmp.n173 = icmp eq i64 %n.vec171, %wide.trip.count.i
br i1 %cmp.n173, label %filltill.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block166
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec171, %middle.block166 ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%arrayidx1.i = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %indvars.iv.i
store i8 79, ptr %arrayidx1.i, align 1, !tbaa !5
%arrayidx4.i = getelementptr inbounds [12 x i8], ptr %a, i64 1, i64 %indvars.iv.i
store i8 79, ptr %arrayidx4.i, align 1, !tbaa !5
%arrayidx7.i = getelementptr inbounds [12 x i8], ptr %a, i64 2, i64 %indvars.iv.i
store i8 79, ptr %arrayidx7.i, align 1, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %filltill.exit, label %for.body.i, !llvm.loop !16
filltill.exit: ; preds = %for.body.i, %middle.block166, %if.then39
%idxprom41 = sext i32 %div to i64
%arrayidx42 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %idxprom41
store i8 79, ptr %arrayidx42, align 1, !tbaa !5
br label %if.end70
if.else43: ; preds = %if.else37
%sub = add nsw i32 %div, -1
%cmp14.i140 = icmp sgt i32 %0, 5
br i1 %cmp14.i140, label %for.body.preheader.i141, label %filltill.exit150
for.body.preheader.i141: ; preds = %if.else43
%wide.trip.count.i142 = zext i32 %sub to i64
%min.iters.check = icmp ult i32 %sub, 8
br i1 %min.iters.check, label %for.body.i143.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i141
%n.vec = and i64 %wide.trip.count.i142, 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 [12 x i8], ptr %a, i64 0, i64 %index
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds [12 x i8], ptr %a, i64 1, i64 %index
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds [12 x i8], ptr %a, i64 2, i64 %index
store <8 x i8> <i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79, i8 79>, ptr %7, align 8, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i142
br i1 %cmp.n, label %filltill.exit150, label %for.body.i143.preheader
for.body.i143.preheader: ; preds = %for.body.preheader.i141, %middle.block
%indvars.iv.i144.ph = phi i64 [ 0, %for.body.preheader.i141 ], [ %n.vec, %middle.block ]
br label %for.body.i143
for.body.i143: ; preds = %for.body.i143.preheader, %for.body.i143
%indvars.iv.i144 = phi i64 [ %indvars.iv.next.i148, %for.body.i143 ], [ %indvars.iv.i144.ph, %for.body.i143.preheader ]
%arrayidx1.i145 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %indvars.iv.i144
store i8 79, ptr %arrayidx1.i145, align 1, !tbaa !5
%arrayidx4.i146 = getelementptr inbounds [12 x i8], ptr %a, i64 1, i64 %indvars.iv.i144
store i8 79, ptr %arrayidx4.i146, align 1, !tbaa !5
%arrayidx7.i147 = getelementptr inbounds [12 x i8], ptr %a, i64 2, i64 %indvars.iv.i144
store i8 79, ptr %arrayidx7.i147, align 1, !tbaa !5
%indvars.iv.next.i148 = add nuw nsw i64 %indvars.iv.i144, 1
%exitcond.not.i149 = icmp eq i64 %indvars.iv.next.i148, %wide.trip.count.i142
br i1 %exitcond.not.i149, label %filltill.exit150, label %for.body.i143, !llvm.loop !18
filltill.exit150: ; preds = %for.body.i143, %middle.block, %if.else43
%cmp47 = icmp eq i32 %rem, 0
%idxprom50 = sext i32 %sub to i64
%arrayidx51 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 %idxprom50
store i8 79, ptr %arrayidx51, align 1, !tbaa !5
%arrayidx54 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 %idxprom50
store i8 79, ptr %arrayidx54, align 1, !tbaa !5
br i1 %cmp47, label %if.end70, label %if.else55
if.else55: ; preds = %filltill.exit150
%arrayidx64 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 %idxprom50
store i8 79, ptr %arrayidx64, align 1, !tbaa !5
br label %if.end70
if.end70: ; preds = %filltill.exit150, %if.else55, %entry, %if.then11, %if.then23, %filltill.exit, %if.then30, %if.then16
%odd.0 = phi i32 [ 35, %entry ], [ 35, %if.then11 ], [ 35, %if.then16 ], [ 79, %if.then23 ], [ 79, %if.then30 ], [ 79, %filltill.exit ], [ 79, %if.else55 ], [ 79, %filltill.exit150 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%putchar = call i32 @putchar(i32 124)
%9 = load i8, ptr %a, align 16, !tbaa !5
%conv = sext i8 %9 to i32
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv)
%arrayidx78.1 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 1
%10 = load i8, ptr %arrayidx78.1, align 1, !tbaa !5
%conv.1 = sext i8 %10 to i32
%call79.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.1)
%arrayidx78.2 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 2
%11 = load i8, ptr %arrayidx78.2, align 2, !tbaa !5
%conv.2 = sext i8 %11 to i32
%call79.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.2)
%arrayidx78.3 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 3
%12 = load i8, ptr %arrayidx78.3, align 1, !tbaa !5
%conv.3 = sext i8 %12 to i32
%call79.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.3)
%arrayidx78.4 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 4
%13 = load i8, ptr %arrayidx78.4, align 4, !tbaa !5
%conv.4 = sext i8 %13 to i32
%call79.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.4)
%arrayidx78.5 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 5
%14 = load i8, ptr %arrayidx78.5, align 1, !tbaa !5
%conv.5 = sext i8 %14 to i32
%call79.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.5)
%arrayidx78.6 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 6
%15 = load i8, ptr %arrayidx78.6, align 2, !tbaa !5
%conv.6 = sext i8 %15 to i32
%call79.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.6)
%arrayidx78.7 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 7
%16 = load i8, ptr %arrayidx78.7, align 1, !tbaa !5
%conv.7 = sext i8 %16 to i32
%call79.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.7)
%arrayidx78.8 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 8
%17 = load i8, ptr %arrayidx78.8, align 8, !tbaa !5
%conv.8 = sext i8 %17 to i32
%call79.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.8)
%arrayidx78.9 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 9
%18 = load i8, ptr %arrayidx78.9, align 1, !tbaa !5
%conv.9 = sext i8 %18 to i32
%call79.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.9)
%arrayidx78.10 = getelementptr inbounds [12 x i8], ptr %a, i64 0, i64 10
%19 = load i8, ptr %arrayidx78.10, align 2, !tbaa !5
%conv.10 = sext i8 %19 to i32
%call79.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv.10)
%puts135 = call i32 @puts(ptr nonnull dereferenceable(1) @str.9)
%putchar136 = call i32 @putchar(i32 124)
%20 = load i8, ptr %scevgep, align 4, !tbaa !5
%conv92 = sext i8 %20 to i32
%call93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92)
%arrayidx91.1 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 1
%21 = load i8, ptr %arrayidx91.1, align 1, !tbaa !5
%conv92.1 = sext i8 %21 to i32
%call93.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.1)
%arrayidx91.2 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 2
%22 = load i8, ptr %arrayidx91.2, align 2, !tbaa !5
%conv92.2 = sext i8 %22 to i32
%call93.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.2)
%arrayidx91.3 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 3
%23 = load i8, ptr %arrayidx91.3, align 1, !tbaa !5
%conv92.3 = sext i8 %23 to i32
%call93.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.3)
%arrayidx91.4 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 4
%24 = load i8, ptr %arrayidx91.4, align 16, !tbaa !5
%conv92.4 = sext i8 %24 to i32
%call93.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.4)
%arrayidx91.5 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 5
%25 = load i8, ptr %arrayidx91.5, align 1, !tbaa !5
%conv92.5 = sext i8 %25 to i32
%call93.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.5)
%arrayidx91.6 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 6
%26 = load i8, ptr %arrayidx91.6, align 2, !tbaa !5
%conv92.6 = sext i8 %26 to i32
%call93.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.6)
%arrayidx91.7 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 7
%27 = load i8, ptr %arrayidx91.7, align 1, !tbaa !5
%conv92.7 = sext i8 %27 to i32
%call93.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.7)
%arrayidx91.8 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 8
%28 = load i8, ptr %arrayidx91.8, align 4, !tbaa !5
%conv92.8 = sext i8 %28 to i32
%call93.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.8)
%arrayidx91.9 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 9
%29 = load i8, ptr %arrayidx91.9, align 1, !tbaa !5
%conv92.9 = sext i8 %29 to i32
%call93.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.9)
%arrayidx91.10 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 1, i64 10
%30 = load i8, ptr %arrayidx91.10, align 2, !tbaa !5
%conv92.10 = sext i8 %30 to i32
%call93.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv92.10)
%puts137 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
%call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %odd.0)
%putchar138 = call i32 @putchar(i32 124)
%31 = load i8, ptr %scevgep157, align 8, !tbaa !5
%conv108 = sext i8 %31 to i32
%call109 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108)
%arrayidx107.1 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 1
%32 = load i8, ptr %arrayidx107.1, align 1, !tbaa !5
%conv108.1 = sext i8 %32 to i32
%call109.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.1)
%arrayidx107.2 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 2
%33 = load i8, ptr %arrayidx107.2, align 2, !tbaa !5
%conv108.2 = sext i8 %33 to i32
%call109.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.2)
%arrayidx107.3 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 3
%34 = load i8, ptr %arrayidx107.3, align 1, !tbaa !5
%conv108.3 = sext i8 %34 to i32
%call109.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.3)
%arrayidx107.4 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 4
%35 = load i8, ptr %arrayidx107.4, align 4, !tbaa !5
%conv108.4 = sext i8 %35 to i32
%call109.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.4)
%arrayidx107.5 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 5
%36 = load i8, ptr %arrayidx107.5, align 1, !tbaa !5
%conv108.5 = sext i8 %36 to i32
%call109.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.5)
%arrayidx107.6 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 6
%37 = load i8, ptr %arrayidx107.6, align 2, !tbaa !5
%conv108.6 = sext i8 %37 to i32
%call109.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.6)
%arrayidx107.7 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 7
%38 = load i8, ptr %arrayidx107.7, align 1, !tbaa !5
%conv108.7 = sext i8 %38 to i32
%call109.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.7)
%arrayidx107.8 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 8
%39 = load i8, ptr %arrayidx107.8, align 16, !tbaa !5
%conv108.8 = sext i8 %39 to i32
%call109.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.8)
%arrayidx107.9 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 9
%40 = load i8, ptr %arrayidx107.9, align 1, !tbaa !5
%conv108.9 = sext i8 %40 to i32
%call109.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.9)
%arrayidx107.10 = getelementptr inbounds [3 x [12 x i8]], ptr %a, i64 0, i64 2, i64 10
%41 = load i8, ptr %arrayidx107.10, align 2, !tbaa !5
%conv108.10 = sext i8 %41 to i32
%call109.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv108.10)
%puts139 = call i32 @puts(ptr nonnull dereferenceable(1) @str.11)
%call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @str)
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %a) #6
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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: write) 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 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: 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 = !{!"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 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = distinct !{!15, !9, !10, !11}
!16 = distinct !{!16, !9, !11, !10}
!17 = distinct !{!17, !9, !10, !11}
!18 = distinct !{!18, !9, !11, !10}
|
#include<stdio.h>
int main()
{
int man,day,amari;
int choco = 0;
scanf("%d",&man);
scanf("%d",&day);
scanf("%d",&amari);
int temp = 0;
for(int i = 0;i < man;i++){
scanf("%d",&temp);
if(temp > day){
choco += 1;
}
else if(day % temp == 0){
choco += (day / temp);
}
else{
choco += (day / temp + 1);
}
}
choco += amari;
printf("%d\n",choco);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_272963/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_272963/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:
%man = alloca i32, align 4
%day = alloca i32, align 4
%amari = alloca i32, align 4
%temp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %man) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %day) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %amari) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %man)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %day)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %amari)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #3
store i32 0, ptr %temp, align 4, !tbaa !5
%0 = load i32, ptr %man, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
%choco.0.lcssa = phi i32 [ 0, %entry ], [ %choco.1, %for.inc ]
%1 = load i32, ptr %amari, align 4, !tbaa !5
%add13 = add nsw i32 %1, %choco.0.lcssa
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add13)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %amari) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %day) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %man) #3
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.023 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%choco.022 = phi i32 [ %choco.1, %for.inc ], [ 0, %entry ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp)
%2 = load i32, ptr %temp, align 4, !tbaa !5
%3 = load i32, ptr %day, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %2, %3
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%add = add nsw i32 %choco.022, 1
br label %for.inc
if.else: ; preds = %for.body
%rem = srem i32 %3, %2
%cmp5 = icmp eq i32 %rem, 0
%div = sdiv i32 %3, %2
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %if.else
%add7 = add nsw i32 %div, %choco.022
br label %for.inc
if.else8: ; preds = %if.else
%add10 = add i32 %choco.022, 1
%add11 = add i32 %add10, %div
br label %for.inc
for.inc: ; preds = %if.then, %if.else8, %if.then6
%choco.1 = phi i32 [ %add, %if.then ], [ %add7, %if.then6 ], [ %add11, %if.else8 ]
%inc = add nuw nsw i32 %i.023, 1
%4 = load i32, ptr %man, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
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 @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"}
|
#include<stdio.h>
#include<string.h>
int N,D,y,x,f;
char S[105][105];
int main()
{
scanf("%d",&N);
for(;N--;)
{
scanf("%d",&D);
memset(S,0,sizeof(S));
for(y=D,x=1,f=-1;;)
{
if(f!=-1)S[--y][++x]=0;
for(f=0;y>=1&&!S[y-1][x]&&!S[y][x+1]&&!S[y][x-1];y--)
{
f=1;
S[y][x]=1;
}
if(!f)break;
for(f=0,S[++y][++x]=0;x<=D&&!S[y][x+1]&&!S[y-1][x+1]&&!S[y+1][x];x++)
{
f=1;
S[y][x]=1;
}
if(!f)break;
for(f=0,S[++y][--x]=0;y<=D&&!S[y+1][x]&&!S[y][x+1]&&!S[y][x-1];y++)
{
f=1;
S[y][x]=1;
}
if(!f)break;
for(f=0,S[--y][--x]=0;x>=1&&!S[y][x-1]&&!S[y-1][x]&&!S[y+1][x];x--)
{
f=1;
S[y][x]=1;
}
if(!f)break;
}
for(y=1;y<D+1;y++,puts(""))
for(x=1;x<D+1;x++)
putchar(S[y][x]==1?'#':' ');
if(N)puts("");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273005/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273005/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 = dso_local global i32 0, align 4
@D = dso_local global i32 0, align 4
@S = dso_local local_unnamed_addr global [105 x [105 x i8]] zeroinitializer, align 16
@y = dso_local local_unnamed_addr global i32 0, align 4
@x = dso_local local_unnamed_addr global i32 0, align 4
@f = dso_local local_unnamed_addr global i32 0, align 4
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%dec250 = add nsw i32 %0, -1
store i32 %dec250, ptr @N, align 4, !tbaa !5
%tobool.not251 = icmp eq i32 %0, 0
br i1 %tobool.not251, label %for.end188, label %for.body
for.body: ; preds = %entry, %if.end187
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @D)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(11025) @S, i8 0, i64 11025, i1 false)
%1 = load i32, ptr @D, align 4, !tbaa !5
store i32 1, ptr @x, align 4, !tbaa !5
store i32 -1, ptr @f, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%3 = add i32 %1, 1
br label %for.cond2
for.cond2: ; preds = %for.cond2.backedge, %for.body
%x.promoted222 = phi i32 [ 1, %for.body ], [ %x.promoted222.be, %for.cond2.backedge ]
%y.promoted219 = phi i32 [ %1, %for.body ], [ %dec119, %for.cond2.backedge ]
%cmp.not = phi i1 [ true, %for.body ], [ false, %for.cond2.backedge ]
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %for.cond2
%dec3 = add nsw i32 %y.promoted219, -1
%idxprom = sext i32 %dec3 to i64
%inc = add nsw i32 %x.promoted222, 1
store i32 %inc, ptr @x, align 4, !tbaa !5
%idxprom4 = sext i32 %inc to i64
%arrayidx5 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom, i64 %idxprom4
store i8 0, ptr %arrayidx5, align 1, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.cond2
%x.promoted221 = phi i32 [ %inc, %if.then ], [ %x.promoted222, %for.cond2 ]
%y.promoted218 = phi i32 [ %dec3, %if.then ], [ %y.promoted219, %for.cond2 ]
%cmp7198 = icmp sgt i32 %y.promoted218, 0
br i1 %cmp7198, label %land.lhs.true.lr.ph, label %for.end161
land.lhs.true.lr.ph: ; preds = %if.end
%idxprom10 = sext i32 %x.promoted221 to i64
%add = add nsw i32 %x.promoted221, 1
%idxprom16 = sext i32 %add to i64
%sub21 = add nsw i32 %x.promoted221, -1
%idxprom22 = sext i32 %sub21 to i64
%sub.peel = add nsw i32 %y.promoted218, -1
%idxprom8.peel = zext i32 %sub.peel to i64
%arrayidx11.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom8.peel, i64 %idxprom10
%4 = load i8, ptr %arrayidx11.peel, align 1, !tbaa !9
%tobool12.not.peel = icmp eq i8 %4, 0
br i1 %tobool12.not.peel, label %land.lhs.true13.peel, label %for.end161
land.lhs.true13.peel: ; preds = %land.lhs.true.lr.ph
%idxprom14.peel = zext i32 %y.promoted218 to i64
%arrayidx17.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom14.peel, i64 %idxprom16
%5 = load i8, ptr %arrayidx17.peel, align 1, !tbaa !9
%tobool18.not.peel = icmp eq i8 %5, 0
br i1 %tobool18.not.peel, label %land.rhs.peel, label %for.end161
land.rhs.peel: ; preds = %land.lhs.true13.peel
%arrayidx23.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom14.peel, i64 %idxprom22
%6 = load i8, ptr %arrayidx23.peel, align 1, !tbaa !9
%tobool24.not.peel = icmp eq i8 %6, 0
br i1 %tobool24.not.peel, label %for.body25.peel, label %for.end161
for.body25.peel: ; preds = %land.rhs.peel
%arrayidx29.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom14.peel, i64 %idxprom10
store i8 1, ptr %arrayidx29.peel, align 1, !tbaa !9
%cmp7.peel = icmp ugt i32 %y.promoted218, 1
br i1 %cmp7.peel, label %land.lhs.true, label %if.end33
land.lhs.true: ; preds = %for.body25.peel, %for.body25
%7 = phi i32 [ %sub, %for.body25 ], [ %sub.peel, %for.body25.peel ]
%sub = add nsw i32 %7, -1
%idxprom8 = zext i32 %sub to i64
%arrayidx11 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom8, i64 %idxprom10
%8 = load i8, ptr %arrayidx11, align 1, !tbaa !9
%tobool12.not = icmp eq i8 %8, 0
br i1 %tobool12.not, label %land.lhs.true13, label %if.end33
land.lhs.true13: ; preds = %land.lhs.true
%idxprom14 = zext i32 %7 to i64
%arrayidx17 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom14, i64 %idxprom16
%9 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%tobool18.not = icmp eq i8 %9, 0
br i1 %tobool18.not, label %land.rhs, label %if.end33
land.rhs: ; preds = %land.lhs.true13
%arrayidx23 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom14, i64 %idxprom22
%10 = load i8, ptr %arrayidx23, align 1, !tbaa !9
%tobool24.not = icmp eq i8 %10, 0
br i1 %tobool24.not, label %for.body25, label %if.end33
for.body25: ; preds = %land.rhs
%arrayidx29 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom14, i64 %idxprom10
store i8 1, ptr %arrayidx29, align 1, !tbaa !9
store i32 %sub, ptr @y, align 4, !tbaa !5
%cmp7 = icmp ugt i32 %7, 1
br i1 %cmp7, label %land.lhs.true, label %if.end33, !llvm.loop !10
if.end33: ; preds = %land.rhs, %for.body25, %land.lhs.true, %land.lhs.true13, %for.body25.peel
%.lcssa.ph = phi i32 [ 0, %for.body25.peel ], [ %7, %land.lhs.true13 ], [ %7, %land.lhs.true ], [ 0, %for.body25 ], [ %7, %land.rhs ]
%inc34 = add nuw nsw i32 %.lcssa.ph, 1
%idxprom35 = zext i32 %inc34 to i64
%inc37 = add nsw i32 %x.promoted221, 1
store i32 %inc37, ptr @x, align 4, !tbaa !5
%idxprom38 = sext i32 %inc37 to i64
%arrayidx39 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom35, i64 %idxprom38
store i8 0, ptr %arrayidx39, align 1, !tbaa !9
%idxprom51 = zext i32 %.lcssa.ph to i64
%add58 = add nuw i32 %.lcssa.ph, 2
%idxprom59 = sext i32 %add58 to i64
%cmp41.not203.not = icmp slt i32 %x.promoted221, %1
br i1 %cmp41.not203.not, label %land.lhs.true42.preheader, label %for.end161
land.lhs.true42.preheader: ; preds = %if.end33
%11 = sext i32 %x.promoted221 to i64
%12 = add nsw i64 %11, 1
%indvars.iv.next.peel = add nsw i64 %11, 2
%arrayidx47.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom35, i64 %indvars.iv.next.peel
%13 = load i8, ptr %arrayidx47.peel, align 1, !tbaa !9
%tobool48.not.peel = icmp eq i8 %13, 0
br i1 %tobool48.not.peel, label %land.lhs.true49.peel, label %for.end161
land.lhs.true49.peel: ; preds = %land.lhs.true42.preheader
%arrayidx55.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom51, i64 %indvars.iv.next.peel
%14 = load i8, ptr %arrayidx55.peel, align 1, !tbaa !9
%tobool56.not.peel = icmp eq i8 %14, 0
br i1 %tobool56.not.peel, label %land.rhs57.peel, label %for.end161
land.rhs57.peel: ; preds = %land.lhs.true49.peel
%arrayidx62.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom59, i64 %12
%15 = load i8, ptr %arrayidx62.peel, align 1, !tbaa !9
%tobool63.not.peel = icmp eq i8 %15, 0
br i1 %tobool63.not.peel, label %for.body66.peel, label %for.end161
for.body66.peel: ; preds = %land.rhs57.peel
%arrayidx70.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom35, i64 %12
store i8 1, ptr %arrayidx70.peel, align 1, !tbaa !9
%16 = add nsw i64 %11, 1
%exitcond.peel.not = icmp eq i64 %16, %2
br i1 %exitcond.peel.not, label %if.end76, label %land.lhs.true42
land.lhs.true42: ; preds = %for.body66.peel, %for.body66
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body66 ], [ %indvars.iv.next.peel, %for.body66.peel ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx47 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom35, i64 %indvars.iv.next
%17 = load i8, ptr %arrayidx47, align 1, !tbaa !9
%tobool48.not = icmp eq i8 %17, 0
br i1 %tobool48.not, label %land.lhs.true49, label %if.end76.loopexit.split.loop.exit277
land.lhs.true49: ; preds = %land.lhs.true42
%arrayidx55 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom51, i64 %indvars.iv.next
%18 = load i8, ptr %arrayidx55, align 1, !tbaa !9
%tobool56.not = icmp eq i8 %18, 0
br i1 %tobool56.not, label %land.rhs57, label %if.end76.loopexit.split.loop.exit
land.rhs57: ; preds = %land.lhs.true49
%arrayidx62 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom59, i64 %indvars.iv
%19 = load i8, ptr %arrayidx62, align 1, !tbaa !9
%tobool63.not = icmp eq i8 %19, 0
br i1 %tobool63.not, label %for.body66, label %if.end76.loopexit.split.loop.exit281
for.body66: ; preds = %land.rhs57
%arrayidx70 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom35, i64 %indvars.iv
store i8 1, ptr %arrayidx70, align 1, !tbaa !9
%exitcond.not = icmp eq i64 %indvars.iv, %2
br i1 %exitcond.not, label %if.end76, label %land.lhs.true42, !llvm.loop !13
if.end76.loopexit.split.loop.exit: ; preds = %land.lhs.true49
%20 = trunc i64 %indvars.iv to i32
br label %if.end76
if.end76.loopexit.split.loop.exit277: ; preds = %land.lhs.true42
%21 = trunc i64 %indvars.iv to i32
br label %if.end76
if.end76.loopexit.split.loop.exit281: ; preds = %land.rhs57
%22 = trunc i64 %indvars.iv to i32
br label %if.end76
if.end76: ; preds = %for.body66, %if.end76.loopexit.split.loop.exit, %if.end76.loopexit.split.loop.exit277, %if.end76.loopexit.split.loop.exit281, %for.body66.peel
%.lcssa196.ph = phi i32 [ %3, %for.body66.peel ], [ %20, %if.end76.loopexit.split.loop.exit ], [ %21, %if.end76.loopexit.split.loop.exit277 ], [ %22, %if.end76.loopexit.split.loop.exit281 ], [ %3, %for.body66 ]
%dec80 = add nsw i32 %.lcssa196.ph, -1
store i32 %dec80, ptr @x, align 4, !tbaa !5
%idxprom81 = sext i32 %dec80 to i64
%arrayidx82 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom59, i64 %idxprom81
store i8 0, ptr %arrayidx82, align 1, !tbaa !9
%sub102 = add nsw i32 %.lcssa196.ph, -2
%idxprom103 = sext i32 %sub102 to i64
%cmp84.not210 = icmp sgt i32 %add58, %1
br i1 %cmp84.not210, label %for.end161, label %land.lhs.true85.lr.ph
land.lhs.true85.lr.ph: ; preds = %if.end76
%idxprom96 = sext i32 %.lcssa196.ph to i64
%indvars.iv.next259.peel = add nsw i64 %idxprom59, 1
%arrayidx90.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %indvars.iv.next259.peel, i64 %idxprom81
%23 = load i8, ptr %arrayidx90.peel, align 1, !tbaa !9
%tobool91.not.peel = icmp eq i8 %23, 0
br i1 %tobool91.not.peel, label %land.lhs.true92.peel, label %for.end161
land.lhs.true92.peel: ; preds = %land.lhs.true85.lr.ph
%arrayidx97.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom59, i64 %idxprom96
%24 = load i8, ptr %arrayidx97.peel, align 1, !tbaa !9
%tobool98.not.peel = icmp eq i8 %24, 0
br i1 %tobool98.not.peel, label %land.rhs99.peel, label %for.end161
land.rhs99.peel: ; preds = %land.lhs.true92.peel
%arrayidx104.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom59, i64 %idxprom103
%25 = load i8, ptr %arrayidx104.peel, align 1, !tbaa !9
%tobool105.not.peel = icmp eq i8 %25, 0
br i1 %tobool105.not.peel, label %for.body108.peel, label %for.end161
for.body108.peel: ; preds = %land.rhs99.peel
store i8 1, ptr %arrayidx82, align 1, !tbaa !9
%cmp84.not.not.peel = icmp slt i32 %add58, %1
br i1 %cmp84.not.not.peel, label %land.lhs.true85, label %if.end118
land.lhs.true85: ; preds = %for.body108.peel, %for.body108
%indvars.iv258 = phi i64 [ %indvars.iv.next259, %for.body108 ], [ %indvars.iv.next259.peel, %for.body108.peel ]
%indvars.iv.next259 = add nsw i64 %indvars.iv258, 1
%arrayidx90 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %indvars.iv.next259, i64 %idxprom81
%26 = load i8, ptr %arrayidx90, align 1, !tbaa !9
%tobool91.not = icmp eq i8 %26, 0
br i1 %tobool91.not, label %land.lhs.true92, label %if.end118.loopexit.split.loop.exit285
land.lhs.true92: ; preds = %land.lhs.true85
%arrayidx97 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %indvars.iv258, i64 %idxprom96
%27 = load i8, ptr %arrayidx97, align 1, !tbaa !9
%tobool98.not = icmp eq i8 %27, 0
br i1 %tobool98.not, label %land.rhs99, label %if.end118.loopexit.split.loop.exit
land.rhs99: ; preds = %land.lhs.true92
%arrayidx104 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %indvars.iv258, i64 %idxprom103
%28 = load i8, ptr %arrayidx104, align 1, !tbaa !9
%tobool105.not = icmp eq i8 %28, 0
br i1 %tobool105.not, label %for.body108, label %if.end118.loopexit.split.loop.exit289
for.body108: ; preds = %land.rhs99
%arrayidx112 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %indvars.iv258, i64 %idxprom81
store i8 1, ptr %arrayidx112, align 1, !tbaa !9
%cmp84.not.not = icmp slt i64 %indvars.iv258, %2
br i1 %cmp84.not.not, label %land.lhs.true85, label %if.end118, !llvm.loop !14
if.end118.loopexit.split.loop.exit: ; preds = %land.lhs.true92
%29 = trunc i64 %indvars.iv258 to i32
br label %if.end118
if.end118.loopexit.split.loop.exit285: ; preds = %land.lhs.true85
%30 = trunc i64 %indvars.iv258 to i32
br label %if.end118
if.end118.loopexit.split.loop.exit289: ; preds = %land.rhs99
%31 = trunc i64 %indvars.iv258 to i32
br label %if.end118
if.end118: ; preds = %for.body108, %if.end118.loopexit.split.loop.exit, %if.end118.loopexit.split.loop.exit285, %if.end118.loopexit.split.loop.exit289, %for.body108.peel
%.lcssa197.ph = phi i32 [ %3, %for.body108.peel ], [ %29, %if.end118.loopexit.split.loop.exit ], [ %30, %if.end118.loopexit.split.loop.exit285 ], [ %31, %if.end118.loopexit.split.loop.exit289 ], [ %3, %for.body108 ]
%dec119 = add nsw i32 %.lcssa197.ph, -1
store i32 %dec119, ptr @y, align 4, !tbaa !5
%idxprom120 = sext i32 %dec119 to i64
store i32 %sub102, ptr @x, align 4, !tbaa !5
%arrayidx124 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom120, i64 %idxprom103
store i8 0, ptr %arrayidx124, align 1, !tbaa !9
%sub135 = add nsw i32 %.lcssa197.ph, -2
%idxprom136 = sext i32 %sub135 to i64
%idxprom143 = sext i32 %.lcssa197.ph to i64
%cmp126216 = icmp sgt i32 %.lcssa196.ph, 2
br i1 %cmp126216, label %land.lhs.true127.preheader, label %for.end161
land.lhs.true127.preheader: ; preds = %if.end118
%sub130.peel = add nsw i32 %.lcssa196.ph, -3
%idxprom131.peel = zext i32 %sub130.peel to i64
%arrayidx132.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom120, i64 %idxprom131.peel
%32 = load i8, ptr %arrayidx132.peel, align 1, !tbaa !9
%tobool133.not.peel = icmp eq i8 %32, 0
br i1 %tobool133.not.peel, label %land.lhs.true134.peel, label %for.end161
land.lhs.true134.peel: ; preds = %land.lhs.true127.preheader
%idxprom138.peel = zext i32 %sub102 to i64
%arrayidx139.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom136, i64 %idxprom138.peel
%33 = load i8, ptr %arrayidx139.peel, align 1, !tbaa !9
%tobool140.not.peel = icmp eq i8 %33, 0
br i1 %tobool140.not.peel, label %land.rhs141.peel, label %for.end161
land.rhs141.peel: ; preds = %land.lhs.true134.peel
%arrayidx146.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom143, i64 %idxprom138.peel
%34 = load i8, ptr %arrayidx146.peel, align 1, !tbaa !9
%tobool147.not.peel = icmp eq i8 %34, 0
br i1 %tobool147.not.peel, label %for.body150.peel, label %for.end161
for.body150.peel: ; preds = %land.rhs141.peel
%arrayidx154.peel = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom120, i64 %idxprom138.peel
store i8 1, ptr %arrayidx154.peel, align 1, !tbaa !9
store i32 %sub130.peel, ptr @x, align 4, !tbaa !5
%cmp126.peel = icmp ugt i32 %.lcssa196.ph, 3
br i1 %cmp126.peel, label %land.lhs.true127, label %for.cond2.backedge
for.cond2.backedge: ; preds = %land.lhs.true134, %land.lhs.true127, %for.body150, %land.rhs141, %for.body150.peel
%x.promoted222.be = phi i32 [ 0, %for.body150.peel ], [ %35, %land.rhs141 ], [ 0, %for.body150 ], [ %35, %land.lhs.true127 ], [ %35, %land.lhs.true134 ]
br label %for.cond2
land.lhs.true127: ; preds = %for.body150.peel, %for.body150
%35 = phi i32 [ %sub130, %for.body150 ], [ %sub130.peel, %for.body150.peel ]
%sub130 = add nsw i32 %35, -1
%idxprom131 = zext i32 %sub130 to i64
%arrayidx132 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom120, i64 %idxprom131
%36 = load i8, ptr %arrayidx132, align 1, !tbaa !9
%tobool133.not = icmp eq i8 %36, 0
br i1 %tobool133.not, label %land.lhs.true134, label %for.cond2.backedge
land.lhs.true134: ; preds = %land.lhs.true127
%idxprom138 = zext i32 %35 to i64
%arrayidx139 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom136, i64 %idxprom138
%37 = load i8, ptr %arrayidx139, align 1, !tbaa !9
%tobool140.not = icmp eq i8 %37, 0
br i1 %tobool140.not, label %land.rhs141, label %for.cond2.backedge
land.rhs141: ; preds = %land.lhs.true134
%arrayidx146 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom143, i64 %idxprom138
%38 = load i8, ptr %arrayidx146, align 1, !tbaa !9
%tobool147.not = icmp eq i8 %38, 0
br i1 %tobool147.not, label %for.body150, label %for.cond2.backedge
for.body150: ; preds = %land.rhs141
%arrayidx154 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom120, i64 %idxprom138
store i8 1, ptr %arrayidx154, align 1, !tbaa !9
store i32 %sub130, ptr @x, align 4, !tbaa !5
%cmp126 = icmp ugt i32 %35, 1
br i1 %cmp126, label %land.lhs.true127, label %for.cond2.backedge, !llvm.loop !15
for.end161: ; preds = %land.rhs141.peel, %land.lhs.true134.peel, %land.lhs.true127.preheader, %if.end118, %if.end76, %land.rhs99.peel, %land.lhs.true92.peel, %land.lhs.true85.lr.ph, %if.end33, %land.rhs57.peel, %land.lhs.true49.peel, %land.lhs.true42.preheader, %if.end, %land.rhs.peel, %land.lhs.true13.peel, %land.lhs.true.lr.ph
store i32 0, ptr @f, align 4, !tbaa !5
store i32 1, ptr @y, align 4, !tbaa !5
%cmp164.not249 = icmp slt i32 %1, 1
br i1 %cmp164.not249, label %for.end183, label %for.cond166.preheader
for.cond166.preheader: ; preds = %for.end161, %for.inc180
%39 = phi i32 [ %48, %for.inc180 ], [ 1, %for.end161 ]
%40 = phi i32 [ %49, %for.inc180 ], [ %1, %for.end161 ]
store i32 1, ptr @x, align 4, !tbaa !5
%cmp168.not247 = icmp slt i32 %40, 1
br i1 %cmp168.not247, label %for.inc180, label %for.body169
for.body169: ; preds = %for.cond166.preheader, %for.body169
%storemerge248 = phi i32 [ %inc178, %for.body169 ], [ 1, %for.cond166.preheader ]
%41 = load i32, ptr @y, align 4, !tbaa !5
%idxprom170 = sext i32 %41 to i64
%idxprom172 = sext i32 %storemerge248 to i64
%arrayidx173 = getelementptr inbounds [105 x [105 x i8]], ptr @S, i64 0, i64 %idxprom170, i64 %idxprom172
%42 = load i8, ptr %arrayidx173, align 1, !tbaa !9
%cmp174 = icmp eq i8 %42, 1
%cond = select i1 %cmp174, i32 35, i32 32
%43 = load ptr, ptr @stdout, align 8, !tbaa !16
%call.i = tail call noundef i32 @putc(i32 noundef %cond, ptr noundef %43)
%44 = load i32, ptr @x, align 4, !tbaa !5
%inc178 = add nsw i32 %44, 1
store i32 %inc178, ptr @x, align 4, !tbaa !5
%45 = load i32, ptr @D, align 4, !tbaa !5
%cmp168.not.not = icmp slt i32 %44, %45
br i1 %cmp168.not.not, label %for.body169, label %for.inc180.loopexit, !llvm.loop !18
for.inc180.loopexit: ; preds = %for.body169
%.pre = load i32, ptr @y, align 4, !tbaa !5
br label %for.inc180
for.inc180: ; preds = %for.inc180.loopexit, %for.cond166.preheader
%46 = phi i32 [ %.pre, %for.inc180.loopexit ], [ %39, %for.cond166.preheader ]
%inc181 = add nsw i32 %46, 1
store i32 %inc181, ptr @y, align 4, !tbaa !5
%47 = load ptr, ptr @stdout, align 8, !tbaa !16
%call.i194 = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %47)
%48 = load i32, ptr @y, align 4, !tbaa !5
%49 = load i32, ptr @D, align 4, !tbaa !5
%cmp164.not = icmp sgt i32 %48, %49
br i1 %cmp164.not, label %for.end183, label %for.cond166.preheader, !llvm.loop !19
for.end183: ; preds = %for.inc180, %for.end161
%50 = load i32, ptr @N, align 4, !tbaa !5
%tobool184.not = icmp eq i32 %50, 0
br i1 %tobool184.not, label %if.end187.thread, label %if.end187
if.end187.thread: ; preds = %for.end183
store i32 -1, ptr @N, align 4, !tbaa !5
br label %for.end188
if.end187: ; preds = %for.end183
%51 = load ptr, ptr @stdout, align 8, !tbaa !16
%call.i195 = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %51)
%.pre263 = load i32, ptr @N, align 4, !tbaa !5
%dec = add nsw i32 %.pre263, -1
store i32 %dec, ptr @N, align 4, !tbaa !5
%tobool.not = icmp eq i32 %.pre263, 0
br i1 %tobool.not, label %for.end188, label %for.body, !llvm.loop !20
for.end188: ; preds = %if.end187, %if.end187.thread, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
!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, !12}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !11, !12}
!14 = distinct !{!14, !11, !12}
!15 = distinct !{!15, !11, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !7, i64 0}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
int str_cmp(const void *a,const void *b)
{
return strcmp((char*)a, (char*)b);
}
int main(){
long long int n;
scanf("%lld", &n);
char s[n][11];
long long int a;
for(a=0;a<n;a++)
{
scanf("%s",s[a]);
}
qsort(s,n,sizeof(s[0]),str_cmp);
long long int ans=1;
for(a=0;a<n - 1;a++)
{
if(strcmp(s[a],s[a+1])!=0)
{
ans++;
}
}
printf("%lld\n",ans);
return 0;}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273128/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"%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @str_cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #7
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca [11 x i8], i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp23 = icmp sgt i64 %2, 0
br i1 %cmp23, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%a.024 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [11 x i8], ptr %vla, i64 %a.024
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %a.024, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %2, %entry ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %.lcssa, i64 noundef 11, ptr noundef nonnull @str_cmp) #8
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp325 = icmp sgt i64 %4, 1
br i1 %cmp325, label %for.body4.preheader, label %for.end14
for.body4.preheader: ; preds = %for.end
%5 = add i64 %4, -2
br label %for.body4
for.body4: ; preds = %for.body4.preheader, %for.body4
%ans.027 = phi i64 [ %spec.select, %for.body4 ], [ 1, %for.body4.preheader ]
%a.126 = phi i64 [ %add, %for.body4 ], [ 0, %for.body4.preheader ]
%arrayidx5 = getelementptr inbounds [11 x i8], ptr %vla, i64 %a.126
%add = add nuw nsw i64 %a.126, 1
%arrayidx7 = getelementptr inbounds [11 x i8], ptr %vla, i64 %add
%call9 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx5, ptr noundef nonnull dereferenceable(1) %arrayidx7) #7
%cmp10.not = icmp ne i32 %call9, 0
%inc11 = zext i1 %cmp10.not to i64
%spec.select = add nuw nsw i64 %ans.027, %inc11
%exitcond.not = icmp eq i64 %a.126, %5
br i1 %exitcond.not, label %for.end14, label %for.body4, !llvm.loop !11
for.end14: ; preds = %for.body4, %for.end
%ans.0.lcssa = phi i64 [ 1, %for.end ], [ %spec.select, %for.body4 ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
attributes #0 = { 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 #1 = { 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 #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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//char S[200010][10];
int compare_string(const void *a, const void *b) {
return strcmp(*(char **)a, *(char **)b);
}
int main(){
int N;
char cmp[10];
char **S;
int flag=1;
scanf("%d\n",&N);
int i,j,cnt=0;
S = (char**)malloc(sizeof(char*)*N);
for(i=0;i<N;i++){
S[i]=(char*)malloc(sizeof(char)*10);
scanf("%s",cmp);
strcpy(S[i],cmp);
}
qsort((void *)S, N, sizeof(S[0]), compare_string);
for(i=0; i<N-1; i++) {
//printf("%d, %s,%s\n",i, S[i],S[i+1]);
if(strcmp(S[i],S[i+1])!=0){
cnt++;
}
}
cnt++;
printf("%d\n",cnt);
free(S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273186/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273186/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"%s\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @compare_string(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !5
%1 = load ptr, ptr %b, align 8, !tbaa !5
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #9
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
%cmp = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #10
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %cmp) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !9
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #11
%cmp242 = icmp sgt i32 %0, 0
br i1 %cmp242, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call4 = call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #11
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call4, ptr %arrayidx, align 8, !tbaa !5
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %cmp)
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call4, ptr noundef nonnull dereferenceable(1) %cmp) #10
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !9
%2 = sext i32 %1 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%conv10.pre-phi = phi i64 [ %conv, %entry ], [ %2, %for.body ]
call void @qsort(ptr noundef %call1, i64 noundef %conv10.pre-phi, i64 noundef 8, ptr noundef nonnull @compare_string) #10
%3 = load i32, ptr %N, align 4, !tbaa !9
%cmp1244 = icmp sgt i32 %3, 1
br i1 %cmp1244, label %for.body14.preheader, label %for.end25
for.body14.preheader: ; preds = %for.end
%sub = add nsw i32 %3, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load ptr, ptr %call1, align 8, !tbaa !5
br label %for.body14
for.body14: ; preds = %for.body14.preheader, %for.body14
%4 = phi ptr [ %.pre, %for.body14.preheader ], [ %5, %for.body14 ]
%indvars.iv50 = phi i64 [ 0, %for.body14.preheader ], [ %indvars.iv.next51, %for.body14 ]
%cnt.046 = phi i32 [ 0, %for.body14.preheader ], [ %spec.select, %for.body14 ]
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%arrayidx18 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv.next51
%5 = load ptr, ptr %arrayidx18, align 8, !tbaa !5
%call19 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) %5) #9
%cmp20.not = icmp ne i32 %call19, 0
%inc22 = zext i1 %cmp20.not to i32
%spec.select = add nuw nsw i32 %cnt.046, %inc22
%exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond.not, label %for.end25.loopexit, label %for.body14, !llvm.loop !13
for.end25.loopexit: ; preds = %for.body14
%6 = add nuw nsw i32 %spec.select, 1
br label %for.end25
for.end25: ; preds = %for.end25.loopexit, %for.end
%cnt.0.lcssa = phi i32 [ 1, %for.end ], [ %6, %for.end25.loopexit ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cnt.0.lcssa)
call void @free(ptr noundef %call1) #10
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %cmp) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #10
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
attributes #0 = { mustprogress nofree nounwind willreturn memory(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 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 #2 = { 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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { 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 #8 = { 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 #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind }
attributes #11 = { 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 = !{!"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>
int main(void)
{
int r, g, b, k = 0;
scanf("%d", &r);
scanf("%d", &g);
scanf("%d", &b);
k = 100 * r + 10 * g + b;
if (k % 4 == 0) {
printf("YES");
}
else {
printf("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273229/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273229/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:
%r = alloca i32, align 4
%g = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #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 %r)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %g)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %g, align 4, !tbaa !5
%mul3 = shl i32 %0, 1
%1 = load i32, ptr %b, align 4, !tbaa !5
%add4 = add i32 %mul3, %1
%2 = and i32 %add4, 3
%cmp = icmp eq i32 %2, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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 r,g,b;
scanf("%d",&r);
scanf("%d",&g);
scanf("%d",&b);
if((g*10 + b) % 4 == 0)
printf("YES");
else
printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273272/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273272/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:
%r = alloca i32, align 4
%g = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #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 %r)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %g)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %g, align 4, !tbaa !5
%mul = shl i32 %0, 1
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %mul, %1
%2 = and i32 %add, 3
%cmp = icmp eq i32 %2, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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 a,b,c,sum;
scanf("%d %d %d",&a,&b,&c);
sum=100*a+10*b+c;
if(sum%4==0){printf("YES");}
else{printf("NO");}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273322/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273322/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 [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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %b, align 4, !tbaa !5
%mul1 = shl i32 %0, 1
%1 = load i32, ptr %c, align 4, !tbaa !5
%add2 = add i32 %mul1, %1
%2 = and i32 %add2, 3
%cmp = icmp eq i32 %2, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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"}
|
#include <stdio.h>
int main(void){
int a,b,c,d;
scanf("%d %d %d",&a,&b,&c);
d=100*a+10*b+c;
if(d%4==0){
printf("YES");}
else{printf("NO");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273373/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273373/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 [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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %b, align 4, !tbaa !5
%mul1 = shl i32 %0, 1
%1 = load i32, ptr %c, align 4, !tbaa !5
%add2 = add i32 %mul1, %1
%2 = and i32 %add2, 3
%cmp = icmp eq i32 %2, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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"}
|
#include <stdio.h>
int main(void){
int r,g,b;
scanf("%d%d%d",&r,&g,&b);
if((r*100+g*10+b)%4==0) printf("YES");
else printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273416/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273416/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 [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:
%r = alloca i32, align 4
%g = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #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 %r, ptr noundef nonnull %g, ptr noundef nonnull %b)
%0 = load i32, ptr %g, align 4, !tbaa !5
%mul1 = shl i32 %0, 1
%1 = load i32, ptr %b, align 4, !tbaa !5
%add2 = add i32 %mul1, %1
%2 = and i32 %add2, 3
%cmp = icmp eq i32 %2, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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>
#include<string.h>
int main()
{
char in[20];
int zero,non,k,i;
scanf("%s",in);
scanf("%d",&k);
for(zero=non=0,i=strlen(in)-1;i>=0;i--)
{
if(in[i]=='0')
zero++;
else
non++;
if(zero==k)
{
printf("%d\n",non);
return 0;
}
}
printf("%d",strlen(in)-1);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27346/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"%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:
%in = alloca [20 x i8], align 16
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %in) #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 %in)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %in) #5
%0 = trunc i64 %call3 to i32
%1 = load i32, ptr %k, align 4
br label %for.cond
for.cond: ; preds = %for.body, %entry
%zero.0 = phi i32 [ 0, %entry ], [ %zero.1, %for.body ]
%non.0 = phi i32 [ 0, %entry ], [ %non.1, %for.body ]
%i.0.in = phi i32 [ %0, %entry ], [ %i.0, %for.body ]
%i.0 = add i32 %i.0.in, -1
%cmp = icmp sgt i32 %i.0, -1
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%idxprom = zext i32 %i.0 to i64
%arrayidx = getelementptr inbounds [20 x i8], ptr %in, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp6 = icmp eq i8 %2, 48
%inc = zext i1 %cmp6 to i32
%zero.1 = add nuw nsw i32 %zero.0, %inc
%not.cmp6 = xor i1 %cmp6, true
%inc8 = zext i1 %not.cmp6 to i32
%non.1 = add nuw nsw i32 %non.0, %inc8
%cmp9 = icmp eq i32 %zero.1, %1
br i1 %cmp9, label %if.then11, label %for.cond, !llvm.loop !8
if.then11: ; preds = %for.body
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %non.1)
br label %cleanup
for.end: ; preds = %for.cond
%sub16 = add i64 %call3, -1
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub16)
br label %cleanup
cleanup: ; preds = %for.end, %if.then11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %in) #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>
int main(void) {
int r, g, b,num;
char buf[128];
fgets(buf,128,stdin);
sscanf(buf,"%d %d %d",&r,&g,&b);
num = r*100 + g*10 + b*1;
if(num%4 == 0) {
printf("YES");
} else {
printf("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273502/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 [9 x i8] c"%d %d %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:
%r = alloca i32, align 4
%g = alloca i32, align 4
%b = alloca i32, align 4
%buf = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %buf) #3
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 128, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %buf, ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %g, ptr noundef nonnull %b) #3
%1 = load i32, ptr %g, align 4, !tbaa !9
%mul3 = shl i32 %1, 1
%2 = load i32, ptr %b, align 4, !tbaa !9
%add5 = add i32 %mul3, %2
%3 = and i32 %add5, 3
%cmp = icmp eq i32 %3, 0
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %buf) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, 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 = !{!"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}
|
#include<stdio.h>
#include<string.h>
int main (void){
int r,g,b,n;
while(scanf("%d%d%d",&r,&g,&b)!=EOF){
n=r*100 + g*10 +b;
if(n%4==0){
printf("YES");}
else printf("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273553/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273553/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 [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:
%r = alloca i32, align 4
%g = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %g, ptr noundef nonnull %b)
%cmp.not7 = icmp eq i32 %call6, -1
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %g, align 4, !tbaa !5
%mul1 = shl i32 %0, 1
%1 = load i32, ptr %b, align 4, !tbaa !5
%add2 = add i32 %mul1, %1
%2 = and i32 %add2, 3
%cmp3 = icmp eq i32 %2, 0
%.str.1..str.2 = select i1 %cmp3, ptr @.str.1, ptr @.str.2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %g, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.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 %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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 a,b,c;
scanf("%d %d %d",&a,&b,&c);
if((b*10+c)%4==0) printf("YES\n");
else printf("NO\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273597/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 = 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
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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %b, align 4, !tbaa !5
%mul = shl i32 %0, 1
%1 = load i32, ptr %c, align 4, !tbaa !5
%add = add i32 %mul, %1
%2 = and i32 %add, 3
%cmp = icmp eq i32 %2, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
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<stdio.h>
int main(void)
{
int i,n,c=0;
char a,dammy;
scanf("%d%c",&n,&dammy);
for(i=0;i<n;i++){
scanf("%c%c",&a,&dammy);
if(a=='Y')
c=1;
}
if(c==1)
printf("Four");
else
printf("Three");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273647/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273647/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%c\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Four\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Three\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 i8, align 1
%dammy = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %dammy) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %dammy)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %if.else
for.body: ; preds = %entry, %for.body
%c.013 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%i.012 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %dammy)
%1 = load i8, ptr %a, align 1, !tbaa !9
%cmp2 = icmp eq i8 %1, 89
%spec.select = select i1 %cmp2, i32 1, i32 %c.013
%inc = add nuw nsw i32 %i.012, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body
%3 = icmp eq i32 %spec.select, 1
br i1 %3, label %if.end9, label %if.else
if.else: ; preds = %entry, %for.end
br label %if.end9
if.end9: ; preds = %for.end, %if.else
%.str.3.sink = phi ptr [ @.str.3, %if.else ], [ @.str.2, %for.end ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %dammy) #3
call void @llvm.lifetime.end.p0(i64 1, 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include <stdlib.h>
int main(void) {
int N;
scanf("%d", &N);
int x = 1;
int y;
int i;
char *S;
int a[4] = {0};
S = (char *)malloc(N * sizeof(char));
for(i=0; i<N; i++) {
scanf("%s", &S[i]);
}
for(i=0; i < N; i++) {
switch(S[i]) {
case('P'):
a[0] = 1;
break;
case('W'):
a[1] = 1;
break;
case('G'):
a[2] = 1;
break;
case('Y'):
a[3] = 1;
break;
default:
printf("ERROR!\n");
return 0;
}
}
if(a[0] + a[1] + a[2] + a[3] == 4){
printf("Four\n");
free(S);
return 0;
}
printf("Three\n");
free(S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273690/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273690/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
@str = private unnamed_addr constant [6 x i8] c"Three\00", align 1
@str.5 = private unnamed_addr constant [5 x i8] c"Four\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"ERROR!\00", align 1
; Function Attrs: 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) #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
%call1 = call noalias ptr @malloc(i64 noundef %conv) #7
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %if.end
for.cond4.preheader: ; preds = %for.body
%cmp553 = icmp sgt i32 %1, 0
br i1 %cmp553, label %for.body7.preheader, label %if.end
for.body7.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i8, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %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.cond4.preheader, !llvm.loop !9
for.body7: ; preds = %for.body7.preheader, %for.inc19
%indvars.iv65 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next66, %for.inc19 ]
%a.sroa.9.058 = phi i32 [ 0, %for.body7.preheader ], [ %a.sroa.9.1, %for.inc19 ]
%a.sroa.7.057 = phi i32 [ 0, %for.body7.preheader ], [ %a.sroa.7.1, %for.inc19 ]
%a.sroa.5.056 = phi i32 [ 0, %for.body7.preheader ], [ %a.sroa.5.1, %for.inc19 ]
%a.sroa.0.055 = phi i32 [ 0, %for.body7.preheader ], [ %a.sroa.0.1, %for.inc19 ]
%arrayidx9 = getelementptr inbounds i8, ptr %call1, i64 %indvars.iv65
%3 = load i8, ptr %arrayidx9, align 1, !tbaa !11
%conv10 = sext i8 %3 to i32
switch i32 %conv10, label %sw.default [
i32 80, label %for.inc19
i32 87, label %sw.bb12
i32 71, label %sw.bb14
i32 89, label %sw.bb16
]
sw.bb12: ; preds = %for.body7
br label %for.inc19
sw.bb14: ; preds = %for.body7
br label %for.inc19
sw.bb16: ; preds = %for.body7
br label %for.inc19
sw.default: ; preds = %for.body7
%puts46 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %cleanup
for.inc19: ; preds = %for.body7, %sw.bb12, %sw.bb14, %sw.bb16
%a.sroa.0.1 = phi i32 [ %a.sroa.0.055, %sw.bb16 ], [ %a.sroa.0.055, %sw.bb14 ], [ %a.sroa.0.055, %sw.bb12 ], [ 1, %for.body7 ]
%a.sroa.5.1 = phi i32 [ %a.sroa.5.056, %sw.bb16 ], [ %a.sroa.5.056, %sw.bb14 ], [ 1, %sw.bb12 ], [ %a.sroa.5.056, %for.body7 ]
%a.sroa.7.1 = phi i32 [ %a.sroa.7.057, %sw.bb16 ], [ 1, %sw.bb14 ], [ %a.sroa.7.057, %sw.bb12 ], [ %a.sroa.7.057, %for.body7 ]
%a.sroa.9.1 = phi i32 [ 1, %sw.bb16 ], [ %a.sroa.9.058, %sw.bb14 ], [ %a.sroa.9.058, %sw.bb12 ], [ %a.sroa.9.058, %for.body7 ]
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%exitcond.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count
br i1 %exitcond.not, label %for.end21, label %for.body7, !llvm.loop !12
for.end21: ; preds = %for.inc19
%4 = add nuw nsw i32 %a.sroa.5.1, %a.sroa.0.1
%5 = add nuw nsw i32 %4, %a.sroa.7.1
%6 = add nuw nsw i32 %5, %a.sroa.9.1
%7 = icmp eq i32 %6, 4
br i1 %7, label %if.then, label %if.end
if.then: ; preds = %for.end21
%puts45 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
call void @free(ptr noundef nonnull %call1) #6
br label %cleanup
if.end: ; preds = %entry, %for.cond4.preheader, %for.end21
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @free(ptr noundef %call1) #6
br label %cleanup
cleanup: ; preds = %if.end, %if.then, %sw.default
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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) 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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void){
int N;
scanf("%d",&N);
int i;
char S;
int c=0;
for(i=0;i<N;i++){
scanf("%c",&S);
if(S == 'Y'){
c = 1;
break;
}
}
if(c == 0) printf("Three");
else printf("Four");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273733/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273733/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"%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Three\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"Four\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%S = alloca i8, align 1
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 1, ptr nonnull %S) #3
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not11 = icmp sgt i32 %0, 0
br i1 %cmp.not11, label %for.body, label %if.end9
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.012, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not = icmp slt i32 %inc, %1
br i1 %cmp.not, label %for.body, label %if.end9, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%i.012 = phi i32 [ %inc, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%2 = load i8, ptr %S, align 1, !tbaa !11
%cmp2 = icmp eq i8 %2, 89
br i1 %cmp2, label %if.end9, label %for.cond
if.end9: ; preds = %for.body, %for.cond, %entry
%.str.3.sink = phi ptr [ @.str.2, %entry ], [ @.str.2, %for.cond ], [ @.str.3, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %S) #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 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(){
int i,N;
int judge = 0;
char c;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf(" %c",&c);
if(c=='Y'){
printf("Four");
judge = 1;
break;
}
if(i==N-1&&judge==0){
printf("Three");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273777/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273777/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" %c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Four\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Three\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 i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #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 %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.015 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%1 = load i8, ptr %c, align 1, !tbaa !9
%cmp2 = icmp eq i8 %1, 89
br i1 %cmp2, label %if.then, label %if.end
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %for.end
if.end: ; preds = %for.body
%2 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%cmp5 = icmp eq i32 %i.015, %sub
br i1 %cmp5, label %if.then9, label %for.inc
if.then9: ; preds = %if.end
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then9
%3 = phi i32 [ %2, %if.end ], [ %.pre, %if.then9 ]
%inc = add nuw nsw i32 %i.015, 1
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.inc, %entry, %if.then
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main (void)
{
int N,i;
int a[20];
int b[20];
int c[20];
int val;
char bin;
int satisfy = 0;
//はいんねえ
scanf("%d",&N);
scanf("%c",&bin);
for(i=0;i<N;i++){
scanf("%d ",&a[i]);
//printf("got %d\n",a[i]);
//scanf("%c",&bin);
}
for(i=0;i<N;i++){
scanf("%d ",&b[i]);
//printf("b got %d\n",b[i]);
//scanf("%c",&bin);
}
for(i=0;i<N-1;i++){
scanf("%d",&c[i]);
//printf("got %d\n",c[i]);
scanf("%c",&bin);
}
//printf("sty:%d\n",satisfy);
for(i=0;i<N;i++){
satisfy+=b[a[i]-1];
//printf("wii add %d\n",b[a[i]-1]);
if(i==0){
}else if(a[i-1]+1 == a[i]){
//printf("add c:%d",c[a[i-1]-1]);
satisfy+=c[a[i-1]-1];
}
//printf("now sty %d\n",satisfy);
}
printf("%d",satisfy);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273863/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"%c\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 [20 x i32], align 16
%b = alloca [20 x i32], align 16
%c = alloca [20 x i32], align 16
%bin = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %bin) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %bin)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %for.end49
for.cond3.preheader: ; preds = %for.body
%cmp470 = icmp sgt i32 %1, 0
br i1 %cmp470, label %for.body5, label %for.end49
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, 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.cond3.preheader, !llvm.loop !9
for.cond12.preheader: ; preds = %for.body5
%cmp1373 = icmp sgt i32 %3, 1
br i1 %cmp1373, label %for.body14, label %for.cond22.preheader
for.body5: ; preds = %for.cond3.preheader, %for.body5
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv81
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx7)
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp4 = icmp slt i64 %indvars.iv.next82, %4
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !11
for.cond22.preheader: ; preds = %for.body14, %for.cond12.preheader
%.lcssa = phi i32 [ %3, %for.cond12.preheader ], [ %7, %for.body14 ]
%cmp2375 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2375, label %for.inc47.peel, label %for.end49
for.inc47.peel: ; preds = %for.cond22.preheader
%wide.trip.count = zext i32 %.lcssa to i64
%5 = load i32, ptr %a, align 16, !tbaa !5
%sub27.peel = add nsw i32 %5, -1
%idxprom28.peel = sext i32 %sub27.peel to i64
%arrayidx29.peel = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %idxprom28.peel
%6 = load i32, ptr %arrayidx29.peel, align 4, !tbaa !5
%exitcond.peel.not = icmp eq i32 %.lcssa, 1
br i1 %exitcond.peel.not, label %for.end49, label %if.else
for.body14: ; preds = %for.cond12.preheader, %for.body14
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body14 ], [ 0, %for.cond12.preheader ]
%arrayidx16 = getelementptr inbounds [20 x i32], ptr %c, i64 0, i64 %indvars.iv84
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx16)
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %bin)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%8 = sext i32 %sub to i64
%cmp13 = icmp slt i64 %indvars.iv.next85, %8
br i1 %cmp13, label %for.body14, label %for.cond22.preheader, !llvm.loop !12
if.else: ; preds = %for.inc47.peel, %for.inc47
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.inc47 ], [ 1, %for.inc47.peel ]
%satisfy.077 = phi i32 [ %satisfy.1, %for.inc47 ], [ %6, %for.inc47.peel ]
%arrayidx26 = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv87
%9 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%sub27 = add nsw i32 %9, -1
%idxprom28 = sext i32 %sub27 to i64
%arrayidx29 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %idxprom28
%10 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%add = add nsw i32 %10, %satisfy.077
%11 = add nsw i64 %indvars.iv87, -1
%arrayidx33 = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %11
%12 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%add34 = add nsw i32 %12, 1
%cmp37 = icmp eq i32 %add34, %9
br i1 %cmp37, label %if.then38, label %for.inc47
if.then38: ; preds = %if.else
%sub42 = add nsw i32 %12, -1
%idxprom43 = sext i32 %sub42 to i64
%arrayidx44 = getelementptr inbounds [20 x i32], ptr %c, i64 0, i64 %idxprom43
%13 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%add45 = add nsw i32 %13, %add
br label %for.inc47
for.inc47: ; preds = %if.then38, %if.else
%satisfy.1 = phi i32 [ %add45, %if.then38 ], [ %add, %if.else ]
%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.end49, label %if.else, !llvm.loop !13
for.end49: ; preds = %for.inc47, %for.cond3.preheader, %entry, %for.inc47.peel, %for.cond22.preheader
%satisfy.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ %6, %for.inc47.peel ], [ 0, %entry ], [ 0, %for.cond3.preheader ], [ %satisfy.1, %for.inc47 ]
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %satisfy.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %bin) #3
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 80, 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}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main()
{
int N;
int a[100];
int b[100];
int c[100];
int out = 0;
scanf("%d", &N);
for (int i = 0; i < N; i++) scanf("%d", &a[i]);
for (int i = 0; i < N; i++) scanf("%d", &b[i]);
for (int i = 0; i < N-1; i++) scanf("%d", &c[i]);
for (int i = 0; i < N; i++) {
out += b[a[i]-1];
if (a[i]-1 == a[i-1]) {
out += c[a[i-1]-1];
}
}
printf("%d\n", out);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273906/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273906/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:
%N = alloca i32, align 4
%a = alloca [100 x i32], align 16
%b = alloca [100 x i32], align 16
%c = 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 void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %for.body, label %for.cond.cleanup27
for.cond3.preheader: ; preds = %for.body
%cmp467 = icmp sgt i32 %1, 0
br i1 %cmp467, label %for.body6, label %for.cond.cleanup27
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.cond3.preheader, !llvm.loop !9
for.cond14.preheader: ; preds = %for.body6
%cmp1570 = icmp sgt i32 %3, 1
br i1 %cmp1570, label %for.body17, label %for.cond25.preheader
for.body6: ; preds = %for.cond3.preheader, %for.body6
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body6 ], [ 0, %for.cond3.preheader ]
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv78
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp4 = icmp slt i64 %indvars.iv.next79, %4
br i1 %cmp4, label %for.body6, label %for.cond14.preheader, !llvm.loop !11
for.cond25.preheader: ; preds = %for.body17, %for.cond14.preheader
%.lcssa = phi i32 [ %3, %for.cond14.preheader ], [ %6, %for.body17 ]
%cmp2672 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2672, label %for.body28.preheader, label %for.cond.cleanup27
for.body28.preheader: ; preds = %for.cond25.preheader
%wide.trip.count = zext i32 %.lcssa to i64
%arrayidx39.phi.trans.insert = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 -1
%.pre = load i32, ptr %arrayidx39.phi.trans.insert, align 4, !tbaa !5
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %.lcssa, 1
br i1 %5, label %for.cond.cleanup27.loopexit.unr-lcssa, label %for.body28.preheader.new
for.body28.preheader.new: ; preds = %for.body28.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body28
for.body17: ; preds = %for.cond14.preheader, %for.body17
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body17 ], [ 0, %for.cond14.preheader ]
%arrayidx19 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv81
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19)
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp15 = icmp slt i64 %indvars.iv.next82, %7
br i1 %cmp15, label %for.body17, label %for.cond25.preheader, !llvm.loop !12
for.cond.cleanup27.loopexit.unr-lcssa: ; preds = %for.inc48.1, %for.body28.preheader
%out.1.lcssa.ph = phi i32 [ undef, %for.body28.preheader ], [ %out.1.1, %for.inc48.1 ]
%.unr = phi i32 [ %.pre, %for.body28.preheader ], [ %15, %for.inc48.1 ]
%indvars.iv84.unr = phi i64 [ 0, %for.body28.preheader ], [ %indvars.iv.next85.1, %for.inc48.1 ]
%out.073.unr = phi i32 [ 0, %for.body28.preheader ], [ %out.1.1, %for.inc48.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup27, label %for.body28.epil
for.body28.epil: ; preds = %for.cond.cleanup27.loopexit.unr-lcssa
%arrayidx30.epil = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv84.unr
%8 = load i32, ptr %arrayidx30.epil, align 4, !tbaa !5
%sub31.epil = add nsw i32 %8, -1
%idxprom32.epil = sext i32 %sub31.epil to i64
%arrayidx33.epil = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %idxprom32.epil
%9 = load i32, ptr %arrayidx33.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %9, %out.073.unr
%cmp40.epil = icmp eq i32 %sub31.epil, %.unr
br i1 %cmp40.epil, label %if.then.epil, label %for.cond.cleanup27
if.then.epil: ; preds = %for.body28.epil
%sub44.epil = add nsw i32 %.unr, -1
%idxprom45.epil = sext i32 %sub44.epil to i64
%arrayidx46.epil = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %idxprom45.epil
%10 = load i32, ptr %arrayidx46.epil, align 4, !tbaa !5
%add47.epil = add nsw i32 %10, %add.epil
br label %for.cond.cleanup27
for.cond.cleanup27: ; preds = %for.cond.cleanup27.loopexit.unr-lcssa, %if.then.epil, %for.body28.epil, %for.cond3.preheader, %entry, %for.cond25.preheader
%out.0.lcssa = phi i32 [ 0, %for.cond25.preheader ], [ 0, %entry ], [ 0, %for.cond3.preheader ], [ %out.1.lcssa.ph, %for.cond.cleanup27.loopexit.unr-lcssa ], [ %add47.epil, %if.then.epil ], [ %add.epil, %for.body28.epil ]
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %out.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #3
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
for.body28: ; preds = %for.inc48.1, %for.body28.preheader.new
%11 = phi i32 [ %.pre, %for.body28.preheader.new ], [ %15, %for.inc48.1 ]
%indvars.iv84 = phi i64 [ 0, %for.body28.preheader.new ], [ %indvars.iv.next85.1, %for.inc48.1 ]
%out.073 = phi i32 [ 0, %for.body28.preheader.new ], [ %out.1.1, %for.inc48.1 ]
%niter = phi i64 [ 0, %for.body28.preheader.new ], [ %niter.next.1, %for.inc48.1 ]
%arrayidx30 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv84
%12 = load i32, ptr %arrayidx30, align 8, !tbaa !5
%sub31 = add nsw i32 %12, -1
%idxprom32 = sext i32 %sub31 to i64
%arrayidx33 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %idxprom32
%13 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%add = add nsw i32 %13, %out.073
%cmp40 = icmp eq i32 %sub31, %11
br i1 %cmp40, label %if.then, label %for.inc48
if.then: ; preds = %for.body28
%sub44 = add nsw i32 %11, -1
%idxprom45 = sext i32 %sub44 to i64
%arrayidx46 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %idxprom45
%14 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%add47 = add nsw i32 %14, %add
br label %for.inc48
for.inc48: ; preds = %for.body28, %if.then
%out.1 = phi i32 [ %add47, %if.then ], [ %add, %for.body28 ]
%indvars.iv.next85 = or i64 %indvars.iv84, 1
%arrayidx30.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next85
%15 = load i32, ptr %arrayidx30.1, align 4, !tbaa !5
%sub31.1 = add nsw i32 %15, -1
%idxprom32.1 = sext i32 %sub31.1 to i64
%arrayidx33.1 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %idxprom32.1
%16 = load i32, ptr %arrayidx33.1, align 4, !tbaa !5
%add.1 = add nsw i32 %16, %out.1
%cmp40.1 = icmp eq i32 %sub31.1, %12
br i1 %cmp40.1, label %if.then.1, label %for.inc48.1
if.then.1: ; preds = %for.inc48
%sub44.1 = add nsw i32 %12, -1
%idxprom45.1 = sext i32 %sub44.1 to i64
%arrayidx46.1 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %idxprom45.1
%17 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
%add47.1 = add nsw i32 %17, %add.1
br label %for.inc48.1
for.inc48.1: ; preds = %if.then.1, %for.inc48
%out.1.1 = phi i32 [ %add47.1, %if.then.1 ], [ %add.1, %for.inc48 ]
%indvars.iv.next85.1 = add nuw nsw i64 %indvars.iv84, 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.cond.cleanup27.loopexit.unr-lcssa, label %for.body28, !llvm.loop !13
}
; 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main() {
int i;
int N;
int A[20], B[20], C[20];
int ans = 0;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
A[i] -= 1;
}
for (i = 0; i < N; i++) {
scanf("%d", &B[i]);
}
for (i = 0; i < N - 1; i++) {
scanf("%d", &C[i]);
}
for (i = 0; i < N; i++) {
ans += B[A[i]];
if (i != 0 && A[i] - A[i - 1] == 1) {
ans += C[A[i - 1]];
}
}
printf("%d", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_273957/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_273957/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
%A = alloca [20 x i32], align 16
%B = alloca [20 x i32], align 16
%C = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %C) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %for.end46
for.cond4.preheader: ; preds = %for.body
%cmp568 = icmp sgt i32 %2, 0
br i1 %cmp568, label %for.body6, label %for.end46
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 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
%sub = add nsw i32 %1, -1
store i32 %sub, ptr %arrayidx, align 4, !tbaa !5
%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.cond4.preheader, !llvm.loop !9
for.cond13.preheader: ; preds = %for.body6
%cmp1571 = icmp sgt i32 %4, 1
br i1 %cmp1571, label %for.body16, label %for.cond23.preheader
for.body6: ; preds = %for.cond4.preheader, %for.body6
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body6 ], [ 0, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %indvars.iv79
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp5 = icmp slt i64 %indvars.iv.next80, %5
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !11
for.cond23.preheader: ; preds = %for.body16, %for.cond13.preheader
%.lcssa = phi i32 [ %4, %for.cond13.preheader ], [ %10, %for.body16 ]
%cmp2473 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2473, label %for.inc44.peel, label %for.end46
for.inc44.peel: ; preds = %for.cond23.preheader
%6 = load i32, ptr %A, align 16, !tbaa !5
%idxprom28.peel = sext i32 %6 to i64
%arrayidx29.peel = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %idxprom28.peel
%7 = load i32, ptr %arrayidx29.peel, align 4, !tbaa !5
%exitcond.peel.not = icmp eq i32 %.lcssa, 1
br i1 %exitcond.peel.not, label %for.end46, label %land.lhs.true.preheader
land.lhs.true.preheader: ; preds = %for.inc44.peel
%wide.trip.count = zext i32 %.lcssa to i64
%8 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %8, 1
%9 = icmp eq i32 %.lcssa, 2
br i1 %9, label %for.end46.loopexit.unr-lcssa, label %land.lhs.true.preheader.new
land.lhs.true.preheader.new: ; preds = %land.lhs.true.preheader
%unroll_iter = and i64 %8, -2
br label %land.lhs.true
for.body16: ; preds = %for.cond13.preheader, %for.body16
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.body16 ], [ 0, %for.cond13.preheader ]
%arrayidx18 = getelementptr inbounds [20 x i32], ptr %C, i64 0, i64 %indvars.iv82
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx18)
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%10 = load i32, ptr %N, align 4, !tbaa !5
%sub14 = add nsw i32 %10, -1
%11 = sext i32 %sub14 to i64
%cmp15 = icmp slt i64 %indvars.iv.next83, %11
br i1 %cmp15, label %for.body16, label %for.cond23.preheader, !llvm.loop !12
land.lhs.true: ; preds = %for.inc44.1, %land.lhs.true.preheader.new
%indvars.iv85 = phi i64 [ 1, %land.lhs.true.preheader.new ], [ %indvars.iv.next86.1, %for.inc44.1 ]
%ans.075 = phi i32 [ %7, %land.lhs.true.preheader.new ], [ %ans.1.1, %for.inc44.1 ]
%niter = phi i64 [ 0, %land.lhs.true.preheader.new ], [ %niter.next.1, %for.inc44.1 ]
%arrayidx27 = getelementptr inbounds [20 x i32], ptr %A, i64 0, i64 %indvars.iv85
%12 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = sext i32 %12 to i64
%arrayidx29 = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %idxprom28
%13 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%add = add nsw i32 %13, %ans.075
%14 = add nsw i64 %indvars.iv85, -1
%arrayidx35 = getelementptr inbounds [20 x i32], ptr %A, i64 0, i64 %14
%15 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%sub36 = sub nsw i32 %12, %15
%cmp37 = icmp eq i32 %sub36, 1
br i1 %cmp37, label %if.then, label %for.inc44
if.then: ; preds = %land.lhs.true
%idxprom41 = sext i32 %15 to i64
%arrayidx42 = getelementptr inbounds [20 x i32], ptr %C, i64 0, i64 %idxprom41
%16 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%add43 = add nsw i32 %16, %add
br label %for.inc44
for.inc44: ; preds = %land.lhs.true, %if.then
%ans.1 = phi i32 [ %add43, %if.then ], [ %add, %land.lhs.true ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%arrayidx27.1 = getelementptr inbounds [20 x i32], ptr %A, i64 0, i64 %indvars.iv.next86
%17 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
%idxprom28.1 = sext i32 %17 to i64
%arrayidx29.1 = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %idxprom28.1
%18 = load i32, ptr %arrayidx29.1, align 4, !tbaa !5
%add.1 = add nsw i32 %18, %ans.1
%arrayidx35.1 = getelementptr inbounds [20 x i32], ptr %A, i64 0, i64 %indvars.iv85
%19 = load i32, ptr %arrayidx35.1, align 4, !tbaa !5
%sub36.1 = sub nsw i32 %17, %19
%cmp37.1 = icmp eq i32 %sub36.1, 1
br i1 %cmp37.1, label %if.then.1, label %for.inc44.1
if.then.1: ; preds = %for.inc44
%idxprom41.1 = sext i32 %19 to i64
%arrayidx42.1 = getelementptr inbounds [20 x i32], ptr %C, i64 0, i64 %idxprom41.1
%20 = load i32, ptr %arrayidx42.1, align 4, !tbaa !5
%add43.1 = add nsw i32 %20, %add.1
br label %for.inc44.1
for.inc44.1: ; preds = %if.then.1, %for.inc44
%ans.1.1 = phi i32 [ %add43.1, %if.then.1 ], [ %add.1, %for.inc44 ]
%indvars.iv.next86.1 = add nuw nsw i64 %indvars.iv85, 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.end46.loopexit.unr-lcssa, label %land.lhs.true, !llvm.loop !13
for.end46.loopexit.unr-lcssa: ; preds = %for.inc44.1, %land.lhs.true.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %land.lhs.true.preheader ], [ %ans.1.1, %for.inc44.1 ]
%indvars.iv85.unr = phi i64 [ 1, %land.lhs.true.preheader ], [ %indvars.iv.next86.1, %for.inc44.1 ]
%ans.075.unr = phi i32 [ %7, %land.lhs.true.preheader ], [ %ans.1.1, %for.inc44.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end46, label %land.lhs.true.epil
land.lhs.true.epil: ; preds = %for.end46.loopexit.unr-lcssa
%arrayidx27.epil = getelementptr inbounds [20 x i32], ptr %A, i64 0, i64 %indvars.iv85.unr
%21 = load i32, ptr %arrayidx27.epil, align 4, !tbaa !5
%idxprom28.epil = sext i32 %21 to i64
%arrayidx29.epil = getelementptr inbounds [20 x i32], ptr %B, i64 0, i64 %idxprom28.epil
%22 = load i32, ptr %arrayidx29.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %22, %ans.075.unr
%23 = add nsw i64 %indvars.iv85.unr, -1
%arrayidx35.epil = getelementptr inbounds [20 x i32], ptr %A, i64 0, i64 %23
%24 = load i32, ptr %arrayidx35.epil, align 4, !tbaa !5
%sub36.epil = sub nsw i32 %21, %24
%cmp37.epil = icmp eq i32 %sub36.epil, 1
br i1 %cmp37.epil, label %if.then.epil, label %for.end46
if.then.epil: ; preds = %land.lhs.true.epil
%idxprom41.epil = sext i32 %24 to i64
%arrayidx42.epil = getelementptr inbounds [20 x i32], ptr %C, i64 0, i64 %idxprom41.epil
%25 = load i32, ptr %arrayidx42.epil, align 4, !tbaa !5
%add43.epil = add nsw i32 %25, %add.epil
br label %for.end46
for.end46: ; preds = %for.end46.loopexit.unr-lcssa, %if.then.epil, %land.lhs.true.epil, %for.cond4.preheader, %entry, %for.inc44.peel, %for.cond23.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond23.preheader ], [ %7, %for.inc44.peel ], [ 0, %entry ], [ 0, %for.cond4.preheader ], [ %ans.1.lcssa.ph, %for.end46.loopexit.unr-lcssa ], [ %add43.epil, %if.then.epil ], [ %add.epil, %land.lhs.true.epil ]
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %C) #3
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 80, 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}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main(void)
{
int n, sum;
char cmd[24];
while (scanf("%d", &n) != EOF) {
sum = 0;
while (n--) {
scanf("%s", cmd);
if (cmd[1] == '+') sum++;
else sum--;
}
printf("%d\n", sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2740/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
@.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
%cmd = alloca [24 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %cmd) #3
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not15 = icmp eq i32 %call14, -1
br i1 %cmp.not15, label %while.end8, label %while.cond1.preheader.lr.ph
while.cond1.preheader.lr.ph: ; preds = %entry
%arrayidx = getelementptr inbounds [24 x i8], ptr %cmd, i64 0, i64 1
br label %while.cond1.preheader
while.cond1.preheader: ; preds = %while.cond1.preheader.lr.ph, %while.end
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec11 = add nsw i32 %0, -1
store i32 %dec11, ptr %n, align 4, !tbaa !5
%tobool.not12 = icmp eq i32 %0, 0
br i1 %tobool.not12, label %while.end, label %while.body2
while.body2: ; preds = %while.cond1.preheader, %while.body2
%sum.013 = phi i32 [ %sum.1, %while.body2 ], [ 0, %while.cond1.preheader ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %cmd)
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp4 = icmp eq i8 %1, 43
%sum.1.v = select i1 %cmp4, i32 1, i32 -1
%sum.1 = add nsw i32 %sum.1.v, %sum.013
%2 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body2, !llvm.loop !10
while.end: ; preds = %while.body2, %while.cond1.preheader
%sum.0.lcssa = phi i32 [ 0, %while.cond1.preheader ], [ %sum.1, %while.body2 ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end8, label %while.cond1.preheader, !llvm.loop !12
while.end8: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %cmd) #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
int bonuse(int *a, int *c){
int tmp = 0;
do{
if(*(a + 1) - *a == 1){
tmp += c[*a - 1];
}
*a++;
}while(*(a + 1));
return tmp;
}
int sumb(int *b){
int tmp = 0;
int i;
do{
tmp += *b;
}while(*b++);
return tmp;
}
int main(void){
int n;
int a[100] = {0};
int b[100] = {0};
int c[100] = {0};
int i;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
for(i = 0; i < n; i++){
scanf("%d", &b[i]);
}
for(i = 0; i < n - 1; i++){
scanf("%d", &c[i]);
}
printf("%d", sumb(b) + bonuse(a, c));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274042/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 norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @bonuse(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %c) local_unnamed_addr #0 {
entry:
%.pre = load i32, ptr %a, align 4, !tbaa !5
br label %do.body
do.body: ; preds = %if.end, %entry
%0 = phi i32 [ %.pre, %entry ], [ %1, %if.end ]
%a.addr.0 = phi ptr [ %a, %entry ], [ %add.ptr, %if.end ]
%tmp.0 = phi i32 [ 0, %entry ], [ %tmp.1, %if.end ]
%add.ptr = getelementptr inbounds i32, ptr %a.addr.0, i64 1
%1 = load i32, ptr %add.ptr, align 4, !tbaa !5
%sub = sub nsw i32 %1, %0
%cmp = icmp eq i32 %sub, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %do.body
%sub1 = add nsw i32 %0, -1
%idxprom = sext i32 %sub1 to i64
%arrayidx = getelementptr inbounds i32, ptr %c, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %2, %tmp.0
br label %if.end
if.end: ; preds = %if.then, %do.body
%tmp.1 = phi i32 [ %add, %if.then ], [ %tmp.0, %do.body ]
%add.ptr2 = getelementptr inbounds i32, ptr %a.addr.0, i64 2
%3 = load i32, ptr %add.ptr2, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %do.end, label %do.body, !llvm.loop !9
do.end: ; preds = %if.end
ret i32 %tmp.1
}
; 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(read, inaccessiblemem: none) uwtable
define dso_local i32 @sumb(ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
br label %do.body
do.body: ; preds = %do.body, %entry
%tmp.0 = phi i32 [ 0, %entry ], [ %add, %do.body ]
%b.addr.0 = phi ptr [ %b, %entry ], [ %incdec.ptr, %do.body ]
%0 = load i32, ptr %b.addr.0, align 4, !tbaa !5
%add = add nsw i32 %0, %tmp.0
%incdec.ptr = getelementptr inbounds i32, ptr %b.addr.0, i64 1
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %do.end, label %do.body, !llvm.loop !11
do.end: ; preds = %do.body
ret i32 %add
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
%b = alloca [100 x i32], align 16
%c = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %a, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %b, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %c, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body, label %do.body.i.preheader
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %do.body.i.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 %for.cond2.preheader, !llvm.loop !12
for.cond11.preheader: ; preds = %for.body4
%4 = icmp sgt i32 %5, 1
br i1 %4, label %for.body13, label %do.body.i.preheader
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv45
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp3 = icmp slt i64 %indvars.iv.next46, %6
br i1 %cmp3, label %for.body4, label %for.cond11.preheader, !llvm.loop !13
for.body13: ; preds = %for.cond11.preheader, %for.body13
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body13 ], [ 0, %for.cond11.preheader ]
%arrayidx15 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv48
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx15)
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%8 = sext i32 %sub to i64
%cmp12 = icmp slt i64 %indvars.iv.next49, %8
br i1 %cmp12, label %for.body13, label %do.body.i.preheader, !llvm.loop !14
do.body.i.preheader: ; preds = %for.body13, %entry, %for.cond2.preheader, %for.cond11.preheader
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %do.body.i
%tmp.0.i = phi i32 [ %add.i, %do.body.i ], [ 0, %do.body.i.preheader ]
%b.addr.0.i = phi ptr [ %incdec.ptr.i, %do.body.i ], [ %b, %do.body.i.preheader ]
%9 = load i32, ptr %b.addr.0.i, align 4, !tbaa !5
%add.i = add nsw i32 %9, %tmp.0.i
%incdec.ptr.i = getelementptr inbounds i32, ptr %b.addr.0.i, i64 1
%tobool.not.i = icmp eq i32 %9, 0
br i1 %tobool.not.i, label %sumb.exit, label %do.body.i, !llvm.loop !11
sumb.exit: ; preds = %do.body.i
%.pre.i = load i32, ptr %a, align 16, !tbaa !5
br label %do.body.i33
do.body.i33: ; preds = %if.end.i, %sumb.exit
%10 = phi i32 [ %.pre.i, %sumb.exit ], [ %11, %if.end.i ]
%a.addr.0.i = phi ptr [ %a, %sumb.exit ], [ %add.ptr.i, %if.end.i ]
%tmp.0.i34 = phi i32 [ 0, %sumb.exit ], [ %tmp.1.i, %if.end.i ]
%add.ptr.i = getelementptr inbounds i32, ptr %a.addr.0.i, i64 1
%11 = load i32, ptr %add.ptr.i, align 4, !tbaa !5
%sub.i = sub nsw i32 %11, %10
%cmp.i = icmp eq i32 %sub.i, 1
br i1 %cmp.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %do.body.i33
%sub1.i = add nsw i32 %10, -1
%idxprom.i = sext i32 %sub1.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr %c, i64 %idxprom.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%add.i36 = add nsw i32 %12, %tmp.0.i34
br label %if.end.i
if.end.i: ; preds = %if.then.i, %do.body.i33
%tmp.1.i = phi i32 [ %add.i36, %if.then.i ], [ %tmp.0.i34, %do.body.i33 ]
%add.ptr2.i = getelementptr inbounds i32, ptr %a.addr.0.i, i64 2
%13 = load i32, ptr %add.ptr2.i, align 4, !tbaa !5
%tobool.not.i35 = icmp eq i32 %13, 0
br i1 %tobool.not.i35, label %bonuse.exit, label %do.body.i33, !llvm.loop !9
bonuse.exit: ; preds = %if.end.i
%add = add nsw i32 %tmp.1.i, %add.i
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; 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(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 = { 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 = !{!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>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
long int i, j;
long int n, k;
long int sum;
long int max;
long int count;
long int a[100];
long int b[100];
long int c[100];
scanf("%ld", &n);
for(i = 0; i < n; i++) {
scanf("%ld", &a[i]);
}
for(i = 0; i < n; i++) {
scanf("%ld", &b[i]);
}
for(i = 0; i < n - 1; i++) {
scanf("%ld", &c[i]);
}
sum = b[n - 1];
for(i = 0; i < n - 1; i++) {
if(a[i] + 1 == a[i + 1]) {
sum += c[a[i] - 1];
}
sum += b[i];
}
printf("%ld\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274086/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"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [100 x i64], align 16
%b = alloca [100 x i64], align 16
%c = alloca [100 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp54 = icmp sgt i64 %0, 0
br i1 %cmp54, label %for.body, label %for.end17.thread
for.cond2.preheader: ; preds = %for.body
%cmp356 = icmp sgt i64 %1, 0
br i1 %cmp356, label %for.body4, label %for.end17.thread
for.body: ; preds = %entry, %for.body
%i.055 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %i.055
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.055, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond10.preheader: ; preds = %for.body4
%cmp1159 = icmp sgt i64 %2, 1
br i1 %cmp1159, label %for.body12, label %for.end17.thread
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.157 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx5 = getelementptr inbounds [100 x i64], ptr %b, i64 0, i64 %i.157
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%inc8 = add nuw nsw i64 %i.157, 1
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc8, %2
br i1 %cmp3, label %for.body4, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%i.260 = phi i64 [ %inc16, %for.body12 ], [ 0, %for.cond10.preheader ]
%arrayidx13 = getelementptr inbounds [100 x i64], ptr %c, i64 0, i64 %i.260
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx13)
%inc16 = add nuw nsw i64 %i.260, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%sub = add nsw i64 %3, -1
%cmp11 = icmp slt i64 %inc16, %sub
br i1 %cmp11, label %for.body12, label %for.end17, !llvm.loop !12
for.end17.thread: ; preds = %entry, %for.cond2.preheader, %for.cond10.preheader
%sub.lcssa.ph.in = phi i64 [ %2, %for.cond10.preheader ], [ %1, %for.cond2.preheader ], [ %0, %entry ]
%sub.lcssa.ph = add nsw i64 %sub.lcssa.ph.in, -1
%arrayidx1970 = getelementptr inbounds [100 x i64], ptr %b, i64 0, i64 %sub.lcssa.ph
%4 = load i64, ptr %arrayidx1970, align 8, !tbaa !5
br label %for.end36
for.end17: ; preds = %for.body12
%arrayidx19 = getelementptr inbounds [100 x i64], ptr %b, i64 0, i64 %sub
%5 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%cmp2261 = icmp sgt i64 %3, 1
br i1 %cmp2261, label %for.body23.preheader, label %for.end36
for.body23.preheader: ; preds = %for.end17
%.pre = load i64, ptr %a, align 16, !tbaa !5
%xtraiter = and i64 %sub, 1
%6 = icmp eq i64 %3, 2
br i1 %6, label %for.end36.loopexit.unr-lcssa, label %for.body23.preheader.new
for.body23.preheader.new: ; preds = %for.body23.preheader
%unroll_iter = and i64 %sub, -2
br label %for.body23
for.body23: ; preds = %if.end.1, %for.body23.preheader.new
%7 = phi i64 [ %.pre, %for.body23.preheader.new ], [ %11, %if.end.1 ]
%i.363 = phi i64 [ 0, %for.body23.preheader.new ], [ %add25.1, %if.end.1 ]
%sum.062 = phi i64 [ %5, %for.body23.preheader.new ], [ %add33.1, %if.end.1 ]
%niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.1, %if.end.1 ]
%add = add nsw i64 %7, 1
%add25 = or i64 %i.363, 1
%arrayidx26 = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %add25
%8 = load i64, ptr %arrayidx26, align 8, !tbaa !5
%cmp27 = icmp eq i64 %add, %8
br i1 %cmp27, label %if.then, label %if.end
if.then: ; preds = %for.body23
%sub29 = add nsw i64 %7, -1
%arrayidx30 = getelementptr inbounds [100 x i64], ptr %c, i64 0, i64 %sub29
%9 = load i64, ptr %arrayidx30, align 8, !tbaa !5
%add31 = add nsw i64 %9, %sum.062
br label %if.end
if.end: ; preds = %if.then, %for.body23
%sum.1 = phi i64 [ %add31, %if.then ], [ %sum.062, %for.body23 ]
%arrayidx32 = getelementptr inbounds [100 x i64], ptr %b, i64 0, i64 %i.363
%10 = load i64, ptr %arrayidx32, align 16, !tbaa !5
%add33 = add nsw i64 %10, %sum.1
%add.1 = add nsw i64 %8, 1
%add25.1 = add nuw nsw i64 %i.363, 2
%arrayidx26.1 = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %add25.1
%11 = load i64, ptr %arrayidx26.1, align 16, !tbaa !5
%cmp27.1 = icmp eq i64 %add.1, %11
br i1 %cmp27.1, label %if.then.1, label %if.end.1
if.then.1: ; preds = %if.end
%sub29.1 = add nsw i64 %8, -1
%arrayidx30.1 = getelementptr inbounds [100 x i64], ptr %c, i64 0, i64 %sub29.1
%12 = load i64, ptr %arrayidx30.1, align 8, !tbaa !5
%add31.1 = add nsw i64 %12, %add33
br label %if.end.1
if.end.1: ; preds = %if.then.1, %if.end
%sum.1.1 = phi i64 [ %add31.1, %if.then.1 ], [ %add33, %if.end ]
%arrayidx32.1 = getelementptr inbounds [100 x i64], ptr %b, i64 0, i64 %add25
%13 = load i64, ptr %arrayidx32.1, align 8, !tbaa !5
%add33.1 = add nsw i64 %13, %sum.1.1
%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.end36.loopexit.unr-lcssa, label %for.body23, !llvm.loop !13
for.end36.loopexit.unr-lcssa: ; preds = %if.end.1, %for.body23.preheader
%add33.lcssa.ph = phi i64 [ undef, %for.body23.preheader ], [ %add33.1, %if.end.1 ]
%.unr = phi i64 [ %.pre, %for.body23.preheader ], [ %11, %if.end.1 ]
%i.363.unr = phi i64 [ 0, %for.body23.preheader ], [ %add25.1, %if.end.1 ]
%sum.062.unr = phi i64 [ %5, %for.body23.preheader ], [ %add33.1, %if.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end36, label %for.body23.epil
for.body23.epil: ; preds = %for.end36.loopexit.unr-lcssa
%add.epil = add nsw i64 %.unr, 1
%add25.epil = add nuw nsw i64 %i.363.unr, 1
%arrayidx26.epil = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %add25.epil
%14 = load i64, ptr %arrayidx26.epil, align 8, !tbaa !5
%cmp27.epil = icmp eq i64 %add.epil, %14
br i1 %cmp27.epil, label %if.then.epil, label %if.end.epil
if.then.epil: ; preds = %for.body23.epil
%sub29.epil = add nsw i64 %.unr, -1
%arrayidx30.epil = getelementptr inbounds [100 x i64], ptr %c, i64 0, i64 %sub29.epil
%15 = load i64, ptr %arrayidx30.epil, align 8, !tbaa !5
%add31.epil = add nsw i64 %15, %sum.062.unr
br label %if.end.epil
if.end.epil: ; preds = %if.then.epil, %for.body23.epil
%sum.1.epil = phi i64 [ %add31.epil, %if.then.epil ], [ %sum.062.unr, %for.body23.epil ]
%arrayidx32.epil = getelementptr inbounds [100 x i64], ptr %b, i64 0, i64 %i.363.unr
%16 = load i64, ptr %arrayidx32.epil, align 8, !tbaa !5
%add33.epil = add nsw i64 %16, %sum.1.epil
br label %for.end36
for.end36: ; preds = %if.end.epil, %for.end36.loopexit.unr-lcssa, %for.end17.thread, %for.end17
%sum.0.lcssa = phi i64 [ %5, %for.end17 ], [ %4, %for.end17.thread ], [ %add33.lcssa.ph, %for.end36.loopexit.unr-lcssa ], [ %add33.epil, %if.end.epil ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int n,i,j,k,a[20],b[20],c[20],s;
scanf("%d",&n);
for (i=0;i<n;i++) scanf("%d",&a[i]);
for (i=0;i<n;i++) scanf("%d",&b[i]);
for (i=0;i<n-1;i++) scanf("%d",&c[i]);
k=-9;
for (s=i=0;i<n;i++) {
j=a[i]-1;
s+=b[j];
if (j==k+1) s+=c[k];
k=j;
}
printf("%d",s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274129/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274129/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
%a = alloca [20 x i32], align 16
%b = alloca [20 x i32], align 16
%c = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %c) #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.end35
for.cond2.preheader: ; preds = %for.body
%cmp355 = icmp sgt i32 %1, 0
br i1 %cmp355, label %for.body4, label %for.end35
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 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.cond2.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.body4
%cmp1258 = icmp sgt i32 %3, 1
br i1 %cmp1258, label %for.body13, label %for.cond20.preheader
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv67
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp3 = icmp slt i64 %indvars.iv.next68, %4
br i1 %cmp3, label %for.body4, label %for.cond11.preheader, !llvm.loop !11
for.cond20.preheader: ; preds = %for.body13, %for.cond11.preheader
%.lcssa = phi i32 [ %3, %for.cond11.preheader ], [ %6, %for.body13 ]
%cmp2160 = icmp sgt i32 %.lcssa, 0
br i1 %cmp2160, label %for.body22.preheader, label %for.end35
for.body22.preheader: ; preds = %for.cond20.preheader
%wide.trip.count = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %.lcssa, 1
br i1 %5, label %for.end35.loopexit.unr-lcssa, label %for.body22.preheader.new
for.body22.preheader.new: ; preds = %for.body22.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body22
for.body13: ; preds = %for.cond11.preheader, %for.body13
%indvars.iv70 = phi i64 [ %indvars.iv.next71, %for.body13 ], [ 0, %for.cond11.preheader ]
%arrayidx15 = getelementptr inbounds [20 x i32], ptr %c, i64 0, i64 %indvars.iv70
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx15)
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp12 = icmp slt i64 %indvars.iv.next71, %7
br i1 %cmp12, label %for.body13, label %for.cond20.preheader, !llvm.loop !12
for.body22: ; preds = %if.end.1, %for.body22.preheader.new
%indvars.iv73 = phi i64 [ 0, %for.body22.preheader.new ], [ %indvars.iv.next74.1, %if.end.1 ]
%s.063 = phi i32 [ 0, %for.body22.preheader.new ], [ %s.1.1, %if.end.1 ]
%k.062 = phi i32 [ -9, %for.body22.preheader.new ], [ %sub25.1, %if.end.1 ]
%niter = phi i64 [ 0, %for.body22.preheader.new ], [ %niter.next.1, %if.end.1 ]
%arrayidx24 = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv73
%8 = load i32, ptr %arrayidx24, align 8, !tbaa !5
%sub25 = add nsw i32 %8, -1
%idxprom26 = sext i32 %sub25 to i64
%arrayidx27 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %idxprom26
%9 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%add = add nsw i32 %9, %s.063
%10 = add i32 %k.062, 2
%cmp29 = icmp eq i32 %8, %10
br i1 %cmp29, label %if.then, label %if.end
if.then: ; preds = %for.body22
%idxprom30 = sext i32 %k.062 to i64
%arrayidx31 = getelementptr inbounds [20 x i32], ptr %c, i64 0, i64 %idxprom30
%11 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%add32 = add nsw i32 %11, %add
br label %if.end
if.end: ; preds = %if.then, %for.body22
%s.1 = phi i32 [ %add32, %if.then ], [ %add, %for.body22 ]
%indvars.iv.next74 = or i64 %indvars.iv73, 1
%arrayidx24.1 = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv.next74
%12 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%sub25.1 = add nsw i32 %12, -1
%idxprom26.1 = sext i32 %sub25.1 to i64
%arrayidx27.1 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %idxprom26.1
%13 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
%add.1 = add nsw i32 %13, %s.1
%14 = add i32 %8, 1
%cmp29.1 = icmp eq i32 %12, %14
br i1 %cmp29.1, label %if.then.1, label %if.end.1
if.then.1: ; preds = %if.end
%idxprom30.1 = sext i32 %sub25 to i64
%arrayidx31.1 = getelementptr inbounds [20 x i32], ptr %c, i64 0, i64 %idxprom30.1
%15 = load i32, ptr %arrayidx31.1, align 4, !tbaa !5
%add32.1 = add nsw i32 %15, %add.1
br label %if.end.1
if.end.1: ; preds = %if.then.1, %if.end
%s.1.1 = phi i32 [ %add32.1, %if.then.1 ], [ %add.1, %if.end ]
%indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 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.end35.loopexit.unr-lcssa, label %for.body22, !llvm.loop !13
for.end35.loopexit.unr-lcssa: ; preds = %if.end.1, %for.body22.preheader
%s.1.lcssa.ph = phi i32 [ undef, %for.body22.preheader ], [ %s.1.1, %if.end.1 ]
%indvars.iv73.unr = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next74.1, %if.end.1 ]
%s.063.unr = phi i32 [ 0, %for.body22.preheader ], [ %s.1.1, %if.end.1 ]
%k.062.unr = phi i32 [ -9, %for.body22.preheader ], [ %sub25.1, %if.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end35, label %for.body22.epil
for.body22.epil: ; preds = %for.end35.loopexit.unr-lcssa
%arrayidx24.epil = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv73.unr
%16 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5
%sub25.epil = add nsw i32 %16, -1
%idxprom26.epil = sext i32 %sub25.epil to i64
%arrayidx27.epil = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %idxprom26.epil
%17 = load i32, ptr %arrayidx27.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %17, %s.063.unr
%18 = add i32 %k.062.unr, 2
%cmp29.epil = icmp eq i32 %16, %18
br i1 %cmp29.epil, label %if.then.epil, label %for.end35
if.then.epil: ; preds = %for.body22.epil
%idxprom30.epil = sext i32 %k.062.unr to i64
%arrayidx31.epil = getelementptr inbounds [20 x i32], ptr %c, i64 0, i64 %idxprom30.epil
%19 = load i32, ptr %arrayidx31.epil, align 4, !tbaa !5
%add32.epil = add nsw i32 %19, %add.epil
br label %for.end35
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %if.then.epil, %for.body22.epil, %for.cond2.preheader, %entry, %for.cond20.preheader
%s.0.lcssa = phi i32 [ 0, %for.cond20.preheader ], [ 0, %entry ], [ 0, %for.cond2.preheader ], [ %s.1.lcssa.ph, %for.end35.loopexit.unr-lcssa ], [ %add32.epil, %if.then.epil ], [ %add.epil, %for.body22.epil ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 80, 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}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;
int in(void){
int i;scanf("%d",&i);
return i;
}
long long llin(void){
long long i;scanf("%lld",&i);
return i;
}
double din(void){
double i;scanf("%lf",&i);
return i;
}
void chin(char s[]){
scanf("%s",s);
}
void print(int a){
printf("%d\n",a);
}
void llprint(long long a){
printf("%lld\n",a);
}
void dprint(double a){
printf("%.10f\n",a);
}
void print2(int a,int b){
printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
return a>b?a:b;
}
long long min(long long a,long long b){
return a<b?a:b;
}
long long llabs(long long a){
return a>0?a:-a;
}
double dmax(double a,double b){
return a>b?a:b;
}
int cmp(const void *a,const void *b){
return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
return *(TYPE *)b-*(TYPE *)a;
}
int main(void){
int a[100001],n,k,i,j,cnt,ans,used;
while(1){
scanf("%d %d",&n,&k);
if(!n)break;
MEMSET(a);
cnt=ans=used=0;
rep(i,k)
scanf("%d",&a[i]);
sort(a,k);
for(i=a[0]?0:1;i<k;i++){
if(a[i]+1==a[i+1])
cnt++;
else if(!a[0]&&a[i]+2==a[i+1]&&!used){
used=1;
cnt+=2;
}
else{
ans=max(ans,cnt);
cnt=0;
if(used){
used=0;
i--;
}
}
}
print(ans+1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274172/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274172/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"
@mod = dso_local local_unnamed_addr constant i32 1000000007, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%.10f\0A\00", align 1
@.str.7 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.8 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #9
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 uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #9
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @din() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #9
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @chin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @llprint(i64 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dprint(double noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %a, i32 noundef %b)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llabs(i64 noundef %a) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dmax(double noundef %a, double noundef %b) local_unnamed_addr #4 {
entry:
%cmp = fcmp ogt double %a, %b
%cond = select i1 %cmp, double %a, double %b
ret double %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
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 @cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
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 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100001 x i32], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %a) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #9
%call68 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.8, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not69 = icmp eq i32 %0, 0
br i1 %tobool.not69, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end44
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) %a, i8 0, i64 400004, i1 false)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %1, 0
br i1 %cmp60, label %for.body, label %if.end.for.end_crit_edge
if.end.for.end_crit_edge: ; preds = %if.end
%.pre76 = sext i32 %1 to i64
br label %for.end
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%arrayidx = getelementptr inbounds [100001 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 %k, 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.end, !llvm.loop !13
for.end: ; preds = %for.body, %if.end.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre76, %if.end.for.end_crit_edge ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @cmp) #9
%4 = load i32, ptr %a, align 16, !tbaa !5
%.fr = freeze i32 %4
%tobool4.not = icmp eq i32 %.fr, 0
%cond = zext i1 %tobool4.not to i32
%5 = load i32, ptr %k, align 4, !tbaa !5
%cmp662 = icmp sgt i32 %5, %cond
br i1 %cmp662, label %for.body8.lr.ph, label %for.end44
for.body8.lr.ph: ; preds = %for.end
br i1 %tobool4.not, label %for.body8.us, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body8.lr.ph
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %5, 1
br i1 %6, label %for.end44.loopexit79.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body8.us: ; preds = %for.body8.lr.ph, %for.inc42.us
%used.066.us = phi i32 [ %used.1.us, %for.inc42.us ], [ 0, %for.body8.lr.ph ]
%ans.065.us = phi i32 [ %ans.1.us, %for.inc42.us ], [ 0, %for.body8.lr.ph ]
%cnt.064.us = phi i32 [ %cnt.1.us, %for.inc42.us ], [ 0, %for.body8.lr.ph ]
%i.163.us = phi i32 [ %inc43.us.pre-phi, %for.inc42.us ], [ 1, %for.body8.lr.ph ]
%idxprom9.us = sext i32 %i.163.us to i64
%arrayidx10.us = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom9.us
%7 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%add.us = add nsw i32 %7, 1
%add11.us = add nsw i32 %i.163.us, 1
%idxprom12.us = sext i32 %add11.us to i64
%arrayidx13.us = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom12.us
%8 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%cmp14.us = icmp eq i32 %add.us, %8
br i1 %cmp14.us, label %if.then16.us, label %if.else.us
if.else.us: ; preds = %for.body8.us
%add22.us = add nsw i32 %7, 2
%cmp26.us = icmp ne i32 %add22.us, %8
%tobool29.us = icmp ne i32 %used.066.us, 0
%or.cond.us = select i1 %cmp26.us, i1 true, i1 %tobool29.us
br i1 %or.cond.us, label %if.else32.us, label %if.then30.us
if.then30.us: ; preds = %if.else.us
%add31.us = add nsw i32 %cnt.064.us, 2
br label %for.inc42.us
if.else32.us: ; preds = %if.else.us
%9 = call i32 @llvm.smax.i32(i32 %ans.065.us, i32 %cnt.064.us)
%dec.us = sext i1 %tobool29.us to i32
%spec.select.us = add nsw i32 %i.163.us, %dec.us
%.pre = add nsw i32 %spec.select.us, 1
br label %for.inc42.us
if.then16.us: ; preds = %for.body8.us
%inc17.us = add nsw i32 %cnt.064.us, 1
br label %for.inc42.us
for.inc42.us: ; preds = %if.then16.us, %if.else32.us, %if.then30.us
%inc43.us.pre-phi = phi i32 [ %add11.us, %if.then16.us ], [ %.pre, %if.else32.us ], [ %add11.us, %if.then30.us ]
%cnt.1.us = phi i32 [ %inc17.us, %if.then16.us ], [ 0, %if.else32.us ], [ %add31.us, %if.then30.us ]
%ans.1.us = phi i32 [ %ans.065.us, %if.then16.us ], [ %9, %if.else32.us ], [ %ans.065.us, %if.then30.us ]
%used.1.us = phi i32 [ %used.066.us, %if.then16.us ], [ 0, %if.else32.us ], [ 1, %if.then30.us ]
%cmp6.us = icmp slt i32 %inc43.us.pre-phi, %5
br i1 %cmp6.us, label %for.body8.us, label %for.end44, !llvm.loop !15
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%10 = phi i32 [ %.fr, %for.body8.preheader.new ], [ %13, %for.body8 ]
%indvars.iv73 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next74.1, %for.body8 ]
%ans.065 = phi i32 [ 0, %for.body8.preheader.new ], [ %ans.1.1, %for.body8 ]
%cnt.064 = phi i32 [ 0, %for.body8.preheader.new ], [ %cnt.1.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%add = add nsw i32 %10, 1
%indvars.iv.next74 = or i64 %indvars.iv73, 1
%arrayidx13 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv.next74
%11 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp eq i32 %add, %11
%inc17 = add nsw i32 %cnt.064, 1
%12 = call i32 @llvm.smax.i32(i32 %ans.065, i32 %cnt.064)
%cnt.1 = select i1 %cmp14, i32 %inc17, i32 0
%ans.1 = select i1 %cmp14, i32 %ans.065, i32 %12
%add.1 = add nsw i32 %11, 1
%indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
%arrayidx13.1 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv.next74.1
%13 = load i32, ptr %arrayidx13.1, align 8, !tbaa !5
%cmp14.1 = icmp eq i32 %add.1, %13
%inc17.1 = add nsw i32 %cnt.1, 1
%14 = call i32 @llvm.smax.i32(i32 %ans.1, i32 %cnt.1)
%cnt.1.1 = select i1 %cmp14.1, i32 %inc17.1, i32 0
%ans.1.1 = select i1 %cmp14.1, i32 %ans.1, i32 %14
%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.end44.loopexit79.unr-lcssa, label %for.body8, !llvm.loop !15
for.end44.loopexit79.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %for.body8.preheader ], [ %ans.1.1, %for.body8 ]
%.unr = phi i32 [ %.fr, %for.body8.preheader ], [ %13, %for.body8 ]
%indvars.iv73.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next74.1, %for.body8 ]
%ans.065.unr = phi i32 [ 0, %for.body8.preheader ], [ %ans.1.1, %for.body8 ]
%cnt.064.unr = phi i32 [ 0, %for.body8.preheader ], [ %cnt.1.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end44, label %for.body8.epil
for.body8.epil: ; preds = %for.end44.loopexit79.unr-lcssa
%add.epil = add nsw i32 %.unr, 1
%indvars.iv.next74.epil = add nuw nsw i64 %indvars.iv73.unr, 1
%arrayidx13.epil = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv.next74.epil
%15 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
%cmp14.epil = icmp eq i32 %add.epil, %15
%16 = call i32 @llvm.smax.i32(i32 %ans.065.unr, i32 %cnt.064.unr)
%ans.1.epil = select i1 %cmp14.epil, i32 %ans.065.unr, i32 %16
br label %for.end44
for.end44: ; preds = %for.body8.epil, %for.end44.loopexit79.unr-lcssa, %for.inc42.us, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %ans.1.us, %for.inc42.us ], [ %ans.1.lcssa.ph, %for.end44.loopexit79.unr-lcssa ], [ %ans.1.epil, %for.body8.epil ]
%add45 = add nsw i32 %ans.0.lcssa, 1
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %add45)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.8, ptr noundef nonnull %n, ptr noundef nonnull %k)
%17 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %17, 0
br i1 %tobool.not, label %while.end, label %if.end
while.end: ; preds = %for.end44, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %a) #9
ret i32 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
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8
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 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(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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include <stdio.h>
int main(void){
int a,b,n,t;
int i;
while(scanf("%d %d %d",&a,&b,&n)!=EOF){
//printf("%d,%d,%d\n",a,b,n);
int s=0;
t=a/b;
a-=b*t;
a*=10;
for(i=0;i<n;i++){
t=a/b;
a-=b*t;
a*=10;
s+=t;
if(a==0) break;
}
printf("%d\n",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274215/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274215/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 [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
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 %n) #3
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %n)
%cmp.not21 = icmp eq i32 %call20, -1
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%.fr = freeze i32 %0
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = srem i32 %.fr, %1
%mul1 = mul nsw i32 %2, 10
store i32 %mul1, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp214 = icmp sgt i32 %3, 0
br i1 %cmp214, label %for.body, label %for.end
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.016, 1
%exitcond.not = icmp eq i32 %inc, %3
br i1 %exitcond.not, label %for.cond.for.end_crit_edge, label %for.body, !llvm.loop !9
for.body: ; preds = %while.body, %for.cond
%s.017 = phi i32 [ %add, %for.cond ], [ 0, %while.body ]
%i.016 = phi i32 [ %inc, %for.cond ], [ 0, %while.body ]
%mul61315 = phi i32 [ %mul6, %for.cond ], [ %mul1, %while.body ]
%div3 = sdiv i32 %mul61315, %1
%mul4 = mul nsw i32 %div3, %1
%sub5.recomposed = srem i32 %mul61315, %1
%mul6 = mul nsw i32 %sub5.recomposed, 10
%add = add nsw i32 %div3, %s.017
%cmp7 = icmp eq i32 %mul61315, %mul4
br i1 %cmp7, label %for.body.for.end_crit_edge, label %for.cond
for.body.for.end_crit_edge: ; preds = %for.body
store i32 %mul6, ptr %a, align 4, !tbaa !5
br label %for.end
for.cond.for.end_crit_edge: ; preds = %for.cond
store i32 %mul6, ptr %a, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond.for.end_crit_edge, %for.body.for.end_crit_edge, %while.body
%s.1 = phi i32 [ %add, %for.body.for.end_crit_edge ], [ %add, %for.cond.for.end_crit_edge ], [ 0, %while.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.1)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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}
|
// Aizu Vol-1 0138: Track and Field Competition
// 2017.8.2
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char *gets(char *);
char buf[50], *p;
#define INF 1000000
typedef struct { int n, t; } R;
R s[4][8], a[4][2];
int getDouble(void)
{
int len = 0, n = 0;
while (isspace(*p)) p++;
while (isdigit(*p)) n = 10 * n + (*p++ - '0');
if (*p == '.') p++;
while (isdigit(*p)) n = 10 * n + (*p++ - '0'), len++;
#define MAGIC 2
if (len > MAGIC) while (1);
while (len < MAGIC) n = 10 * n, len++;
return n;
}
int getInt(void)
{
int n = 0;
while (isspace(*p)) p++;
while (isdigit(*p)) n = 10 * n + (*p++ - '0');
return n;
}
int main()
{
int i, j;
int t1, t2, n1, n2;
for (i = 0; i < 3; i++) for (j = 0; j < 8; j++) {
gets(p = buf);
s[i][j].n = getInt(), s[i][j].t = getDouble();
}
for (i = 0; i < 3; i++) {
if (s[i][0].t <= s[i][1].t) t1 = 0, t2 = 1;
else t1 = 1, t2 = 0;
for (j = 2; j < 8; j++) {
if (s[i][j].t < s[i][t1].t) t2 = t1, t1 = j;
else if (s[i][j].t < s[i][t2].t) t2 = j;
}
a[i][0].n = s[i][t1].n, a[i][0].t = s[i][t1].t, s[i][t1].t = INF;
a[i][1].n = s[i][t2].n, a[i][1].t = s[i][t2].t, s[i][t2].t = INF;
}
t1 = t2 = n1 = n2 = INF;
for (i = 0; i < 3; i++) {
for (j = 0; j < 8; j++) {
if (s[i][j].t < t1) t2 = t1, n2 = n1, t1 = s[i][j].t, n1 = s[i][j].n;
else if (s[i][j].t < t2) t2 = s[i][j].t, n2 = s[i][j].n;
}
}
a[3][0].n = n1, a[3][0].t = t1;
a[3][1].n = n2, a[3][1].t = t2;
for (i = 0; i <= 3; i++) {
for (j = 0; j < 2; j++) printf("%d %d.%02d\n", a[i][j].n, a[i][j].t/100, a[i][j].t%100);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274280/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274280/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.R = type { i32, i32 }
@p = dso_local local_unnamed_addr global ptr null, align 8
@buf = dso_local global [50 x i8] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [4 x [8 x %struct.R]] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global [4 x [2 x %struct.R]] zeroinitializer, align 16
@.str = private unnamed_addr constant [12 x i8] c"%d %d.%02d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @getDouble() local_unnamed_addr #0 {
entry:
%call = tail call ptr @__ctype_b_loc() #5
%0 = load ptr, ptr %call, align 8, !tbaa !5
%1 = load ptr, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %1, align 1, !tbaa !9
%idxprom52 = sext i8 %2 to i64
%arrayidx53 = getelementptr inbounds i16, ptr %0, i64 %idxprom52
%3 = load i16, ptr %arrayidx53, align 2, !tbaa !10
%4 = and i16 %3, 8192
%tobool.not54 = icmp eq i16 %4, 0
br i1 %tobool.not54, label %while.cond2.preheader, label %while.body
while.cond2.preheader: ; preds = %while.body, %entry
%5 = phi i16 [ %3, %entry ], [ %13, %while.body ]
%6 = phi i8 [ %2, %entry ], [ %12, %while.body ]
%7 = phi ptr [ %1, %entry ], [ %incdec.ptr, %while.body ]
%8 = phi ptr [ %0, %entry ], [ %11, %while.body ]
%9 = and i16 %5, 2048
%tobool9.not57 = icmp eq i16 %9, 0
br i1 %tobool9.not57, label %while.end13, label %while.body10
while.body: ; preds = %entry, %while.body
%10 = phi ptr [ %incdec.ptr, %while.body ], [ %1, %entry ]
%incdec.ptr = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%11 = load ptr, ptr %call, align 8, !tbaa !5
%12 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%idxprom = sext i8 %12 to i64
%arrayidx = getelementptr inbounds i16, ptr %11, i64 %idxprom
%13 = load i16, ptr %arrayidx, align 2, !tbaa !10
%14 = and i16 %13, 8192
%tobool.not = icmp eq i16 %14, 0
br i1 %tobool.not, label %while.cond2.preheader, label %while.body, !llvm.loop !12
while.body10: ; preds = %while.cond2.preheader, %while.body10
%15 = phi ptr [ %incdec.ptr11, %while.body10 ], [ %7, %while.cond2.preheader ]
%n.058 = phi i32 [ %add, %while.body10 ], [ 0, %while.cond2.preheader ]
%mul = mul nsw i32 %n.058, 10
%incdec.ptr11 = getelementptr inbounds i8, ptr %15, i64 1
store ptr %incdec.ptr11, ptr @p, align 8, !tbaa !5
%16 = load i8, ptr %15, align 1, !tbaa !9
%conv12 = sext i8 %16 to i32
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv12
%17 = load ptr, ptr %call, align 8, !tbaa !5
%18 = load i8, ptr %incdec.ptr11, align 1, !tbaa !9
%idxprom5 = sext i8 %18 to i64
%arrayidx6 = getelementptr inbounds i16, ptr %17, i64 %idxprom5
%19 = load i16, ptr %arrayidx6, align 2, !tbaa !10
%20 = and i16 %19, 2048
%tobool9.not = icmp eq i16 %20, 0
br i1 %tobool9.not, label %while.end13, label %while.body10, !llvm.loop !14
while.end13: ; preds = %while.body10, %while.cond2.preheader
%21 = phi ptr [ %8, %while.cond2.preheader ], [ %17, %while.body10 ]
%n.0.lcssa = phi i32 [ 0, %while.cond2.preheader ], [ %add, %while.body10 ]
%.lcssa51 = phi ptr [ %7, %while.cond2.preheader ], [ %incdec.ptr11, %while.body10 ]
%.lcssa = phi i8 [ %6, %while.cond2.preheader ], [ %18, %while.body10 ]
%cmp = icmp eq i8 %.lcssa, 46
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %while.end13
%incdec.ptr16 = getelementptr inbounds i8, ptr %.lcssa51, i64 1
store ptr %incdec.ptr16, ptr @p, align 8, !tbaa !5
%.pre = load ptr, ptr %call, align 8, !tbaa !5
%.pre74 = load i8, ptr %incdec.ptr16, align 1, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %while.end13
%22 = phi i8 [ %.pre74, %if.then ], [ %.lcssa, %while.end13 ]
%23 = phi ptr [ %incdec.ptr16, %if.then ], [ %.lcssa51, %while.end13 ]
%24 = phi ptr [ %.pre, %if.then ], [ %21, %while.end13 ]
%idxprom2062 = sext i8 %22 to i64
%arrayidx2163 = getelementptr inbounds i16, ptr %24, i64 %idxprom2062
%25 = load i16, ptr %arrayidx2163, align 2, !tbaa !10
%26 = and i16 %25, 2048
%tobool24.not64 = icmp eq i16 %26, 0
br i1 %tobool24.not64, label %while.body41.peel, label %while.body25
while.body25: ; preds = %if.end, %while.body25
%27 = phi ptr [ %incdec.ptr27, %while.body25 ], [ %23, %if.end ]
%n.166 = phi i32 [ %add30, %while.body25 ], [ %n.0.lcssa, %if.end ]
%len.065 = phi i32 [ %inc, %while.body25 ], [ 0, %if.end ]
%mul26 = mul nsw i32 %n.166, 10
%incdec.ptr27 = getelementptr inbounds i8, ptr %27, i64 1
store ptr %incdec.ptr27, ptr @p, align 8, !tbaa !5
%28 = load i8, ptr %27, align 1, !tbaa !9
%conv28 = sext i8 %28 to i32
%sub29 = add i32 %mul26, -48
%add30 = add i32 %sub29, %conv28
%inc = add nuw nsw i32 %len.065, 1
%29 = load ptr, ptr %call, align 8, !tbaa !5
%30 = load i8, ptr %incdec.ptr27, align 1, !tbaa !9
%idxprom20 = sext i8 %30 to i64
%arrayidx21 = getelementptr inbounds i16, ptr %29, i64 %idxprom20
%31 = load i16, ptr %arrayidx21, align 2, !tbaa !10
%32 = and i16 %31, 2048
%tobool24.not = icmp eq i16 %32, 0
br i1 %tobool24.not, label %while.end31, label %while.body25, !llvm.loop !15
while.end31: ; preds = %while.body25
%cmp32 = icmp ugt i32 %len.065, 1
br i1 %cmp32, label %while.cond35, label %while.cond38.preheader
while.cond38.preheader: ; preds = %while.end31
%cmp3969.not = icmp eq i32 %inc, 2
br i1 %cmp3969.not, label %while.end44, label %while.body41.peel
while.body41.peel: ; preds = %if.end, %while.cond38.preheader
%n.271.ph = phi i32 [ %n.0.lcssa, %if.end ], [ %add30, %while.cond38.preheader ]
%mul42.peel = mul nsw i32 %n.271.ph, 10
%mul42 = mul i32 %n.271.ph, 100
%mul42.lcssa = select i1 %tobool24.not64, i32 %mul42, i32 %mul42.peel
br label %while.end44
while.cond35: ; preds = %while.end31, %while.cond35
br label %while.cond35
while.end44: ; preds = %while.body41.peel, %while.cond38.preheader
%n.2.lcssa = phi i32 [ %add30, %while.cond38.preheader ], [ %mul42.lcssa, %while.body41.peel ]
ret i32 %n.2.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @getInt() local_unnamed_addr #0 {
entry:
%call = tail call ptr @__ctype_b_loc() #5
%0 = load ptr, ptr %call, align 8, !tbaa !5
%1 = load ptr, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %1, align 1, !tbaa !9
%idxprom15 = sext i8 %2 to i64
%arrayidx16 = getelementptr inbounds i16, ptr %0, i64 %idxprom15
%3 = load i16, ptr %arrayidx16, align 2, !tbaa !10
%4 = and i16 %3, 8192
%tobool.not17 = icmp eq i16 %4, 0
br i1 %tobool.not17, label %while.cond2.preheader, label %while.body
while.cond2.preheader: ; preds = %while.body, %entry
%5 = phi i16 [ %3, %entry ], [ %11, %while.body ]
%6 = phi ptr [ %1, %entry ], [ %incdec.ptr, %while.body ]
%7 = and i16 %5, 2048
%tobool9.not20 = icmp eq i16 %7, 0
br i1 %tobool9.not20, label %while.end13, label %while.body10
while.body: ; preds = %entry, %while.body
%8 = phi ptr [ %incdec.ptr, %while.body ], [ %1, %entry ]
%incdec.ptr = getelementptr inbounds i8, ptr %8, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%9 = load ptr, ptr %call, align 8, !tbaa !5
%10 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%idxprom = sext i8 %10 to i64
%arrayidx = getelementptr inbounds i16, ptr %9, i64 %idxprom
%11 = load i16, ptr %arrayidx, align 2, !tbaa !10
%12 = and i16 %11, 8192
%tobool.not = icmp eq i16 %12, 0
br i1 %tobool.not, label %while.cond2.preheader, label %while.body, !llvm.loop !16
while.body10: ; preds = %while.cond2.preheader, %while.body10
%13 = phi ptr [ %incdec.ptr11, %while.body10 ], [ %6, %while.cond2.preheader ]
%n.021 = phi i32 [ %add, %while.body10 ], [ 0, %while.cond2.preheader ]
%mul = mul nsw i32 %n.021, 10
%incdec.ptr11 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr11, ptr @p, align 8, !tbaa !5
%14 = load i8, ptr %13, align 1, !tbaa !9
%conv12 = sext i8 %14 to i32
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv12
%15 = load ptr, ptr %call, align 8, !tbaa !5
%16 = load i8, ptr %incdec.ptr11, align 1, !tbaa !9
%idxprom5 = sext i8 %16 to i64
%arrayidx6 = getelementptr inbounds i16, ptr %15, i64 %idxprom5
%17 = load i16, ptr %arrayidx6, align 2, !tbaa !10
%18 = and i16 %17, 2048
%tobool9.not = icmp eq i16 %18, 0
br i1 %tobool9.not, label %while.end13, label %while.body10, !llvm.loop !17
while.end13: ; preds = %while.body10, %while.cond2.preheader
%n.0.lcssa = phi i32 [ 0, %while.cond2.preheader ], [ %add, %while.body10 ]
ret i32 %n.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc12
%indvars.iv304 = phi i64 [ 0, %entry ], [ %indvars.iv.next305, %for.inc12 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %getDouble.exit
%indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %getDouble.exit ]
store ptr @buf, ptr @p, align 8, !tbaa !5
%call = tail call ptr @gets(ptr noundef nonnull @buf)
%call.i = tail call ptr @__ctype_b_loc() #5
%0 = load ptr, ptr %call.i, align 8, !tbaa !5
%1 = load ptr, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %1, align 1, !tbaa !9
%idxprom15.i = sext i8 %2 to i64
%arrayidx16.i = getelementptr inbounds i16, ptr %0, i64 %idxprom15.i
%3 = load i16, ptr %arrayidx16.i, align 2, !tbaa !10
%4 = and i16 %3, 8192
%tobool.not17.i = icmp eq i16 %4, 0
br i1 %tobool.not17.i, label %while.cond2.preheader.i, label %while.body.i
while.cond2.preheader.i: ; preds = %while.body.i, %for.body3
%5 = phi ptr [ %0, %for.body3 ], [ %10, %while.body.i ]
%6 = phi i16 [ %3, %for.body3 ], [ %12, %while.body.i ]
%7 = phi ptr [ %1, %for.body3 ], [ %incdec.ptr.i, %while.body.i ]
%8 = and i16 %6, 2048
%tobool9.not20.i = icmp eq i16 %8, 0
br i1 %tobool9.not20.i, label %getInt.exit, label %while.body10.i
while.body.i: ; preds = %for.body3, %while.body.i
%9 = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %1, %for.body3 ]
%incdec.ptr.i = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
%10 = load ptr, ptr %call.i, align 8, !tbaa !5
%11 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%idxprom.i = sext i8 %11 to i64
%arrayidx.i = getelementptr inbounds i16, ptr %10, i64 %idxprom.i
%12 = load i16, ptr %arrayidx.i, align 2, !tbaa !10
%13 = and i16 %12, 8192
%tobool.not.i = icmp eq i16 %13, 0
br i1 %tobool.not.i, label %while.cond2.preheader.i, label %while.body.i, !llvm.loop !16
while.body10.i: ; preds = %while.cond2.preheader.i, %while.body10.i
%14 = phi ptr [ %incdec.ptr11.i, %while.body10.i ], [ %7, %while.cond2.preheader.i ]
%n.021.i = phi i32 [ %add.i, %while.body10.i ], [ 0, %while.cond2.preheader.i ]
%mul.i = mul nsw i32 %n.021.i, 10
%incdec.ptr11.i = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr11.i, ptr @p, align 8, !tbaa !5
%15 = load i8, ptr %14, align 1, !tbaa !9
%conv12.i = sext i8 %15 to i32
%sub.i = add i32 %mul.i, -48
%add.i = add i32 %sub.i, %conv12.i
%16 = load ptr, ptr %call.i, align 8, !tbaa !5
%17 = load i8, ptr %incdec.ptr11.i, align 1, !tbaa !9
%idxprom5.i = sext i8 %17 to i64
%arrayidx6.i = getelementptr inbounds i16, ptr %16, i64 %idxprom5.i
%18 = load i16, ptr %arrayidx6.i, align 2, !tbaa !10
%19 = and i16 %18, 2048
%tobool9.not.i = icmp eq i16 %19, 0
br i1 %tobool9.not.i, label %getInt.exit, label %while.body10.i, !llvm.loop !17
getInt.exit: ; preds = %while.body10.i, %while.cond2.preheader.i
%20 = phi ptr [ %7, %while.cond2.preheader.i ], [ %incdec.ptr11.i, %while.body10.i ]
%21 = phi ptr [ %5, %while.cond2.preheader.i ], [ %16, %while.body10.i ]
%n.0.lcssa.i = phi i32 [ 0, %while.cond2.preheader.i ], [ %add.i, %while.body10.i ]
%arrayidx6 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 %indvars.iv304, i64 %indvars.iv
store i32 %n.0.lcssa.i, ptr %arrayidx6, align 8, !tbaa !18
%22 = load i8, ptr %20, align 1, !tbaa !9
%idxprom52.i = sext i8 %22 to i64
%arrayidx53.i = getelementptr inbounds i16, ptr %21, i64 %idxprom52.i
%23 = load i16, ptr %arrayidx53.i, align 2, !tbaa !10
%24 = and i16 %23, 8192
%tobool.not54.i = icmp eq i16 %24, 0
br i1 %tobool.not54.i, label %while.cond2.preheader.i263, label %while.body.i258
while.cond2.preheader.i263: ; preds = %while.body.i258, %getInt.exit
%25 = phi i16 [ %23, %getInt.exit ], [ %33, %while.body.i258 ]
%26 = phi i8 [ %22, %getInt.exit ], [ %32, %while.body.i258 ]
%27 = phi ptr [ %20, %getInt.exit ], [ %incdec.ptr.i259, %while.body.i258 ]
%28 = phi ptr [ %21, %getInt.exit ], [ %31, %while.body.i258 ]
%29 = and i16 %25, 2048
%tobool9.not57.i = icmp eq i16 %29, 0
br i1 %tobool9.not57.i, label %while.end13.i, label %while.body10.i264
while.body.i258: ; preds = %getInt.exit, %while.body.i258
%30 = phi ptr [ %incdec.ptr.i259, %while.body.i258 ], [ %20, %getInt.exit ]
%incdec.ptr.i259 = getelementptr inbounds i8, ptr %30, i64 1
store ptr %incdec.ptr.i259, ptr @p, align 8, !tbaa !5
%31 = load ptr, ptr %call.i, align 8, !tbaa !5
%32 = load i8, ptr %incdec.ptr.i259, align 1, !tbaa !9
%idxprom.i260 = sext i8 %32 to i64
%arrayidx.i261 = getelementptr inbounds i16, ptr %31, i64 %idxprom.i260
%33 = load i16, ptr %arrayidx.i261, align 2, !tbaa !10
%34 = and i16 %33, 8192
%tobool.not.i262 = icmp eq i16 %34, 0
br i1 %tobool.not.i262, label %while.cond2.preheader.i263, label %while.body.i258, !llvm.loop !12
while.body10.i264: ; preds = %while.cond2.preheader.i263, %while.body10.i264
%35 = phi ptr [ %incdec.ptr11.i266, %while.body10.i264 ], [ %27, %while.cond2.preheader.i263 ]
%n.058.i = phi i32 [ %add.i269, %while.body10.i264 ], [ 0, %while.cond2.preheader.i263 ]
%mul.i265 = mul nsw i32 %n.058.i, 10
%incdec.ptr11.i266 = getelementptr inbounds i8, ptr %35, i64 1
store ptr %incdec.ptr11.i266, ptr @p, align 8, !tbaa !5
%36 = load i8, ptr %35, align 1, !tbaa !9
%conv12.i267 = sext i8 %36 to i32
%sub.i268 = add i32 %mul.i265, -48
%add.i269 = add i32 %sub.i268, %conv12.i267
%37 = load ptr, ptr %call.i, align 8, !tbaa !5
%38 = load i8, ptr %incdec.ptr11.i266, align 1, !tbaa !9
%idxprom5.i270 = sext i8 %38 to i64
%arrayidx6.i271 = getelementptr inbounds i16, ptr %37, i64 %idxprom5.i270
%39 = load i16, ptr %arrayidx6.i271, align 2, !tbaa !10
%40 = and i16 %39, 2048
%tobool9.not.i272 = icmp eq i16 %40, 0
br i1 %tobool9.not.i272, label %while.end13.i, label %while.body10.i264, !llvm.loop !14
while.end13.i: ; preds = %while.body10.i264, %while.cond2.preheader.i263
%41 = phi ptr [ %28, %while.cond2.preheader.i263 ], [ %37, %while.body10.i264 ]
%n.0.lcssa.i273 = phi i32 [ 0, %while.cond2.preheader.i263 ], [ %add.i269, %while.body10.i264 ]
%.lcssa51.i = phi ptr [ %27, %while.cond2.preheader.i263 ], [ %incdec.ptr11.i266, %while.body10.i264 ]
%.lcssa.i = phi i8 [ %26, %while.cond2.preheader.i263 ], [ %38, %while.body10.i264 ]
%cmp.i = icmp eq i8 %.lcssa.i, 46
br i1 %cmp.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %while.end13.i
%incdec.ptr16.i = getelementptr inbounds i8, ptr %.lcssa51.i, i64 1
store ptr %incdec.ptr16.i, ptr @p, align 8, !tbaa !5
%.pre.i = load ptr, ptr %call.i, align 8, !tbaa !5
%.pre74.i = load i8, ptr %incdec.ptr16.i, align 1, !tbaa !9
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.end13.i
%42 = phi i8 [ %.pre74.i, %if.then.i ], [ %.lcssa.i, %while.end13.i ]
%43 = phi ptr [ %incdec.ptr16.i, %if.then.i ], [ %.lcssa51.i, %while.end13.i ]
%44 = phi ptr [ %.pre.i, %if.then.i ], [ %41, %while.end13.i ]
%idxprom2062.i = sext i8 %42 to i64
%arrayidx2163.i = getelementptr inbounds i16, ptr %44, i64 %idxprom2062.i
%45 = load i16, ptr %arrayidx2163.i, align 2, !tbaa !10
%46 = and i16 %45, 2048
%tobool24.not64.i = icmp eq i16 %46, 0
br i1 %tobool24.not64.i, label %getDouble.exit.loopexit.loopexit, label %while.body25.i
while.body25.i: ; preds = %if.end.i, %while.body25.i
%47 = phi ptr [ %incdec.ptr27.i, %while.body25.i ], [ %43, %if.end.i ]
%n.166.i = phi i32 [ %add30.i, %while.body25.i ], [ %n.0.lcssa.i273, %if.end.i ]
%len.065.i = phi i32 [ %inc.i, %while.body25.i ], [ 0, %if.end.i ]
%mul26.i = mul nsw i32 %n.166.i, 10
%incdec.ptr27.i = getelementptr inbounds i8, ptr %47, i64 1
store ptr %incdec.ptr27.i, ptr @p, align 8, !tbaa !5
%48 = load i8, ptr %47, align 1, !tbaa !9
%conv28.i = sext i8 %48 to i32
%sub29.i = add i32 %mul26.i, -48
%add30.i = add i32 %sub29.i, %conv28.i
%inc.i = add nuw nsw i32 %len.065.i, 1
%49 = load ptr, ptr %call.i, align 8, !tbaa !5
%50 = load i8, ptr %incdec.ptr27.i, align 1, !tbaa !9
%idxprom20.i = sext i8 %50 to i64
%arrayidx21.i = getelementptr inbounds i16, ptr %49, i64 %idxprom20.i
%51 = load i16, ptr %arrayidx21.i, align 2, !tbaa !10
%52 = and i16 %51, 2048
%tobool24.not.i = icmp eq i16 %52, 0
br i1 %tobool24.not.i, label %while.end31.i, label %while.body25.i, !llvm.loop !15
while.end31.i: ; preds = %while.body25.i
%cmp32.i = icmp ugt i32 %len.065.i, 1
br i1 %cmp32.i, label %while.cond35.i, label %while.cond38.preheader.i
while.cond38.preheader.i: ; preds = %while.end31.i
%cmp3969.not.i = icmp eq i32 %inc.i, 2
br i1 %cmp3969.not.i, label %getDouble.exit, label %while.body41.preheader.i
while.body41.preheader.i: ; preds = %while.cond38.preheader.i
%mul42.i.peel = mul nsw i32 %add30.i, 10
br i1 %tobool24.not64.i, label %getDouble.exit.loopexit.loopexit, label %getDouble.exit
while.cond35.i: ; preds = %while.end31.i, %while.cond35.i
br label %while.cond35.i
getDouble.exit.loopexit.loopexit: ; preds = %if.end.i, %while.body41.preheader.i
%n.1.lcssa7983.i406 = phi i32 [ %add30.i, %while.body41.preheader.i ], [ %n.0.lcssa.i273, %if.end.i ]
%mul42.i = mul i32 %n.1.lcssa7983.i406, 100
br label %getDouble.exit
getDouble.exit: ; preds = %while.body41.preheader.i, %getDouble.exit.loopexit.loopexit, %while.cond38.preheader.i
%n.2.lcssa.i = phi i32 [ %add30.i, %while.cond38.preheader.i ], [ %mul42.i.peel, %while.body41.preheader.i ], [ %mul42.i, %getDouble.exit.loopexit.loopexit ]
%t = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 %indvars.iv304, i64 %indvars.iv, i32 1
store i32 %n.2.lcssa.i, ptr %t, align 4, !tbaa !21
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 8
br i1 %exitcond.not, label %for.inc12, label %for.body3, !llvm.loop !22
for.inc12: ; preds = %getDouble.exit
%indvars.iv.next305 = add nuw nsw i64 %indvars.iv304, 1
%exitcond307.not = icmp eq i64 %indvars.iv.next305, 3
br i1 %exitcond307.not, label %for.body17.preheader, label %for.cond1.preheader, !llvm.loop !23
for.body17.preheader: ; preds = %for.inc12
%53 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 0, i32 1), align 4, !tbaa !21
%54 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 1, i32 1), align 4, !tbaa !21
%cmp26.not = icmp sgt i32 %53, %54
%. = zext i1 %cmp26.not to i32
%55 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 2, i32 1), align 4, !tbaa !21
%idxprom37 = zext i1 %cmp26.not to i64
%t39 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom37, i32 1
%56 = load i32, ptr %t39, align 4, !tbaa !21
%cmp40 = icmp slt i32 %55, %56
br i1 %cmp40, label %for.inc57, label %if.else42
if.else42: ; preds = %for.body17.preheader
%not.cmp26.not = xor i1 %cmp26.not, true
%.256 = zext i1 %not.cmp26.not to i32
%idxprom50 = zext i1 %not.cmp26.not to i64
%t52 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom50, i32 1
%57 = load i32, ptr %t52, align 4, !tbaa !21
%cmp53 = icmp slt i32 %55, %57
%spec.select = select i1 %cmp53, i32 2, i32 %.256
br label %for.inc57
for.inc57: ; preds = %for.body17.preheader, %if.else42
%58 = phi i32 [ %56, %if.else42 ], [ %55, %for.body17.preheader ]
%t1.2 = phi i32 [ %., %if.else42 ], [ 2, %for.body17.preheader ]
%t2.2 = phi i32 [ %spec.select, %if.else42 ], [ %., %for.body17.preheader ]
%59 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 3, i32 1), align 4, !tbaa !21
%cmp40.1 = icmp slt i32 %59, %58
br i1 %cmp40.1, label %for.inc57.1, label %if.else42.1
if.else42.1: ; preds = %for.inc57
%idxprom37.1 = zext i32 %t1.2 to i64
%t39.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom37.1, i32 1
%idxprom50.1 = zext i32 %t2.2 to i64
%t52.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom50.1, i32 1
%60 = load i32, ptr %t52.1, align 4, !tbaa !21
%cmp53.1 = icmp slt i32 %59, %60
%spec.select.1 = select i1 %cmp53.1, i32 3, i32 %t2.2
%.pre384 = load i32, ptr %t39.1, align 4, !tbaa !21
br label %for.inc57.1
for.inc57.1: ; preds = %for.inc57, %if.else42.1
%.pre385 = phi i32 [ %.pre384, %if.else42.1 ], [ %59, %for.inc57 ]
%t1.2.1 = phi i32 [ %t1.2, %if.else42.1 ], [ 3, %for.inc57 ]
%t2.2.1 = phi i32 [ %spec.select.1, %if.else42.1 ], [ %t1.2, %for.inc57 ]
%61 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 4, i32 1), align 4, !tbaa !21
%cmp40.2 = icmp slt i32 %61, %.pre385
br i1 %cmp40.2, label %for.inc57.2, label %if.else42.2
if.else42.2: ; preds = %for.inc57.1
%idxprom50.2 = zext i32 %t2.2.1 to i64
%t52.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom50.2, i32 1
%62 = load i32, ptr %t52.2, align 4, !tbaa !21
%cmp53.2 = icmp slt i32 %61, %62
%spec.select.2 = select i1 %cmp53.2, i32 4, i32 %t2.2.1
br label %for.inc57.2
for.inc57.2: ; preds = %for.inc57.1, %if.else42.2
%63 = phi i32 [ %.pre385, %if.else42.2 ], [ %61, %for.inc57.1 ]
%t1.2.2 = phi i32 [ %t1.2.1, %if.else42.2 ], [ 4, %for.inc57.1 ]
%t2.2.2 = phi i32 [ %spec.select.2, %if.else42.2 ], [ %t1.2.1, %for.inc57.1 ]
%64 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 5, i32 1), align 4, !tbaa !21
%cmp40.3 = icmp slt i32 %64, %63
br i1 %cmp40.3, label %for.inc57.3, label %if.else42.3
if.else42.3: ; preds = %for.inc57.2
%idxprom37.3 = zext i32 %t1.2.2 to i64
%t39.3 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom37.3, i32 1
%idxprom50.3 = zext i32 %t2.2.2 to i64
%t52.3 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom50.3, i32 1
%65 = load i32, ptr %t52.3, align 4, !tbaa !21
%cmp53.3 = icmp slt i32 %64, %65
%spec.select.3 = select i1 %cmp53.3, i32 5, i32 %t2.2.2
%.pre386 = load i32, ptr %t39.3, align 4, !tbaa !21
br label %for.inc57.3
for.inc57.3: ; preds = %for.inc57.2, %if.else42.3
%.pre387 = phi i32 [ %.pre386, %if.else42.3 ], [ %64, %for.inc57.2 ]
%t1.2.3 = phi i32 [ %t1.2.2, %if.else42.3 ], [ 5, %for.inc57.2 ]
%t2.2.3 = phi i32 [ %spec.select.3, %if.else42.3 ], [ %t1.2.2, %for.inc57.2 ]
%66 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 6, i32 1), align 4, !tbaa !21
%cmp40.4 = icmp slt i32 %66, %.pre387
br i1 %cmp40.4, label %for.inc57.4, label %if.else42.4
if.else42.4: ; preds = %for.inc57.3
%idxprom50.4 = zext i32 %t2.2.3 to i64
%t52.4 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom50.4, i32 1
%67 = load i32, ptr %t52.4, align 4, !tbaa !21
%cmp53.4 = icmp slt i32 %66, %67
%spec.select.4 = select i1 %cmp53.4, i32 6, i32 %t2.2.3
br label %for.inc57.4
for.inc57.4: ; preds = %for.inc57.3, %if.else42.4
%68 = phi i32 [ %.pre387, %if.else42.4 ], [ %66, %for.inc57.3 ]
%t1.2.4 = phi i32 [ %t1.2.3, %if.else42.4 ], [ 6, %for.inc57.3 ]
%t2.2.4 = phi i32 [ %spec.select.4, %if.else42.4 ], [ %t1.2.3, %for.inc57.3 ]
%69 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 7, i32 1), align 4, !tbaa !21
%idxprom37.5 = zext i32 %t1.2.4 to i64
%cmp40.5 = icmp slt i32 %69, %68
br i1 %cmp40.5, label %for.inc57.5, label %if.else42.5
if.else42.5: ; preds = %for.inc57.4
%t39.5 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom37.5, i32 1
%idxprom50.5 = zext i32 %t2.2.4 to i64
%t52.5 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom50.5, i32 1
%70 = load i32, ptr %t52.5, align 4, !tbaa !21
%cmp53.5 = icmp slt i32 %69, %70
%spec.select.5 = select i1 %cmp53.5, i32 7, i32 %t2.2.4
%.pre388 = load i32, ptr %t39.5, align 4, !tbaa !21
%.pre389 = zext i32 %spec.select.5 to i64
br label %for.inc57.5
for.inc57.5: ; preds = %for.inc57.4, %if.else42.5
%idxprom85.pre-phi = phi i64 [ %.pre389, %if.else42.5 ], [ %idxprom37.5, %for.inc57.4 ]
%71 = phi i32 [ %.pre388, %if.else42.5 ], [ %69, %for.inc57.4 ]
%t1.2.5 = phi i32 [ %t1.2.4, %if.else42.5 ], [ 7, %for.inc57.4 ]
%idxprom62 = zext i32 %t1.2.5 to i64
%arrayidx63 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom62
%72 = load i32, ptr %arrayidx63, align 8, !tbaa !18
store i32 %72, ptr @a, align 16, !tbaa !18
%t73 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom62, i32 1
store i32 %71, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 0, i64 0, i32 1), align 4, !tbaa !21
store i32 1000000, ptr %t73, align 4, !tbaa !21
%arrayidx86 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom85.pre-phi
%t96 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 %idxprom85.pre-phi, i32 1
%73 = load <2 x i32>, ptr %arrayidx86, align 8, !tbaa !24
store <2 x i32> %73, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 0, i64 1), align 8, !tbaa !24
store i32 1000000, ptr %t96, align 4, !tbaa !21
%74 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 0, i32 1), align 4, !tbaa !21
%75 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 1, i32 1), align 4, !tbaa !21
%cmp26.not.1 = icmp sgt i32 %74, %75
%..1 = zext i1 %cmp26.not.1 to i32
%76 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 2, i32 1), align 4, !tbaa !21
%idxprom37.1317 = zext i1 %cmp26.not.1 to i64
%t39.1318 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom37.1317, i32 1
%77 = load i32, ptr %t39.1318, align 4, !tbaa !21
%cmp40.1319 = icmp slt i32 %76, %77
br i1 %cmp40.1319, label %for.inc57.1327, label %if.else42.1324
if.else42.1324: ; preds = %for.inc57.5
%not.cmp26.not.1 = xor i1 %cmp26.not.1, true
%.256.1 = zext i1 %not.cmp26.not.1 to i32
%idxprom50.1320 = zext i1 %not.cmp26.not.1 to i64
%t52.1321 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom50.1320, i32 1
%78 = load i32, ptr %t52.1321, align 4, !tbaa !21
%cmp53.1322 = icmp slt i32 %76, %78
%spec.select.1323 = select i1 %cmp53.1322, i32 2, i32 %.256.1
br label %for.inc57.1327
for.inc57.1327: ; preds = %for.inc57.5, %if.else42.1324
%79 = phi i32 [ %77, %if.else42.1324 ], [ %76, %for.inc57.5 ]
%t1.2.1325 = phi i32 [ %..1, %if.else42.1324 ], [ 2, %for.inc57.5 ]
%t2.2.1326 = phi i32 [ %spec.select.1323, %if.else42.1324 ], [ %..1, %for.inc57.5 ]
%80 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 3, i32 1), align 4, !tbaa !21
%cmp40.1.1 = icmp slt i32 %80, %79
br i1 %cmp40.1.1, label %for.inc57.1.1, label %if.else42.1.1
if.else42.1.1: ; preds = %for.inc57.1327
%idxprom37.1.1 = zext i32 %t1.2.1325 to i64
%t39.1.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom37.1.1, i32 1
%idxprom50.1.1 = zext i32 %t2.2.1326 to i64
%t52.1.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom50.1.1, i32 1
%81 = load i32, ptr %t52.1.1, align 4, !tbaa !21
%cmp53.1.1 = icmp slt i32 %80, %81
%spec.select.1.1 = select i1 %cmp53.1.1, i32 3, i32 %t2.2.1326
%.pre391 = load i32, ptr %t39.1.1, align 4, !tbaa !21
br label %for.inc57.1.1
for.inc57.1.1: ; preds = %for.inc57.1327, %if.else42.1.1
%.pre392 = phi i32 [ %.pre391, %if.else42.1.1 ], [ %80, %for.inc57.1327 ]
%t1.2.1.1 = phi i32 [ %t1.2.1325, %if.else42.1.1 ], [ 3, %for.inc57.1327 ]
%t2.2.1.1 = phi i32 [ %spec.select.1.1, %if.else42.1.1 ], [ %t1.2.1325, %for.inc57.1327 ]
%82 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 4, i32 1), align 4, !tbaa !21
%cmp40.2.1 = icmp slt i32 %82, %.pre392
br i1 %cmp40.2.1, label %for.inc57.2.1, label %if.else42.2.1
if.else42.2.1: ; preds = %for.inc57.1.1
%idxprom50.2.1 = zext i32 %t2.2.1.1 to i64
%t52.2.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom50.2.1, i32 1
%83 = load i32, ptr %t52.2.1, align 4, !tbaa !21
%cmp53.2.1 = icmp slt i32 %82, %83
%spec.select.2.1 = select i1 %cmp53.2.1, i32 4, i32 %t2.2.1.1
br label %for.inc57.2.1
for.inc57.2.1: ; preds = %for.inc57.1.1, %if.else42.2.1
%84 = phi i32 [ %.pre392, %if.else42.2.1 ], [ %82, %for.inc57.1.1 ]
%t1.2.2.1 = phi i32 [ %t1.2.1.1, %if.else42.2.1 ], [ 4, %for.inc57.1.1 ]
%t2.2.2.1 = phi i32 [ %spec.select.2.1, %if.else42.2.1 ], [ %t1.2.1.1, %for.inc57.1.1 ]
%85 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 5, i32 1), align 4, !tbaa !21
%cmp40.3.1 = icmp slt i32 %85, %84
br i1 %cmp40.3.1, label %for.inc57.3.1, label %if.else42.3.1
if.else42.3.1: ; preds = %for.inc57.2.1
%idxprom37.3.1 = zext i32 %t1.2.2.1 to i64
%t39.3.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom37.3.1, i32 1
%idxprom50.3.1 = zext i32 %t2.2.2.1 to i64
%t52.3.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom50.3.1, i32 1
%86 = load i32, ptr %t52.3.1, align 4, !tbaa !21
%cmp53.3.1 = icmp slt i32 %85, %86
%spec.select.3.1 = select i1 %cmp53.3.1, i32 5, i32 %t2.2.2.1
%.pre393 = load i32, ptr %t39.3.1, align 4, !tbaa !21
br label %for.inc57.3.1
for.inc57.3.1: ; preds = %for.inc57.2.1, %if.else42.3.1
%.pre394 = phi i32 [ %.pre393, %if.else42.3.1 ], [ %85, %for.inc57.2.1 ]
%t1.2.3.1 = phi i32 [ %t1.2.2.1, %if.else42.3.1 ], [ 5, %for.inc57.2.1 ]
%t2.2.3.1 = phi i32 [ %spec.select.3.1, %if.else42.3.1 ], [ %t1.2.2.1, %for.inc57.2.1 ]
%87 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 6, i32 1), align 4, !tbaa !21
%cmp40.4.1 = icmp slt i32 %87, %.pre394
br i1 %cmp40.4.1, label %for.inc57.4.1, label %if.else42.4.1
if.else42.4.1: ; preds = %for.inc57.3.1
%idxprom50.4.1 = zext i32 %t2.2.3.1 to i64
%t52.4.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom50.4.1, i32 1
%88 = load i32, ptr %t52.4.1, align 4, !tbaa !21
%cmp53.4.1 = icmp slt i32 %87, %88
%spec.select.4.1 = select i1 %cmp53.4.1, i32 6, i32 %t2.2.3.1
br label %for.inc57.4.1
for.inc57.4.1: ; preds = %for.inc57.3.1, %if.else42.4.1
%89 = phi i32 [ %.pre394, %if.else42.4.1 ], [ %87, %for.inc57.3.1 ]
%t1.2.4.1 = phi i32 [ %t1.2.3.1, %if.else42.4.1 ], [ 6, %for.inc57.3.1 ]
%t2.2.4.1 = phi i32 [ %spec.select.4.1, %if.else42.4.1 ], [ %t1.2.3.1, %for.inc57.3.1 ]
%90 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 7, i32 1), align 4, !tbaa !21
%idxprom37.5.1 = zext i32 %t1.2.4.1 to i64
%cmp40.5.1 = icmp slt i32 %90, %89
br i1 %cmp40.5.1, label %for.inc57.5.1, label %if.else42.5.1
if.else42.5.1: ; preds = %for.inc57.4.1
%t39.5.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom37.5.1, i32 1
%idxprom50.5.1 = zext i32 %t2.2.4.1 to i64
%t52.5.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom50.5.1, i32 1
%91 = load i32, ptr %t52.5.1, align 4, !tbaa !21
%cmp53.5.1 = icmp slt i32 %90, %91
%spec.select.5.1 = select i1 %cmp53.5.1, i32 7, i32 %t2.2.4.1
%.pre395 = load i32, ptr %t39.5.1, align 4, !tbaa !21
%.pre396 = zext i32 %spec.select.5.1 to i64
br label %for.inc57.5.1
for.inc57.5.1: ; preds = %for.inc57.4.1, %if.else42.5.1
%idxprom85.1.pre-phi = phi i64 [ %.pre396, %if.else42.5.1 ], [ %idxprom37.5.1, %for.inc57.4.1 ]
%92 = phi i32 [ %.pre395, %if.else42.5.1 ], [ %90, %for.inc57.4.1 ]
%t1.2.5.1 = phi i32 [ %t1.2.4.1, %if.else42.5.1 ], [ 7, %for.inc57.4.1 ]
%idxprom62.1 = zext i32 %t1.2.5.1 to i64
%arrayidx63.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom62.1
%93 = load i32, ptr %arrayidx63.1, align 8, !tbaa !18
store i32 %93, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1), align 16, !tbaa !18
%t73.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom62.1, i32 1
store i32 %92, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1, i64 0, i32 1), align 4, !tbaa !21
store i32 1000000, ptr %t73.1, align 4, !tbaa !21
%arrayidx86.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom85.1.pre-phi
%t96.1 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 %idxprom85.1.pre-phi, i32 1
%94 = load <2 x i32>, ptr %arrayidx86.1, align 8, !tbaa !24
store <2 x i32> %94, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1, i64 1), align 8, !tbaa !24
store i32 1000000, ptr %t96.1, align 4, !tbaa !21
%95 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 0, i32 1), align 4, !tbaa !21
%96 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 1, i32 1), align 4, !tbaa !21
%cmp26.not.2 = icmp sgt i32 %95, %96
%..2 = zext i1 %cmp26.not.2 to i32
%97 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 2, i32 1), align 4, !tbaa !21
%idxprom37.2329 = zext i1 %cmp26.not.2 to i64
%t39.2330 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom37.2329, i32 1
%98 = load i32, ptr %t39.2330, align 4, !tbaa !21
%cmp40.2331 = icmp slt i32 %97, %98
br i1 %cmp40.2331, label %for.inc57.2339, label %if.else42.2336
if.else42.2336: ; preds = %for.inc57.5.1
%not.cmp26.not.2 = xor i1 %cmp26.not.2, true
%.256.2 = zext i1 %not.cmp26.not.2 to i32
%idxprom50.2332 = zext i1 %not.cmp26.not.2 to i64
%t52.2333 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom50.2332, i32 1
%99 = load i32, ptr %t52.2333, align 4, !tbaa !21
%cmp53.2334 = icmp slt i32 %97, %99
%spec.select.2335 = select i1 %cmp53.2334, i32 2, i32 %.256.2
br label %for.inc57.2339
for.inc57.2339: ; preds = %for.inc57.5.1, %if.else42.2336
%100 = phi i32 [ %98, %if.else42.2336 ], [ %97, %for.inc57.5.1 ]
%t1.2.2337 = phi i32 [ %..2, %if.else42.2336 ], [ 2, %for.inc57.5.1 ]
%t2.2.2338 = phi i32 [ %spec.select.2335, %if.else42.2336 ], [ %..2, %for.inc57.5.1 ]
%101 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 3, i32 1), align 4, !tbaa !21
%cmp40.1.2 = icmp slt i32 %101, %100
br i1 %cmp40.1.2, label %for.inc57.1.2, label %if.else42.1.2
if.else42.1.2: ; preds = %for.inc57.2339
%idxprom37.1.2 = zext i32 %t1.2.2337 to i64
%t39.1.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom37.1.2, i32 1
%idxprom50.1.2 = zext i32 %t2.2.2338 to i64
%t52.1.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom50.1.2, i32 1
%102 = load i32, ptr %t52.1.2, align 4, !tbaa !21
%cmp53.1.2 = icmp slt i32 %101, %102
%spec.select.1.2 = select i1 %cmp53.1.2, i32 3, i32 %t2.2.2338
%.pre398 = load i32, ptr %t39.1.2, align 4, !tbaa !21
br label %for.inc57.1.2
for.inc57.1.2: ; preds = %for.inc57.2339, %if.else42.1.2
%.pre399 = phi i32 [ %.pre398, %if.else42.1.2 ], [ %101, %for.inc57.2339 ]
%t1.2.1.2 = phi i32 [ %t1.2.2337, %if.else42.1.2 ], [ 3, %for.inc57.2339 ]
%t2.2.1.2 = phi i32 [ %spec.select.1.2, %if.else42.1.2 ], [ %t1.2.2337, %for.inc57.2339 ]
%103 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 4, i32 1), align 4, !tbaa !21
%cmp40.2.2 = icmp slt i32 %103, %.pre399
br i1 %cmp40.2.2, label %for.inc57.2.2, label %if.else42.2.2
if.else42.2.2: ; preds = %for.inc57.1.2
%idxprom50.2.2 = zext i32 %t2.2.1.2 to i64
%t52.2.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom50.2.2, i32 1
%104 = load i32, ptr %t52.2.2, align 4, !tbaa !21
%cmp53.2.2 = icmp slt i32 %103, %104
%spec.select.2.2 = select i1 %cmp53.2.2, i32 4, i32 %t2.2.1.2
br label %for.inc57.2.2
for.inc57.2.2: ; preds = %for.inc57.1.2, %if.else42.2.2
%105 = phi i32 [ %.pre399, %if.else42.2.2 ], [ %103, %for.inc57.1.2 ]
%t1.2.2.2 = phi i32 [ %t1.2.1.2, %if.else42.2.2 ], [ 4, %for.inc57.1.2 ]
%t2.2.2.2 = phi i32 [ %spec.select.2.2, %if.else42.2.2 ], [ %t1.2.1.2, %for.inc57.1.2 ]
%106 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 5, i32 1), align 4, !tbaa !21
%cmp40.3.2 = icmp slt i32 %106, %105
br i1 %cmp40.3.2, label %for.inc57.3.2, label %if.else42.3.2
if.else42.3.2: ; preds = %for.inc57.2.2
%idxprom37.3.2 = zext i32 %t1.2.2.2 to i64
%t39.3.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom37.3.2, i32 1
%idxprom50.3.2 = zext i32 %t2.2.2.2 to i64
%t52.3.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom50.3.2, i32 1
%107 = load i32, ptr %t52.3.2, align 4, !tbaa !21
%cmp53.3.2 = icmp slt i32 %106, %107
%spec.select.3.2 = select i1 %cmp53.3.2, i32 5, i32 %t2.2.2.2
%.pre400 = load i32, ptr %t39.3.2, align 4, !tbaa !21
br label %for.inc57.3.2
for.inc57.3.2: ; preds = %for.inc57.2.2, %if.else42.3.2
%.pre401 = phi i32 [ %.pre400, %if.else42.3.2 ], [ %106, %for.inc57.2.2 ]
%t1.2.3.2 = phi i32 [ %t1.2.2.2, %if.else42.3.2 ], [ 5, %for.inc57.2.2 ]
%t2.2.3.2 = phi i32 [ %spec.select.3.2, %if.else42.3.2 ], [ %t1.2.2.2, %for.inc57.2.2 ]
%108 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 6, i32 1), align 4, !tbaa !21
%cmp40.4.2 = icmp slt i32 %108, %.pre401
br i1 %cmp40.4.2, label %for.inc57.4.2, label %if.else42.4.2
if.else42.4.2: ; preds = %for.inc57.3.2
%idxprom50.4.2 = zext i32 %t2.2.3.2 to i64
%t52.4.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom50.4.2, i32 1
%109 = load i32, ptr %t52.4.2, align 4, !tbaa !21
%cmp53.4.2 = icmp slt i32 %108, %109
%spec.select.4.2 = select i1 %cmp53.4.2, i32 6, i32 %t2.2.3.2
br label %for.inc57.4.2
for.inc57.4.2: ; preds = %for.inc57.3.2, %if.else42.4.2
%110 = phi i32 [ %.pre401, %if.else42.4.2 ], [ %108, %for.inc57.3.2 ]
%t1.2.4.2 = phi i32 [ %t1.2.3.2, %if.else42.4.2 ], [ 6, %for.inc57.3.2 ]
%t2.2.4.2 = phi i32 [ %spec.select.4.2, %if.else42.4.2 ], [ %t1.2.3.2, %for.inc57.3.2 ]
%111 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 7, i32 1), align 4, !tbaa !21
%idxprom37.5.2 = zext i32 %t1.2.4.2 to i64
%cmp40.5.2 = icmp slt i32 %111, %110
br i1 %cmp40.5.2, label %for.inc57.5.2, label %if.else42.5.2
if.else42.5.2: ; preds = %for.inc57.4.2
%t39.5.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom37.5.2, i32 1
%idxprom50.5.2 = zext i32 %t2.2.4.2 to i64
%t52.5.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom50.5.2, i32 1
%112 = load i32, ptr %t52.5.2, align 4, !tbaa !21
%cmp53.5.2 = icmp slt i32 %111, %112
%spec.select.5.2 = select i1 %cmp53.5.2, i32 7, i32 %t2.2.4.2
%.pre402 = load i32, ptr %t39.5.2, align 4, !tbaa !21
%.pre403 = zext i32 %spec.select.5.2 to i64
br label %for.inc57.5.2
for.inc57.5.2: ; preds = %for.inc57.4.2, %if.else42.5.2
%idxprom85.2.pre-phi = phi i64 [ %.pre403, %if.else42.5.2 ], [ %idxprom37.5.2, %for.inc57.4.2 ]
%113 = phi i32 [ %.pre402, %if.else42.5.2 ], [ %111, %for.inc57.4.2 ]
%t1.2.5.2 = phi i32 [ %t1.2.4.2, %if.else42.5.2 ], [ 7, %for.inc57.4.2 ]
%idxprom62.2 = zext i32 %t1.2.5.2 to i64
%arrayidx63.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom62.2
%114 = load i32, ptr %arrayidx63.2, align 8, !tbaa !18
store i32 %114, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2), align 16, !tbaa !18
%t73.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom62.2, i32 1
store i32 %113, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2, i64 0, i32 1), align 4, !tbaa !21
store i32 1000000, ptr %t73.2, align 4, !tbaa !21
%arrayidx86.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom85.2.pre-phi
%t96.2 = getelementptr inbounds [4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 %idxprom85.2.pre-phi, i32 1
%115 = load <2 x i32>, ptr %arrayidx86.2, align 8, !tbaa !24
store <2 x i32> %115, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2, i64 1), align 8, !tbaa !24
store i32 1000000, ptr %t96.2, align 4, !tbaa !21
%116 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 0, i32 1), align 4, !tbaa !21
%cmp120 = icmp slt i32 %116, 1000000
%117 = load i32, ptr @s, align 16
%spec.select414 = tail call i32 @llvm.smin.i32(i32 %116, i32 1000000)
%spec.select415 = select i1 %cmp120, i32 %117, i32 1000000
%118 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 1, i32 1), align 4, !tbaa !21
%cmp120.1 = icmp slt i32 %118, %spec.select414
br i1 %cmp120.1, label %if.then121.1, label %if.else132.1
if.else132.1: ; preds = %for.inc57.5.2
%cmp138.1 = icmp slt i32 %118, 1000000
%119 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 1), align 8
%spec.select416 = tail call i32 @llvm.smin.i32(i32 %118, i32 1000000)
%spec.select417 = select i1 %cmp138.1, i32 %119, i32 1000000
br label %for.inc152.1
if.then121.1: ; preds = %for.inc57.5.2
%120 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 1), align 8, !tbaa !18
br label %for.inc152.1
for.inc152.1: ; preds = %if.else132.1, %if.then121.1
%t1.5.1 = phi i32 [ %118, %if.then121.1 ], [ %spec.select414, %if.else132.1 ]
%t2.5.1 = phi i32 [ %spec.select414, %if.then121.1 ], [ %spec.select416, %if.else132.1 ]
%n1.2.1 = phi i32 [ %120, %if.then121.1 ], [ %spec.select415, %if.else132.1 ]
%n2.2.1 = phi i32 [ %spec.select415, %if.then121.1 ], [ %spec.select417, %if.else132.1 ]
%121 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 2, i32 1), align 4, !tbaa !21
%cmp120.2 = icmp slt i32 %121, %t1.5.1
br i1 %cmp120.2, label %if.then121.2, label %if.else132.2
if.else132.2: ; preds = %for.inc152.1
%cmp138.2 = icmp slt i32 %121, %t2.5.1
%122 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 2), align 16
%spec.select418 = tail call i32 @llvm.smin.i32(i32 %121, i32 %t2.5.1)
%spec.select419 = select i1 %cmp138.2, i32 %122, i32 %n2.2.1
br label %for.inc152.2
if.then121.2: ; preds = %for.inc152.1
%123 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 2), align 16, !tbaa !18
br label %for.inc152.2
for.inc152.2: ; preds = %if.else132.2, %if.then121.2
%t1.5.2 = phi i32 [ %121, %if.then121.2 ], [ %t1.5.1, %if.else132.2 ]
%t2.5.2 = phi i32 [ %t1.5.1, %if.then121.2 ], [ %spec.select418, %if.else132.2 ]
%n1.2.2 = phi i32 [ %123, %if.then121.2 ], [ %n1.2.1, %if.else132.2 ]
%n2.2.2 = phi i32 [ %n1.2.1, %if.then121.2 ], [ %spec.select419, %if.else132.2 ]
%124 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 3, i32 1), align 4, !tbaa !21
%cmp120.3 = icmp slt i32 %124, %t1.5.2
br i1 %cmp120.3, label %if.then121.3, label %if.else132.3
if.else132.3: ; preds = %for.inc152.2
%cmp138.3 = icmp slt i32 %124, %t2.5.2
%125 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 3), align 8
%spec.select420 = tail call i32 @llvm.smin.i32(i32 %124, i32 %t2.5.2)
%spec.select421 = select i1 %cmp138.3, i32 %125, i32 %n2.2.2
br label %for.inc152.3
if.then121.3: ; preds = %for.inc152.2
%126 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 3), align 8, !tbaa !18
br label %for.inc152.3
for.inc152.3: ; preds = %if.else132.3, %if.then121.3
%t1.5.3 = phi i32 [ %124, %if.then121.3 ], [ %t1.5.2, %if.else132.3 ]
%t2.5.3 = phi i32 [ %t1.5.2, %if.then121.3 ], [ %spec.select420, %if.else132.3 ]
%n1.2.3 = phi i32 [ %126, %if.then121.3 ], [ %n1.2.2, %if.else132.3 ]
%n2.2.3 = phi i32 [ %n1.2.2, %if.then121.3 ], [ %spec.select421, %if.else132.3 ]
%127 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 4, i32 1), align 4, !tbaa !21
%cmp120.4 = icmp slt i32 %127, %t1.5.3
br i1 %cmp120.4, label %if.then121.4, label %if.else132.4
if.else132.4: ; preds = %for.inc152.3
%cmp138.4 = icmp slt i32 %127, %t2.5.3
%128 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 4), align 16
%spec.select422 = tail call i32 @llvm.smin.i32(i32 %127, i32 %t2.5.3)
%spec.select423 = select i1 %cmp138.4, i32 %128, i32 %n2.2.3
br label %for.inc152.4
if.then121.4: ; preds = %for.inc152.3
%129 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 4), align 16, !tbaa !18
br label %for.inc152.4
for.inc152.4: ; preds = %if.else132.4, %if.then121.4
%t1.5.4 = phi i32 [ %127, %if.then121.4 ], [ %t1.5.3, %if.else132.4 ]
%t2.5.4 = phi i32 [ %t1.5.3, %if.then121.4 ], [ %spec.select422, %if.else132.4 ]
%n1.2.4 = phi i32 [ %129, %if.then121.4 ], [ %n1.2.3, %if.else132.4 ]
%n2.2.4 = phi i32 [ %n1.2.3, %if.then121.4 ], [ %spec.select423, %if.else132.4 ]
%130 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 5, i32 1), align 4, !tbaa !21
%cmp120.5 = icmp slt i32 %130, %t1.5.4
br i1 %cmp120.5, label %if.then121.5, label %if.else132.5
if.else132.5: ; preds = %for.inc152.4
%cmp138.5 = icmp slt i32 %130, %t2.5.4
%131 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 5), align 8
%spec.select424 = tail call i32 @llvm.smin.i32(i32 %130, i32 %t2.5.4)
%spec.select425 = select i1 %cmp138.5, i32 %131, i32 %n2.2.4
br label %for.inc152.5
if.then121.5: ; preds = %for.inc152.4
%132 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 5), align 8, !tbaa !18
br label %for.inc152.5
for.inc152.5: ; preds = %if.else132.5, %if.then121.5
%t1.5.5 = phi i32 [ %130, %if.then121.5 ], [ %t1.5.4, %if.else132.5 ]
%t2.5.5 = phi i32 [ %t1.5.4, %if.then121.5 ], [ %spec.select424, %if.else132.5 ]
%n1.2.5 = phi i32 [ %132, %if.then121.5 ], [ %n1.2.4, %if.else132.5 ]
%n2.2.5 = phi i32 [ %n1.2.4, %if.then121.5 ], [ %spec.select425, %if.else132.5 ]
%133 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 6, i32 1), align 4, !tbaa !21
%cmp120.6 = icmp slt i32 %133, %t1.5.5
br i1 %cmp120.6, label %if.then121.6, label %if.else132.6
if.else132.6: ; preds = %for.inc152.5
%cmp138.6 = icmp slt i32 %133, %t2.5.5
%134 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 6), align 16
%spec.select426 = tail call i32 @llvm.smin.i32(i32 %133, i32 %t2.5.5)
%spec.select427 = select i1 %cmp138.6, i32 %134, i32 %n2.2.5
br label %for.inc152.6
if.then121.6: ; preds = %for.inc152.5
%135 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 6), align 16, !tbaa !18
br label %for.inc152.6
for.inc152.6: ; preds = %if.else132.6, %if.then121.6
%t1.5.6 = phi i32 [ %133, %if.then121.6 ], [ %t1.5.5, %if.else132.6 ]
%t2.5.6 = phi i32 [ %t1.5.5, %if.then121.6 ], [ %spec.select426, %if.else132.6 ]
%n1.2.6 = phi i32 [ %135, %if.then121.6 ], [ %n1.2.5, %if.else132.6 ]
%n2.2.6 = phi i32 [ %n1.2.5, %if.then121.6 ], [ %spec.select427, %if.else132.6 ]
%136 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 7, i32 1), align 4, !tbaa !21
%cmp120.7 = icmp slt i32 %136, %t1.5.6
br i1 %cmp120.7, label %if.then121.7, label %if.else132.7
if.else132.7: ; preds = %for.inc152.6
%cmp138.7 = icmp slt i32 %136, %t2.5.6
%137 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 7), align 8
%spec.select428 = tail call i32 @llvm.smin.i32(i32 %136, i32 %t2.5.6)
%spec.select429 = select i1 %cmp138.7, i32 %137, i32 %n2.2.6
br label %for.inc152.7
if.then121.7: ; preds = %for.inc152.6
%138 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 0, i64 7), align 8, !tbaa !18
br label %for.inc152.7
for.inc152.7: ; preds = %if.else132.7, %if.then121.7
%t1.5.7 = phi i32 [ %136, %if.then121.7 ], [ %t1.5.6, %if.else132.7 ]
%t2.5.7 = phi i32 [ %t1.5.6, %if.then121.7 ], [ %spec.select428, %if.else132.7 ]
%n1.2.7 = phi i32 [ %138, %if.then121.7 ], [ %n1.2.6, %if.else132.7 ]
%n2.2.7 = phi i32 [ %n1.2.6, %if.then121.7 ], [ %spec.select429, %if.else132.7 ]
%139 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 0, i32 1), align 4, !tbaa !21
%cmp120.1350 = icmp slt i32 %139, %t1.5.7
br i1 %cmp120.1350, label %if.then121.1354, label %if.else132.1352
if.else132.1352: ; preds = %for.inc152.7
%cmp138.1351 = icmp slt i32 %139, %t2.5.7
%140 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 0), align 16
%spec.select430 = tail call i32 @llvm.smin.i32(i32 %139, i32 %t2.5.7)
%spec.select431 = select i1 %cmp138.1351, i32 %140, i32 %n2.2.7
br label %for.inc152.1359
if.then121.1354: ; preds = %for.inc152.7
%141 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 0), align 16, !tbaa !18
br label %for.inc152.1359
for.inc152.1359: ; preds = %if.else132.1352, %if.then121.1354
%t1.5.1355 = phi i32 [ %139, %if.then121.1354 ], [ %t1.5.7, %if.else132.1352 ]
%t2.5.1356 = phi i32 [ %t1.5.7, %if.then121.1354 ], [ %spec.select430, %if.else132.1352 ]
%n1.2.1357 = phi i32 [ %141, %if.then121.1354 ], [ %n1.2.7, %if.else132.1352 ]
%n2.2.1358 = phi i32 [ %n1.2.7, %if.then121.1354 ], [ %spec.select431, %if.else132.1352 ]
%142 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 1, i32 1), align 4, !tbaa !21
%cmp120.1.1 = icmp slt i32 %142, %t1.5.1355
br i1 %cmp120.1.1, label %if.then121.1.1, label %if.else132.1.1
if.else132.1.1: ; preds = %for.inc152.1359
%cmp138.1.1 = icmp slt i32 %142, %t2.5.1356
%143 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 1), align 8
%spec.select432 = tail call i32 @llvm.smin.i32(i32 %142, i32 %t2.5.1356)
%spec.select433 = select i1 %cmp138.1.1, i32 %143, i32 %n2.2.1358
br label %for.inc152.1.1
if.then121.1.1: ; preds = %for.inc152.1359
%144 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 1), align 8, !tbaa !18
br label %for.inc152.1.1
for.inc152.1.1: ; preds = %if.else132.1.1, %if.then121.1.1
%t1.5.1.1 = phi i32 [ %142, %if.then121.1.1 ], [ %t1.5.1355, %if.else132.1.1 ]
%t2.5.1.1 = phi i32 [ %t1.5.1355, %if.then121.1.1 ], [ %spec.select432, %if.else132.1.1 ]
%n1.2.1.1 = phi i32 [ %144, %if.then121.1.1 ], [ %n1.2.1357, %if.else132.1.1 ]
%n2.2.1.1 = phi i32 [ %n1.2.1357, %if.then121.1.1 ], [ %spec.select433, %if.else132.1.1 ]
%145 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 2, i32 1), align 4, !tbaa !21
%cmp120.2.1 = icmp slt i32 %145, %t1.5.1.1
br i1 %cmp120.2.1, label %if.then121.2.1, label %if.else132.2.1
if.else132.2.1: ; preds = %for.inc152.1.1
%cmp138.2.1 = icmp slt i32 %145, %t2.5.1.1
%146 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 2), align 16
%spec.select434 = tail call i32 @llvm.smin.i32(i32 %145, i32 %t2.5.1.1)
%spec.select435 = select i1 %cmp138.2.1, i32 %146, i32 %n2.2.1.1
br label %for.inc152.2.1
if.then121.2.1: ; preds = %for.inc152.1.1
%147 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 2), align 16, !tbaa !18
br label %for.inc152.2.1
for.inc152.2.1: ; preds = %if.else132.2.1, %if.then121.2.1
%t1.5.2.1 = phi i32 [ %145, %if.then121.2.1 ], [ %t1.5.1.1, %if.else132.2.1 ]
%t2.5.2.1 = phi i32 [ %t1.5.1.1, %if.then121.2.1 ], [ %spec.select434, %if.else132.2.1 ]
%n1.2.2.1 = phi i32 [ %147, %if.then121.2.1 ], [ %n1.2.1.1, %if.else132.2.1 ]
%n2.2.2.1 = phi i32 [ %n1.2.1.1, %if.then121.2.1 ], [ %spec.select435, %if.else132.2.1 ]
%148 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 3, i32 1), align 4, !tbaa !21
%cmp120.3.1 = icmp slt i32 %148, %t1.5.2.1
br i1 %cmp120.3.1, label %if.then121.3.1, label %if.else132.3.1
if.else132.3.1: ; preds = %for.inc152.2.1
%cmp138.3.1 = icmp slt i32 %148, %t2.5.2.1
%149 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 3), align 8
%spec.select436 = tail call i32 @llvm.smin.i32(i32 %148, i32 %t2.5.2.1)
%spec.select437 = select i1 %cmp138.3.1, i32 %149, i32 %n2.2.2.1
br label %for.inc152.3.1
if.then121.3.1: ; preds = %for.inc152.2.1
%150 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 3), align 8, !tbaa !18
br label %for.inc152.3.1
for.inc152.3.1: ; preds = %if.else132.3.1, %if.then121.3.1
%t1.5.3.1 = phi i32 [ %148, %if.then121.3.1 ], [ %t1.5.2.1, %if.else132.3.1 ]
%t2.5.3.1 = phi i32 [ %t1.5.2.1, %if.then121.3.1 ], [ %spec.select436, %if.else132.3.1 ]
%n1.2.3.1 = phi i32 [ %150, %if.then121.3.1 ], [ %n1.2.2.1, %if.else132.3.1 ]
%n2.2.3.1 = phi i32 [ %n1.2.2.1, %if.then121.3.1 ], [ %spec.select437, %if.else132.3.1 ]
%151 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 4, i32 1), align 4, !tbaa !21
%cmp120.4.1 = icmp slt i32 %151, %t1.5.3.1
br i1 %cmp120.4.1, label %if.then121.4.1, label %if.else132.4.1
if.else132.4.1: ; preds = %for.inc152.3.1
%cmp138.4.1 = icmp slt i32 %151, %t2.5.3.1
%152 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 4), align 16
%spec.select438 = tail call i32 @llvm.smin.i32(i32 %151, i32 %t2.5.3.1)
%spec.select439 = select i1 %cmp138.4.1, i32 %152, i32 %n2.2.3.1
br label %for.inc152.4.1
if.then121.4.1: ; preds = %for.inc152.3.1
%153 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 4), align 16, !tbaa !18
br label %for.inc152.4.1
for.inc152.4.1: ; preds = %if.else132.4.1, %if.then121.4.1
%t1.5.4.1 = phi i32 [ %151, %if.then121.4.1 ], [ %t1.5.3.1, %if.else132.4.1 ]
%t2.5.4.1 = phi i32 [ %t1.5.3.1, %if.then121.4.1 ], [ %spec.select438, %if.else132.4.1 ]
%n1.2.4.1 = phi i32 [ %153, %if.then121.4.1 ], [ %n1.2.3.1, %if.else132.4.1 ]
%n2.2.4.1 = phi i32 [ %n1.2.3.1, %if.then121.4.1 ], [ %spec.select439, %if.else132.4.1 ]
%154 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 5, i32 1), align 4, !tbaa !21
%cmp120.5.1 = icmp slt i32 %154, %t1.5.4.1
br i1 %cmp120.5.1, label %if.then121.5.1, label %if.else132.5.1
if.else132.5.1: ; preds = %for.inc152.4.1
%cmp138.5.1 = icmp slt i32 %154, %t2.5.4.1
%155 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 5), align 8
%spec.select440 = tail call i32 @llvm.smin.i32(i32 %154, i32 %t2.5.4.1)
%spec.select441 = select i1 %cmp138.5.1, i32 %155, i32 %n2.2.4.1
br label %for.inc152.5.1
if.then121.5.1: ; preds = %for.inc152.4.1
%156 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 5), align 8, !tbaa !18
br label %for.inc152.5.1
for.inc152.5.1: ; preds = %if.else132.5.1, %if.then121.5.1
%t1.5.5.1 = phi i32 [ %154, %if.then121.5.1 ], [ %t1.5.4.1, %if.else132.5.1 ]
%t2.5.5.1 = phi i32 [ %t1.5.4.1, %if.then121.5.1 ], [ %spec.select440, %if.else132.5.1 ]
%n1.2.5.1 = phi i32 [ %156, %if.then121.5.1 ], [ %n1.2.4.1, %if.else132.5.1 ]
%n2.2.5.1 = phi i32 [ %n1.2.4.1, %if.then121.5.1 ], [ %spec.select441, %if.else132.5.1 ]
%157 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 6, i32 1), align 4, !tbaa !21
%cmp120.6.1 = icmp slt i32 %157, %t1.5.5.1
br i1 %cmp120.6.1, label %if.then121.6.1, label %if.else132.6.1
if.else132.6.1: ; preds = %for.inc152.5.1
%cmp138.6.1 = icmp slt i32 %157, %t2.5.5.1
%158 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 6), align 16
%spec.select442 = tail call i32 @llvm.smin.i32(i32 %157, i32 %t2.5.5.1)
%spec.select443 = select i1 %cmp138.6.1, i32 %158, i32 %n2.2.5.1
br label %for.inc152.6.1
if.then121.6.1: ; preds = %for.inc152.5.1
%159 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 6), align 16, !tbaa !18
br label %for.inc152.6.1
for.inc152.6.1: ; preds = %if.else132.6.1, %if.then121.6.1
%t1.5.6.1 = phi i32 [ %157, %if.then121.6.1 ], [ %t1.5.5.1, %if.else132.6.1 ]
%t2.5.6.1 = phi i32 [ %t1.5.5.1, %if.then121.6.1 ], [ %spec.select442, %if.else132.6.1 ]
%n1.2.6.1 = phi i32 [ %159, %if.then121.6.1 ], [ %n1.2.5.1, %if.else132.6.1 ]
%n2.2.6.1 = phi i32 [ %n1.2.5.1, %if.then121.6.1 ], [ %spec.select443, %if.else132.6.1 ]
%160 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 7, i32 1), align 4, !tbaa !21
%cmp120.7.1 = icmp slt i32 %160, %t1.5.6.1
br i1 %cmp120.7.1, label %if.then121.7.1, label %if.else132.7.1
if.else132.7.1: ; preds = %for.inc152.6.1
%cmp138.7.1 = icmp slt i32 %160, %t2.5.6.1
%161 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 7), align 8
%spec.select444 = tail call i32 @llvm.smin.i32(i32 %160, i32 %t2.5.6.1)
%spec.select445 = select i1 %cmp138.7.1, i32 %161, i32 %n2.2.6.1
br label %for.inc152.7.1
if.then121.7.1: ; preds = %for.inc152.6.1
%162 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 1, i64 7), align 8, !tbaa !18
br label %for.inc152.7.1
for.inc152.7.1: ; preds = %if.else132.7.1, %if.then121.7.1
%t1.5.7.1 = phi i32 [ %160, %if.then121.7.1 ], [ %t1.5.6.1, %if.else132.7.1 ]
%t2.5.7.1 = phi i32 [ %t1.5.6.1, %if.then121.7.1 ], [ %spec.select444, %if.else132.7.1 ]
%n1.2.7.1 = phi i32 [ %162, %if.then121.7.1 ], [ %n1.2.6.1, %if.else132.7.1 ]
%n2.2.7.1 = phi i32 [ %n1.2.6.1, %if.then121.7.1 ], [ %spec.select445, %if.else132.7.1 ]
%163 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 0, i32 1), align 4, !tbaa !21
%cmp120.2362 = icmp slt i32 %163, %t1.5.7.1
br i1 %cmp120.2362, label %if.then121.2366, label %if.else132.2364
if.else132.2364: ; preds = %for.inc152.7.1
%cmp138.2363 = icmp slt i32 %163, %t2.5.7.1
%164 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 0), align 16
%spec.select446 = tail call i32 @llvm.smin.i32(i32 %163, i32 %t2.5.7.1)
%spec.select447 = select i1 %cmp138.2363, i32 %164, i32 %n2.2.7.1
br label %for.inc152.2371
if.then121.2366: ; preds = %for.inc152.7.1
%165 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 0), align 16, !tbaa !18
br label %for.inc152.2371
for.inc152.2371: ; preds = %if.else132.2364, %if.then121.2366
%t1.5.2367 = phi i32 [ %163, %if.then121.2366 ], [ %t1.5.7.1, %if.else132.2364 ]
%t2.5.2368 = phi i32 [ %t1.5.7.1, %if.then121.2366 ], [ %spec.select446, %if.else132.2364 ]
%n1.2.2369 = phi i32 [ %165, %if.then121.2366 ], [ %n1.2.7.1, %if.else132.2364 ]
%n2.2.2370 = phi i32 [ %n1.2.7.1, %if.then121.2366 ], [ %spec.select447, %if.else132.2364 ]
%166 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 1, i32 1), align 4, !tbaa !21
%cmp120.1.2 = icmp slt i32 %166, %t1.5.2367
br i1 %cmp120.1.2, label %if.then121.1.2, label %if.else132.1.2
if.else132.1.2: ; preds = %for.inc152.2371
%cmp138.1.2 = icmp slt i32 %166, %t2.5.2368
%167 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 1), align 8
%spec.select448 = tail call i32 @llvm.smin.i32(i32 %166, i32 %t2.5.2368)
%spec.select449 = select i1 %cmp138.1.2, i32 %167, i32 %n2.2.2370
br label %for.inc152.1.2
if.then121.1.2: ; preds = %for.inc152.2371
%168 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 1), align 8, !tbaa !18
br label %for.inc152.1.2
for.inc152.1.2: ; preds = %if.else132.1.2, %if.then121.1.2
%t1.5.1.2 = phi i32 [ %166, %if.then121.1.2 ], [ %t1.5.2367, %if.else132.1.2 ]
%t2.5.1.2 = phi i32 [ %t1.5.2367, %if.then121.1.2 ], [ %spec.select448, %if.else132.1.2 ]
%n1.2.1.2 = phi i32 [ %168, %if.then121.1.2 ], [ %n1.2.2369, %if.else132.1.2 ]
%n2.2.1.2 = phi i32 [ %n1.2.2369, %if.then121.1.2 ], [ %spec.select449, %if.else132.1.2 ]
%169 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 2, i32 1), align 4, !tbaa !21
%cmp120.2.2 = icmp slt i32 %169, %t1.5.1.2
br i1 %cmp120.2.2, label %if.then121.2.2, label %if.else132.2.2
if.else132.2.2: ; preds = %for.inc152.1.2
%cmp138.2.2 = icmp slt i32 %169, %t2.5.1.2
%170 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 2), align 16
%spec.select450 = tail call i32 @llvm.smin.i32(i32 %169, i32 %t2.5.1.2)
%spec.select451 = select i1 %cmp138.2.2, i32 %170, i32 %n2.2.1.2
br label %for.inc152.2.2
if.then121.2.2: ; preds = %for.inc152.1.2
%171 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 2), align 16, !tbaa !18
br label %for.inc152.2.2
for.inc152.2.2: ; preds = %if.else132.2.2, %if.then121.2.2
%t1.5.2.2 = phi i32 [ %169, %if.then121.2.2 ], [ %t1.5.1.2, %if.else132.2.2 ]
%t2.5.2.2 = phi i32 [ %t1.5.1.2, %if.then121.2.2 ], [ %spec.select450, %if.else132.2.2 ]
%n1.2.2.2 = phi i32 [ %171, %if.then121.2.2 ], [ %n1.2.1.2, %if.else132.2.2 ]
%n2.2.2.2 = phi i32 [ %n1.2.1.2, %if.then121.2.2 ], [ %spec.select451, %if.else132.2.2 ]
%172 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 3, i32 1), align 4, !tbaa !21
%cmp120.3.2 = icmp slt i32 %172, %t1.5.2.2
br i1 %cmp120.3.2, label %if.then121.3.2, label %if.else132.3.2
if.else132.3.2: ; preds = %for.inc152.2.2
%cmp138.3.2 = icmp slt i32 %172, %t2.5.2.2
%173 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 3), align 8
%spec.select452 = tail call i32 @llvm.smin.i32(i32 %172, i32 %t2.5.2.2)
%spec.select453 = select i1 %cmp138.3.2, i32 %173, i32 %n2.2.2.2
br label %for.inc152.3.2
if.then121.3.2: ; preds = %for.inc152.2.2
%174 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 3), align 8, !tbaa !18
br label %for.inc152.3.2
for.inc152.3.2: ; preds = %if.else132.3.2, %if.then121.3.2
%t1.5.3.2 = phi i32 [ %172, %if.then121.3.2 ], [ %t1.5.2.2, %if.else132.3.2 ]
%t2.5.3.2 = phi i32 [ %t1.5.2.2, %if.then121.3.2 ], [ %spec.select452, %if.else132.3.2 ]
%n1.2.3.2 = phi i32 [ %174, %if.then121.3.2 ], [ %n1.2.2.2, %if.else132.3.2 ]
%n2.2.3.2 = phi i32 [ %n1.2.2.2, %if.then121.3.2 ], [ %spec.select453, %if.else132.3.2 ]
%175 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 4, i32 1), align 4, !tbaa !21
%cmp120.4.2 = icmp slt i32 %175, %t1.5.3.2
br i1 %cmp120.4.2, label %if.then121.4.2, label %if.else132.4.2
if.else132.4.2: ; preds = %for.inc152.3.2
%cmp138.4.2 = icmp slt i32 %175, %t2.5.3.2
%176 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 4), align 16
%spec.select454 = tail call i32 @llvm.smin.i32(i32 %175, i32 %t2.5.3.2)
%spec.select455 = select i1 %cmp138.4.2, i32 %176, i32 %n2.2.3.2
br label %for.inc152.4.2
if.then121.4.2: ; preds = %for.inc152.3.2
%177 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 4), align 16, !tbaa !18
br label %for.inc152.4.2
for.inc152.4.2: ; preds = %if.else132.4.2, %if.then121.4.2
%t1.5.4.2 = phi i32 [ %175, %if.then121.4.2 ], [ %t1.5.3.2, %if.else132.4.2 ]
%t2.5.4.2 = phi i32 [ %t1.5.3.2, %if.then121.4.2 ], [ %spec.select454, %if.else132.4.2 ]
%n1.2.4.2 = phi i32 [ %177, %if.then121.4.2 ], [ %n1.2.3.2, %if.else132.4.2 ]
%n2.2.4.2 = phi i32 [ %n1.2.3.2, %if.then121.4.2 ], [ %spec.select455, %if.else132.4.2 ]
%178 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 5, i32 1), align 4, !tbaa !21
%cmp120.5.2 = icmp slt i32 %178, %t1.5.4.2
br i1 %cmp120.5.2, label %if.then121.5.2, label %if.else132.5.2
if.else132.5.2: ; preds = %for.inc152.4.2
%cmp138.5.2 = icmp slt i32 %178, %t2.5.4.2
%179 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 5), align 8
%spec.select456 = tail call i32 @llvm.smin.i32(i32 %178, i32 %t2.5.4.2)
%spec.select457 = select i1 %cmp138.5.2, i32 %179, i32 %n2.2.4.2
br label %for.inc152.5.2
if.then121.5.2: ; preds = %for.inc152.4.2
%180 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 5), align 8, !tbaa !18
br label %for.inc152.5.2
for.inc152.5.2: ; preds = %if.else132.5.2, %if.then121.5.2
%t1.5.5.2 = phi i32 [ %178, %if.then121.5.2 ], [ %t1.5.4.2, %if.else132.5.2 ]
%t2.5.5.2 = phi i32 [ %t1.5.4.2, %if.then121.5.2 ], [ %spec.select456, %if.else132.5.2 ]
%n1.2.5.2 = phi i32 [ %180, %if.then121.5.2 ], [ %n1.2.4.2, %if.else132.5.2 ]
%n2.2.5.2 = phi i32 [ %n1.2.4.2, %if.then121.5.2 ], [ %spec.select457, %if.else132.5.2 ]
%181 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 6, i32 1), align 4, !tbaa !21
%cmp120.6.2 = icmp slt i32 %181, %t1.5.5.2
br i1 %cmp120.6.2, label %if.then121.6.2, label %if.else132.6.2
if.else132.6.2: ; preds = %for.inc152.5.2
%cmp138.6.2 = icmp slt i32 %181, %t2.5.5.2
%182 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 6), align 16
%spec.select458 = tail call i32 @llvm.smin.i32(i32 %181, i32 %t2.5.5.2)
%spec.select459 = select i1 %cmp138.6.2, i32 %182, i32 %n2.2.5.2
br label %for.inc152.6.2
if.then121.6.2: ; preds = %for.inc152.5.2
%183 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 6), align 16, !tbaa !18
br label %for.inc152.6.2
for.inc152.6.2: ; preds = %if.else132.6.2, %if.then121.6.2
%t1.5.6.2 = phi i32 [ %181, %if.then121.6.2 ], [ %t1.5.5.2, %if.else132.6.2 ]
%t2.5.6.2 = phi i32 [ %t1.5.5.2, %if.then121.6.2 ], [ %spec.select458, %if.else132.6.2 ]
%n1.2.6.2 = phi i32 [ %183, %if.then121.6.2 ], [ %n1.2.5.2, %if.else132.6.2 ]
%n2.2.6.2 = phi i32 [ %n1.2.5.2, %if.then121.6.2 ], [ %spec.select459, %if.else132.6.2 ]
%184 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 7, i32 1), align 4, !tbaa !21
%cmp120.7.2 = icmp slt i32 %184, %t1.5.6.2
br i1 %cmp120.7.2, label %if.then121.7.2, label %if.else132.7.2
if.else132.7.2: ; preds = %for.inc152.6.2
%cmp138.7.2 = icmp slt i32 %184, %t2.5.6.2
%185 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 7), align 8
%spec.select460 = tail call i32 @llvm.smin.i32(i32 %184, i32 %t2.5.6.2)
%spec.select461 = select i1 %cmp138.7.2, i32 %185, i32 %n2.2.6.2
br label %for.inc152.7.2
if.then121.7.2: ; preds = %for.inc152.6.2
%186 = load i32, ptr getelementptr inbounds ([4 x [8 x %struct.R]], ptr @s, i64 0, i64 2, i64 7), align 8, !tbaa !18
br label %for.inc152.7.2
for.inc152.7.2: ; preds = %if.else132.7.2, %if.then121.7.2
%t1.5.7.2 = phi i32 [ %184, %if.then121.7.2 ], [ %t1.5.6.2, %if.else132.7.2 ]
%t2.5.7.2 = phi i32 [ %t1.5.6.2, %if.then121.7.2 ], [ %spec.select460, %if.else132.7.2 ]
%n1.2.7.2 = phi i32 [ %186, %if.then121.7.2 ], [ %n1.2.6.2, %if.else132.7.2 ]
%n2.2.7.2 = phi i32 [ %n1.2.6.2, %if.then121.7.2 ], [ %spec.select461, %if.else132.7.2 ]
store i32 %n1.2.7.2, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3), align 16, !tbaa !18
store i32 %t1.5.7.2, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 0, i32 1), align 4, !tbaa !21
store i32 %n2.2.7.2, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 1), align 8, !tbaa !18
store i32 %t2.5.7.2, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 1, i32 1), align 4, !tbaa !21
%div = sdiv i32 %71, 100
%rem = srem i32 %71, 100
%call179 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %72, i32 noundef %div, i32 noundef %rem)
%187 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 0, i64 1), align 8, !tbaa !18
%188 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 0, i64 1, i32 1), align 4, !tbaa !21
%div.1 = sdiv i32 %188, 100
%rem.1 = srem i32 %188, 100
%call179.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %187, i32 noundef %div.1, i32 noundef %rem.1)
%189 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1, i64 0), align 16, !tbaa !18
%190 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1, i64 0, i32 1), align 4, !tbaa !21
%div.1381 = sdiv i32 %190, 100
%rem.1382 = srem i32 %190, 100
%call179.1383 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %189, i32 noundef %div.1381, i32 noundef %rem.1382)
%191 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1, i64 1), align 8, !tbaa !18
%192 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 1, i64 1, i32 1), align 4, !tbaa !21
%div.1.1 = sdiv i32 %192, 100
%rem.1.1 = srem i32 %192, 100
%call179.1.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %191, i32 noundef %div.1.1, i32 noundef %rem.1.1)
%193 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2, i64 0), align 16, !tbaa !18
%194 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2, i64 0, i32 1), align 4, !tbaa !21
%div.2 = sdiv i32 %194, 100
%rem.2 = srem i32 %194, 100
%call179.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %193, i32 noundef %div.2, i32 noundef %rem.2)
%195 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2, i64 1), align 8, !tbaa !18
%196 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 2, i64 1, i32 1), align 4, !tbaa !21
%div.1.2 = sdiv i32 %196, 100
%rem.1.2 = srem i32 %196, 100
%call179.1.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %195, i32 noundef %div.1.2, i32 noundef %rem.1.2)
%197 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 0), align 16, !tbaa !18
%198 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 0, i32 1), align 4, !tbaa !21
%div.3 = sdiv i32 %198, 100
%rem.3 = srem i32 %198, 100
%call179.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %197, i32 noundef %div.3, i32 noundef %rem.3)
%199 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 1), align 8, !tbaa !18
%200 = load i32, ptr getelementptr inbounds ([4 x [2 x %struct.R]], ptr @a, i64 0, i64 3, i64 1, i32 1), align 4, !tbaa !21
%div.1.3 = sdiv i32 %200, 100
%rem.1.3 = srem i32 %200, 100
%call179.1.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %199, i32 noundef %div.1.3, i32 noundef %rem.1.3)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @gets(ptr noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = !{!19, !20, i64 0}
!19 = !{!"", !20, i64 0, !20, i64 4}
!20 = !{!"int", !7, i64 0}
!21 = !{!19, !20, i64 4}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !13}
!24 = !{!20, !20, i64 0}
|
#include <stdio.h>
int main(void)
{
int t;
int n;
while (scanf("%d", &t), t != 0){
scanf("%d", &n);
while (n-- > 0){
int s, f;
scanf("%d %d", &s, &f);
t -= f - s;
}
if (t <= 0){
puts("OK");
}
else {
printf("%d\n", t);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274323/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 [3 x i8] c"OK\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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%s = alloca i32, align 4
%f = 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 %n) #3
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not14 = icmp eq i32 %0, 0
br i1 %cmp.not14, label %while.end10, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%dec11 = add nsw i32 %1, -1
store i32 %dec11, ptr %n, align 4, !tbaa !5
%cmp312 = icmp sgt i32 %1, 0
br i1 %cmp312, label %while.body4, label %while.body.while.end_crit_edge
while.body.while.end_crit_edge: ; preds = %while.body
%.pre = load i32, ptr %t, align 4, !tbaa !5
br label %while.end
while.body4: ; preds = %while.body, %while.body4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #3
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %f)
%2 = load i32, ptr %f, align 4, !tbaa !5
%3 = load i32, ptr %s, align 4, !tbaa !5
%sub.neg = sub i32 %3, %2
%4 = load i32, ptr %t, align 4, !tbaa !5
%sub6 = add i32 %sub.neg, %4
store i32 %sub6, ptr %t, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
%5 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %5, 0
br i1 %cmp3, label %while.body4, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body4, %while.body.while.end_crit_edge
%6 = phi i32 [ %.pre, %while.body.while.end_crit_edge ], [ %sub6, %while.body4 ]
%cmp7 = icmp slt i32 %6, 1
br i1 %cmp7, label %if.then, label %if.else
if.then: ; preds = %while.end
%call8 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.else: ; preds = %while.end
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %6)
br label %if.end
if.end: ; preds = %if.else, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%7 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not = icmp eq i32 %7, 0
br i1 %cmp.not, label %while.end10, label %while.body, !llvm.loop !11
while.end10: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: 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 #2
; 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}
|
#include <stdio.h>
int main()
{
int i, t, s, f, n, a;
scanf("%d", &t);
while (t > 0) {
a = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &s, &f);
a += (f - s);
}
if (a < t)
printf("%d\n", t - a);
else
printf("OK\n");
scanf("%d", &t);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274367/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
@str = private unnamed_addr constant [3 x i8] c"OK\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%s = alloca i32, align 4
%f = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #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 %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp212 = icmp sgt i32 %1, 0
br i1 %cmp212, label %for.body, label %for.end
for.body: ; preds = %while.body, %for.body
%a.014 = phi i32 [ %add, %for.body ], [ 0, %while.body ]
%i.013 = phi i32 [ %inc, %for.body ], [ 0, %while.body ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %f)
%2 = load i32, ptr %f, align 4, !tbaa !5
%3 = load i32, ptr %s, align 4, !tbaa !5
%sub = add i32 %2, %a.014
%add = sub i32 %sub, %3
%inc = add nuw nsw i32 %i.013, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %4
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %while.body
%a.0.lcssa = phi i32 [ 0, %while.body ], [ %add, %for.body ]
%5 = load i32, ptr %t, align 4, !tbaa !5
%cmp4 = icmp slt i32 %a.0.lcssa, %5
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.end
%sub5 = sub nsw i32 %5, %a.0.lcssa
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub5)
br label %if.end
if.else: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%6 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp sgt i32 %6, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
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
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 len,array[105],last=4,count=0,i;
scanf("%d",&len);
for(i=1;i<=len;i++)
scanf("%d",&array[i]);
for(i=1;i<=len;i++)
{
if(array[i]==0)
{
count++;
last=4;
}
else if(array[i]==1)
{
if(last==1)
{
count++;
last=4;
}
else
last=1;
}
else if(array[i]==2)
{
if(last==2)
{
count++;
last=4;
}
else
last=2;
}
else
{
if(last==1)
last=2;
else if(last==2)
last=1;
else
last=4;
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27441/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27441/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:
%len = alloca i32, align 4
%array = alloca [105 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %len) #3
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %array) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len)
%0 = load i32, ptr %len, align 4, !tbaa !5
%cmp.not59 = icmp slt i32 %0, 1
br i1 %cmp.not59, label %for.end41, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not61 = icmp slt i32 %2, 1
br i1 %cmp3.not61, label %for.end41, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = add nuw i32 %2, 1
%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 ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [105 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
%2 = load i32, ptr %len, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc39
%indvars.iv68 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next69, %for.inc39 ]
%count.063 = phi i32 [ 0, %for.body4.preheader ], [ %count.1, %for.inc39 ]
%last.062 = phi i32 [ 4, %for.body4.preheader ], [ %last.1, %for.inc39 ]
%arrayidx6 = getelementptr inbounds [105 x i32], ptr %array, i64 0, i64 %indvars.iv68
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
switch i32 %4, label %if.else27 [
i32 0, label %if.then
i32 1, label %if.then12
i32 2, label %if.then21
]
if.then: ; preds = %for.body4
%inc8 = add nsw i32 %count.063, 1
br label %for.inc39
if.then12: ; preds = %for.body4
%cmp13 = icmp eq i32 %last.062, 1
%spec.select = select i1 %cmp13, i32 4, i32 1
%inc15 = zext i1 %cmp13 to i32
%spec.select56 = add nsw i32 %count.063, %inc15
br label %for.inc39
if.then21: ; preds = %for.body4
%cmp22 = icmp eq i32 %last.062, 2
%spec.select57 = select i1 %cmp22, i32 4, i32 2
%inc24 = zext i1 %cmp22 to i32
%spec.select58 = add nsw i32 %count.063, %inc24
br label %for.inc39
if.else27: ; preds = %for.body4
switch i32 %last.062, label %if.else33 [
i32 1, label %for.inc39
i32 2, label %if.then32
]
if.then32: ; preds = %if.else27
br label %for.inc39
if.else33: ; preds = %if.else27
br label %for.inc39
for.inc39: ; preds = %if.then21, %if.then12, %if.else27, %if.then, %if.then32, %if.else33
%last.1 = phi i32 [ 4, %if.then ], [ 1, %if.then32 ], [ 4, %if.else33 ], [ 2, %if.else27 ], [ %spec.select, %if.then12 ], [ %spec.select57, %if.then21 ]
%count.1 = phi i32 [ %inc8, %if.then ], [ %count.063, %if.then32 ], [ %count.063, %if.else33 ], [ %count.063, %if.else27 ], [ %spec.select56, %if.then12 ], [ %spec.select58, %if.then21 ]
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.body4, !llvm.loop !11
for.end41: ; preds = %for.inc39, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.1, %for.inc39 ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %array) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %len) #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>
void main(){
long long int x, money=100, year=0;
scanf("%lld",&x);
while(x>money){
money *= 1.01;
year++;
}
printf("%lld",year);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274453/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"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 100
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%year.07 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%money.06 = phi i64 [ %conv1, %while.body ], [ 100, %entry ]
%conv = sitofp i64 %money.06 to double
%mul = fmul double %conv, 1.010000e+00
%conv1 = fptosi double %mul to i64
%inc = add nuw nsw i64 %year.07, 1
%cmp = icmp sgt i64 %0, %conv1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%year.0.lcssa = phi i64 [ 0, %entry ], [ %inc, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %year.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
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
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>
int main(void){
long long x,cnt=0,k=100;
scanf("%lld",&x);
while(k<x){
k += k/100;
cnt++;
}
printf("%lld",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274497/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274497/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"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 100
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%k.07 = phi i64 [ %add, %while.body ], [ 100, %entry ]
%cnt.06 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%div = sdiv i64 %k.07, 100
%add = add nsw i64 %div, %k.07
%inc = add nuw nsw i64 %cnt.06, 1
%cmp = icmp slt i64 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%cnt.0.lcssa = phi i64 [ 0, %entry ], [ %inc, %while.body ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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()
{
int m,n,arr[205];
scanf("%d",&n);
int i,sum=0;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
if(arr[i]==0)
{
sum++;
}
}
//printf("%d\n",sum);
for(i=0;i<n;i++)
{
if(arr[i]==1 || arr[i]==2)
break;
}
int ans=i;
//printf("%d\n",ans);
/*for(i=ans;i<n-1;i++)
{
if(arr[i]==1 && arr[i+1]==3)
{
//printf("HHHH %d %d\n",i,arr[i+1]);
arr[i+1]=2;
//printf("HHHH %d %d\n",i,arr[i+1]);
}
if(arr[i]==2 && arr[i+1]==3)
{
arr[i+1]=1;
}
}
// for(i=0;i<n;i++)
// printf("%d ",arr[i]);
int count=1;
for(m=ans+1;m<n;m++)
{
if(arr[m]==arr[m-1] && (arr[m]==1 || arr[m]==2))
{
count++;
}
else
{
if(count!=1)
{ if(count%2==0)
{
sum+=(count/2);
}
else
{
sum+=(count/2);
}
count=1;
}
}
}
if(count!=1)
{
if(count%2==0)
sum+=(count/2);
else
sum+=(count/2);
}*/
for(m=ans;m<n-1;m++)
{
if(arr[m]==1 && arr[m+1]==1)
{
sum++;
m++;
}
else if(arr[m]==2 && arr[m+1]==2)
{
sum++;
m++;
}
else if(arr[m]==2 && arr[m+1]==3)
{
arr[m+1]=1;
}
else if(arr[m]==1 && arr[m+1]==3)
{
arr[m+1]=2;
}
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27454/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27454/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:
%n = alloca i32, align 4
%arr = alloca [205 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 820, ptr nonnull %arr) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp106 = icmp sgt i32 %0, 0
br i1 %cmp106, label %for.body, label %for.end19
for.cond6.preheader: ; preds = %for.body
%cmp7110 = icmp sgt i32 %2, 0
br i1 %cmp7110, label %for.body8.preheader, label %for.end19
for.body8.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.0108 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [205 x i32], ptr %arr, 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
%cmp4 = icmp eq i32 %1, 0
%inc = zext i1 %cmp4 to i32
%spec.select = add nuw nsw i32 %sum.0108, %inc
%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.cond6.preheader, !llvm.loop !9
for.body8: ; preds = %for.body8.preheader, %for.inc17
%indvars.iv120 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next121, %for.inc17 ]
%arrayidx10 = getelementptr inbounds [205 x i32], ptr %arr, i64 0, i64 %indvars.iv120
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%.off = add i32 %4, -1
%switch = icmp ult i32 %.off, 2
br i1 %switch, label %for.end19.loopexit.split.loop.exit, label %for.inc17
for.inc17: ; preds = %for.body8
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%exitcond.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count
br i1 %exitcond.not, label %for.end19, label %for.body8, !llvm.loop !11
for.end19.loopexit.split.loop.exit: ; preds = %for.body8
%5 = trunc i64 %indvars.iv120 to i32
br label %for.end19
for.end19: ; preds = %for.inc17, %for.end19.loopexit.split.loop.exit, %entry, %for.cond6.preheader
%.lcssa127 = phi i32 [ %2, %for.cond6.preheader ], [ %0, %entry ], [ %2, %for.end19.loopexit.split.loop.exit ], [ %2, %for.inc17 ]
%sum.0.lcssa126 = phi i32 [ %spec.select, %for.cond6.preheader ], [ 0, %entry ], [ %spec.select, %for.end19.loopexit.split.loop.exit ], [ %spec.select, %for.inc17 ]
%i.1.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %5, %for.end19.loopexit.split.loop.exit ], [ %2, %for.inc17 ]
%sub = add nsw i32 %.lcssa127, -1
%cmp21114 = icmp slt i32 %i.1.lcssa, %sub
br i1 %cmp21114, label %for.body22, label %for.end75
for.body22: ; preds = %for.end19, %for.inc73
%m.0116 = phi i32 [ %inc74, %for.inc73 ], [ %i.1.lcssa, %for.end19 ]
%sum.2115 = phi i32 [ %sum.3, %for.inc73 ], [ %sum.0.lcssa126, %for.end19 ]
%idxprom23 = sext i32 %m.0116 to i64
%arrayidx24 = getelementptr inbounds [205 x i32], ptr %arr, i64 0, i64 %idxprom23
%6 = load i32, ptr %arrayidx24, align 4, !tbaa !5
switch i32 %6, label %for.inc73 [
i32 1, label %land.lhs.true
i32 2, label %land.lhs.true35
]
land.lhs.true: ; preds = %for.body22
%add = add nsw i32 %m.0116, 1
%idxprom26 = sext i32 %add to i64
%arrayidx27 = getelementptr inbounds [205 x i32], ptr %arr, i64 0, i64 %idxprom26
%7 = load i32, ptr %arrayidx27, align 4, !tbaa !5
switch i32 %7, label %for.inc73 [
i32 1, label %if.then29
i32 3, label %if.then65
]
if.then29: ; preds = %land.lhs.true
%inc30 = add nsw i32 %sum.2115, 1
br label %for.inc73
land.lhs.true35: ; preds = %for.body22
%add36 = add nsw i32 %m.0116, 1
%idxprom37 = sext i32 %add36 to i64
%arrayidx38 = getelementptr inbounds [205 x i32], ptr %arr, i64 0, i64 %idxprom37
%8 = load i32, ptr %arrayidx38, align 4, !tbaa !5
switch i32 %8, label %for.inc73 [
i32 2, label %if.then40
i32 3, label %if.then52
]
if.then40: ; preds = %land.lhs.true35
%inc41 = add nsw i32 %sum.2115, 1
br label %for.inc73
if.then52: ; preds = %land.lhs.true35
store i32 1, ptr %arrayidx38, align 4, !tbaa !5
br label %for.inc73
if.then65: ; preds = %land.lhs.true
store i32 2, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc73
for.inc73: ; preds = %land.lhs.true, %land.lhs.true35, %for.body22, %if.then29, %if.then52, %if.then65, %if.then40
%sum.3 = phi i32 [ %inc30, %if.then29 ], [ %inc41, %if.then40 ], [ %sum.2115, %if.then52 ], [ %sum.2115, %if.then65 ], [ %sum.2115, %for.body22 ], [ %sum.2115, %land.lhs.true35 ], [ %sum.2115, %land.lhs.true ]
%m.1 = phi i32 [ %add, %if.then29 ], [ %add36, %if.then40 ], [ %m.0116, %if.then52 ], [ %m.0116, %if.then65 ], [ %m.0116, %for.body22 ], [ %m.0116, %land.lhs.true35 ], [ %m.0116, %land.lhs.true ]
%inc74 = add nsw i32 %m.1, 1
%cmp21 = icmp slt i32 %inc74, %sub
br i1 %cmp21, label %for.body22, label %for.end75, !llvm.loop !12
for.end75: ; preds = %for.inc73, %for.end19
%sum.2.lcssa = phi i32 [ %sum.0.lcssa126, %for.end19 ], [ %sum.3, %for.inc73 ]
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.2.lcssa)
call void @llvm.lifetime.end.p0(i64 820, ptr nonnull %arr) #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 main(){
long int X;
long int m = 100;
scanf("%ld", &X);
int cnt = 0;
while(m<X){
m += m * 0.01;
cnt += 1;
}
printf("%d", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274583/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274583/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"%ld\00", align 1
@.str.1 = 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:
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i64, ptr %X, align 8, !tbaa !5
%cmp7 = icmp sgt i64 %0, 100
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%cnt.09 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%m.08 = phi i64 [ %conv2, %while.body ], [ 100, %entry ]
%conv = sitofp i64 %m.08 to double
%1 = call double @llvm.fmuladd.f64(double %conv, double 1.000000e-02, double %conv)
%conv2 = fptosi double %1 to i64
%add = add nuw nsw i32 %cnt.09, 1
%cmp = icmp sgt i64 %0, %conv2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %X) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 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 = !{!"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<stdlib.h>
int main (void){
long X;
long deposit = 100;
int years = 0;
scanf("%ld",&X);
long rishi = 0;
while(deposit<X){
years ++;
deposit += deposit / 100;
}
printf("%d",years);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274626/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274626/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"%ld\00", align 1
@.str.1 = 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:
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i64, ptr %X, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 100
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%deposit.07 = phi i64 [ %add, %while.body ], [ 100, %entry ]
%years.06 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%inc = add nuw nsw i32 %years.06, 1
%div = sdiv i64 %deposit.07, 100
%add = add nsw i64 %div, %deposit.07
%cmp = icmp slt i64 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%years.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %years.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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) {
// your code goes here
int n;scanf("%d",&n);
char inp[n];scanf("%s",inp);
int i,arr[n];
int mark[n];
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
mark[i]=0;
}
int flag=0;
for(i=0;i<n-1;i++)
{
if(inp[i]=='R' && inp[i+1]=='L')
{
flag=1;
mark[i]=1;
}
}
int time=10000000000;
if(flag==1)
{
for(i=0;i<n;i++)
{
if(mark[i]==1)
{
int x=arr[i+1]-arr[i];
x/=2;
if(time>x)
time=x;
}
}
printf("%d",time);
}
else
printf("-1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27467/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27467/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
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\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 i8, i64 %1, align 16
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla2 = alloca i32, i64 %4, align 16
%vla3 = alloca i32, i64 %4, align 16
%cmp69 = icmp sgt i32 %3, 0
br i1 %cmp69, label %for.body, label %if.else
for.cond7.preheader: ; preds = %for.body
%cmp871 = icmp sgt i32 %6, 1
br i1 %cmp871, label %for.body9.preheader, label %if.else
for.body9.preheader: ; preds = %for.cond7.preheader
%sub = add nsw i32 %6, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body9.outer
for.body9.outer: ; preds = %for.inc21.thread, %for.body9.preheader
%indvars.iv81.ph = phi i64 [ %9, %for.inc21.thread ], [ 0, %for.body9.preheader ]
%5 = phi i1 [ true, %for.inc21.thread ], [ false, %for.body9.preheader ]
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx6 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv
store i32 0, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !9
for.body9: ; preds = %for.body9.outer, %for.inc21
%indvars.iv81 = phi i64 [ %9, %for.inc21 ], [ %indvars.iv81.ph, %for.body9.outer ]
%arrayidx11 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv81
%8 = load i8, ptr %arrayidx11, align 1, !tbaa !11
%cmp12 = icmp eq i8 %8, 82
%9 = add nuw nsw i64 %indvars.iv81, 1
br i1 %cmp12, label %land.lhs.true, label %for.inc21
land.lhs.true: ; preds = %for.body9
%arrayidx15 = getelementptr inbounds i8, ptr %vla, i64 %9
%10 = load i8, ptr %arrayidx15, align 1, !tbaa !11
%cmp17 = icmp eq i8 %10, 76
br i1 %cmp17, label %for.inc21.thread, label %for.inc21
for.inc21: ; preds = %for.body9, %land.lhs.true
%exitcond.not = icmp eq i64 %9, %wide.trip.count
br i1 %exitcond.not, label %for.end23, label %for.body9, !llvm.loop !12
for.inc21.thread: ; preds = %land.lhs.true
%arrayidx20 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv81
store i32 1, ptr %arrayidx20, align 4, !tbaa !5
%exitcond.not99 = icmp eq i64 %9, %wide.trip.count
br i1 %exitcond.not99, label %for.cond27.preheader, label %for.body9.outer, !llvm.loop !12
for.end23: ; preds = %for.inc21
br i1 %5, label %for.cond27.preheader, label %if.else
for.cond27.preheader: ; preds = %for.inc21.thread, %for.end23
%cmp2875 = icmp sgt i32 %6, 0
br i1 %cmp2875, label %for.body30.preheader, label %for.end49
for.body30.preheader: ; preds = %for.cond27.preheader
%wide.trip.count89 = zext i32 %6 to i64
br label %for.body30
for.body30: ; preds = %for.body30.preheader, %for.inc47
%indvars.iv85 = phi i64 [ 0, %for.body30.preheader ], [ %12, %for.inc47 ]
%time.077 = phi i32 [ 1410065408, %for.body30.preheader ], [ %time.2, %for.inc47 ]
%arrayidx32 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv85
%11 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %11, 1
%12 = add nuw nsw i64 %indvars.iv85, 1
br i1 %cmp33, label %if.then35, label %for.inc47
if.then35: ; preds = %for.body30
%arrayidx38 = getelementptr inbounds i32, ptr %vla2, i64 %12
%13 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%arrayidx40 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv85
%14 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%sub41 = sub nsw i32 %13, %14
%div = sdiv i32 %sub41, 2
%spec.select = call i32 @llvm.smin.i32(i32 %time.077, i32 %div)
br label %for.inc47
for.inc47: ; preds = %for.body30, %if.then35
%time.2 = phi i32 [ %spec.select, %if.then35 ], [ %time.077, %for.body30 ]
%exitcond90.not = icmp eq i64 %12, %wide.trip.count89
br i1 %exitcond90.not, label %for.end49, label %for.body30, !llvm.loop !13
for.end49: ; preds = %for.inc47, %for.cond27.preheader
%time.0.lcssa = phi i32 [ 1410065408, %for.cond27.preheader ], [ %time.2, %for.inc47 ]
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %time.0.lcssa)
br label %if.end52
if.else: ; preds = %entry, %for.cond7.preheader, %for.end23
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end52
if.end52: ; preds = %if.else, %for.end49
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: 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.smin.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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main (void) {
long X, sum = 100;
int year = 0;
scanf("%ld", &X);
while (X > sum) {
sum = (long)(sum * 1.01);
year++;
}
printf ("%d", year);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274712/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274712/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"%ld\00", align 1
@.str.1 = 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:
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i64, ptr %X, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 100
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%year.07 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%sum.06 = phi i64 [ %conv1, %while.body ], [ 100, %entry ]
%conv = sitofp i64 %sum.06 to double
%mul = fmul double %conv, 1.010000e+00
%conv1 = fptosi double %mul to i64
%inc = add nuw nsw i32 %year.07, 1
%cmp = icmp sgt i64 %0, %conv1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%year.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %year.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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()
{
unsigned long long a = 100;
unsigned long long x;
scanf("%lld",&x);
int year = 1;
// printf("%d",x);
while(1){
a = a + a*0.01;
if(a >= x){
printf("%d",year);
return 0;
}
year ++;
// printf("%d %d\n",a,year);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274763/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"%lld\00", align 1
@.str.1 = 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:
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%a.0 = phi i64 [ 100, %entry ], [ %conv2, %while.cond ]
%year.0 = phi i32 [ 1, %entry ], [ %inc, %while.cond ]
%conv = uitofp i64 %a.0 to double
%1 = call double @llvm.fmuladd.f64(double %conv, double 1.000000e-02, double %conv)
%conv2 = fptoui double %1 to i64
%cmp.not = icmp ugt i64 %0, %conv2
%inc = add nuw nsw i32 %year.0, 1
br i1 %cmp.not, label %while.cond, label %if.then
if.then: ; preds = %while.cond
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %year.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
typedef long long ll;
int main(){
ll X;
scanf("%lld",&X);
ll year = 0,money = 100;
while(money < X){
money *= 1.01;
year++;
}
printf("%lld",year);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274813/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274813/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"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i64, ptr %X, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %0, 100
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%money.07 = phi i64 [ %conv1, %while.body ], [ 100, %entry ]
%year.06 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%conv = sitofp i64 %money.07 to double
%mul = fmul double %conv, 1.010000e+00
%conv1 = fptosi double %mul to i64
%inc = add nuw nsw i64 %year.06, 1
%cmp = icmp sgt i64 %0, %conv1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%year.0.lcssa = phi i64 [ 0, %entry ], [ %inc, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %year.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"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>
int main(void)
{
char s[100005];
int K,i=0,len;
scanf("%s", s);
scanf("%d", &K);
len = strlen(s);
for (i = 0; i < len; i++) {
if ('z' - s[i] +1<=K&&'z'-s[i]+1!=26) {
K -= 'z' - s[i] + 1;
s[i] = 'a';
}
else {
K -= 0;
}
if (K == 0)break;
}
if (K != 0) {
s[len - 1] += K % 26;
}
printf("%s\n", s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274857/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274857/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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100005 x i8], align 16
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %K)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call3 to i32
%K.promoted = load i32, ptr %K, align 4, !tbaa !5
%cmp49 = icmp sgt i32 %conv, 0
br i1 %cmp49, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call3, 4294967295
br label %for.body
for.cond: ; preds = %if.end
%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 %if.then30, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%sub204850 = phi i32 [ %K.promoted, %for.body.preheader ], [ %sub2047, %for.cond ]
%arrayidx = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%conv5 = sext i8 %0 to i32
%add = sub nsw i32 123, %conv5
%cmp6.not = icmp sgt i32 %add, %sub204850
%cmp13.not = icmp eq i8 %0, 97
%or.cond = or i1 %cmp13.not, %cmp6.not
br i1 %or.cond, label %if.end, label %if.then
if.then: ; preds = %for.body
%sub20 = sub nsw i32 %sub204850, %add
store i32 %sub20, ptr %K, align 4, !tbaa !5
store i8 97, ptr %arrayidx, align 1, !tbaa !11
br label %if.end
if.end: ; preds = %for.body, %if.then
%sub2047 = phi i32 [ %sub204850, %for.body ], [ %sub20, %if.then ]
%cmp24 = icmp eq i32 %sub2047, 0
br i1 %cmp24, label %if.end37, label %for.cond
for.end: ; preds = %entry
%cmp28.not = icmp eq i32 %K.promoted, 0
br i1 %cmp28.not, label %if.end37, label %if.then30
if.then30: ; preds = %for.cond, %for.end
%1 = phi i32 [ %K.promoted, %for.end ], [ %sub2047, %for.cond ]
%rem = srem i32 %1, 26
%sub31 = shl i64 %call3, 32
%sext = add i64 %sub31, -4294967296
%idxprom32 = ashr exact i64 %sext, 32
%arrayidx33 = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %idxprom32
%2 = load i8, ptr %arrayidx33, align 1, !tbaa !11
%3 = trunc i32 %rem to i8
%conv36 = add i8 %2, %3
store i8 %conv36, ptr %arrayidx33, align 1, !tbaa !11
br label %if.end37
if.end37: ; preds = %if.end, %if.then30, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #5
call void @llvm.lifetime.end.p0(i64 100005, 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: 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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
|
#include <stdio.h>
#define MAXNUMS 1000000
#define MAXGAPS 13
void ShellSort(int line[], const long n);
void InsertionSort(int line[], const long n, const long gap);
int main(void)
{
long i;
long num_line;
scanf("%ld", &num_line);
int line[MAXNUMS];
for (i = 0; i < num_line; i++) {
scanf("%d", &line[i]);
}
ShellSort(line, num_line);
for (i = 0; i < num_line; i++) {
if (i != 0) {
printf(" ");
}
printf("%d", line[i]);
}
printf("\n");
return 0;
}
void ShellSort(int line[], const long n)
{
int i;
long gap[MAXGAPS];
long gap_tmp = 1;
gap[0] = gap_tmp;
int num_gap = 1;
for (i = 1; (gap_tmp = 3 * gap_tmp + 1) <= n; i++) {
gap[i] = gap_tmp;
num_gap++;
}
for (i = num_gap - 1; i > -1; i--) {
InsertionSort(line, n, gap[i]);
}
}
void InsertionSort(int line[], const long n, const long gap)
{
int i, j;
for (i = gap; i < n; i++) {
long key = line[i];
for (j = i - gap; j >= 0 && line[j] > key; j -= gap) {
line[j + gap] = line[j];
}
line[j + gap] = key;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_274907/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_274907/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"%ld\00", align 1
@.str.1 = 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:
%gap.i = alloca [13 x i64], align 16
%num_line = alloca i64, align 8
%line = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num_line) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num_line)
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %line) #6
%0 = load i64, ptr %num_line, align 8, !tbaa !5
%cmp20 = icmp sgt i64 %0, 0
br i1 %cmp20, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %gap.i) #6
store i64 1, ptr %gap.i, align 16, !tbaa !5
br label %for.cond3.preheader.i
for.body: ; preds = %entry, %for.body
%i.021 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr %line, i64 0, i64 %i.021
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.021, 1
%1 = load i64, ptr %num_line, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %gap.i) #6
store i64 1, ptr %gap.i, align 16, !tbaa !5
%cmp.not.not18.i = icmp sgt i64 %1, 3
br i1 %cmp.not.not18.i, label %for.body.i, label %for.cond3.preheader.i
for.cond3.preheader.loopexit.i: ; preds = %for.body.i
%2 = and i64 %indvars.iv.next.i, 4294967295
br label %for.cond3.preheader.i
for.cond3.preheader.i: ; preds = %for.end.thread, %for.cond3.preheader.loopexit.i, %for.end
%3 = phi i64 [ %1, %for.end ], [ %1, %for.cond3.preheader.loopexit.i ], [ %0, %for.end.thread ]
%num_gap.0.lcssa.i = phi i64 [ 1, %for.end ], [ %2, %for.cond3.preheader.loopexit.i ], [ 1, %for.end.thread ]
br label %for.body5.i
for.body.i: ; preds = %for.end, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 1, %for.end ]
%mul21.i = phi i64 [ %mul.i, %for.body.i ], [ 3, %for.end ]
%add.i = add nsw i64 %mul21.i, 1
%arrayidx1.i = getelementptr inbounds [13 x i64], ptr %gap.i, i64 0, i64 %indvars.iv.i
store i64 %add.i, ptr %arrayidx1.i, align 8, !tbaa !5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%mul.i = mul nsw i64 %add.i, 3
%cmp.not.not.i = icmp slt i64 %mul.i, %1
br i1 %cmp.not.not.i, label %for.body.i, label %for.cond3.preheader.loopexit.i, !llvm.loop !11
for.body5.i: ; preds = %InsertionSort.exit.i, %for.cond3.preheader.i
%indvars.iv26.i = phi i64 [ %num_gap.0.lcssa.i, %for.cond3.preheader.i ], [ %indvars.iv.next27.i, %InsertionSort.exit.i ]
%indvars.iv.next27.i = add nsw i64 %indvars.iv26.i, -1
%idxprom6.i = and i64 %indvars.iv.next27.i, 4294967295
%arrayidx7.i = getelementptr inbounds [13 x i64], ptr %gap.i, i64 0, i64 %idxprom6.i
%4 = load i64, ptr %arrayidx7.i, align 8, !tbaa !5
%conv.i.i = trunc i64 %4 to i32
%invariant.gep.i.i = getelementptr i32, ptr %line, i64 %4
%sext.i.i = shl i64 %4, 32
%conv149.i.i = ashr exact i64 %sext.i.i, 32
%cmp50.i.i = icmp slt i64 %conv149.i.i, %3
br i1 %cmp50.i.i, label %for.body.i.i, label %InsertionSort.exit.i
for.body.i.i: ; preds = %for.body5.i, %for.end.i.i
%indvars.iv.i.i = phi i64 [ %indvars.iv.next.i.i, %for.end.i.i ], [ %conv149.i.i, %for.body5.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr %line, i64 %indvars.iv.i.i
%5 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !12
%6 = trunc i64 %indvars.iv.i.i to i32
%j.045.i.i = sub i32 %6, %conv.i.i
%cmp746.i.i = icmp sgt i32 %j.045.i.i, -1
br i1 %cmp746.i.i, label %land.rhs.i.i, label %for.end.i.i
land.rhs.i.i: ; preds = %for.body.i.i, %for.body14.i.i
%j.047.i.i = phi i32 [ %j.0.i.i, %for.body14.i.i ], [ %j.045.i.i, %for.body.i.i ]
%idxprom9.i.i = zext i32 %j.047.i.i to i64
%arrayidx10.i.i = getelementptr inbounds i32, ptr %line, i64 %idxprom9.i.i
%7 = load i32, ptr %arrayidx10.i.i, align 4, !tbaa !12
%cmp12.i.i = icmp sgt i32 %7, %5
br i1 %cmp12.i.i, label %for.body14.i.i, label %for.end.i.i
for.body14.i.i: ; preds = %land.rhs.i.i
%arrayidx18.i.i = getelementptr i32, ptr %arrayidx10.i.i, i64 %4
store i32 %7, ptr %arrayidx18.i.i, align 4, !tbaa !12
%j.0.i.i = sub i32 %j.047.i.i, %conv.i.i
%cmp7.i.i = icmp sgt i32 %j.0.i.i, -1
br i1 %cmp7.i.i, label %land.rhs.i.i, label %for.end.i.i, !llvm.loop !14
for.end.i.i: ; preds = %for.body14.i.i, %land.rhs.i.i, %for.body.i.i
%j.0.lcssa.i.i = phi i32 [ %j.045.i.i, %for.body.i.i ], [ %j.0.i.i, %for.body14.i.i ], [ %j.047.i.i, %land.rhs.i.i ]
%conv23.i.i = sext i32 %j.0.lcssa.i.i to i64
%gep.i.i = getelementptr i32, ptr %invariant.gep.i.i, i64 %conv23.i.i
store i32 %5, ptr %gep.i.i, align 4, !tbaa !12
%indvars.iv.next.i.i = add nsw i64 %indvars.iv.i.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i.i, %3
br i1 %exitcond.not.i, label %InsertionSort.exit.i, label %for.body.i.i, !llvm.loop !15
InsertionSort.exit.i: ; preds = %for.end.i.i, %for.body5.i
%8 = trunc i64 %indvars.iv26.i to i32
%cmp4.i = icmp sgt i32 %8, 1
br i1 %cmp4.i, label %for.body5.i, label %ShellSort.exit, !llvm.loop !16
ShellSort.exit: ; preds = %InsertionSort.exit.i
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %gap.i) #6
%cmp322 = icmp sgt i64 %3, 0
br i1 %cmp322, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %ShellSort.exit
%.pre = load i32, ptr %line, align 16, !tbaa !12
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%9 = load i64, ptr %num_line, align 8, !tbaa !5
%cmp3.peel = icmp sgt i64 %9, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%i.123 = phi i64 [ %inc10, %if.end ], [ 1, %if.end.peel ]
%putchar19 = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [1000000 x i32], ptr %line, i64 0, i64 %i.123
%10 = load i32, ptr %arrayidx7, align 4, !tbaa !12
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%inc10 = add nuw nsw i64 %i.123, 1
%11 = load i64, ptr %num_line, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc10, %11
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !17
for.end11: ; preds = %if.end, %if.end.peel, %ShellSort.exit
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %line) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num_line) #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: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @ShellSort(ptr nocapture noundef %line, i64 noundef %n) local_unnamed_addr #3 {
entry:
%gap = alloca [13 x i64], align 16
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %gap) #6
store i64 1, ptr %gap, align 16, !tbaa !5
%cmp.not.not18 = icmp sgt i64 %n, 3
br i1 %cmp.not.not18, label %for.body, label %for.body5.preheader
for.body5.preheader: ; preds = %for.cond3.preheader.loopexit, %entry
%indvars.iv26.ph = phi i64 [ %0, %for.cond3.preheader.loopexit ], [ 1, %entry ]
br label %for.body5
for.cond3.preheader.loopexit: ; preds = %for.body
%0 = and i64 %indvars.iv.next, 4294967295
br label %for.body5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%mul21 = phi i64 [ %mul, %for.body ], [ 3, %entry ]
%add = add nsw i64 %mul21, 1
%arrayidx1 = getelementptr inbounds [13 x i64], ptr %gap, i64 0, i64 %indvars.iv
store i64 %add, ptr %arrayidx1, align 8, !tbaa !5
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%mul = mul nsw i64 %add, 3
%cmp.not.not = icmp slt i64 %mul, %n
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader.loopexit, !llvm.loop !11
for.body5: ; preds = %for.body5.preheader, %InsertionSort.exit
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %InsertionSort.exit ], [ %indvars.iv26.ph, %for.body5.preheader ]
%indvars.iv.next27 = add nsw i64 %indvars.iv26, -1
%idxprom6 = and i64 %indvars.iv.next27, 4294967295
%arrayidx7 = getelementptr inbounds [13 x i64], ptr %gap, i64 0, i64 %idxprom6
%1 = load i64, ptr %arrayidx7, align 8, !tbaa !5
%conv.i = trunc i64 %1 to i32
%invariant.gep.i = getelementptr i32, ptr %line, i64 %1
%sext.i = shl i64 %1, 32
%conv149.i = ashr exact i64 %sext.i, 32
%cmp50.i = icmp slt i64 %conv149.i, %n
br i1 %cmp50.i, label %for.body.i, label %InsertionSort.exit
for.body.i: ; preds = %for.body5, %for.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.end.i ], [ %conv149.i, %for.body5 ]
%arrayidx.i = getelementptr inbounds i32, ptr %line, i64 %indvars.iv.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !12
%3 = trunc i64 %indvars.iv.i to i32
%j.045.i = sub i32 %3, %conv.i
%cmp746.i = icmp sgt i32 %j.045.i, -1
br i1 %cmp746.i, label %land.rhs.i, label %for.end.i
land.rhs.i: ; preds = %for.body.i, %for.body14.i
%j.047.i = phi i32 [ %j.0.i, %for.body14.i ], [ %j.045.i, %for.body.i ]
%idxprom9.i = zext i32 %j.047.i to i64
%arrayidx10.i = getelementptr inbounds i32, ptr %line, i64 %idxprom9.i
%4 = load i32, ptr %arrayidx10.i, align 4, !tbaa !12
%cmp12.i = icmp sgt i32 %4, %2
br i1 %cmp12.i, label %for.body14.i, label %for.end.i
for.body14.i: ; preds = %land.rhs.i
%arrayidx18.i = getelementptr i32, ptr %arrayidx10.i, i64 %1
store i32 %4, ptr %arrayidx18.i, align 4, !tbaa !12
%j.0.i = sub i32 %j.047.i, %conv.i
%cmp7.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp7.i, label %land.rhs.i, label %for.end.i, !llvm.loop !14
for.end.i: ; preds = %for.body14.i, %land.rhs.i, %for.body.i
%j.0.lcssa.i = phi i32 [ %j.045.i, %for.body.i ], [ %j.047.i, %land.rhs.i ], [ %j.0.i, %for.body14.i ]
%conv23.i = sext i32 %j.0.lcssa.i to i64
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %conv23.i
store i32 %2, ptr %gep.i, align 4, !tbaa !12
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
%exitcond.not = icmp eq i64 %indvars.iv.next.i, %n
br i1 %exitcond.not, label %InsertionSort.exit, label %for.body.i, !llvm.loop !15
InsertionSort.exit: ; preds = %for.end.i, %for.body5
%5 = trunc i64 %indvars.iv26 to i32
%cmp4 = icmp sgt i32 %5, 1
br i1 %cmp4, label %for.body5, label %for.end9, !llvm.loop !16
for.end9: ; preds = %InsertionSort.exit
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %gap) #6
ret void
}
; 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 void @InsertionSort(ptr nocapture noundef %line, i64 noundef %n, i64 noundef %gap) local_unnamed_addr #4 {
entry:
%conv = trunc i64 %gap to i32
%invariant.gep = getelementptr i32, ptr %line, i64 %gap
%sext = shl i64 %gap, 32
%conv149 = ashr exact i64 %sext, 32
%cmp50 = icmp slt i64 %conv149, %n
br i1 %cmp50, label %for.body, label %for.end27
for.body: ; preds = %entry, %for.end
%indvars.iv = phi i64 [ %indvars.iv.next, %for.end ], [ %conv149, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %line, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%1 = trunc i64 %indvars.iv to i32
%j.045 = sub i32 %1, %conv
%cmp746 = icmp sgt i32 %j.045, -1
br i1 %cmp746, label %land.rhs, label %for.end
land.rhs: ; preds = %for.body, %for.body14
%j.047 = phi i32 [ %j.0, %for.body14 ], [ %j.045, %for.body ]
%idxprom9 = zext i32 %j.047 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %line, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !12
%cmp12 = icmp sgt i32 %2, %0
br i1 %cmp12, label %for.body14, label %for.end
for.body14: ; preds = %land.rhs
%arrayidx18 = getelementptr i32, ptr %arrayidx10, i64 %gap
store i32 %2, ptr %arrayidx18, align 4, !tbaa !12
%j.0 = sub i32 %j.047, %conv
%cmp7 = icmp sgt i32 %j.0, -1
br i1 %cmp7, label %land.rhs, label %for.end, !llvm.loop !14
for.end: ; preds = %land.rhs, %for.body14, %for.body
%j.0.lcssa = phi i32 [ %j.045, %for.body ], [ %j.0, %for.body14 ], [ %j.047, %land.rhs ]
%conv23 = sext i32 %j.0.lcssa to i64
%gep = getelementptr i32, ptr %invariant.gep, i64 %conv23
store i32 %0, ptr %gep, align 4, !tbaa !12
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%cmp = icmp slt i64 %indvars.iv.next, %n
br i1 %cmp, label %for.body, label %for.end27, !llvm.loop !15
for.end27: ; preds = %for.end, %entry
ret void
}
; 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 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 = { 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 #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 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
short int a[10000000];
int n,x,max=0,t[10];
int main(void){
scanf("%d",&n);
for(;n>10;n-=10){
scanf("%d %d %d %d %d %d %d %d %d %d",&t[0],&t[1],&t[2],&t[3],&t[4],&t[5],&t[6],&t[7],&t[8],&t[9]);
for(x=0;x<10;x++){a[t[x]]++;if(max<t[x])max=t[x];}
}
for(;n>0;n--){scanf("%d",&x);a[x]++;if(max<x)max=x;}
for(n=0,x=0;n<=max;n++){
for(;a[n]>0;a[n]--){
if(x>0)printf(" ");else x=1;
printf("%d",n);
}
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275014/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275014/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"
@max = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [30 x i8] c"%d %d %d %d %d %d %d %d %d %d\00", align 1
@t = dso_local global [10 x i32] zeroinitializer, align 16
@x = dso_local global i32 0, align 4
@a = dso_local local_unnamed_addr global [10000000 x i16] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp56 = icmp sgt i32 %.pr, 10
br i1 %cmp56, label %for.body, label %for.cond15thread-pre-split
for.body: ; preds = %entry, %for.inc.9
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @t, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 1), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 2), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 3), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 4), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 5), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 6), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 7), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 8), ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 9))
%max.promoted = load i32, ptr @max, align 4, !tbaa !5
%0 = load i32, ptr @t, align 16, !tbaa !5
%idxprom5 = sext i32 %0 to i64
%arrayidx6 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5
%1 = load i16, ptr %arrayidx6, align 2, !tbaa !9
%inc = add i16 %1, 1
store i16 %inc, ptr %arrayidx6, align 2, !tbaa !9
%cmp9 = icmp slt i32 %max.promoted, %0
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i32 %0, ptr @max, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%2 = phi i32 [ %max.promoted, %for.body ], [ %0, %if.then ]
%3 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 1), align 4, !tbaa !5
%idxprom5.1 = sext i32 %3 to i64
%arrayidx6.1 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.1
%4 = load i16, ptr %arrayidx6.1, align 2, !tbaa !9
%inc.1 = add i16 %4, 1
store i16 %inc.1, ptr %arrayidx6.1, align 2, !tbaa !9
%cmp9.1 = icmp slt i32 %2, %3
br i1 %cmp9.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
store i32 %3, ptr @max, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%5 = phi i32 [ %2, %for.inc ], [ %3, %if.then.1 ]
%6 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 2), align 8, !tbaa !5
%idxprom5.2 = sext i32 %6 to i64
%arrayidx6.2 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.2
%7 = load i16, ptr %arrayidx6.2, align 2, !tbaa !9
%inc.2 = add i16 %7, 1
store i16 %inc.2, ptr %arrayidx6.2, align 2, !tbaa !9
%cmp9.2 = icmp slt i32 %5, %6
br i1 %cmp9.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
store i32 %6, ptr @max, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%8 = phi i32 [ %5, %for.inc.1 ], [ %6, %if.then.2 ]
%9 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 3), align 4, !tbaa !5
%idxprom5.3 = sext i32 %9 to i64
%arrayidx6.3 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.3
%10 = load i16, ptr %arrayidx6.3, align 2, !tbaa !9
%inc.3 = add i16 %10, 1
store i16 %inc.3, ptr %arrayidx6.3, align 2, !tbaa !9
%cmp9.3 = icmp slt i32 %8, %9
br i1 %cmp9.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
store i32 %9, ptr @max, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%11 = phi i32 [ %8, %for.inc.2 ], [ %9, %if.then.3 ]
%12 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 4), align 16, !tbaa !5
%idxprom5.4 = sext i32 %12 to i64
%arrayidx6.4 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.4
%13 = load i16, ptr %arrayidx6.4, align 2, !tbaa !9
%inc.4 = add i16 %13, 1
store i16 %inc.4, ptr %arrayidx6.4, align 2, !tbaa !9
%cmp9.4 = icmp slt i32 %11, %12
br i1 %cmp9.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
store i32 %12, ptr @max, align 4, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3
%14 = phi i32 [ %11, %for.inc.3 ], [ %12, %if.then.4 ]
%15 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 5), align 4, !tbaa !5
%idxprom5.5 = sext i32 %15 to i64
%arrayidx6.5 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.5
%16 = load i16, ptr %arrayidx6.5, align 2, !tbaa !9
%inc.5 = add i16 %16, 1
store i16 %inc.5, ptr %arrayidx6.5, align 2, !tbaa !9
%cmp9.5 = icmp slt i32 %14, %15
br i1 %cmp9.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
store i32 %15, ptr @max, align 4, !tbaa !5
br label %for.inc.5
for.inc.5: ; preds = %if.then.5, %for.inc.4
%17 = phi i32 [ %14, %for.inc.4 ], [ %15, %if.then.5 ]
%18 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 6), align 8, !tbaa !5
%idxprom5.6 = sext i32 %18 to i64
%arrayidx6.6 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.6
%19 = load i16, ptr %arrayidx6.6, align 2, !tbaa !9
%inc.6 = add i16 %19, 1
store i16 %inc.6, ptr %arrayidx6.6, align 2, !tbaa !9
%cmp9.6 = icmp slt i32 %17, %18
br i1 %cmp9.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
store i32 %18, ptr @max, align 4, !tbaa !5
br label %for.inc.6
for.inc.6: ; preds = %if.then.6, %for.inc.5
%20 = phi i32 [ %17, %for.inc.5 ], [ %18, %if.then.6 ]
%21 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 7), align 4, !tbaa !5
%idxprom5.7 = sext i32 %21 to i64
%arrayidx6.7 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.7
%22 = load i16, ptr %arrayidx6.7, align 2, !tbaa !9
%inc.7 = add i16 %22, 1
store i16 %inc.7, ptr %arrayidx6.7, align 2, !tbaa !9
%cmp9.7 = icmp slt i32 %20, %21
br i1 %cmp9.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
store i32 %21, ptr @max, align 4, !tbaa !5
br label %for.inc.7
for.inc.7: ; preds = %if.then.7, %for.inc.6
%23 = phi i32 [ %20, %for.inc.6 ], [ %21, %if.then.7 ]
%24 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 8), align 16, !tbaa !5
%idxprom5.8 = sext i32 %24 to i64
%arrayidx6.8 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.8
%25 = load i16, ptr %arrayidx6.8, align 2, !tbaa !9
%inc.8 = add i16 %25, 1
store i16 %inc.8, ptr %arrayidx6.8, align 2, !tbaa !9
%cmp9.8 = icmp slt i32 %23, %24
br i1 %cmp9.8, label %if.then.8, label %for.inc.8
if.then.8: ; preds = %for.inc.7
store i32 %24, ptr @max, align 4, !tbaa !5
br label %for.inc.8
for.inc.8: ; preds = %if.then.8, %for.inc.7
%26 = phi i32 [ %23, %for.inc.7 ], [ %24, %if.then.8 ]
%27 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @t, i64 0, i64 9), align 4, !tbaa !5
%idxprom5.9 = sext i32 %27 to i64
%arrayidx6.9 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom5.9
%28 = load i16, ptr %arrayidx6.9, align 2, !tbaa !9
%inc.9 = add i16 %28, 1
store i16 %inc.9, ptr %arrayidx6.9, align 2, !tbaa !9
%cmp9.9 = icmp slt i32 %26, %27
br i1 %cmp9.9, label %if.then.9, label %for.inc.9
if.then.9: ; preds = %for.inc.8
store i32 %27, ptr @max, align 4, !tbaa !5
br label %for.inc.9
for.inc.9: ; preds = %if.then.9, %for.inc.8
store i32 10, ptr @x, align 4, !tbaa !5
%29 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %29, -10
store i32 %sub, ptr @n, align 4, !tbaa !5
%cmp = icmp sgt i32 %29, 20
br i1 %cmp, label %for.body, label %for.cond15thread-pre-split, !llvm.loop !11
for.cond15thread-pre-split: ; preds = %for.inc.9, %entry
%.pr54 = phi i32 [ %.pr, %entry ], [ %sub, %for.inc.9 ]
%cmp1657 = icmp sgt i32 %.pr54, 0
br i1 %cmp1657, label %for.body17, label %for.cond15thread-pre-split.for.end26_crit_edge
for.cond15thread-pre-split.for.end26_crit_edge: ; preds = %for.cond15thread-pre-split
%.pre = load i32, ptr @max, align 4, !tbaa !5
br label %for.end26
for.body17: ; preds = %for.cond15thread-pre-split, %for.inc25
%call18 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
%30 = load i32, ptr @x, align 4, !tbaa !5
%idxprom19 = sext i32 %30 to i64
%arrayidx20 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom19
%31 = load i16, ptr %arrayidx20, align 2, !tbaa !9
%inc21 = add i16 %31, 1
store i16 %inc21, ptr %arrayidx20, align 2, !tbaa !9
%32 = load i32, ptr @max, align 4, !tbaa !5
%cmp22 = icmp slt i32 %32, %30
br i1 %cmp22, label %if.then23, label %for.inc25
if.then23: ; preds = %for.body17
store i32 %30, ptr @max, align 4, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %for.body17, %if.then23
%33 = phi i32 [ %32, %for.body17 ], [ %30, %if.then23 ]
%34 = load i32, ptr @n, align 4, !tbaa !5
%dec = add nsw i32 %34, -1
store i32 %dec, ptr @n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %34, 1
br i1 %cmp16, label %for.body17, label %for.end26, !llvm.loop !13
for.end26: ; preds = %for.inc25, %for.cond15thread-pre-split.for.end26_crit_edge
%35 = phi i32 [ %.pre, %for.cond15thread-pre-split.for.end26_crit_edge ], [ %33, %for.inc25 ]
store i32 0, ptr @n, align 4, !tbaa !5
store i32 0, ptr @x, align 4, !tbaa !5
%cmp28.not61 = icmp slt i32 %35, 0
br i1 %cmp28.not61, label %for.end49, label %for.cond30.preheader
for.cond30.preheader: ; preds = %for.end26, %for.inc47
%36 = phi i32 [ %44, %for.inc47 ], [ %35, %for.end26 ]
%37 = phi i32 [ %inc48, %for.inc47 ], [ 0, %for.end26 ]
%idxprom3158 = sext i32 %37 to i64
%arrayidx3259 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom3158
%38 = load i16, ptr %arrayidx3259, align 2, !tbaa !9
%cmp3360 = icmp sgt i16 %38, 0
br i1 %cmp3360, label %for.body35, label %for.inc47
for.body35: ; preds = %for.cond30.preheader, %if.end40
%39 = phi i32 [ %42, %if.end40 ], [ %37, %for.cond30.preheader ]
%40 = load i32, ptr @x, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %40, 0
br i1 %cmp36, label %if.then38, label %if.else
if.then38: ; preds = %for.body35
%putchar53 = tail call i32 @putchar(i32 32)
%.pre65 = load i32, ptr @n, align 4, !tbaa !5
br label %if.end40
if.else: ; preds = %for.body35
store i32 1, ptr @x, align 4, !tbaa !5
br label %if.end40
if.end40: ; preds = %if.else, %if.then38
%41 = phi i32 [ %39, %if.else ], [ %.pre65, %if.then38 ]
%call41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %41)
%42 = load i32, ptr @n, align 4, !tbaa !5
%idxprom43 = sext i32 %42 to i64
%arrayidx44 = getelementptr inbounds [10000000 x i16], ptr @a, i64 0, i64 %idxprom43
%43 = load i16, ptr %arrayidx44, align 2, !tbaa !9
%dec45 = add i16 %43, -1
store i16 %dec45, ptr %arrayidx44, align 2, !tbaa !9
%cmp33 = icmp sgt i16 %dec45, 0
br i1 %cmp33, label %for.body35, label %for.inc47.loopexit, !llvm.loop !14
for.inc47.loopexit: ; preds = %if.end40
%.pre66 = load i32, ptr @max, align 4, !tbaa !5
br label %for.inc47
for.inc47: ; preds = %for.inc47.loopexit, %for.cond30.preheader
%44 = phi i32 [ %36, %for.cond30.preheader ], [ %.pre66, %for.inc47.loopexit ]
%.lcssa = phi i32 [ %37, %for.cond30.preheader ], [ %42, %for.inc47.loopexit ]
%inc48 = add nsw i32 %.lcssa, 1
store i32 %inc48, ptr @n, align 4, !tbaa !5
%cmp28.not.not = icmp slt i32 %.lcssa, %44
br i1 %cmp28.not.not, label %for.cond30.preheader, label %for.end49, !llvm.loop !15
for.end49: ; preds = %for.inc47, %for.end26
%putchar = tail call i32 @putchar(i32 10)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include<stdio.h>
#include<math.h>
int main(void)
{
int a,b;
scanf("%d%d",&a,&b);
int i,j,n,m,tmp,cnt=0;
for(i=a;i<=b;i++){
tmp = i;
n = tmp;
m = 0;
for(j=1;j<6;j++){
m += (tmp%10)*(int)pow(10,5-j);
tmp /= 10;
}
if(n==m)
cnt++;
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275115/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275115/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:
%a = alloca i32, align 4
%b = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not24 = icmp sgt i32 %0, %1
br i1 %cmp.not24, label %for.end11, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%2 = add i32 %1, 1
%3 = sub i32 %2, %0
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.cond1.preheader.preheader29, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader.preheader
%n.vec = and i32 %3, -8
%ind.end = add i32 %0, %n.vec
%.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
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> [ zeroinitializer, %vector.ph ], [ %42, %vector.body ]
%vec.phi27 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %43, %vector.body ]
%vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%vec.ind.frozen = freeze <4 x i32> %vec.ind
%4 = sdiv <4 x i32> %vec.ind.frozen, <i32 10, i32 10, i32 10, i32 10>
%5 = mul <4 x i32> %4, <i32 10, i32 10, i32 10, i32 10>
%.decomposed = sub <4 x i32> %vec.ind.frozen, %5
%step.add.frozen = freeze <4 x i32> %step.add
%6 = sdiv <4 x i32> %step.add.frozen, <i32 10, i32 10, i32 10, i32 10>
%7 = mul <4 x i32> %6, <i32 10, i32 10, i32 10, i32 10>
%.decomposed32 = sub <4 x i32> %step.add.frozen, %7
%8 = mul nsw <4 x i32> %.decomposed, <i32 10000, i32 10000, i32 10000, i32 10000>
%9 = mul nsw <4 x i32> %.decomposed32, <i32 10000, i32 10000, i32 10000, i32 10000>
%10 = srem <4 x i32> %4, <i32 10, i32 10, i32 10, i32 10>
%11 = srem <4 x i32> %6, <i32 10, i32 10, i32 10, i32 10>
%12 = mul nsw <4 x i32> %10, <i32 1000, i32 1000, i32 1000, i32 1000>
%13 = mul nsw <4 x i32> %11, <i32 1000, i32 1000, i32 1000, i32 1000>
%14 = add nsw <4 x i32> %12, %8
%15 = add nsw <4 x i32> %13, %9
%16 = sdiv <4 x i32> %vec.ind, <i32 100, i32 100, i32 100, i32 100>
%17 = sdiv <4 x i32> %step.add, <i32 100, i32 100, i32 100, i32 100>
%18 = srem <4 x i32> %16, <i32 10, i32 10, i32 10, i32 10>
%19 = srem <4 x i32> %17, <i32 10, i32 10, i32 10, i32 10>
%20 = mul nsw <4 x i32> %18, <i32 100, i32 100, i32 100, i32 100>
%21 = mul nsw <4 x i32> %19, <i32 100, i32 100, i32 100, i32 100>
%22 = add nsw <4 x i32> %20, %14
%23 = add nsw <4 x i32> %21, %15
%24 = sdiv <4 x i32> %vec.ind, <i32 1000, i32 1000, i32 1000, i32 1000>
%25 = sdiv <4 x i32> %step.add, <i32 1000, i32 1000, i32 1000, i32 1000>
%26 = srem <4 x i32> %24, <i32 10, i32 10, i32 10, i32 10>
%27 = srem <4 x i32> %25, <i32 10, i32 10, i32 10, i32 10>
%28 = mul nsw <4 x i32> %26, <i32 10, i32 10, i32 10, i32 10>
%29 = mul nsw <4 x i32> %27, <i32 10, i32 10, i32 10, i32 10>
%30 = add nsw <4 x i32> %28, %22
%31 = add nsw <4 x i32> %29, %23
%32 = sdiv <4 x i32> %vec.ind, <i32 10000, i32 10000, i32 10000, i32 10000>
%33 = sdiv <4 x i32> %step.add, <i32 10000, i32 10000, i32 10000, i32 10000>
%34 = srem <4 x i32> %32, <i32 10, i32 10, i32 10, i32 10>
%35 = srem <4 x i32> %33, <i32 10, i32 10, i32 10, i32 10>
%36 = add nsw <4 x i32> %34, %30
%37 = add nsw <4 x i32> %35, %31
%38 = icmp eq <4 x i32> %vec.ind, %36
%39 = icmp eq <4 x i32> %step.add, %37
%40 = zext <4 x i1> %38 to <4 x i32>
%41 = zext <4 x i1> %39 to <4 x i32>
%42 = add <4 x i32> %vec.phi, %40
%43 = add <4 x i32> %vec.phi27, %41
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%44 = icmp eq i32 %index.next, %n.vec
br i1 %44, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %43, %42
%45 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %3, %n.vec
br i1 %cmp.n, label %for.end11, label %for.cond1.preheader.preheader29
for.cond1.preheader.preheader29: ; preds = %for.cond1.preheader.preheader, %middle.block
%cnt.026.ph = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %45, %middle.block ]
%i.025.ph = phi i32 [ %0, %for.cond1.preheader.preheader ], [ %ind.end, %middle.block ]
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader29, %for.cond1.preheader
%cnt.026 = phi i32 [ %spec.select, %for.cond1.preheader ], [ %cnt.026.ph, %for.cond1.preheader.preheader29 ]
%i.025 = phi i32 [ %inc10, %for.cond1.preheader ], [ %i.025.ph, %for.cond1.preheader.preheader29 ]
%rem = srem i32 %i.025, 10
%mul = mul nsw i32 %rem, 10000
%div = sdiv i32 %i.025, 10
%rem.1 = srem i32 %div, 10
%mul.1 = mul nsw i32 %rem.1, 1000
%add.1 = add nsw i32 %mul.1, %mul
%div.1 = sdiv i32 %i.025, 100
%rem.2 = srem i32 %div.1, 10
%mul.2 = mul nsw i32 %rem.2, 100
%add.2 = add nsw i32 %mul.2, %add.1
%div.2 = sdiv i32 %i.025, 1000
%rem.3 = srem i32 %div.2, 10
%mul.3 = mul nsw i32 %rem.3, 10
%add.3 = add nsw i32 %mul.3, %add.2
%div.3 = sdiv i32 %i.025, 10000
%rem.4 = srem i32 %div.3, 10
%add.4 = add nsw i32 %rem.4, %add.3
%cmp6 = icmp eq i32 %i.025, %add.4
%inc8 = zext i1 %cmp6 to i32
%spec.select = add nuw nsw i32 %cnt.026, %inc8
%inc10 = add nsw i32 %i.025, 1
%cmp.not.not = icmp slt i32 %i.025, %1
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.end11, !llvm.loop !13
for.end11: ; preds = %for.cond1.preheader, %middle.block, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %45, %middle.block ], [ %spec.select, %for.cond1.preheader ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
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.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, !12, !11}
|
#include <stdio.h>
#include <stdlib.h>
// 標準入力から改行かスペースまで読み取り、数字として返す
int get_num() {
// 10文字+区切り文字までしか受け付けられない
char s[11];
int i, n;
for (i = 0; i < sizeof(s); i++) {
s[i] = getchar();
if (s[i] == ' ' || s[i] == '\n') {
s[i] = '\0';
break;
}
}
sscanf(s, "%d", &n);
return n;
}
int is_loop_num(int x) {
int y0, y1;
y0 = x;
y1 = 0;
while(x > 0) {
y1 = y1 * 10 + x % 10;
x /= 10;
}
if (y0 == y1) {
return 1;
} else {
return 0;
}
}
int main(void) {
int A, B, i, count = 0;
A = get_num();
B = get_num();
for (i = A; i <= B; i++) {
count += is_loop_num(i);
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275159/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275159/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
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_num() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %0)
%conv2 = trunc i32 %call.i to i8
store i8 %conv2, ptr %s, align 1, !tbaa !9
%sext = shl i32 %call.i, 24
switch i32 %sext, label %for.inc [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
if.then: ; preds = %for.inc.9, %for.inc.9, %for.inc.8, %for.inc.8, %for.inc.7, %for.inc.7, %for.inc.6, %for.inc.6, %for.inc.5, %for.inc.5, %for.inc.4, %for.inc.4, %for.inc.3, %for.inc.3, %for.inc.2, %for.inc.2, %for.inc.1, %for.inc.1, %for.inc, %for.inc, %entry, %entry
%conv.lcssa = phi i64 [ 0, %entry ], [ 0, %entry ], [ 1, %for.inc ], [ 1, %for.inc ], [ 2, %for.inc.1 ], [ 2, %for.inc.1 ], [ 3, %for.inc.2 ], [ 3, %for.inc.2 ], [ 4, %for.inc.3 ], [ 4, %for.inc.3 ], [ 5, %for.inc.4 ], [ 5, %for.inc.4 ], [ 6, %for.inc.5 ], [ 6, %for.inc.5 ], [ 7, %for.inc.6 ], [ 7, %for.inc.6 ], [ 8, %for.inc.7 ], [ 8, %for.inc.7 ], [ 9, %for.inc.8 ], [ 9, %for.inc.8 ], [ 10, %for.inc.9 ], [ 10, %for.inc.9 ]
%arrayidx.le = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %conv.lcssa
store i8 0, ptr %arrayidx.le, align 1, !tbaa !9
br label %for.end
for.inc: ; preds = %entry
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.1 = tail call i32 @getc(ptr noundef %1)
%conv2.1 = trunc i32 %call.i.1 to i8
%arrayidx.1 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 1
store i8 %conv2.1, ptr %arrayidx.1, align 1, !tbaa !9
%sext.1 = shl i32 %call.i.1, 24
switch i32 %sext.1, label %for.inc.1 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.1: ; preds = %for.inc
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.2 = tail call i32 @getc(ptr noundef %2)
%conv2.2 = trunc i32 %call.i.2 to i8
%arrayidx.2 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 2
store i8 %conv2.2, ptr %arrayidx.2, align 1, !tbaa !9
%sext.2 = shl i32 %call.i.2, 24
switch i32 %sext.2, label %for.inc.2 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.2: ; preds = %for.inc.1
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.3 = tail call i32 @getc(ptr noundef %3)
%conv2.3 = trunc i32 %call.i.3 to i8
%arrayidx.3 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 3
store i8 %conv2.3, ptr %arrayidx.3, align 1, !tbaa !9
%sext.3 = shl i32 %call.i.3, 24
switch i32 %sext.3, label %for.inc.3 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.3: ; preds = %for.inc.2
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.4 = tail call i32 @getc(ptr noundef %4)
%conv2.4 = trunc i32 %call.i.4 to i8
%arrayidx.4 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 4
store i8 %conv2.4, ptr %arrayidx.4, align 1, !tbaa !9
%sext.4 = shl i32 %call.i.4, 24
switch i32 %sext.4, label %for.inc.4 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.4: ; preds = %for.inc.3
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.5 = tail call i32 @getc(ptr noundef %5)
%conv2.5 = trunc i32 %call.i.5 to i8
%arrayidx.5 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 5
store i8 %conv2.5, ptr %arrayidx.5, align 1, !tbaa !9
%sext.5 = shl i32 %call.i.5, 24
switch i32 %sext.5, label %for.inc.5 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.5: ; preds = %for.inc.4
%6 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.6 = tail call i32 @getc(ptr noundef %6)
%conv2.6 = trunc i32 %call.i.6 to i8
%arrayidx.6 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 6
store i8 %conv2.6, ptr %arrayidx.6, align 1, !tbaa !9
%sext.6 = shl i32 %call.i.6, 24
switch i32 %sext.6, label %for.inc.6 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.6: ; preds = %for.inc.5
%7 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.7 = tail call i32 @getc(ptr noundef %7)
%conv2.7 = trunc i32 %call.i.7 to i8
%arrayidx.7 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 7
store i8 %conv2.7, ptr %arrayidx.7, align 1, !tbaa !9
%sext.7 = shl i32 %call.i.7, 24
switch i32 %sext.7, label %for.inc.7 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.7: ; preds = %for.inc.6
%8 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.8 = tail call i32 @getc(ptr noundef %8)
%conv2.8 = trunc i32 %call.i.8 to i8
%arrayidx.8 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 8
store i8 %conv2.8, ptr %arrayidx.8, align 1, !tbaa !9
%sext.8 = shl i32 %call.i.8, 24
switch i32 %sext.8, label %for.inc.8 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.8: ; preds = %for.inc.7
%9 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.9 = tail call i32 @getc(ptr noundef %9)
%conv2.9 = trunc i32 %call.i.9 to i8
%arrayidx.9 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 9
store i8 %conv2.9, ptr %arrayidx.9, align 1, !tbaa !9
%sext.9 = shl i32 %call.i.9, 24
switch i32 %sext.9, label %for.inc.9 [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.inc.9: ; preds = %for.inc.8
%10 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.10 = tail call i32 @getc(ptr noundef %10)
%conv2.10 = trunc i32 %call.i.10 to i8
%arrayidx.10 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 10
store i8 %conv2.10, ptr %arrayidx.10, align 1, !tbaa !9
%sext.10 = shl i32 %call.i.10, 24
switch i32 %sext.10, label %for.end [
i32 536870912, label %if.then
i32 167772160, label %if.then
]
for.end: ; preds = %for.inc.9, %if.then
%call15 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %s, ptr noundef nonnull @.str, ptr noundef nonnull %n) #4
%11 = load i32, ptr %n, align 4, !tbaa !10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #4
ret i32 %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_sscanf(ptr nocapture noundef readonly, 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 i32 @is_loop_num(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp7 = icmp sgt i32 %x, 0
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%y1.09 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.08 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%mul = mul nsw i32 %y1.09, 10
%rem = urem i32 %x.addr.08, 10
%add = add nsw i32 %mul, %rem
%div = udiv i32 %x.addr.08, 10
%cmp.not = icmp ult i32 %x.addr.08, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%y1.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%cmp1 = icmp eq i32 %y1.0.lcssa, %x
%. = zext i1 %cmp1 to i32
ret i32 %.
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 @get_num()
%call1 = tail call i32 @get_num()
%cmp.not7 = icmp sgt i32 %call, %call1
br i1 %cmp.not7, label %for.end, label %for.body
for.body: ; preds = %entry, %is_loop_num.exit
%count.09 = phi i32 [ %add, %is_loop_num.exit ], [ 0, %entry ]
%i.08 = phi i32 [ %inc, %is_loop_num.exit ], [ %call, %entry ]
%cmp7.i = icmp sgt i32 %i.08, 0
br i1 %cmp7.i, label %while.body.i, label %is_loop_num.exit
while.body.i: ; preds = %for.body, %while.body.i
%y1.09.i = phi i32 [ %add.i, %while.body.i ], [ 0, %for.body ]
%x.addr.08.i = phi i32 [ %div.i, %while.body.i ], [ %i.08, %for.body ]
%mul.i = mul nsw i32 %y1.09.i, 10
%rem.i = urem i32 %x.addr.08.i, 10
%add.i = add nsw i32 %rem.i, %mul.i
%div.i = udiv i32 %x.addr.08.i, 10
%cmp.not.i = icmp ult i32 %x.addr.08.i, 10
br i1 %cmp.not.i, label %is_loop_num.exit, label %while.body.i, !llvm.loop !12
is_loop_num.exit: ; preds = %while.body.i, %for.body
%y1.0.lcssa.i = phi i32 [ 0, %for.body ], [ %add.i, %while.body.i ]
%cmp1.i = icmp eq i32 %y1.0.lcssa.i, %i.08
%..i = zext i1 %cmp1.i to i32
%add = add nuw nsw i32 %count.09, %..i
%inc = add i32 %i.08, 1
%exitcond.not = icmp eq i32 %i.08, %call1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %is_loop_num.exit, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %add, %is_loop_num.exit ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) 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 = { 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 #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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
int main(void)
{
int A, B;
int c=0;
scanf("%d%d", &A, &B);
for(int i=A;i<=B;i++){
int n=i;
int ind=0;
int x[5]={};
while(n>0){
x[ind]=n%10;
n/=10;
ind++;
}
int res=1;
for(int j=0;j<(ind-1)/2;j++){
if(x[j]!=x[ind-1-j]) res=0;
}
if(res) c++;
}
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275201/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275201/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:
%A = alloca i32, align 4
%B = alloca i32, align 4
%x = alloca [5 x i32], align 16
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 %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp.not41 = icmp sgt i32 %0, %1
br i1 %cmp.not41, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.cond.cleanup5, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.cond.cleanup5 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
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 = %entry, %for.cond.cleanup5
%i.043 = phi i32 [ %inc19, %for.cond.cleanup5 ], [ %0, %entry ]
%c.042 = phi i32 [ %spec.select, %for.cond.cleanup5 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %x) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %x, i8 0, i64 20, i1 false)
%cmp134 = icmp sgt i32 %i.043, 0
br i1 %cmp134, label %while.body, label %for.cond.cleanup5
for.cond2.preheader: ; preds = %while.body
%2 = trunc i64 %indvars.iv to i32
%cmp437 = icmp sgt i32 %2, 1
br i1 %cmp437, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond2.preheader
%div35354 = lshr i64 %indvars.iv, 1
%3 = and i64 %indvars.iv, 4294967295
%wide.trip.count = and i64 %div35354, 2147483647
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body6.preheader63, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.mod.vf = and i64 %div35354, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
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> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %12, %vector.body ]
%vec.phi55 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %13, %vector.body ]
%4 = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load56 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = sub nsw i64 %3, %index
%7 = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 %6
%8 = getelementptr inbounds i32, ptr %7, i64 -3
%wide.load57 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%reverse = shufflevector <4 x i32> %wide.load57, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%9 = getelementptr inbounds i32, ptr %7, i64 -7
%wide.load58 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%reverse59 = shufflevector <4 x i32> %wide.load58, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%10 = icmp eq <4 x i32> %wide.load, %reverse
%11 = icmp eq <4 x i32> %wide.load56, %reverse59
%12 = select <4 x i1> %10, <4 x i32> %vec.phi, <4 x i32> zeroinitializer
%13 = select <4 x i1> %11, <4 x i32> %vec.phi55, <4 x i32> zeroinitializer
%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
%rdx.select.cmp.not = icmp ne <4 x i32> %12, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp6062 = icmp ne <4 x i32> %13, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp60 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp6062
%15 = bitcast <4 x i1> %rdx.select.cmp60 to i4
%.not = icmp eq i4 %15, 0
%rdx.select61 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup5, label %for.body6.preheader63
for.body6.preheader63: ; preds = %for.body6.preheader, %middle.block
%indvars.iv46.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
%res.038.ph = phi i32 [ 1, %for.body6.preheader ], [ %rdx.select61, %middle.block ]
br label %for.body6
while.body: ; preds = %for.body, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %for.body ]
%n.035 = phi i32 [ %div, %while.body ], [ %i.043, %for.body ]
%rem = urem i32 %n.035, 10
%arrayidx = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 %indvars.iv
store i32 %rem, ptr %arrayidx, align 4, !tbaa !5
%div = udiv i32 %n.035, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp1.not = icmp ult i32 %n.035, 10
br i1 %cmp1.not, label %for.cond2.preheader, label %while.body, !llvm.loop !13
for.cond.cleanup5: ; preds = %for.body6, %middle.block, %for.body, %for.cond2.preheader
%res.0.lcssa = phi i32 [ 1, %for.cond2.preheader ], [ 1, %for.body ], [ %rdx.select61, %middle.block ], [ %spec.select33, %for.body6 ]
%tobool.not = icmp ne i32 %res.0.lcssa, 0
%inc16 = zext i1 %tobool.not to i32
%spec.select = add nuw nsw i32 %c.042, %inc16
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %x) #4
%inc19 = add i32 %i.043, 1
%exitcond50.not = icmp eq i32 %i.043, %1
br i1 %exitcond50.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
for.body6: ; preds = %for.body6.preheader63, %for.body6
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body6 ], [ %indvars.iv46.ph, %for.body6.preheader63 ]
%res.038 = phi i32 [ %spec.select33, %for.body6 ], [ %res.038.ph, %for.body6.preheader63 ]
%arrayidx8 = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 %indvars.iv46
%16 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%17 = sub nsw i64 %3, %indvars.iv46
%arrayidx12 = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 %17
%18 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13.not = icmp eq i32 %16, %18
%spec.select33 = select i1 %cmp13.not, i32 %res.038, i32 0
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !15
}
; 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, !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, !12, !11}
|
#include <stdio.h>
#include <string.h>
int main (void){
int a,b;
int count = 0;
scanf("%d %d", &a, &b);
int h[5];
for(int i = a; i <= b; i++){
int tmp = i;
for(int j = 0; j < 5; j++){
h[j] = tmp%10;
tmp /= 10;
}
if( h[0] == h[4] && h[1] == h[3] )
count++;
}
printf("%d", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275245/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275245/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
; 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
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 %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not24 = icmp sgt i32 %0, %1
br i1 %cmp.not24, label %for.cond.cleanup, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%2 = add i32 %1, 1
%3 = sub i32 %2, %0
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.cond1.preheader.preheader32, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader.preheader
%n.vec = and i32 %3, -8
%ind.end = add i32 %0, %n.vec
%.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi, %vector.body ]
%vec.phi29 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi30, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%vec.ind.frozen = freeze <4 x i32> %vec.ind
%4 = sdiv <4 x i32> %vec.ind.frozen, <i32 10, i32 10, i32 10, i32 10>
%5 = mul <4 x i32> %4, <i32 10, i32 10, i32 10, i32 10>
%.decomposed = sub <4 x i32> %vec.ind.frozen, %5
%step.add.frozen = freeze <4 x i32> %step.add
%6 = sdiv <4 x i32> %step.add.frozen, <i32 10, i32 10, i32 10, i32 10>
%7 = mul <4 x i32> %6, <i32 10, i32 10, i32 10, i32 10>
%.decomposed33 = sub <4 x i32> %step.add.frozen, %7
%8 = sdiv <4 x i32> %vec.ind, <i32 10000, i32 10000, i32 10000, i32 10000>
%9 = sdiv <4 x i32> %step.add, <i32 10000, i32 10000, i32 10000, i32 10000>
%10 = srem <4 x i32> %8, <i32 10, i32 10, i32 10, i32 10>
%11 = srem <4 x i32> %9, <i32 10, i32 10, i32 10, i32 10>
%12 = icmp eq <4 x i32> %.decomposed, %10
%13 = icmp eq <4 x i32> %.decomposed33, %11
%14 = sdiv <4 x i32> %vec.ind, <i32 1000, i32 1000, i32 1000, i32 1000>
%15 = sdiv <4 x i32> %step.add, <i32 1000, i32 1000, i32 1000, i32 1000>
%16 = srem <4 x i32> %14, <i32 10, i32 10, i32 10, i32 10>
%17 = srem <4 x i32> %15, <i32 10, i32 10, i32 10, i32 10>
%18 = srem <4 x i32> %4, <i32 10, i32 10, i32 10, i32 10>
%19 = srem <4 x i32> %6, <i32 10, i32 10, i32 10, i32 10>
%20 = icmp eq <4 x i32> %18, %16
%21 = icmp eq <4 x i32> %19, %17
%narrow = select <4 x i1> %12, <4 x i1> %20, <4 x i1> zeroinitializer
%22 = zext <4 x i1> %narrow to <4 x i32>
%predphi = add <4 x i32> %vec.phi, %22
%narrow31 = select <4 x i1> %13, <4 x i1> %21, <4 x i1> zeroinitializer
%23 = zext <4 x i1> %narrow31 to <4 x i32>
%predphi30 = add <4 x i32> %vec.phi29, %23
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%24 = icmp eq i32 %index.next, %n.vec
br i1 %24, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %predphi30, %predphi
%25 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %3, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.cond1.preheader.preheader32
for.cond1.preheader.preheader32: ; preds = %for.cond1.preheader.preheader, %middle.block
%i.026.ph = phi i32 [ %0, %for.cond1.preheader.preheader ], [ %ind.end, %middle.block ]
%count.025.ph = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %25, %middle.block ]
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader32, %if.end
%i.026 = phi i32 [ %inc13, %if.end ], [ %i.026.ph, %for.cond1.preheader.preheader32 ]
%count.025 = phi i32 [ %count.1, %if.end ], [ %count.025.ph, %for.cond1.preheader.preheader32 ]
%rem = srem i32 %i.026, 10
%div = sdiv i32 %i.026, 10
%div.3 = sdiv i32 %i.026, 10000
%rem.4 = srem i32 %div.3, 10
%cmp7 = icmp eq i32 %rem, %rem.4
br i1 %cmp7, label %land.lhs.true, label %if.end
for.cond.cleanup: ; preds = %if.end, %middle.block, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %25, %middle.block ], [ %count.1, %if.end ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
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
land.lhs.true: ; preds = %for.cond1.preheader
%div.2 = sdiv i32 %i.026, 1000
%rem.3 = srem i32 %div.2, 10
%rem.1 = srem i32 %div, 10
%cmp10 = icmp eq i32 %rem.1, %rem.3
%inc11 = zext i1 %cmp10 to i32
%spec.select = add nsw i32 %count.025, %inc11
br label %if.end
if.end: ; preds = %land.lhs.true, %for.cond1.preheader
%count.1 = phi i32 [ %count.025, %for.cond1.preheader ], [ %spec.select, %land.lhs.true ]
%inc13 = add i32 %i.026, 1
%exitcond.not = icmp eq i32 %i.026, %1
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !13
}
; 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
; 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, !12, !11}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
int num=0,i,ge,shi,bai,qian,wan,a,b;
scanf("%d%d",&a,&b);
for (i=a;i<=b;i++)
{
ge=i%10;
shi=i%100/10;
//bai=i%1000/100;
qian=i%10000/1000;
wan=i/10000;
if (ge==wan&&shi==qian)
{
num++;
}
}
printf("%d",num);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275302/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
; 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
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 i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not17 = icmp sgt i32 %0, %1
br i1 %cmp.not17, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%num.019 = phi i32 [ %num.1, %for.inc ], [ 0, %entry ]
%i.018 = phi i32 [ %inc7, %for.inc ], [ %0, %entry ]
%rem = srem i32 %i.018, 10
%div4 = sdiv i32 %i.018, 10000
%rem2 = srem i32 %i.018, 10000
%cmp5 = icmp eq i32 %rem, %div4
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%div3.lhs.trunc = trunc i32 %rem2 to i16
%div315 = sdiv i16 %div3.lhs.trunc, 1000
%rem1 = srem i32 %i.018, 100
%div.lhs.trunc = trunc i32 %rem1 to i8
%div16 = sdiv i8 %div.lhs.trunc, 10
%2 = sext i8 %div16 to i16
%cmp6 = icmp eq i16 %div315, %2
%inc = zext i1 %cmp6 to i32
%spec.select = add nsw i32 %num.019, %inc
br label %for.inc
for.inc: ; preds = %land.lhs.true, %for.body
%num.1 = phi i32 [ %num.019, %for.body ], [ %spec.select, %land.lhs.true ]
%inc7 = add i32 %i.018, 1
%exitcond.not = icmp eq i32 %i.018, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%num.0.lcssa = phi i32 [ 0, %entry ], [ %num.1, %for.inc ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0.lcssa)
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"}
|
#include <stdio.h>
int main(void){
int n,i,cnt=1;
int a[20];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&a[i]);
int max=a[0];
for(i=1;i<n;i++){
if(max<=a[i]){
cnt++;
max=a[i];
}
}
printf("%d",cnt);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275346/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
%a = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 80, 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
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body, label %for.end14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 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 !9
for.end: ; preds = %for.body
%cmp426 = icmp sgt i32 %1, 1
br i1 %cmp426, label %for.body5.preheader, label %for.end14
for.body5.preheader: ; preds = %for.end
%.pre = load i32, ptr %a, align 16, !tbaa !5
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %3, 1
%4 = icmp eq i32 %1, 2
br i1 %4, label %for.end14.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %3, -2
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv33 = phi i64 [ 1, %for.body5.preheader.new ], [ %indvars.iv.next34.1, %for.body5 ]
%max.029 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %spec.select23.1, %for.body5 ]
%cnt.028 = phi i32 [ 1, %for.body5.preheader.new ], [ %spec.select.1, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ]
%arrayidx7 = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv33
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8.not = icmp sle i32 %max.029, %5
%inc9 = zext i1 %cmp8.not to i32
%spec.select = add nuw nsw i32 %cnt.028, %inc9
%spec.select23 = call i32 @llvm.smax.i32(i32 %max.029, i32 %5)
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%arrayidx7.1 = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv.next34
%6 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%cmp8.not.1 = icmp sle i32 %spec.select23, %6
%inc9.1 = zext i1 %cmp8.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc9.1
%spec.select23.1 = call i32 @llvm.smax.i32(i32 %spec.select23, i32 %6)
%indvars.iv.next34.1 = add nuw nsw i64 %indvars.iv33, 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.end14.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11
for.end14.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %spec.select.1, %for.body5 ]
%indvars.iv33.unr = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next34.1, %for.body5 ]
%max.029.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %spec.select23.1, %for.body5 ]
%cnt.028.unr = phi i32 [ 1, %for.body5.preheader ], [ %spec.select.1, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end14, label %for.body5.epil
for.body5.epil: ; preds = %for.end14.loopexit.unr-lcssa
%arrayidx7.epil = getelementptr inbounds [20 x i32], ptr %a, i64 0, i64 %indvars.iv33.unr
%7 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%cmp8.not.epil = icmp sle i32 %max.029.unr, %7
%inc9.epil = zext i1 %cmp8.not.epil to i32
%spec.select.epil = add nuw nsw i32 %cnt.028.unr, %inc9.epil
br label %for.end14
for.end14: ; preds = %for.body5.epil, %for.end14.loopexit.unr-lcssa, %entry, %for.end
%cnt.0.lcssa = phi i32 [ 1, %for.end ], [ 1, %entry ], [ %spec.select.lcssa.ph, %for.end14.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body5.epil ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, 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: 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int bin_search(int x, int *sum, int high)
{
int low=0,mid;
while(low <= high)
{
mid = (low+high)/2;
if(mid == 0 && sum[mid] >= x)
break;
else if(mid != 0 && (sum[mid] >= x && sum[mid-1] < x))
break;
else if(sum[mid] > x && sum[mid-1] >= x)
high = mid-1;
else if(sum[mid] < x)
low = mid+1;
}
return mid+1;
}
int main()
{
int n,m,i,A[100100],sum[100100],q,x;
scanf("%d",&n);
for(i=0;i<n;++i)
{
scanf("%d",&A[i]);
if(i == 0)
sum[i] = A[i];
else
sum[i] = A[i] + sum[i-1];
}
scanf("%d",&m);
for(i=0;i<m;++i)
{
scanf("%d",&q);
x = bin_search(q, sum, n);
printf("%d\n",x);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27539/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27539/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 norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @bin_search(i32 noundef %x, ptr nocapture noundef readonly %sum, i32 noundef %high) local_unnamed_addr #0 {
entry:
%cmp.not57 = icmp slt i32 %high, 0
br i1 %cmp.not57, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end32
%low.059 = phi i32 [ %low.1, %if.end32 ], [ 0, %entry ]
%high.addr.058 = phi i32 [ %high.addr.1, %if.end32 ], [ %high, %entry ]
%add = add nsw i32 %low.059, %high.addr.058
%div = sdiv i32 %add, 2
%add.off = add i32 %add, 1
%cmp1 = icmp ult i32 %add.off, 3
br i1 %cmp1, label %land.lhs.true, label %land.lhs.true4
land.lhs.true: ; preds = %while.body
%0 = load i32, ptr %sum, align 4, !tbaa !5
%cmp2.not = icmp slt i32 %0, %x
br i1 %cmp2.not, label %land.lhs.true.if.else13_crit_edge, label %while.end.loopexit
land.lhs.true.if.else13_crit_edge: ; preds = %land.lhs.true
%idxprom14.phi.trans.insert = sext i32 %div to i64
%arrayidx15.phi.trans.insert = getelementptr inbounds i32, ptr %sum, i64 %idxprom14.phi.trans.insert
%.pre = load i32, ptr %arrayidx15.phi.trans.insert, align 4, !tbaa !5
br label %if.else13
land.lhs.true4: ; preds = %while.body
%idxprom5 = sext i32 %div to i64
%arrayidx6 = getelementptr inbounds i32, ptr %sum, i64 %idxprom5
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7.not = icmp slt i32 %1, %x
br i1 %cmp7.not, label %if.else13, label %land.lhs.true8
land.lhs.true8: ; preds = %land.lhs.true4
%sub = add nsw i32 %div, -1
%idxprom9 = sext i32 %sub to i64
%arrayidx10 = getelementptr inbounds i32, ptr %sum, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp slt i32 %2, %x
br i1 %cmp11, label %while.end.loopexit, label %if.else13
if.else13: ; preds = %land.lhs.true.if.else13_crit_edge, %land.lhs.true8, %land.lhs.true4
%3 = phi i32 [ %.pre, %land.lhs.true.if.else13_crit_edge ], [ %1, %land.lhs.true8 ], [ %1, %land.lhs.true4 ]
%cmp16 = icmp sgt i32 %3, %x
br i1 %cmp16, label %land.lhs.true17, label %if.else24
land.lhs.true17: ; preds = %if.else13
%sub18 = add nsw i32 %div, -1
%idxprom19 = sext i32 %sub18 to i64
%arrayidx20 = getelementptr inbounds i32, ptr %sum, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp slt i32 %4, %x
br i1 %cmp21.not, label %if.else24, label %if.end32
if.else24: ; preds = %land.lhs.true17, %if.else13
%cmp27 = icmp slt i32 %3, %x
%add29 = add nsw i32 %div, 1
%spec.select = select i1 %cmp27, i32 %add29, i32 %low.059
br label %if.end32
if.end32: ; preds = %if.else24, %land.lhs.true17
%high.addr.1 = phi i32 [ %sub18, %land.lhs.true17 ], [ %high.addr.058, %if.else24 ]
%low.1 = phi i32 [ %low.059, %land.lhs.true17 ], [ %spec.select, %if.else24 ]
%cmp.not = icmp sgt i32 %low.1, %high.addr.1
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !9
while.end.loopexit: ; preds = %land.lhs.true8, %land.lhs.true, %if.end32
%mid.1.ph = phi i32 [ %div, %if.end32 ], [ 0, %land.lhs.true ], [ %div, %land.lhs.true8 ]
%5 = add nsw i32 %mid.1.ph, 1
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%mid.1 = phi i32 [ undef, %entry ], [ %5, %while.end.loopexit ]
ret i32 %mid.1
}
; 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
%m = alloca i32, align 4
%A = alloca [100100 x i32], align 16
%sum = alloca [100100 x i32], align 16
%q = 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 void @llvm.lifetime.start.p0(i64 400400, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 400400, ptr nonnull %sum) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
%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.inc.peel, label %for.end
for.inc.peel: ; preds = %entry
%call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%1 = load i32, ptr %A, align 16, !tbaa !5
store i32 %1, ptr %sum, align 16
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %2, 1
br i1 %cmp.peel, label %for.inc, label %for.end
for.inc: ; preds = %for.inc.peel, %for.inc
%3 = phi i32 [ %add, %for.inc ], [ %1, %for.inc.peel ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ]
%arrayidx = getelementptr inbounds [100100 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %3, %4
%5 = getelementptr inbounds [100100 x i32], ptr %sum, i64 0, i64 %indvars.iv
store i32 %add, ptr %5, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.inc, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %for.inc.peel, %entry
%8 = phi i32 [ undef, %entry ], [ %1, %for.inc.peel ], [ %1, %for.inc ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%9 = load i32, ptr %m, align 4, !tbaa !5
%cmp1535 = icmp sgt i32 %9, 0
br i1 %cmp1535, label %for.body16, label %for.end22
for.body16: ; preds = %for.end, %while.end.loopexit.i
%i.136 = phi i32 [ %inc21, %while.end.loopexit.i ], [ 0, %for.end ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not57.i = icmp sgt i32 %11, -1
call void @llvm.assume(i1 %cmp.not57.i)
%cmp2.not.i = icmp slt i32 %8, %10
%cmp2.not.i.fr = freeze i1 %cmp2.not.i
br i1 %cmp2.not.i.fr, label %while.body.i.us, label %while.body.i
while.body.i.us: ; preds = %for.body16, %if.end32.i.us
%low.059.i.us = phi i32 [ %low.1.i.us, %if.end32.i.us ], [ 0, %for.body16 ]
%high.addr.058.i.us = phi i32 [ %high.addr.1.i.us, %if.end32.i.us ], [ %11, %for.body16 ]
%add.i.us = add nsw i32 %high.addr.058.i.us, %low.059.i.us
%div.i.us = sdiv i32 %add.i.us, 2
%add.off.i.us = add i32 %add.i.us, 1
%cmp1.i.us = icmp ult i32 %add.off.i.us, 3
%idxprom14.phi.trans.insert.i.us = sext i32 %div.i.us to i64
%arrayidx15.phi.trans.insert.i.us = getelementptr inbounds i32, ptr %sum, i64 %idxprom14.phi.trans.insert.i.us
%.pre.i.us = load i32, ptr %arrayidx15.phi.trans.insert.i.us, align 4, !tbaa !5
%cmp7.not.i.us = icmp slt i32 %.pre.i.us, %10
%or.cond = select i1 %cmp1.i.us, i1 true, i1 %cmp7.not.i.us
br i1 %or.cond, label %if.else13.i.us, label %land.lhs.true8.i.us
land.lhs.true8.i.us: ; preds = %while.body.i.us
%sub.i.us = add nsw i32 %div.i.us, -1
%idxprom9.i.us = sext i32 %sub.i.us to i64
%arrayidx10.i.us = getelementptr inbounds i32, ptr %sum, i64 %idxprom9.i.us
%12 = load i32, ptr %arrayidx10.i.us, align 4, !tbaa !5
%cmp11.i.us = icmp slt i32 %12, %10
br i1 %cmp11.i.us, label %while.end.loopexit.i, label %if.else13.i.us
if.else13.i.us: ; preds = %while.body.i.us, %land.lhs.true8.i.us
%cmp16.i.us = icmp sgt i32 %.pre.i.us, %10
br i1 %cmp16.i.us, label %land.lhs.true17.i.us, label %if.else24.i.us
land.lhs.true17.i.us: ; preds = %if.else13.i.us
%sub18.i.us = add nsw i32 %div.i.us, -1
%idxprom19.i.us = sext i32 %sub18.i.us to i64
%arrayidx20.i.us = getelementptr inbounds i32, ptr %sum, i64 %idxprom19.i.us
%13 = load i32, ptr %arrayidx20.i.us, align 4, !tbaa !5
%cmp21.not.i.us = icmp slt i32 %13, %10
br i1 %cmp21.not.i.us, label %if.else24.i.us, label %if.end32.i.us
if.else24.i.us: ; preds = %land.lhs.true17.i.us, %if.else13.i.us
%cmp27.i.us = icmp slt i32 %.pre.i.us, %10
%add29.i.us = add nsw i32 %div.i.us, 1
%spec.select.i.us = select i1 %cmp27.i.us, i32 %add29.i.us, i32 %low.059.i.us
br label %if.end32.i.us
if.end32.i.us: ; preds = %if.else24.i.us, %land.lhs.true17.i.us
%high.addr.1.i.us = phi i32 [ %sub18.i.us, %land.lhs.true17.i.us ], [ %high.addr.058.i.us, %if.else24.i.us ]
%low.1.i.us = phi i32 [ %low.059.i.us, %land.lhs.true17.i.us ], [ %spec.select.i.us, %if.else24.i.us ]
%cmp.not.i.us = icmp sgt i32 %low.1.i.us, %high.addr.1.i.us
br i1 %cmp.not.i.us, label %while.end.loopexit.i, label %while.body.i.us, !llvm.loop !9
while.body.i: ; preds = %for.body16, %if.end32.i
%low.059.i = phi i32 [ %low.1.i, %if.end32.i ], [ 0, %for.body16 ]
%high.addr.058.i = phi i32 [ %high.addr.1.i, %if.end32.i ], [ %11, %for.body16 ]
%add.i = add nsw i32 %high.addr.058.i, %low.059.i
%div.i = sdiv i32 %add.i, 2
%add.off.i = add i32 %add.i, 1
%cmp1.i = icmp ult i32 %add.off.i, 3
br i1 %cmp1.i, label %while.end.loopexit.i, label %land.lhs.true4.i
land.lhs.true4.i: ; preds = %while.body.i
%idxprom5.i = sext i32 %div.i to i64
%arrayidx6.i = getelementptr inbounds i32, ptr %sum, i64 %idxprom5.i
%14 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%cmp7.not.i = icmp slt i32 %14, %10
br i1 %cmp7.not.i, label %if.else13.i, label %land.lhs.true8.i
land.lhs.true8.i: ; preds = %land.lhs.true4.i
%sub.i = add nsw i32 %div.i, -1
%idxprom9.i = sext i32 %sub.i to i64
%arrayidx10.i = getelementptr inbounds i32, ptr %sum, i64 %idxprom9.i
%15 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%cmp11.i = icmp slt i32 %15, %10
br i1 %cmp11.i, label %while.end.loopexit.i, label %if.else13.i
if.else13.i: ; preds = %land.lhs.true8.i, %land.lhs.true4.i
%cmp16.i = icmp sgt i32 %14, %10
br i1 %cmp16.i, label %land.lhs.true17.i, label %if.else24.i
land.lhs.true17.i: ; preds = %if.else13.i
%sub18.i = add nsw i32 %div.i, -1
%idxprom19.i = sext i32 %sub18.i to i64
%arrayidx20.i = getelementptr inbounds i32, ptr %sum, i64 %idxprom19.i
%16 = load i32, ptr %arrayidx20.i, align 4, !tbaa !5
%cmp21.not.i = icmp slt i32 %16, %10
br i1 %cmp21.not.i, label %if.else24.i, label %if.end32.i
if.else24.i: ; preds = %land.lhs.true17.i, %if.else13.i
%add29.i = add nsw i32 %div.i, 1
%spec.select.i = select i1 %cmp7.not.i, i32 %add29.i, i32 %low.059.i
br label %if.end32.i
if.end32.i: ; preds = %if.else24.i, %land.lhs.true17.i
%high.addr.1.i = phi i32 [ %sub18.i, %land.lhs.true17.i ], [ %high.addr.058.i, %if.else24.i ]
%low.1.i = phi i32 [ %low.059.i, %land.lhs.true17.i ], [ %spec.select.i, %if.else24.i ]
%cmp.not.i = icmp sgt i32 %low.1.i, %high.addr.1.i
br i1 %cmp.not.i, label %while.end.loopexit.i, label %while.body.i, !llvm.loop !9
while.end.loopexit.i: ; preds = %while.body.i, %land.lhs.true8.i, %if.end32.i, %land.lhs.true8.i.us, %if.end32.i.us
%.us-phi = phi i32 [ %div.i.us, %if.end32.i.us ], [ %div.i.us, %land.lhs.true8.i.us ], [ 0, %while.body.i ], [ %div.i, %land.lhs.true8.i ], [ %div.i, %if.end32.i ]
%17 = add nsw i32 %.us-phi, 1
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17)
%inc21 = add nuw nsw i32 %i.136, 1
%18 = load i32, ptr %m, align 4, !tbaa !5
%cmp15 = icmp slt i32 %inc21, %18
br i1 %cmp15, label %for.body16, label %for.end22, !llvm.loop !13
for.end22: ; preds = %while.end.loopexit.i, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 400400, ptr nonnull %sum) #5
call void @llvm.lifetime.end.p0(i64 400400, ptr nonnull %A) #5
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: 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: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
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=0,Ni[20],max=0,result=0;
scanf("%d", &N);
for (int i = 0; i < N; i++){
scanf("%d", &Ni[i]);
}
for(int i=0;i<N;i++){
if(Ni[i]>=max){
max=Ni[i];
result++;
}
}
printf("%d",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275432/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275432/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
%Ni = alloca [20 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 80, ptr nonnull %Ni) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp426 = icmp sgt i32 %2, 0
br i1 %cmp426, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %Ni, 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.cond3.preheader, !llvm.loop !9
for.cond.cleanup5.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%spec.select23.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %spec.select23.1, %for.body6 ]
%indvars.iv33.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next34.1, %for.body6 ]
%result.028.unr = phi i32 [ 0, %for.body6.preheader ], [ %spec.select23.1, %for.body6 ]
%max.027.unr = phi i32 [ 0, %for.body6.preheader ], [ %spec.select.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [20 x i32], ptr %Ni, i64 0, i64 %indvars.iv33.unr
%4 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%cmp9.not.epil = icmp sge i32 %4, %max.027.unr
%inc12.epil = zext i1 %cmp9.not.epil to i32
%spec.select23.epil = add nuw nsw i32 %result.028.unr, %inc12.epil
br label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %for.body6.epil, %for.cond.cleanup5.loopexit.unr-lcssa, %entry, %for.cond3.preheader
%result.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %spec.select23.lcssa.ph, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %spec.select23.epil, %for.body6.epil ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %Ni) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv33 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next34.1, %for.body6 ]
%result.028 = phi i32 [ 0, %for.body6.preheader.new ], [ %spec.select23.1, %for.body6 ]
%max.027 = phi i32 [ 0, %for.body6.preheader.new ], [ %spec.select.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds [20 x i32], ptr %Ni, i64 0, i64 %indvars.iv33
%5 = load i32, ptr %arrayidx8, align 8, !tbaa !5
%cmp9.not = icmp sge i32 %5, %max.027
%spec.select = call i32 @llvm.smax.i32(i32 %5, i32 %max.027)
%inc12 = zext i1 %cmp9.not to i32
%spec.select23 = add nuw nsw i32 %result.028, %inc12
%indvars.iv.next34 = or i64 %indvars.iv33, 1
%arrayidx8.1 = getelementptr inbounds [20 x i32], ptr %Ni, i64 0, i64 %indvars.iv.next34
%6 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%cmp9.not.1 = icmp sge i32 %6, %spec.select
%spec.select.1 = call i32 @llvm.smax.i32(i32 %6, i32 %spec.select)
%inc12.1 = zext i1 %cmp9.not.1 to i32
%spec.select23.1 = add nuw nsw i32 %spec.select23, %inc12.1
%indvars.iv.next34.1 = add nuw nsw i64 %indvars.iv33, 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.cond.cleanup5.loopexit.unr-lcssa, label %for.body6, !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 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 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int n, i, j, view, flag;
view=1;
scanf("%d", &n);
int height[n];
for(i=1;i<n;i++){
scanf("%d ", &height[i]);
}
scanf("%d", &height[n]);
for(i=2;i<=n;i++){
flag=1;
for(j=1;j<i;j++){
if(height[j]>height[i]){
flag=0;
}
}
if(flag){
view+=1;
}
}
printf("%d\n", view);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275476/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275476/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
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
%cmp35 = icmp sgt i32 %3, 1
br i1 %cmp35, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %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 !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%idxprom2.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %5, %for.body ]
%arrayidx3 = getelementptr inbounds i32, ptr %vla, i64 %idxprom2.pre-phi
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp6.not39 = icmp slt i32 %6, 2
br i1 %cmp6.not39, label %for.end23, label %for.cond8.preheader.preheader
for.cond8.preheader.preheader: ; preds = %for.end
%7 = add nuw i32 %6, 1
%wide.trip.count51 = zext i32 %7 to i64
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.cond8.preheader.preheader, %for.end18
%indvar = phi i64 [ 0, %for.cond8.preheader.preheader ], [ %indvar.next, %for.end18 ]
%indvars.iv48 = phi i64 [ 2, %for.cond8.preheader.preheader ], [ %indvars.iv.next49, %for.end18 ]
%view.040 = phi i32 [ 1, %for.cond8.preheader.preheader ], [ %spec.select34, %for.end18 ]
%8 = add i64 %indvar, 1
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv48
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.cond8.preheader
%n.vec = and i64 %8, -8
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, 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 i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %14, %vector.body ]
%vec.phi53 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %15, %vector.body ]
%offset.idx = or i64 %index, 1
%10 = getelementptr inbounds i32, ptr %vla, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load54 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = icmp sgt <4 x i32> %wide.load, %broadcast.splat
%13 = icmp sgt <4 x i32> %wide.load54, %broadcast.splat
%14 = select <4 x i1> %12, <4 x i32> zeroinitializer, <4 x i32> %vec.phi
%15 = select <4 x i1> %13, <4 x i32> zeroinitializer, <4 x i32> %vec.phi53
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %14, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp5557 = icmp ne <4 x i32> %15, <i32 1, i32 1, i32 1, i32 1>
%rdx.select.cmp55 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp5557
%17 = bitcast <4 x i1> %rdx.select.cmp55 to i4
%.not = icmp eq i4 %17, 0
%rdx.select56 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %8, %n.vec
br i1 %cmp.n, label %for.end18, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader, %middle.block
%indvars.iv45.ph = phi i64 [ 1, %for.cond8.preheader ], [ %ind.end, %middle.block ]
%flag.038.ph = phi i32 [ 1, %for.cond8.preheader ], [ %rdx.select56, %middle.block ]
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ]
%flag.038 = phi i32 [ %spec.select, %for.body10 ], [ %flag.038.ph, %for.body10.preheader ]
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv45
%18 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %18, %9
%spec.select = select i1 %cmp15, i32 0, i32 %flag.038
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %indvars.iv48
br i1 %exitcond.not, label %for.end18, label %for.body10, !llvm.loop !14
for.end18: ; preds = %for.body10, %middle.block
%spec.select.lcssa = phi i32 [ %rdx.select56, %middle.block ], [ %spec.select, %for.body10 ]
%tobool.not = icmp ne i32 %spec.select.lcssa, 0
%add = zext i1 %tobool.not to i32
%spec.select34 = add nuw nsw i32 %view.040, %add
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
%indvar.next = add i64 %indvar, 1
br i1 %exitcond52.not, label %for.end23, label %for.cond8.preheader, !llvm.loop !15
for.end23: ; preds = %for.end18, %for.end
%view.0.lcssa = phi i32 [ 1, %for.end ], [ %spec.select34, %for.end18 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %view.0.lcssa)
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, !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>
#include <ctype.h>
void print_int(int n)
{
printf("%d\n",n);
}
void swap(int * a, int * b)
{
int t = *a;
*a = *b;
*b = t;
}
void sort(int a[], int n)
{
for(int i = 1; i < n; i++)
{
int j = i-1;
while(j >= 0 && a[j+1] > a[j])
{
swap(&a[j+1],&a[j]);
j--;
}
}
}
int main(int argc, char * argv[])
{
int count;
scanf("%d", &count);
int high[count];
int result = 1;
for(int i = 0; i < count; i++)
{
scanf("%d", &high[i]);
}
for(int i = 1; i < count; i++)
{
int j = i-1;
while(j >= 0 && high[i] >= high[j])
{
j--;
}
if(j < 0)
{
result++;
}
}
print_int(result);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275519/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275519/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
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_int(i32 noundef %n) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %n)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 #2 {
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) #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(argmem: readwrite) uwtable
define dso_local void @sort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp23 = icmp sgt i32 %n, 1
br i1 %cmp23, label %while.cond.preheader.preheader, label %for.cond.cleanup
while.cond.preheader.preheader: ; preds = %entry
%0 = add i32 %n, -1
%xtraiter = and i32 %0, 1
%1 = icmp eq i32 %n, 2
br i1 %1, label %for.cond.cleanup.loopexit.unr-lcssa, label %while.cond.preheader.preheader.new
while.cond.preheader.preheader.new: ; preds = %while.cond.preheader.preheader
%unroll_iter = and i32 %0, -2
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.end.1, %while.cond.preheader.preheader.new
%i.024 = phi i32 [ 1, %while.cond.preheader.preheader.new ], [ %inc.1, %while.end.1 ]
%niter = phi i32 [ 0, %while.cond.preheader.preheader.new ], [ %niter.next.1, %while.end.1 ]
%idxprom.phi.trans.insert = zext i32 %i.024 to i64
%arrayidx.phi.trans.insert = getelementptr inbounds i32, ptr %a, i64 %idxprom.phi.trans.insert
%.pre = load i32, ptr %arrayidx.phi.trans.insert, align 4, !tbaa !5
br label %land.rhs
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %while.end.1, %while.cond.preheader.preheader
%i.024.unr = phi i32 [ 1, %while.cond.preheader.preheader ], [ %inc.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %while.cond.preheader.epil
while.cond.preheader.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%idxprom.phi.trans.insert.epil = zext i32 %i.024.unr to i64
%arrayidx.phi.trans.insert.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom.phi.trans.insert.epil
%.pre.epil = load i32, ptr %arrayidx.phi.trans.insert.epil, align 4, !tbaa !5
br label %land.rhs.epil
land.rhs.epil: ; preds = %while.body.epil, %while.cond.preheader.epil
%j.0.in21.epil = phi i32 [ %i.024.unr, %while.cond.preheader.epil ], [ %j.022.epil, %while.body.epil ]
%j.022.epil = add nsw i32 %j.0.in21.epil, -1
%idxprom2.epil = zext i32 %j.022.epil to i64
%arrayidx3.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom2.epil
%2 = load i32, ptr %arrayidx3.epil, align 4, !tbaa !5
%cmp4.epil = icmp sgt i32 %.pre.epil, %2
br i1 %cmp4.epil, label %while.body.epil, label %for.cond.cleanup
while.body.epil: ; preds = %land.rhs.epil
%idxprom.epil = zext i32 %j.0.in21.epil to i64
%arrayidx.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom.epil
store i32 %2, ptr %arrayidx.epil, align 4, !tbaa !5
store i32 %.pre.epil, ptr %arrayidx3.epil, align 4, !tbaa !5
%cmp1.epil = icmp sgt i32 %j.0.in21.epil, 1
br i1 %cmp1.epil, label %land.rhs.epil, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %while.body.epil, %land.rhs.epil, %entry
ret void
land.rhs: ; preds = %while.cond.preheader, %while.body
%j.0.in21 = phi i32 [ %i.024, %while.cond.preheader ], [ %j.022, %while.body ]
%j.022 = add nsw i32 %j.0.in21, -1
%idxprom2 = zext i32 %j.022 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %.pre, %3
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom = zext i32 %j.0.in21 to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
store i32 %.pre, ptr %arrayidx3, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %j.0.in21, 1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %land.rhs
%inc = add nuw nsw i32 %i.024, 1
%idxprom.phi.trans.insert.1 = zext i32 %inc to i64
%arrayidx.phi.trans.insert.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom.phi.trans.insert.1
%.pre.1 = load i32, ptr %arrayidx.phi.trans.insert.1, align 4, !tbaa !5
br label %land.rhs.1
land.rhs.1: ; preds = %while.body.1, %while.end
%j.0.in21.1 = phi i32 [ %inc, %while.end ], [ %j.022.1, %while.body.1 ]
%j.022.1 = add nsw i32 %j.0.in21.1, -1
%idxprom2.1 = zext i32 %j.022.1 to i64
%arrayidx3.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom2.1
%4 = load i32, ptr %arrayidx3.1, align 4, !tbaa !5
%cmp4.1 = icmp sgt i32 %.pre.1, %4
br i1 %cmp4.1, label %while.body.1, label %while.end.1
while.body.1: ; preds = %land.rhs.1
%idxprom.1 = zext i32 %j.0.in21.1 to i64
%arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom.1
store i32 %4, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %.pre.1, ptr %arrayidx3.1, align 4, !tbaa !5
%cmp1.1 = icmp sgt i32 %j.0.in21.1, 1
br i1 %cmp1.1, label %land.rhs.1, label %while.end.1, !llvm.loop !9
while.end.1: ; preds = %while.body.1, %land.rhs.1
%inc.1 = add nuw nsw i32 %i.024, 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.cond.cleanup.loopexit.unr-lcssa, label %while.cond.preheader, !llvm.loop !11
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%count = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %count)
%0 = load i32, ptr %count, 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 %count, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %3, 0
br i1 %cmp27, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp429 = icmp sgt i32 %4, 1
br i1 %cmp429, label %while.cond.preheader.preheader, label %for.cond.cleanup5
while.cond.preheader.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %4 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.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %count, 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.cond3.preheader, !llvm.loop !12
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %while.end
%indvars.iv35 = phi i64 [ 1, %while.cond.preheader.preheader ], [ %indvars.iv.next36, %while.end ]
%result.030 = phi i32 [ 1, %while.cond.preheader.preheader ], [ %spec.select, %while.end ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv35
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
br label %while.cond
for.cond.cleanup5: ; preds = %while.end, %entry, %for.cond3.preheader
%result.0.lcssa = phi i32 [ 1, %for.cond3.preheader ], [ 1, %entry ], [ %spec.select, %while.end ]
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %result.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #6
ret i32 0
while.cond: ; preds = %while.cond.preheader, %land.rhs
%indvars.iv37 = phi i64 [ %indvars.iv35, %while.cond.preheader ], [ %8, %land.rhs ]
%7 = icmp sgt i64 %indvars.iv37, 0
br i1 %7, label %land.rhs, label %while.end
land.rhs: ; preds = %while.cond
%8 = add nsw i64 %indvars.iv37, -1
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %8
%9 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12.not = icmp slt i32 %6, %9
br i1 %cmp12.not, label %while.end.split.loop.exit44, label %while.cond, !llvm.loop !13
while.end.split.loop.exit44: ; preds = %land.rhs
%10 = trunc i64 %indvars.iv37 to i32
br label %while.end
while.end: ; preds = %while.cond, %while.end.split.loop.exit44
%j.0.in.lcssa = phi i32 [ %10, %while.end.split.loop.exit44 ], [ 0, %while.cond ]
%cmp13 = icmp slt i32 %j.0.in.lcssa, 1
%inc14 = zext i1 %cmp13 to i32
%spec.select = add nuw nsw i32 %result.030, %inc14
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%exitcond.not = icmp eq i64 %indvars.iv.next36, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %while.cond.preheader, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
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(){
int sum=0,N,H,i,max=0;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&H);
if(H>=max){
sum++;
max=H;
}
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275562/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275562/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:
%N = alloca i32, align 4
%H = 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 %H) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%max.011 = phi i32 [ %spec.select7, %for.body ], [ 0, %entry ]
%i.010 = phi i32 [ %inc3, %for.body ], [ 0, %entry ]
%sum.09 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H)
%1 = load i32, ptr %H, align 4, !tbaa !5
%cmp2.not = icmp sge i32 %1, %max.011
%inc = zext i1 %cmp2.not to i32
%spec.select = add nuw nsw i32 %sum.09, %inc
%spec.select7 = call i32 @llvm.smax.i32(i32 %1, i32 %max.011)
%inc3 = add nuw nsw i32 %i.010, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc3, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #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.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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int N,i,j,sum=1;
int flag;
scanf("%d", &N);
int H[N];
for(i=0;i<N;i++){
scanf("%d", &H[i]);
}
for(i=1;i<N;i++){
flag=0;
for(j=0;j<i;j++){
if(H[j]>H[i]){
flag = 1;
break;
}
}
if(flag==0) sum++;
}
printf("%d",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275605/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275605/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
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
%cmp33 = icmp sgt i32 %3, 0
br i1 %cmp33, label %for.body, label %for.end22
for.cond2.preheader: ; preds = %for.body
%cmp337 = icmp sgt i32 %5, 1
br i1 %cmp337, label %for.cond5.preheader.preheader, label %for.end22
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%wide.trip.count48 = zext i32 %5 to i64
%4 = load i32, ptr %vla, align 16, !tbaa !5
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 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
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.end15
%indvars.iv45 = phi i64 [ 1, %for.cond5.preheader.preheader ], [ %indvars.iv.next46, %for.end15 ]
%sum.038 = phi i32 [ 1, %for.cond5.preheader.preheader ], [ %spec.select, %for.end15 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv45
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp1252 = icmp sgt i32 %4, %7
br i1 %cmp1252, label %for.end15, label %for.cond5
for.cond5: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv4353 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ 0, %for.cond5.preheader ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv4353, 1
%exitcond = icmp eq i64 %indvars.iv.next44, %indvars.iv45
br i1 %exitcond, label %for.end15.loopexit, label %for.body7, !llvm.loop !11
for.body7: ; preds = %for.cond5
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next44
%8 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %8, %7
br i1 %cmp12, label %for.end15.loopexit, label %for.cond5, !llvm.loop !11
for.end15.loopexit: ; preds = %for.body7, %for.cond5
%cmp6.not.le = icmp uge i64 %indvars.iv.next44, %indvars.iv45
br label %for.end15
for.end15: ; preds = %for.end15.loopexit, %for.cond5.preheader
%cmp6.not.lcssa = phi i1 [ false, %for.cond5.preheader ], [ %cmp6.not.le, %for.end15.loopexit ]
%inc18 = zext i1 %cmp6.not.lcssa to i32
%spec.select = add nuw nsw i32 %sum.038, %inc18
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond49.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count48
br i1 %exitcond49.not, label %for.end22, label %for.cond5.preheader, !llvm.loop !12
for.end22: ; preds = %for.end15, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 1, %for.cond2.preheader ], [ 1, %entry ], [ %spec.select, %for.end15 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
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}
|
#include <stdio.h>
int main() {
int n,h[20],i;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&h[i]);
int cnt=1,max=h[0];
for(i=1;i<n;i++){
if(h[i-1] <=h[i] && max<=h[i]){
cnt++;
max=h[i];
}
}
printf("%d\n",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275649/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275649/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:
%n = alloca i32, align 4
%h = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %h) #3
%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 %for.end19
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %h, 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 !9
for.end: ; preds = %for.body
%cmp432 = icmp sgt i32 %1, 1
br i1 %cmp432, label %for.body5.preheader, label %for.end19
for.body5.preheader: ; preds = %for.end
%.pre = load i32, ptr %h, align 16, !tbaa !5
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %3, 1
%4 = icmp eq i32 %1, 2
br i1 %4, label %for.end19.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %3, -2
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%5 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %7, %for.body5 ]
%indvars.iv39 = phi i64 [ 1, %for.body5.preheader.new ], [ %indvars.iv.next40.1, %for.body5 ]
%max.035 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %max.1.1, %for.body5 ]
%cnt.034 = phi i32 [ 1, %for.body5.preheader.new ], [ %cnt.1.1, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ]
%arrayidx9 = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv39
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not = icmp sle i32 %5, %6
%cmp13.not = icmp sle i32 %max.035, %6
%or.cond.not = select i1 %cmp10.not, i1 %cmp13.not, i1 false
%inc14 = zext i1 %or.cond.not to i32
%cnt.1 = add nuw nsw i32 %cnt.034, %inc14
%max.1 = select i1 %or.cond.not, i32 %6, i32 %max.035
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx9.1 = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv.next40
%7 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%cmp10.not.1 = icmp sle i32 %6, %7
%cmp13.not.1 = icmp sle i32 %max.1, %7
%or.cond.not.1 = select i1 %cmp10.not.1, i1 %cmp13.not.1, i1 false
%inc14.1 = zext i1 %or.cond.not.1 to i32
%cnt.1.1 = add nuw nsw i32 %cnt.1, %inc14.1
%max.1.1 = select i1 %or.cond.not.1, i32 %7, i32 %max.1
%indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39, 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.end19.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11
for.end19.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%cnt.1.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %cnt.1.1, %for.body5 ]
%.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %7, %for.body5 ]
%indvars.iv39.unr = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next40.1, %for.body5 ]
%max.035.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %max.1.1, %for.body5 ]
%cnt.034.unr = phi i32 [ 1, %for.body5.preheader ], [ %cnt.1.1, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end19, label %for.body5.epil
for.body5.epil: ; preds = %for.end19.loopexit.unr-lcssa
%arrayidx9.epil = getelementptr inbounds [20 x i32], ptr %h, i64 0, i64 %indvars.iv39.unr
%8 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
%cmp10.not.epil = icmp sle i32 %.unr, %8
%cmp13.not.epil = icmp sle i32 %max.035.unr, %8
%or.cond.not.epil = select i1 %cmp10.not.epil, i1 %cmp13.not.epil, i1 false
%inc14.epil = zext i1 %or.cond.not.epil to i32
%cnt.1.epil = add nuw nsw i32 %cnt.034.unr, %inc14.epil
br label %for.end19
for.end19: ; preds = %for.body5.epil, %for.end19.loopexit.unr-lcssa, %entry, %for.end
%cnt.0.lcssa = phi i32 [ 1, %for.end ], [ 1, %entry ], [ %cnt.1.lcssa.ph, %for.end19.loopexit.unr-lcssa ], [ %cnt.1.epil, %for.body5.epil ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %h) #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>
#include<stdlib.h>
#include<math.h>
int main()
{int t,a=0;
scanf("%d",&t);
char s[5];
while(t--){
//int a=0;
scanf("%s",s);
if(s[1]=='+')
a++;
else
a--;
}
printf("%d\n",a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2757/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2757/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
@.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:
%t = alloca i32, align 4
%s = alloca [5 x i8], align 1
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)
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #3
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec7 = add nsw i32 %0, -1
store i32 %dec7, ptr %t, align 4, !tbaa !5
%tobool.not8 = icmp eq i32 %0, 0
br i1 %tobool.not8, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%a.09 = phi i32 [ 0, %while.body.lr.ph ], [ %a.1, %while.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp = icmp eq i8 %1, 43
%a.1.v = select i1 %cmp, i32 1, i32 -1
%a.1 = add nsw i32 %a.1.v, %a.09
%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 !10
while.end: ; preds = %while.body, %entry
%a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1, %while.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %a.0.lcssa)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #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"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
int h[n],max,count;
max = 0;
count = 0;
for(int i = 0; i < n; ++i){
scanf("%d",&h[i]);
if(h[i] >= max){
max = h[i];
count++;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275742/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275742/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:
%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
%cmp15 = icmp sgt i32 %3, 0
br i1 %cmp15, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select14, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%count.017 = phi i32 [ %spec.select14, %for.body ], [ 0, %entry ]
%max.016 = phi i32 [ %spec.select, %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)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4.not = icmp sge i32 %4, %max.016
%spec.select = call i32 @llvm.smax.i32(i32 %4, i32 %max.016)
%inc = zext i1 %cmp4.not to i32
%spec.select14 = add nuw nsw i32 %count.017, %inc
%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.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
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}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define INRANGE(a,b,c) ((a<=b)&&(b<=c)?(1):(0))
int h,w;
int map[100][100];
int count;
void walk(int x,int y){
map[x][y]=2;
if(INRANGE(0,x-1,h-1)&&map[x-1][y]==1) walk(x-1,y);
if(INRANGE(0,x+1,h-1)<h&&map[x+1][y]==1) walk(x+1,y);
if(INRANGE(0,y-1,w-1)&&map[x][y-1]==1) walk(x,y-1);
if(INRANGE(0,y+1,w-1)&&map[x][y+1]==1) walk(x,y+1);
if(INRANGE(0,x-1,h-1)&&INRANGE(0,y-1,w-1)&&map[x-1][y-1]==1) walk(x-1,y-1);
if(INRANGE(0,x+1,h-1)&&INRANGE(0,y-1,w-1)&&map[x+1][y-1]==1) walk(x+1,y-1);
if(INRANGE(0,x+1,h-1)&&INRANGE(0,y+1,w-1)&&map[x+1][y+1]==1) walk(x+1,y+1);
if(INRANGE(0,x-1,h-1)&&INRANGE(0,y+1,w-1)&&map[x-1][y+1]==1) walk(x-1,y+1);
}
int main(void){
int i,j;
while(scanf("%d%d",&w,&h),w||h){
count=0;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
scanf("%d",&map[i][j]);
}
}
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if(map[i][j]==1){
walk(i,j);
count++;
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275786/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275786/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"
@map = dso_local global [100 x [100 x i32]] zeroinitializer, align 16
@h = dso_local global i32 0, align 4
@w = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@count = dso_local local_unnamed_addr global i32 0, align 4
@.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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @walk(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%0 = sext i32 %x to i64
%.pre = load i32, ptr @h, align 4
br label %tailrecurse
tailrecurse: ; preds = %land.lhs.true169, %entry
%1 = phi i32 [ %34, %land.lhs.true169 ], [ %.pre, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %land.lhs.true169 ], [ %0, %entry ]
%y.tr = phi i32 [ %add47253278, %land.lhs.true169 ], [ %y, %entry ]
%idxprom1 = sext i32 %y.tr to i64
%arrayidx2 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %indvars.iv, i64 %idxprom1
store i32 2, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp = icmp slt i64 %indvars.iv, 1
%2 = sext i32 %1 to i64
%cmp5.not = icmp sgt i64 %indvars.iv, %2
%or.cond = select i1 %cmp, i1 true, i1 %cmp5.not
br i1 %or.cond, label %if.end, label %land.lhs.true6
land.lhs.true6: ; preds = %tailrecurse
%idxprom8 = and i64 %indvars.iv.next, 4294967295
%arrayidx11 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %idxprom8, i64 %idxprom1
%3 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %3, 1
br i1 %cmp12, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true6
%4 = trunc i64 %indvars.iv.next to i32
tail call void @walk(i32 noundef %4, i32 noundef %y.tr)
%.pre258 = load i32, ptr @h, align 4
br label %if.end
if.end: ; preds = %tailrecurse, %if.then, %land.lhs.true6
%5 = phi i32 [ %1, %tailrecurse ], [ %.pre258, %if.then ], [ %1, %land.lhs.true6 ]
%6 = add nsw i64 %indvars.iv, 1
%cmp14 = icmp sgt i64 %indvars.iv, -2
%sub16 = add nsw i32 %5, -1
%7 = sext i32 %sub16 to i64
%cmp17 = icmp slt i64 %indvars.iv, %7
%8 = select i1 %cmp14, i1 %cmp17, i1 false
%cond = zext i1 %8 to i32
%cmp18 = icmp sgt i32 %5, %cond
br i1 %cmp18, label %land.lhs.true19, label %if.end28
land.lhs.true19: ; preds = %if.end
%arrayidx24 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %6, i64 %idxprom1
%9 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp25 = icmp eq i32 %9, 1
br i1 %cmp25, label %if.then26, label %if.end28
if.then26: ; preds = %land.lhs.true19
%10 = trunc i64 %6 to i32
tail call void @walk(i32 noundef %10, i32 noundef %y.tr)
br label %if.end28
if.end28: ; preds = %if.then26, %land.lhs.true19, %if.end
%sub29 = add nsw i32 %y.tr, -1
%cmp30 = icmp slt i32 %y.tr, 1
%11 = load i32, ptr @w, align 4
%cmp34.not = icmp slt i32 %11, %y.tr
%or.cond237 = select i1 %cmp30, i1 true, i1 %cmp34.not
br i1 %or.cond237, label %if.end46, label %land.lhs.true37
land.lhs.true37: ; preds = %if.end28
%idxprom41 = zext i32 %sub29 to i64
%arrayidx42 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %indvars.iv, i64 %idxprom41
%12 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%cmp43 = icmp eq i32 %12, 1
br i1 %cmp43, label %if.then44, label %if.end46.thread
if.then44: ; preds = %land.lhs.true37
%13 = trunc i64 %indvars.iv to i32
tail call void @walk(i32 noundef %13, i32 noundef %sub29)
%.pre259.pre = load i32, ptr @w, align 4
br label %if.end46.thread
if.end46.thread: ; preds = %if.then44, %land.lhs.true37
%.pre259 = phi i32 [ %.pre259.pre, %if.then44 ], [ %11, %land.lhs.true37 ]
%add47250 = add nuw nsw i32 %y.tr, 1
br label %land.lhs.true49
if.end46: ; preds = %if.end28
%add47 = add nsw i32 %y.tr, 1
%cmp48 = icmp sgt i32 %y.tr, -2
br i1 %cmp48, label %land.lhs.true49, label %if.end64.thread
if.end64.thread: ; preds = %if.end46
%14 = load i32, ptr @h, align 4
br label %if.end93
land.lhs.true49: ; preds = %if.end46.thread, %if.end46
%15 = phi i32 [ %.pre259, %if.end46.thread ], [ %11, %if.end46 ]
%add47252 = phi i32 [ %add47250, %if.end46.thread ], [ %add47, %if.end46 ]
%sub51 = add nsw i32 %15, -1
%cmp52.not.not = icmp sgt i32 %sub51, %y.tr
br i1 %cmp52.not.not, label %land.lhs.true55, label %if.end64
land.lhs.true55: ; preds = %land.lhs.true49
%idxprom59 = zext i32 %add47252 to i64
%arrayidx60 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %indvars.iv, i64 %idxprom59
%16 = load i32, ptr %arrayidx60, align 4, !tbaa !5
%cmp61 = icmp eq i32 %16, 1
br i1 %cmp61, label %if.then62, label %if.end64
if.then62: ; preds = %land.lhs.true55
%17 = trunc i64 %indvars.iv to i32
tail call void @walk(i32 noundef %17, i32 noundef %add47252)
%.pre260 = load i32, ptr @w, align 4
br label %if.end64
if.end64: ; preds = %land.lhs.true49, %if.then62, %land.lhs.true55
%18 = phi i32 [ %15, %land.lhs.true49 ], [ %.pre260, %if.then62 ], [ %15, %land.lhs.true55 ]
%19 = load i32, ptr @h, align 4
%20 = sext i32 %19 to i64
%cmp70.not = icmp sgt i64 %indvars.iv, %20
%or.cond239 = select i1 %cmp, i1 true, i1 %cmp70.not
%brmerge = or i1 %cmp30, %or.cond239
%cmp79.not = icmp slt i32 %18, %y.tr
%or.cond241 = select i1 %brmerge, i1 true, i1 %cmp79.not
br i1 %or.cond241, label %if.end93, label %land.lhs.true82
land.lhs.true82: ; preds = %if.end64
%idxprom84 = and i64 %indvars.iv.next, 4294967295
%idxprom87 = zext i32 %sub29 to i64
%arrayidx88 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %idxprom84, i64 %idxprom87
%21 = load i32, ptr %arrayidx88, align 4, !tbaa !5
%cmp89 = icmp eq i32 %21, 1
br i1 %cmp89, label %if.then90, label %land.lhs.true96
if.then90: ; preds = %land.lhs.true82
%22 = trunc i64 %indvars.iv.next to i32
tail call void @walk(i32 noundef %22, i32 noundef %sub29)
%.pre261 = load i32, ptr @h, align 4
%.pre262 = load i32, ptr @w, align 4
br label %land.lhs.true96
if.end93: ; preds = %if.end64.thread, %if.end64
%23 = phi i32 [ %14, %if.end64.thread ], [ %19, %if.end64 ]
%add47253279 = phi i32 [ %add47, %if.end64.thread ], [ %add47252, %if.end64 ]
%cmp48254277 = phi i1 [ true, %if.end64.thread ], [ false, %if.end64 ]
%24 = phi i32 [ %11, %if.end64.thread ], [ %18, %if.end64 ]
br i1 %cmp14, label %land.lhs.true96, label %if.end180
land.lhs.true96: ; preds = %land.lhs.true82, %if.then90, %if.end93
%add47253278 = phi i32 [ %add47252, %land.lhs.true82 ], [ %add47252, %if.then90 ], [ %add47253279, %if.end93 ]
%cmp48254276 = phi i1 [ false, %land.lhs.true82 ], [ false, %if.then90 ], [ %cmp48254277, %if.end93 ]
%25 = phi i32 [ %18, %land.lhs.true82 ], [ %.pre262, %if.then90 ], [ %24, %if.end93 ]
%26 = phi i32 [ %19, %land.lhs.true82 ], [ %.pre261, %if.then90 ], [ %23, %if.end93 ]
%sub98 = add nsw i32 %26, -1
%27 = sext i32 %sub98 to i64
%cmp99.not.not = icmp sge i64 %indvars.iv, %27
%brmerge243 = or i1 %cmp30, %cmp99.not.not
%cmp108.not = icmp slt i32 %25, %y.tr
%or.cond244 = select i1 %brmerge243, i1 true, i1 %cmp108.not
br i1 %or.cond244, label %land.lhs.true125, label %land.lhs.true111
land.lhs.true111: ; preds = %land.lhs.true96
%idxprom113 = and i64 %6, 4294967295
%idxprom116 = zext i32 %sub29 to i64
%arrayidx117 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %idxprom113, i64 %idxprom116
%28 = load i32, ptr %arrayidx117, align 4, !tbaa !5
%cmp118 = icmp eq i32 %28, 1
br i1 %cmp118, label %if.then119, label %land.lhs.true125
if.then119: ; preds = %land.lhs.true111
%29 = trunc i64 %6 to i32
tail call void @walk(i32 noundef %29, i32 noundef %sub29)
%.pre263 = load i32, ptr @h, align 4
%.pre266 = add nsw i32 %.pre263, -1
%.pre267 = sext i32 %.pre266 to i64
br label %land.lhs.true125
land.lhs.true125: ; preds = %land.lhs.true111, %if.then119, %land.lhs.true96
%.pre-phi = phi i64 [ %27, %land.lhs.true111 ], [ %.pre267, %if.then119 ], [ %27, %land.lhs.true96 ]
%30 = phi i32 [ %26, %land.lhs.true111 ], [ %.pre263, %if.then119 ], [ %26, %land.lhs.true96 ]
%cmp128.not.not = icmp sle i64 %.pre-phi, %indvars.iv
%brmerge245 = or i1 %cmp48254276, %cmp128.not.not
br i1 %brmerge245, label %if.end151, label %land.lhs.true134
land.lhs.true134: ; preds = %land.lhs.true125
%31 = load i32, ptr @w, align 4, !tbaa !5
%sub136 = add nsw i32 %31, -1
%cmp137.not.not = icmp sgt i32 %sub136, %y.tr
br i1 %cmp137.not.not, label %land.lhs.true140, label %if.end151
land.lhs.true140: ; preds = %land.lhs.true134
%idxprom142 = and i64 %6, 4294967295
%idxprom145 = zext i32 %add47253278 to i64
%arrayidx146 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %idxprom142, i64 %idxprom145
%32 = load i32, ptr %arrayidx146, align 4, !tbaa !5
%cmp147 = icmp eq i32 %32, 1
br i1 %cmp147, label %if.then148, label %if.end151
if.then148: ; preds = %land.lhs.true140
%33 = trunc i64 %6 to i32
tail call void @walk(i32 noundef %33, i32 noundef %add47253278)
%.pre264 = load i32, ptr @h, align 4
br label %if.end151
if.end151: ; preds = %land.lhs.true125, %land.lhs.true134, %if.then148, %land.lhs.true140
%34 = phi i32 [ %30, %land.lhs.true125 ], [ %30, %land.lhs.true134 ], [ %.pre264, %if.then148 ], [ %30, %land.lhs.true140 ]
%35 = sext i32 %34 to i64
%cmp157.not = icmp sgt i64 %indvars.iv, %35
%or.cond247 = select i1 %cmp, i1 true, i1 %cmp157.not
%brmerge249 = or i1 %cmp48254276, %or.cond247
br i1 %brmerge249, label %if.end180, label %land.lhs.true163
land.lhs.true163: ; preds = %if.end151
%36 = load i32, ptr @w, align 4, !tbaa !5
%sub165 = add nsw i32 %36, -1
%cmp166.not.not = icmp sgt i32 %sub165, %y.tr
br i1 %cmp166.not.not, label %land.lhs.true169, label %if.end180
land.lhs.true169: ; preds = %land.lhs.true163
%idxprom171 = and i64 %indvars.iv.next, 4294967295
%idxprom174 = zext i32 %add47253278 to i64
%arrayidx175 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %idxprom171, i64 %idxprom174
%37 = load i32, ptr %arrayidx175, align 4, !tbaa !5
%cmp176 = icmp eq i32 %37, 1
br i1 %cmp176, label %tailrecurse, label %if.end180
if.end180: ; preds = %if.end151, %land.lhs.true163, %land.lhs.true169, %if.end93
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call50 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%0 = load i32, ptr @w, align 4, !tbaa !5
%tobool51 = icmp ne i32 %0, 0
%1 = load i32, ptr @h, align 4
%tobool152 = icmp ne i32 %1, 0
%2 = select i1 %tobool51, i1 true, i1 %tobool152
br i1 %2, label %while.body, label %while.end
while.body: ; preds = %entry, %for.end28
%3 = phi i32 [ %29, %for.end28 ], [ %0, %entry ]
%4 = phi i32 [ %30, %for.end28 ], [ %1, %entry ]
store i32 0, ptr @count, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %4, 0
%5 = icmp sgt i32 %3, 0
%or.cond = and i1 %cmp44, %5
br i1 %or.cond, label %for.cond2.preheader, label %for.end28
for.cond11.preheader: ; preds = %for.inc8
%cmp1248 = icmp sgt i32 %11, 0
%6 = icmp sgt i32 %12, 0
%or.cond73 = and i1 %cmp1248, %6
br i1 %or.cond73, label %for.cond14.preheader, label %for.end28
for.cond2.preheader: ; preds = %while.body, %for.inc8
%7 = phi i32 [ %11, %for.inc8 ], [ %4, %while.body ]
%8 = phi i32 [ %12, %for.inc8 ], [ %3, %while.body ]
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.inc8 ], [ 0, %while.body ]
%cmp342 = icmp sgt i32 %8, 0
br i1 %cmp342, label %for.body4, label %for.inc8
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %indvars.iv56, i64 %indvars.iv
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr @w, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp3, label %for.body4, label %for.inc8.loopexit, !llvm.loop !9
for.inc8.loopexit: ; preds = %for.body4
%.pre = load i32, ptr @h, align 4, !tbaa !5
br label %for.inc8
for.inc8: ; preds = %for.inc8.loopexit, %for.cond2.preheader
%11 = phi i32 [ %.pre, %for.inc8.loopexit ], [ %7, %for.cond2.preheader ]
%12 = phi i32 [ %9, %for.inc8.loopexit ], [ %8, %for.cond2.preheader ]
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%13 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next57, %13
br i1 %cmp, label %for.cond2.preheader, label %for.cond11.preheader, !llvm.loop !11
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.inc26
%14 = phi i32 [ %24, %for.inc26 ], [ %11, %for.cond11.preheader ]
%15 = phi i32 [ %25, %for.inc26 ], [ %12, %for.cond11.preheader ]
%16 = phi i32 [ %26, %for.inc26 ], [ %12, %for.cond11.preheader ]
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.inc26 ], [ 0, %for.cond11.preheader ]
%cmp1546 = icmp sgt i32 %16, 0
br i1 %cmp1546, label %for.body16.lr.ph, label %for.inc26
for.body16.lr.ph: ; preds = %for.cond14.preheader
%17 = trunc i64 %indvars.iv62 to i32
br label %for.body16
for.body16: ; preds = %for.body16.lr.ph, %for.inc23
%18 = phi i32 [ %15, %for.body16.lr.ph ], [ %22, %for.inc23 ]
%indvars.iv59 = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next60, %for.inc23 ]
%arrayidx20 = getelementptr inbounds [100 x [100 x i32]], ptr @map, i64 0, i64 %indvars.iv62, i64 %indvars.iv59
%19 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %19, 1
br i1 %cmp21, label %if.then, label %for.inc23
if.then: ; preds = %for.body16
%20 = trunc i64 %indvars.iv59 to i32
tail call void @walk(i32 noundef %17, i32 noundef %20)
%21 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %21, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%.pre65 = load i32, ptr @w, align 4, !tbaa !5
br label %for.inc23
for.inc23: ; preds = %for.body16, %if.then
%22 = phi i32 [ %18, %for.body16 ], [ %.pre65, %if.then ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%23 = sext i32 %22 to i64
%cmp15 = icmp slt i64 %indvars.iv.next60, %23
br i1 %cmp15, label %for.body16, label %for.inc26.loopexit, !llvm.loop !13
for.inc26.loopexit: ; preds = %for.inc23
%.pre66 = load i32, ptr @h, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %for.inc26.loopexit, %for.cond14.preheader
%24 = phi i32 [ %.pre66, %for.inc26.loopexit ], [ %14, %for.cond14.preheader ]
%25 = phi i32 [ %22, %for.inc26.loopexit ], [ %15, %for.cond14.preheader ]
%26 = phi i32 [ %22, %for.inc26.loopexit ], [ %16, %for.cond14.preheader ]
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%27 = sext i32 %24 to i64
%cmp12 = icmp slt i64 %indvars.iv.next63, %27
br i1 %cmp12, label %for.cond14.preheader, label %for.end28, !llvm.loop !14
for.end28: ; preds = %for.inc26, %while.body, %for.cond11.preheader
%28 = load i32, ptr @count, align 4, !tbaa !5
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%29 = load i32, ptr @w, align 4, !tbaa !5
%tobool = icmp ne i32 %29, 0
%30 = load i32, ptr @h, align 4
%tobool1 = icmp ne i32 %30, 0
%31 = select i1 %tobool, i1 true, i1 %tobool1
br i1 %31, label %while.body, label %while.end, !llvm.loop !15
while.end: ; preds = %for.end28, %entry
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, 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 = { 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" }
!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, !12}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int width,height;
int map[50][50];
void visit(int x,int y) {
int i,j;
if(x<0 || x>=width || y<0 || y>=height)return;
if(map[y][x]==0)return;
map[y][x]=0;
for(i=-1;i<=1;i++) {
for(j=-1;j<=1;j++)visit(x+i,y+j);
}
}
int main(void) {
int i,j;
int result;
while(1) {
scanf("%d%d",&width,&height);
if(width==0 && height==0)break;
for(i=0;i<height;i++) {
for(j=0;j<width;j++)scanf("%d",&map[i][j]);
}
result=0;
for(i=0;i<height;i++) {
for(j=0;j<width;j++) {
if(map[i][j]) {
result++;
visit(j,i);
}
}
}
printf("%d\n",result);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275843/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"
@width = dso_local global i32 0, align 4
@height = dso_local global i32 0, align 4
@map = dso_local global [50 x [50 x i32]] zeroinitializer, align 16
@.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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @visit(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end10, %entry
%x.tr = phi i32 [ %x, %entry ], [ %add.2, %if.end10 ]
%y.tr = phi i32 [ %y, %entry ], [ %add19.2, %if.end10 ]
%cmp = icmp slt i32 %x.tr, 0
br i1 %cmp, label %cleanup, label %lor.lhs.false
lor.lhs.false: ; preds = %tailrecurse
%0 = load i32, ptr @width, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, %x.tr
%cmp3 = icmp sgt i32 %y.tr, -1
%or.cond.not37 = and i1 %cmp3, %cmp1
%1 = load i32, ptr @height, align 4
%cmp5.not = icmp sgt i32 %1, %y.tr
%or.cond36 = select i1 %or.cond.not37, i1 %cmp5.not, i1 false
br i1 %or.cond36, label %if.end, label %cleanup
if.end: ; preds = %lor.lhs.false
%idxprom = zext i32 %y.tr to i64
%idxprom6 = zext i32 %x.tr to i64
%arrayidx7 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %idxprom, i64 %idxprom6
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp eq i32 %2, 0
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end
store i32 0, ptr %arrayidx7, align 4, !tbaa !5
%add19 = add nsw i32 %y.tr, -1
%add = add nsw i32 %x.tr, -1
tail call void @visit(i32 noundef %add, i32 noundef %add19)
tail call void @visit(i32 noundef %add, i32 noundef %y.tr)
%add19.2 = add nuw nsw i32 %y.tr, 1
tail call void @visit(i32 noundef %add, i32 noundef %add19.2)
tail call void @visit(i32 noundef %x.tr, i32 noundef %add19)
tail call void @visit(i32 noundef %x.tr, i32 noundef %y.tr)
tail call void @visit(i32 noundef %x.tr, i32 noundef %add19.2)
%add.2 = add nuw nsw i32 %x.tr, 1
tail call void @visit(i32 noundef %add.2, i32 noundef %add19)
tail call void @visit(i32 noundef %add.2, i32 noundef %y.tr)
br label %tailrecurse
cleanup: ; preds = %if.end, %tailrecurse, %lor.lhs.false
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call56 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @width, ptr noundef nonnull @height)
%0 = load i32, ptr @width, align 4, !tbaa !5
%cmp57 = icmp eq i32 %0, 0
%1 = load i32, ptr @height, align 4
%cmp158 = icmp eq i32 %1, 0
%or.cond59 = select i1 %cmp57, i1 %cmp158, i1 false
br i1 %or.cond59, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end30
%2 = phi i32 [ %26, %for.end30 ], [ %0, %entry ]
%3 = phi i32 [ %27, %for.end30 ], [ %1, %entry ]
%cmp247 = icmp sgt i32 %3, 0
%4 = icmp sgt i32 %2, 0
%or.cond80 = and i1 %cmp247, %4
br i1 %or.cond80, label %for.cond3.preheader, label %for.end30
for.cond12.preheader: ; preds = %for.inc9
%cmp1352 = icmp sgt i32 %10, 0
%5 = icmp sgt i32 %11, 0
%or.cond81 = and i1 %cmp1352, %5
br i1 %or.cond81, label %for.cond15.preheader, label %for.end30
for.cond3.preheader: ; preds = %for.cond.preheader, %for.inc9
%6 = phi i32 [ %10, %for.inc9 ], [ %3, %for.cond.preheader ]
%7 = phi i32 [ %11, %for.inc9 ], [ %2, %for.cond.preheader ]
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc9 ], [ 0, %for.cond.preheader ]
%cmp445 = icmp sgt i32 %7, 0
br i1 %cmp445, label %for.body5, label %for.inc9
for.body5: ; preds = %for.cond3.preheader, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %indvars.iv63, i64 %indvars.iv
%call8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr @width, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp4, label %for.body5, label %for.inc9.loopexit, !llvm.loop !9
for.inc9.loopexit: ; preds = %for.body5
%.pre = load i32, ptr @height, align 4, !tbaa !5
br label %for.inc9
for.inc9: ; preds = %for.inc9.loopexit, %for.cond3.preheader
%10 = phi i32 [ %.pre, %for.inc9.loopexit ], [ %6, %for.cond3.preheader ]
%11 = phi i32 [ %8, %for.inc9.loopexit ], [ %7, %for.cond3.preheader ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%12 = sext i32 %10 to i64
%cmp2 = icmp slt i64 %indvars.iv.next64, %12
br i1 %cmp2, label %for.cond3.preheader, label %for.cond12.preheader, !llvm.loop !11
for.cond15.preheader: ; preds = %for.cond12.preheader, %for.inc28
%13 = phi i32 [ %22, %for.inc28 ], [ %10, %for.cond12.preheader ]
%14 = phi i32 [ %23, %for.inc28 ], [ %11, %for.cond12.preheader ]
%15 = phi i32 [ %24, %for.inc28 ], [ %11, %for.cond12.preheader ]
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.inc28 ], [ 0, %for.cond12.preheader ]
%result.054 = phi i32 [ %result.1.lcssa, %for.inc28 ], [ 0, %for.cond12.preheader ]
%cmp1649 = icmp sgt i32 %15, 0
br i1 %cmp1649, label %for.body17.lr.ph, label %for.inc28
for.body17.lr.ph: ; preds = %for.cond15.preheader
%16 = trunc i64 %indvars.iv69 to i32
br label %for.body17
for.body17: ; preds = %for.body17.lr.ph, %for.inc25
%17 = phi i32 [ %14, %for.body17.lr.ph ], [ %20, %for.inc25 ]
%indvars.iv66 = phi i64 [ 0, %for.body17.lr.ph ], [ %indvars.iv.next67, %for.inc25 ]
%result.151 = phi i32 [ %result.054, %for.body17.lr.ph ], [ %result.2, %for.inc25 ]
%arrayidx21 = getelementptr inbounds [50 x [50 x i32]], ptr @map, i64 0, i64 %indvars.iv69, i64 %indvars.iv66
%18 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%tobool.not = icmp eq i32 %18, 0
br i1 %tobool.not, label %for.inc25, label %if.then22
if.then22: ; preds = %for.body17
%inc23 = add nsw i32 %result.151, 1
%19 = trunc i64 %indvars.iv66 to i32
tail call void @visit(i32 noundef %19, i32 noundef %16)
%.pre72 = load i32, ptr @width, align 4, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %for.body17, %if.then22
%20 = phi i32 [ %.pre72, %if.then22 ], [ %17, %for.body17 ]
%result.2 = phi i32 [ %inc23, %if.then22 ], [ %result.151, %for.body17 ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%21 = sext i32 %20 to i64
%cmp16 = icmp slt i64 %indvars.iv.next67, %21
br i1 %cmp16, label %for.body17, label %for.inc28.loopexit, !llvm.loop !13
for.inc28.loopexit: ; preds = %for.inc25
%.pre73 = load i32, ptr @height, align 4, !tbaa !5
br label %for.inc28
for.inc28: ; preds = %for.inc28.loopexit, %for.cond15.preheader
%22 = phi i32 [ %13, %for.cond15.preheader ], [ %.pre73, %for.inc28.loopexit ]
%23 = phi i32 [ %14, %for.cond15.preheader ], [ %20, %for.inc28.loopexit ]
%24 = phi i32 [ %15, %for.cond15.preheader ], [ %20, %for.inc28.loopexit ]
%result.1.lcssa = phi i32 [ %result.054, %for.cond15.preheader ], [ %result.2, %for.inc28.loopexit ]
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%25 = sext i32 %22 to i64
%cmp13 = icmp slt i64 %indvars.iv.next70, %25
br i1 %cmp13, label %for.cond15.preheader, label %for.end30, !llvm.loop !14
for.end30: ; preds = %for.inc28, %for.cond.preheader, %for.cond12.preheader
%result.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond.preheader ], [ %result.1.lcssa, %for.inc28 ]
%call31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %result.0.lcssa)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @width, ptr noundef nonnull @height)
%26 = load i32, ptr @width, align 4, !tbaa !5
%cmp = icmp eq i32 %26, 0
%27 = load i32, ptr @height, align 4
%cmp1 = icmp eq i32 %27, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end30, %entry
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, 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 = { 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" }
!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, !12}
|
#include <stdio.h>
#include <math.h>
int main(void){
int q;
double x;
while(1){
scanf("%d",&q);
if(q==-1)
break;
x=(double)q/2;
while(fabs(x*x*x-q)>=0.00001*q)
x=x-(x*x*x-q)/(3*x*x);
printf("%f\n",x);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275887/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"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
%call30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%0 = load i32, ptr %q, align 4, !tbaa !5
%cmp31 = icmp eq i32 %0, -1
br i1 %cmp31, label %while.end17, label %if.end
if.end: ; preds = %entry, %while.end
%1 = phi i32 [ %7, %while.end ], [ %0, %entry ]
%conv = sitofp i32 %1 to double
%div = fmul double %conv, 5.000000e-01
%neg = fneg double %conv
%mul5 = fmul double %conv, 1.000000e-05
%mul27 = fmul double %div, %div
%2 = call double @llvm.fmuladd.f64(double %mul27, double %div, double %neg)
%3 = call double @llvm.fabs.f64(double %2)
%cmp628 = fcmp ult double %3, %mul5
br i1 %cmp628, label %while.end, label %while.body8
while.body8: ; preds = %if.end, %while.body8
%4 = phi double [ %5, %while.body8 ], [ %2, %if.end ]
%x.029 = phi double [ %sub, %while.body8 ], [ %div, %if.end ]
%mul13 = fmul double %x.029, 3.000000e+00
%mul14 = fmul double %x.029, %mul13
%div15 = fdiv double %4, %mul14
%sub = fsub double %x.029, %div15
%mul = fmul double %sub, %sub
%5 = call double @llvm.fmuladd.f64(double %mul, double %sub, double %neg)
%6 = call double @llvm.fabs.f64(double %5)
%cmp6 = fcmp ult double %6, %mul5
br i1 %cmp6, label %while.end, label %while.body8, !llvm.loop !9
while.end: ; preds = %while.body8, %if.end
%x.0.lcssa = phi double [ %div, %if.end ], [ %sub, %while.body8 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%7 = load i32, ptr %q, align 4, !tbaa !5
%cmp = icmp eq i32 %7, -1
br i1 %cmp, label %while.end17, label %if.end
while.end17: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #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 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}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<math.h>
#include<string.h>
typedef int64_t i64;
typedef int32_t i32;
static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))
#define SORT(a,n,cmp) msort((a),(n),sizeof(*(a)),cmp)
int is_prime (i32 n) {
if (n <= 1) return 0;
for (i32 k = 2; k * k <= n; ++k) {
if (n % k == 0) return 0;
}
return 1;
}
void test (void) {
for (i32 n = 3; n <= 1000; ++n) {
if (is_prime (n)) continue;
i32 e = n + 1;
while (!is_prime (e)) ++e;
i32 d = e - n;
printf ("%" PRIi32 " %" PRIi32 "\n", n, e);
if (2 * d > n) {
printf ("%" PRIi32 "\n", n);
}
}
}
void run (void) {
i32 n = read_int();
i32 e = n;
while (!is_prime (e)) ++e;
print_int (e);
puts ("");
for (i32 i = 1; i <= n; ++i) {
print_int (i);
putchar (' ');
print_int (i + 1 <= n ? i + 1 : 1);
puts ("");
e--;
}
for (i32 i = 1; e > 0; ++i, --e) {
print_int (i);
putchar (' ');
print_int (i + n / 2);
puts ("");
}
}
int main (void) {
run ();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27593/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27593/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"%i %i\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%i\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(none) uwtable
define dso_local i32 @is_prime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %n, 2
br i1 %cmp, label %return, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp1.not10 = icmp ult i32 %n, 4
br i1 %cmp1.not10, label %return, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %k.011, 1
%mul = mul nsw i32 %inc, %inc
%cmp1.not = icmp sgt i32 %mul, %n
br i1 %cmp1.not, label %cleanup.loopexit, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%k.011 = phi i32 [ %inc, %for.cond ], [ 2, %for.cond.preheader ]
%rem = srem i32 %n, %k.011
%cmp2 = icmp ne i32 %rem, 0
br i1 %cmp2, label %for.cond, label %cleanup.loopexit
cleanup.loopexit: ; preds = %for.body, %for.cond
%0 = zext i1 %cmp2 to i32
br label %return
return: ; preds = %for.cond.preheader, %cleanup.loopexit, %entry
%retval.1 = phi i32 [ 0, %entry ], [ 1, %for.cond.preheader ], [ %0, %cleanup.loopexit ]
ret i32 %retval.1
}
; 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 @test() local_unnamed_addr #2 {
entry:
br label %for.cond.preheader.i
for.cond.cleanup: ; preds = %for.inc
ret void
for.cond.preheader.i: ; preds = %for.inc, %entry
%n.037 = phi i32 [ 3, %entry ], [ %inc8, %for.inc ]
%cmp1.not10.i = icmp ult i32 %n.037, 4
br i1 %cmp1.not10.i, label %for.inc, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %k.011.i, 1
%mul.i = mul nsw i32 %inc.i, %inc.i
%cmp1.not.i = icmp ugt i32 %mul.i, %n.037
br i1 %cmp1.not.i, label %for.inc, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%k.011.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.cond.preheader.i ]
%rem.i = urem i32 %n.037, %k.011.i
%cmp2.i.not.not = icmp eq i32 %rem.i, 0
br i1 %cmp2.i.not.not, label %for.body.i22.preheader, label %for.cond.i
for.body.i22.preheader: ; preds = %for.body.i22, %for.body.i
%e.0.in = phi i32 [ %n.037, %for.body.i ], [ %e.0, %for.body.i22 ]
%e.0 = add nuw nsw i32 %e.0.in, 1
br label %for.body.i22
for.cond.i28: ; preds = %for.body.i22
%inc.i29 = add nuw nsw i32 %k.011.i23, 1
%mul.i30 = mul nsw i32 %inc.i29, %inc.i29
%cmp1.not.i31 = icmp ugt i32 %mul.i30, %e.0
br i1 %cmp1.not.i31, label %while.end, label %for.body.i22, !llvm.loop !5
for.body.i22: ; preds = %for.body.i22.preheader, %for.cond.i28
%k.011.i23 = phi i32 [ %inc.i29, %for.cond.i28 ], [ 2, %for.body.i22.preheader ]
%rem.i24 = urem i32 %e.0, %k.011.i23
%cmp2.i25.not = icmp eq i32 %rem.i24, 0
br i1 %cmp2.i25.not, label %for.body.i22.preheader, label %for.cond.i28, !llvm.loop !7
while.end: ; preds = %for.cond.i28
%sub = sub nsw i32 %e.0, %n.037
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %n.037, i32 noundef %e.0)
%mul = shl nsw i32 %sub, 1
%cmp4 = icmp sgt i32 %mul, %n.037
br i1 %cmp4, label %if.then5, label %for.inc
if.then5: ; preds = %while.end
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.037)
br label %for.inc
for.inc: ; preds = %for.cond.i, %for.cond.preheader.i, %while.end, %if.then5
%inc8 = add nuw nsw i32 %n.037, 1
%exitcond.not = icmp eq i32 %inc8, 1001
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond.preheader.i, !llvm.loop !8
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #2 {
entry:
%s.i131 = alloca [20 x i32], align 16
%s.i105 = alloca [20 x i32], align 16
%s.i79 = alloca [20 x i32], align 16
%s.i53 = alloca [20 x i32], align 16
%s.i = alloca [20 x i32], align 16
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i.i = tail call i32 @getc(ptr noundef %0)
%1 = add i32 %call.i.i, -58
%2 = icmp ult i32 %1, -10
br i1 %2, label %while.body.i, label %while.body8.preheader.i
while.cond3.preheader.loopexit.i: ; preds = %while.body.i
%3 = icmp eq i32 %c.023.i, 45
br label %while.body8.preheader.i
while.body8.preheader.i: ; preds = %while.cond3.preheader.loopexit.i, %entry
%prev.0.lcssa.i = phi i1 [ false, %entry ], [ %3, %while.cond3.preheader.loopexit.i ]
%c.0.lcssa.i = phi i32 [ %call.i.i, %entry ], [ %call.i21.i, %while.cond3.preheader.loopexit.i ]
br label %while.body8.i
while.body.i: ; preds = %entry, %while.body.i
%c.023.i = phi i32 [ %call.i21.i, %while.body.i ], [ %call.i.i, %entry ]
%4 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i21.i = tail call i32 @getc(ptr noundef %4)
%5 = add i32 %call.i21.i, -58
%6 = icmp ult i32 %5, -10
br i1 %6, label %while.body.i, label %while.cond3.preheader.loopexit.i, !llvm.loop !13
while.body8.i: ; preds = %while.body8.i, %while.body8.preheader.i
%res.026.i = phi i32 [ %sub.i, %while.body8.i ], [ 0, %while.body8.preheader.i ]
%c.125.i = phi i32 [ %call.i22.i, %while.body8.i ], [ %c.0.lcssa.i, %while.body8.preheader.i ]
%mul.i = mul i32 %res.026.i, 10
%add.i = add nsw i32 %c.125.i, -48
%sub.i = add i32 %add.i, %mul.i
%7 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i22.i = tail call i32 @getc(ptr noundef %7)
%8 = add i32 %call.i22.i, -48
%9 = icmp ult i32 %8, 10
br i1 %9, label %while.body8.i, label %read_int.exit, !llvm.loop !14
read_int.exit: ; preds = %while.body8.i
%sub13.i = sub i32 0, %sub.i
%cond.i = select i1 %prev.0.lcssa.i, i32 %sub13.i, i32 %sub.i
br label %while.cond
while.cond: ; preds = %while.body, %read_int.exit
%e.0 = phi i32 [ %cond.i, %read_int.exit ], [ %inc, %while.body ]
%cmp.i = icmp slt i32 %e.0, 2
br i1 %cmp.i, label %while.body, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %while.cond
%cmp1.not10.i = icmp ult i32 %e.0, 4
br i1 %cmp1.not10.i, label %while.end, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %k.011.i, 1
%mul.i44 = mul nsw i32 %inc.i, %inc.i
%cmp1.not.i = icmp sgt i32 %mul.i44, %e.0
br i1 %cmp1.not.i, label %while.end, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%k.011.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.cond.preheader.i ]
%rem.i = srem i32 %e.0, %k.011.i
%cmp2.i.not = icmp eq i32 %rem.i, 0
br i1 %cmp2.i.not, label %while.body, label %for.cond.i
while.body: ; preds = %for.body.i, %while.cond
%inc = add nsw i32 %e.0, 1
br label %while.cond, !llvm.loop !15
while.end: ; preds = %for.cond.preheader.i, %for.cond.i
%conv2 = sext i32 %e.0 to i64
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i) #4
br label %while.body.i46
while.cond6.preheader.i: ; preds = %while.body.i46
%10 = trunc i64 %indvars.iv.next.i to i32
%cmp729.i = icmp sgt i32 %10, 0
br i1 %cmp729.i, label %while.body9.preheader.i, label %while.end13.i
while.body9.preheader.i: ; preds = %while.cond6.preheader.i
%11 = and i64 %indvars.iv.next.i, 4294967295
br label %while.body9.i
while.body.i46: ; preds = %while.body.i46, %while.end
%indvars.iv.i = phi i64 [ 0, %while.end ], [ %indvars.iv.next.i, %while.body.i46 ]
%n.addr.127.i = phi i64 [ %conv2, %while.end ], [ %div.i, %while.body.i46 ]
%rem.i47 = urem i64 %n.addr.127.i, 10
%12 = trunc i64 %rem.i47 to i32
%conv.i48 = or i32 %12, 48
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [20 x i32], ptr %s.i, i64 0, i64 %indvars.iv.i
store i32 %conv.i48, ptr %arrayidx.i, align 4, !tbaa !16
%div.i = udiv i64 %n.addr.127.i, 10
%cmp5.not.i = icmp ult i64 %n.addr.127.i, 10
br i1 %cmp5.not.i, label %while.cond6.preheader.i, label %while.body.i46, !llvm.loop !18
while.body9.i: ; preds = %while.body9.i, %while.body9.preheader.i
%indvars.iv32.i = phi i64 [ %11, %while.body9.preheader.i ], [ %indvars.iv.next33.i, %while.body9.i ]
%indvars.iv.next33.i = add nsw i64 %indvars.iv32.i, -1
%idxprom10.i = and i64 %indvars.iv.next33.i, 4294967295
%arrayidx11.i = getelementptr inbounds [20 x i32], ptr %s.i, i64 0, i64 %idxprom10.i
%13 = load i32, ptr %arrayidx11.i, align 4, !tbaa !16
%14 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i22.i49 = tail call noundef i32 @putc(i32 noundef %13, ptr noundef %14)
%cmp7.i = icmp ugt i64 %indvars.iv32.i, 1
br i1 %cmp7.i, label %while.body9.i, label %while.end13.i, !llvm.loop !19
while.end13.i: ; preds = %while.body9.i, %while.cond6.preheader.i
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i) #4
%15 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %15)
%cmp.not174 = icmp slt i32 %cond.i, 1
br i1 %cmp.not174, label %for.cond14.preheader, label %for.body.preheader
for.body.preheader: ; preds = %while.end13.i
%16 = zext i32 %cond.i to i64
%17 = add nuw i32 %cond.i, 1
%wide.trip.count = zext i32 %17 to i64
br label %for.body
for.cond14.preheader.loopexit: ; preds = %print_int.exit103
%18 = sub i32 %e.0, %cond.i
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond14.preheader.loopexit, %while.end13.i
%e.1.lcssa = phi i32 [ %e.0, %while.end13.i ], [ %18, %for.cond14.preheader.loopexit ]
%cmp15177 = icmp sgt i32 %e.1.lcssa, 0
br i1 %cmp15177, label %for.body18.lr.ph, label %for.cond.cleanup17
for.body18.lr.ph: ; preds = %for.cond14.preheader
%div = sdiv i32 %cond.i, 2
%19 = sext i32 %div to i64
%20 = add nuw i32 %e.1.lcssa, 1
%wide.trip.count188 = zext i32 %20 to i64
br label %for.body18
for.body: ; preds = %for.body.preheader, %print_int.exit103
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %print_int.exit103 ]
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i53) #4
br label %while.body.i57
while.cond6.preheader.i66: ; preds = %while.body.i57
%21 = trunc i64 %indvars.iv.next.i62 to i32
%cmp729.i67 = icmp sgt i32 %21, 0
br i1 %cmp729.i67, label %while.body9.preheader.i69, label %print_int.exit77
while.body9.preheader.i69: ; preds = %while.cond6.preheader.i66
%22 = and i64 %indvars.iv.next.i62, 4294967295
br label %while.body9.i70
while.body.i57: ; preds = %while.body.i57, %for.body
%indvars.iv.i58 = phi i64 [ 0, %for.body ], [ %indvars.iv.next.i62, %while.body.i57 ]
%n.addr.127.i59 = phi i64 [ %indvars.iv, %for.body ], [ %div.i64, %while.body.i57 ]
%rem.i60 = urem i64 %n.addr.127.i59, 10
%23 = trunc i64 %rem.i60 to i32
%conv.i61 = or i32 %23, 48
%indvars.iv.next.i62 = add nuw i64 %indvars.iv.i58, 1
%arrayidx.i63 = getelementptr inbounds [20 x i32], ptr %s.i53, i64 0, i64 %indvars.iv.i58
store i32 %conv.i61, ptr %arrayidx.i63, align 4, !tbaa !16
%div.i64 = udiv i64 %n.addr.127.i59, 10
%cmp5.not.i65 = icmp ult i64 %n.addr.127.i59, 10
br i1 %cmp5.not.i65, label %while.cond6.preheader.i66, label %while.body.i57, !llvm.loop !18
while.body9.i70: ; preds = %while.body9.i70, %while.body9.preheader.i69
%indvars.iv32.i71 = phi i64 [ %22, %while.body9.preheader.i69 ], [ %indvars.iv.next33.i72, %while.body9.i70 ]
%indvars.iv.next33.i72 = add nsw i64 %indvars.iv32.i71, -1
%idxprom10.i73 = and i64 %indvars.iv.next33.i72, 4294967295
%arrayidx11.i74 = getelementptr inbounds [20 x i32], ptr %s.i53, i64 0, i64 %idxprom10.i73
%24 = load i32, ptr %arrayidx11.i74, align 4, !tbaa !16
%25 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i22.i75 = tail call noundef i32 @putc(i32 noundef %24, ptr noundef %25)
%cmp7.i76 = icmp ugt i64 %indvars.iv32.i71, 1
br i1 %cmp7.i76, label %while.body9.i70, label %print_int.exit77, !llvm.loop !19
print_int.exit77: ; preds = %while.body9.i70, %while.cond6.preheader.i66
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i53) #4
%26 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i78 = tail call noundef i32 @putc(i32 noundef 32, ptr noundef %26)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp7.not.not = icmp ult i64 %indvars.iv, %16
%27 = and i64 %indvars.iv.next, 4294967295
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i79) #4
%spec.select = select i1 %cmp7.not.not, i64 %27, i64 1
br label %while.body.i83
while.cond6.preheader.i92: ; preds = %while.body.i83
%28 = trunc i64 %indvars.iv.next.i88 to i32
%cmp729.i93 = icmp sgt i32 %28, 0
br i1 %cmp729.i93, label %while.body9.preheader.i95, label %print_int.exit103
while.body9.preheader.i95: ; preds = %while.cond6.preheader.i92
%29 = and i64 %indvars.iv.next.i88, 4294967295
br label %while.body9.i96
while.body.i83: ; preds = %print_int.exit77, %while.body.i83
%indvars.iv.i84 = phi i64 [ %indvars.iv.next.i88, %while.body.i83 ], [ 0, %print_int.exit77 ]
%n.addr.127.i85 = phi i64 [ %div.i90, %while.body.i83 ], [ %spec.select, %print_int.exit77 ]
%rem.i86 = urem i64 %n.addr.127.i85, 10
%30 = trunc i64 %rem.i86 to i32
%conv.i87 = or i32 %30, 48
%indvars.iv.next.i88 = add nuw i64 %indvars.iv.i84, 1
%arrayidx.i89 = getelementptr inbounds [20 x i32], ptr %s.i79, i64 0, i64 %indvars.iv.i84
store i32 %conv.i87, ptr %arrayidx.i89, align 4, !tbaa !16
%div.i90 = udiv i64 %n.addr.127.i85, 10
%cmp5.not.i91 = icmp ult i64 %n.addr.127.i85, 10
br i1 %cmp5.not.i91, label %while.cond6.preheader.i92, label %while.body.i83, !llvm.loop !18
while.body9.i96: ; preds = %while.body9.i96, %while.body9.preheader.i95
%indvars.iv32.i97 = phi i64 [ %29, %while.body9.preheader.i95 ], [ %indvars.iv.next33.i98, %while.body9.i96 ]
%indvars.iv.next33.i98 = add nsw i64 %indvars.iv32.i97, -1
%idxprom10.i99 = and i64 %indvars.iv.next33.i98, 4294967295
%arrayidx11.i100 = getelementptr inbounds [20 x i32], ptr %s.i79, i64 0, i64 %idxprom10.i99
%31 = load i32, ptr %arrayidx11.i100, align 4, !tbaa !16
%32 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i22.i101 = tail call noundef i32 @putc(i32 noundef %31, ptr noundef %32)
%cmp7.i102 = icmp ugt i64 %indvars.iv32.i97, 1
br i1 %cmp7.i102, label %while.body9.i96, label %print_int.exit103, !llvm.loop !19
print_int.exit103: ; preds = %while.body9.i96, %while.cond6.preheader.i92
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i79) #4
%33 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i104 = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %33)
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond14.preheader.loopexit, label %for.body, !llvm.loop !20
for.cond.cleanup17: ; preds = %print_int.exit162, %for.cond14.preheader
ret void
for.body18: ; preds = %for.body18.lr.ph, %print_int.exit162
%indvars.iv184 = phi i64 [ 1, %for.body18.lr.ph ], [ %indvars.iv.next185, %print_int.exit162 ]
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i105) #4
br label %while.body.i109
while.cond6.preheader.i118: ; preds = %while.body.i109
%34 = trunc i64 %indvars.iv.next.i114 to i32
%cmp729.i119 = icmp sgt i32 %34, 0
br i1 %cmp729.i119, label %while.body9.preheader.i121, label %print_int.exit129
while.body9.preheader.i121: ; preds = %while.cond6.preheader.i118
%35 = and i64 %indvars.iv.next.i114, 4294967295
br label %while.body9.i122
while.body.i109: ; preds = %while.body.i109, %for.body18
%indvars.iv.i110 = phi i64 [ 0, %for.body18 ], [ %indvars.iv.next.i114, %while.body.i109 ]
%n.addr.127.i111 = phi i64 [ %indvars.iv184, %for.body18 ], [ %div.i116, %while.body.i109 ]
%rem.i112 = urem i64 %n.addr.127.i111, 10
%36 = trunc i64 %rem.i112 to i32
%conv.i113 = or i32 %36, 48
%indvars.iv.next.i114 = add nuw i64 %indvars.iv.i110, 1
%arrayidx.i115 = getelementptr inbounds [20 x i32], ptr %s.i105, i64 0, i64 %indvars.iv.i110
store i32 %conv.i113, ptr %arrayidx.i115, align 4, !tbaa !16
%div.i116 = udiv i64 %n.addr.127.i111, 10
%cmp5.not.i117 = icmp ult i64 %n.addr.127.i111, 10
br i1 %cmp5.not.i117, label %while.cond6.preheader.i118, label %while.body.i109, !llvm.loop !18
while.body9.i122: ; preds = %while.body9.i122, %while.body9.preheader.i121
%indvars.iv32.i123 = phi i64 [ %35, %while.body9.preheader.i121 ], [ %indvars.iv.next33.i124, %while.body9.i122 ]
%indvars.iv.next33.i124 = add nsw i64 %indvars.iv32.i123, -1
%idxprom10.i125 = and i64 %indvars.iv.next33.i124, 4294967295
%arrayidx11.i126 = getelementptr inbounds [20 x i32], ptr %s.i105, i64 0, i64 %idxprom10.i125
%37 = load i32, ptr %arrayidx11.i126, align 4, !tbaa !16
%38 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i22.i127 = tail call noundef i32 @putc(i32 noundef %37, ptr noundef %38)
%cmp7.i128 = icmp ugt i64 %indvars.iv32.i123, 1
br i1 %cmp7.i128, label %while.body9.i122, label %print_int.exit129, !llvm.loop !19
print_int.exit129: ; preds = %while.body9.i122, %while.cond6.preheader.i118
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i105) #4
%39 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i130 = tail call noundef i32 @putc(i32 noundef 32, ptr noundef %39)
%40 = add nsw i64 %indvars.iv184, %19
%cmp.i132 = icmp slt i64 %40, 0
br i1 %cmp.i132, label %if.end.thread.i159, label %if.end.i133
if.end.thread.i159: ; preds = %print_int.exit129
%41 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i.i160 = tail call noundef i32 @putc(i32 noundef 45, ptr noundef %41)
%sub.i161 = sub nsw i64 0, %40
br label %while.body.preheader.i135
if.end.i133: ; preds = %print_int.exit129
%42 = and i64 %40, 4294967295
%cmp1.i134 = icmp eq i64 %42, 0
br i1 %cmp1.i134, label %if.then2.i157, label %while.body.preheader.i135
if.then2.i157: ; preds = %if.end.i133
%43 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i21.i158 = tail call noundef i32 @putc(i32 noundef 48, ptr noundef %43)
br label %print_int.exit162
while.body.preheader.i135: ; preds = %if.end.i133, %if.end.thread.i159
%n.addr.025.i136 = phi i64 [ %sub.i161, %if.end.thread.i159 ], [ %40, %if.end.i133 ]
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %s.i131) #4
br label %while.body.i137
while.cond6.preheader.i146: ; preds = %while.body.i137
%44 = trunc i64 %indvars.iv.next.i142 to i32
%cmp729.i147 = icmp sgt i32 %44, 0
br i1 %cmp729.i147, label %while.body9.preheader.i149, label %while.end13.i148
while.body9.preheader.i149: ; preds = %while.cond6.preheader.i146
%45 = and i64 %indvars.iv.next.i142, 4294967295
br label %while.body9.i150
while.body.i137: ; preds = %while.body.i137, %while.body.preheader.i135
%indvars.iv.i138 = phi i64 [ 0, %while.body.preheader.i135 ], [ %indvars.iv.next.i142, %while.body.i137 ]
%n.addr.127.i139 = phi i64 [ %n.addr.025.i136, %while.body.preheader.i135 ], [ %div.i144, %while.body.i137 ]
%rem.i140 = urem i64 %n.addr.127.i139, 10
%46 = trunc i64 %rem.i140 to i32
%conv.i141 = or i32 %46, 48
%indvars.iv.next.i142 = add nuw i64 %indvars.iv.i138, 1
%arrayidx.i143 = getelementptr inbounds [20 x i32], ptr %s.i131, i64 0, i64 %indvars.iv.i138
store i32 %conv.i141, ptr %arrayidx.i143, align 4, !tbaa !16
%div.i144 = udiv i64 %n.addr.127.i139, 10
%cmp5.not.i145 = icmp ult i64 %n.addr.127.i139, 10
br i1 %cmp5.not.i145, label %while.cond6.preheader.i146, label %while.body.i137, !llvm.loop !18
while.body9.i150: ; preds = %while.body9.i150, %while.body9.preheader.i149
%indvars.iv32.i151 = phi i64 [ %45, %while.body9.preheader.i149 ], [ %indvars.iv.next33.i152, %while.body9.i150 ]
%indvars.iv.next33.i152 = add nsw i64 %indvars.iv32.i151, -1
%idxprom10.i153 = and i64 %indvars.iv.next33.i152, 4294967295
%arrayidx11.i154 = getelementptr inbounds [20 x i32], ptr %s.i131, i64 0, i64 %idxprom10.i153
%47 = load i32, ptr %arrayidx11.i154, align 4, !tbaa !16
%48 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i22.i155 = tail call noundef i32 @putc(i32 noundef %47, ptr noundef %48)
%cmp7.i156 = icmp ugt i64 %indvars.iv32.i151, 1
br i1 %cmp7.i156, label %while.body9.i150, label %while.end13.i148, !llvm.loop !19
while.end13.i148: ; preds = %while.body9.i150, %while.cond6.preheader.i146
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %s.i131) #4
br label %print_int.exit162
print_int.exit162: ; preds = %if.then2.i157, %while.end13.i148
%49 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i163 = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %49)
%indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
%exitcond189.not = icmp eq i64 %indvars.iv.next185, %wide.trip.count188
br i1 %exitcond189.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !21
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) 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 = distinct !{!7, !6}
!8 = distinct !{!8, !6}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !11, i64 0}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
|
#include <stdio.h>
int main(void)
{
int road[6][2] = {
{1, 2}, {-1, 3}, {1, -1}, {4, 5}, {5, 2}, {2, 1}
};
int i, loc;
char p[128];
while (scanf("%s", p), p[0] != '#'){
i = 0;
loc = 0;
while (p[i] != '\0'){
if (loc != -1){
loc = road[loc][p[i] - '0'];
}
i++;
}
if (loc == 5){
printf("Yes\n");
}
else {
printf("No\n");
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_275973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_275973/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"
@__const.main.road = private unnamed_addr constant [6 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 -1, i32 3], [2 x i32] [i32 1, i32 -1], [2 x i32] [i32 4, i32 5], [2 x i32] [i32 5, i32 2], [2 x i32] [i32 2, i32 1]], align 16
@.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:
%p = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %p) #4
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%0 = load i8, ptr %p, align 16, !tbaa !5
%cmp.not35 = icmp eq i8 %0, 35
br i1 %cmp.not35, label %while.end23, label %while.cond2.preheader
while.cond2.preheader: ; preds = %entry, %if.end22
%1 = phi i8 [ %4, %if.end22 ], [ %0, %entry ]
%cmp5.not30 = icmp eq i8 %1, 0
br i1 %cmp5.not30, label %if.else, label %while.body7
while.body7: ; preds = %while.cond2.preheader, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %while.cond2.preheader ]
%conv433.in = phi i8 [ %3, %if.end ], [ %1, %while.cond2.preheader ]
%loc.032 = phi i32 [ %loc.1, %if.end ], [ 0, %while.cond2.preheader ]
%cmp8.not = icmp eq i32 %loc.032, -1
br i1 %cmp8.not, label %if.end, label %if.then
if.then: ; preds = %while.body7
%conv433 = sext i8 %conv433.in to i64
%idxprom10 = sext i32 %loc.032 to i64
%sub = add nsw i64 %conv433, -48
%arrayidx16 = getelementptr inbounds [6 x [2 x i32]], ptr @__const.main.road, i64 0, i64 %idxprom10, i64 %sub
%2 = load i32, ptr %arrayidx16, align 4, !tbaa !8
br label %if.end
if.end: ; preds = %if.then, %while.body7
%loc.1 = phi i32 [ %2, %if.then ], [ -1, %while.body7 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [128 x i8], ptr %p, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5.not = icmp eq i8 %3, 0
br i1 %cmp5.not, label %while.end, label %while.body7, !llvm.loop !10
while.end: ; preds = %if.end
%cmp17 = icmp eq i32 %loc.1, 5
br i1 %cmp17, label %if.end22, label %if.else
if.else: ; preds = %while.cond2.preheader, %while.end
br label %if.end22
if.end22: ; preds = %while.end, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %while.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%4 = load i8, ptr %p, align 16, !tbaa !5
%cmp.not = icmp eq i8 %4, 35
br i1 %cmp.not, label %while.end23, label %while.cond2.preheader, !llvm.loop !12
while.end23: ; preds = %if.end22, %entry
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %p) #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 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int GCD (int a, int b) {
int c;
c = a % b;
if (c == 0) {
return b;
} else {
return GCD (b, c);
}
}
int main () {
int x, y, z;
while (scanf("%d %d", &x, &y) != EOF) {
z = GCD (x, y);
printf ("%d\n", z);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276022/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276022/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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @GCD(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%a.tr = phi i32 [ %a, %entry ], [ %b.tr, %tailrecurse ]
%b.tr = phi i32 [ %b, %entry ], [ %rem, %tailrecurse ]
%rem = srem i32 %a.tr, %b.tr
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %cleanup, label %tailrecurse
cleanup: ; preds = %tailrecurse
ret i32 %b.tr
}
; 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:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %GCD.exit
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %while.body
%a.tr.i = phi i32 [ %0, %while.body ], [ %b.tr.i, %tailrecurse.i ]
%b.tr.i = phi i32 [ %1, %while.body ], [ %rem.i, %tailrecurse.i ]
%rem.i = srem i32 %a.tr.i, %b.tr.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %GCD.exit, label %tailrecurse.i
GCD.exit: ; preds = %tailrecurse.i
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %b.tr.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %GCD.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #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 #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 = !{!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"}
|
// AOJ 2160: Voronoi Island
// 2018.1.8 bal4u@uu
#include <stdio.h>
#include <string.h>
#include <math.h>
#define EPS 1e-8
typedef struct { double x, y; } PP;
typedef struct { PP s, e; } LINE;
PP pi[11], pc[11];
int dcmp(double x)
{
if (fabs(x) < EPS) return 0;
return x < 0 ? -1 : 1;
}
double cross(double ax, double ay, double bx, double by) { return ax*by - ay*bx; }
void lineIntersection(PP *p, LINE *a, PP *vs, PP *ve)
{
double a1, a2;
a1 = cross(ve->x - vs->x, ve->y - vs->y,
a->s.x - vs->x, a->s.y - vs->y);
a2 = cross(ve->x - vs->x, ve->y - vs->y,
a->e.x - vs->x, a->e.y - vs->y);
p->x = (a->s.x*a2 - a->e.x*a1) / (a2-a1);
p->y = (a->s.y*a2 - a->e.y*a1) / (a2-a1);
}
int convex_cut(LINE *u, int n, PP *p, PP *po)
{
int i, d1, d2, top = 0;
for (i = 0; i < n; i++) {
d1 = dcmp(cross(u->e.x - u->s.x, u->e.y - u->s.y,
p[i].x - u->s.x, p[i].y - u->s.y));
d2 = dcmp(cross(u->e.x - u->s.x, u->e.y - u->s.y,
p[i+1].x - u->s.x, p[i+1].y - u->s.y));
if (d1 >= 0) po[top++] = p[i];
if (d1*d2 < 0) lineIntersection(po + top++, u, p+i, p+i+1);
}
po[top].x = po[0].x, po[top].y = po[0].y;
return top;
}
// 垂直二等分線
void bisector(LINE *u, PP a, PP b)
{
double ax = (a.x + b.x)/2;
double ay = (a.y + b.y)/2;
u->s.x = ax, u->s.y = ay;
if (fabs(a.y - b.y) <= EPS) u->e.x = ax, u->e.y = ay + (b.x-a.x)*100;
else u->e.x = ax-(b.y-a.y)*100, u->e.y = (ax - u->e.x)*(b.x - a.x)/(b.y - a.y) + ay;
}
double polygonArea(int n, PP *p)
{
double area = 0;
for (int i = 1; i < n-1; i++) {
area += cross(p[i].x-p[0].x, p[i].y-p[0].y, p[i+1].x-p[0].x, p[i+1].y-p[0].y);
}
return fabs(area) / 2;
}
int main()
{
int n, m, i, j, k, x, y, k1, k2;
PP pol[2][100];
LINE u;
while(scanf("%d%d", &n, &m) && n > 0) {
for (i = 0; i < n; i++) scanf("%d%d", &x, &y), pi[i].x = x, pi[i].y = y;
pi[n] = pi[0];
for (i = 0; i < m; i++) scanf("%d%d", &x, &y), pc[i].x = x, pc[i].y = y;
pc[m] = pc[0];
for (i = 0; i < m; i++) {
memcpy(pol[0], pi, sizeof(PP) * (n+1));
k = n, k1 = 0, k2 = 1;
for (j = 0; j < m; j++) {
if (j == i) continue;
bisector(&u, pc[i], pc[j]);
k = convex_cut(&u, k, pol[k1], pol[k2]);
k1 = k2, k2 = !k2;
}
printf("%.5lf\n", polygonArea(k, pol[k1]));
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276088/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276088/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.PP = type { double, double }
%struct.LINE = type { %struct.PP, %struct.PP }
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@pi = dso_local local_unnamed_addr global [11 x %struct.PP] zeroinitializer, align 16
@pc = dso_local local_unnamed_addr global [11 x %struct.PP] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [7 x i8] c"%.5lf\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @dcmp(double noundef %x) local_unnamed_addr #0 {
entry:
%0 = tail call double @llvm.fabs.f64(double %x)
%cmp = fcmp olt double %0, 1.000000e-08
%cmp1 = fcmp olt double %x, 0.000000e+00
%cond = select i1 %cmp1, i32 -1, i32 1
%retval.0 = select i1 %cmp, i32 0, i32 %cond
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @cross(double noundef %ax, double noundef %ay, double noundef %bx, double noundef %by) local_unnamed_addr #0 {
entry:
%0 = fneg double %ay
%neg = fmul double %0, %bx
%1 = tail call double @llvm.fmuladd.f64(double %ax, double %by, double %neg)
ret double %1
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @lineIntersection(ptr nocapture noundef writeonly %p, ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %vs, ptr nocapture noundef readonly %ve) local_unnamed_addr #2 {
entry:
%0 = load double, ptr %ve, align 8, !tbaa !5
%1 = load double, ptr %vs, align 8, !tbaa !5
%sub = fsub double %0, %1
%y = getelementptr inbounds %struct.PP, ptr %ve, i64 0, i32 1
%2 = load double, ptr %y, align 8, !tbaa !10
%y2 = getelementptr inbounds %struct.PP, ptr %vs, i64 0, i32 1
%3 = load double, ptr %y2, align 8, !tbaa !10
%sub3 = fsub double %2, %3
%4 = fneg double %sub3
%e = getelementptr inbounds %struct.LINE, ptr %a, i64 0, i32 1
%5 = load <2 x double>, ptr %a, align 8, !tbaa !11
%6 = load <2 x double>, ptr %e, align 8, !tbaa !11
%7 = shufflevector <2 x double> %6, <2 x double> %5, <2 x i32> <i32 0, i32 2>
%8 = insertelement <2 x double> poison, double %1, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%10 = fsub <2 x double> %7, %9
%11 = shufflevector <2 x double> %6, <2 x double> %5, <2 x i32> <i32 1, i32 3>
%12 = insertelement <2 x double> poison, double %3, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = fsub <2 x double> %11, %13
%15 = insertelement <2 x double> poison, double %4, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = fmul <2 x double> %10, %16
%18 = insertelement <2 x double> poison, double %sub, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %19, <2 x double> %14, <2 x double> %17)
%shift = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%21 = fsub <2 x double> %20, %shift
%22 = fneg <2 x double> %6
%23 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%24 = fmul <2 x double> %23, %22
%25 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%26 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> %25, <2 x double> %24)
%27 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%28 = fdiv <2 x double> %26, %27
store <2 x double> %28, ptr %p, align 8, !tbaa !11
ret void
}
; 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 nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @convex_cut(ptr nocapture noundef readonly %u, i32 noundef %n, ptr nocapture noundef readonly %p, ptr nocapture noundef %po) local_unnamed_addr #4 {
entry:
%cmp109 = icmp sgt i32 %n, 0
br i1 %cmp109, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%e = getelementptr inbounds %struct.LINE, ptr %u, i64 0, i32 1
%y = getelementptr inbounds %struct.LINE, ptr %u, i64 0, i32 1, i32 1
%y4 = getelementptr inbounds %struct.PP, ptr %u, i64 0, i32 1
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%top.0111 = phi i32 [ 0, %for.body.lr.ph ], [ %top.2, %for.inc ]
%0 = load double, ptr %e, align 8, !tbaa !12
%1 = load double, ptr %u, align 8, !tbaa !14
%sub = fsub double %0, %1
%2 = load double, ptr %y, align 8, !tbaa !15
%3 = load double, ptr %y4, align 8, !tbaa !16
%sub5 = fsub double %2, %3
%arrayidx = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv
%4 = load double, ptr %arrayidx, align 8, !tbaa !5
%sub9 = fsub double %4, %1
%y12 = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv, i32 1
%5 = load double, ptr %y12, align 8, !tbaa !10
%sub15 = fsub double %5, %3
%6 = fneg double %sub5
%neg.i = fmul double %sub9, %6
%7 = tail call double @llvm.fmuladd.f64(double %sub, double %sub15, double %neg.i)
%8 = tail call double @llvm.fabs.f64(double %7)
%cmp.i = fcmp olt double %8, 1.000000e-08
%cmp1.i = fcmp olt double %7, 0.000000e+00
%cond.i = select i1 %cmp1.i, i32 -1, i32 1
%retval.0.i = select i1 %cmp.i, i32 0, i32 %cond.i
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx28 = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv.next
%9 = load double, ptr %arrayidx28, align 8, !tbaa !5
%sub32 = fsub double %9, %1
%y36 = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv.next, i32 1
%10 = load double, ptr %y36, align 8, !tbaa !10
%sub39 = fsub double %10, %3
%neg.i103 = fmul double %sub32, %6
%11 = tail call double @llvm.fmuladd.f64(double %sub, double %sub39, double %neg.i103)
%12 = tail call double @llvm.fabs.f64(double %11)
%cmp.i104 = fcmp olt double %12, 1.000000e-08
%cmp1.i105 = fcmp olt double %11, 0.000000e+00
%cond.i106 = select i1 %cmp1.i105, i32 -1, i32 1
%retval.0.i107 = select i1 %cmp.i104, i32 0, i32 %cond.i106
%cmp42 = icmp sgt i32 %retval.0.i, -1
br i1 %cmp42, label %if.then, label %if.end
if.then: ; preds = %for.body
%inc = add nsw i32 %top.0111, 1
%idxprom43 = sext i32 %top.0111 to i64
%arrayidx44 = getelementptr inbounds %struct.PP, ptr %po, i64 %idxprom43
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %arrayidx44, ptr noundef nonnull align 8 dereferenceable(16) %arrayidx, i64 16, i1 false), !tbaa.struct !17
br label %if.end
if.end: ; preds = %if.then, %for.body
%top.1 = phi i32 [ %inc, %if.then ], [ %top.0111, %for.body ]
%mul = mul nsw i32 %retval.0.i107, %retval.0.i
%cmp47 = icmp slt i32 %mul, 0
br i1 %cmp47, label %if.then48, label %for.inc
if.then48: ; preds = %if.end
%inc49 = add nsw i32 %top.1, 1
%idx.ext = sext i32 %top.1 to i64
%add.ptr = getelementptr inbounds %struct.PP, ptr %po, i64 %idx.ext
%add.ptr54 = getelementptr inbounds %struct.PP, ptr %arrayidx, i64 1
%13 = load double, ptr %add.ptr54, align 8, !tbaa !5
%14 = load double, ptr %arrayidx, align 8, !tbaa !5
%sub.i = fsub double %13, %14
%y.i = getelementptr inbounds %struct.PP, ptr %arrayidx, i64 1, i32 1
%15 = load double, ptr %y.i, align 8, !tbaa !10
%16 = load double, ptr %y12, align 8, !tbaa !10
%sub3.i = fsub double %15, %16
%17 = fneg double %sub3.i
%18 = load <2 x double>, ptr %u, align 8, !tbaa !11
%19 = load <2 x double>, ptr %e, align 8, !tbaa !11
%20 = shufflevector <2 x double> %19, <2 x double> %18, <2 x i32> <i32 0, i32 2>
%21 = insertelement <2 x double> poison, double %14, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = fsub <2 x double> %20, %22
%24 = shufflevector <2 x double> %19, <2 x double> %18, <2 x i32> <i32 1, i32 3>
%25 = insertelement <2 x double> poison, double %16, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = fsub <2 x double> %24, %26
%28 = insertelement <2 x double> poison, double %17, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = fmul <2 x double> %23, %29
%31 = insertelement <2 x double> poison, double %sub.i, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %27, <2 x double> %30)
%shift = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%34 = fsub <2 x double> %33, %shift
%35 = fneg <2 x double> %19
%36 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%37 = fmul <2 x double> %36, %35
%38 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%39 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %38, <2 x double> %37)
%40 = shufflevector <2 x double> %34, <2 x double> poison, <2 x i32> zeroinitializer
%41 = fdiv <2 x double> %39, %40
store <2 x double> %41, ptr %add.ptr, align 8, !tbaa !11
br label %for.inc
for.inc: ; preds = %if.end, %if.then48
%top.2 = phi i32 [ %inc49, %if.then48 ], [ %top.1, %if.end ]
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18
for.end: ; preds = %for.inc, %entry
%top.0.lcssa = phi i32 [ 0, %entry ], [ %top.2, %for.inc ]
%idxprom59 = sext i32 %top.0.lcssa to i64
%arrayidx60 = getelementptr inbounds %struct.PP, ptr %po, i64 %idxprom59
%42 = load <2 x double>, ptr %po, align 8, !tbaa !11
store <2 x double> %42, ptr %arrayidx60, align 8, !tbaa !11
ret i32 %top.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @bisector(ptr nocapture noundef writeonly %u, double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) local_unnamed_addr #6 {
entry:
%0 = insertelement <2 x double> poison, double %a.coerce0, i64 0
%1 = insertelement <2 x double> %0, double %a.coerce1, i64 1
%2 = insertelement <2 x double> poison, double %b.coerce0, i64 0
%3 = insertelement <2 x double> %2, double %b.coerce1, i64 1
%4 = fadd <2 x double> %1, %3
%5 = fmul <2 x double> %4, <double 5.000000e-01, double 5.000000e-01>
store <2 x double> %5, ptr %u, align 8, !tbaa !11
%sub = fsub double %a.coerce1, %b.coerce1
%6 = tail call double @llvm.fabs.f64(double %sub)
%cmp = fcmp ugt double %6, 1.000000e-08
br i1 %cmp, label %if.else, label %if.then
if.then: ; preds = %entry
%sub13 = fsub double %b.coerce0, %a.coerce0
%7 = extractelement <2 x double> %5, i64 1
%8 = tail call double @llvm.fmuladd.f64(double %sub13, double 1.000000e+02, double %7)
%9 = extractelement <2 x double> %5, i64 0
br label %if.end
if.else: ; preds = %entry
%sub18 = fsub double %b.coerce1, %a.coerce1
%neg = fneg double %sub18
%10 = extractelement <2 x double> %5, i64 0
%11 = tail call double @llvm.fmuladd.f64(double %neg, double 1.000000e+02, double %10)
%sub23 = fsub double %10, %11
%sub26 = fsub double %b.coerce0, %a.coerce0
%mul = fmul double %sub26, %sub23
%div30 = fdiv double %mul, %sub18
%12 = extractelement <2 x double> %5, i64 1
%add31 = fadd double %12, %div30
br label %if.end
if.end: ; preds = %if.else, %if.then
%div.sink = phi double [ %11, %if.else ], [ %9, %if.then ]
%.sink = phi double [ %add31, %if.else ], [ %8, %if.then ]
%13 = getelementptr inbounds %struct.LINE, ptr %u, i64 0, i32 1
store double %div.sink, ptr %13, align 8
%14 = getelementptr inbounds %struct.LINE, ptr %u, i64 0, i32 1, i32 1
store double %.sink, ptr %14, align 8
ret void
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local double @polygonArea(i32 noundef %n, ptr nocapture noundef readonly %p) local_unnamed_addr #7 {
entry:
%cmp36 = icmp sgt i32 %n, 2
br i1 %cmp36, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = load double, ptr %p, align 8, !tbaa !5
%y7 = getelementptr inbounds %struct.PP, ptr %p, i64 0, i32 1
%1 = load double, ptr %y7, align 8, !tbaa !10
%wide.trip.count = zext i32 %sub to i64
%arrayidx.phi.trans.insert = getelementptr inbounds %struct.PP, ptr %p, i64 1
%.pre = load double, ptr %arrayidx.phi.trans.insert, align 8, !tbaa !5
%y.phi.trans.insert = getelementptr inbounds %struct.PP, ptr %p, i64 1, i32 1
%.pre40 = load double, ptr %y.phi.trans.insert, align 8, !tbaa !10
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%area.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add22, %for.body ]
%2 = tail call double @llvm.fabs.f64(double %area.0.lcssa)
%div = fmul double %2, 5.000000e-01
ret double %div
for.body: ; preds = %for.body.lr.ph, %for.body
%3 = phi double [ %.pre40, %for.body.lr.ph ], [ %6, %for.body ]
%4 = phi double [ %.pre, %for.body.lr.ph ], [ %5, %for.body ]
%indvars.iv = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%area.037 = phi double [ 0.000000e+00, %for.body.lr.ph ], [ %add22, %for.body ]
%sub3 = fsub double %4, %0
%sub8 = fsub double %3, %1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx10 = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv.next
%5 = load double, ptr %arrayidx10, align 8, !tbaa !5
%sub14 = fsub double %5, %0
%y18 = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv.next, i32 1
%6 = load double, ptr %y18, align 8, !tbaa !10
%sub21 = fsub double %6, %1
%7 = fneg double %sub8
%neg.i = fmul double %sub14, %7
%8 = tail call double @llvm.fmuladd.f64(double %sub3, double %sub21, double %neg.i)
%add22 = fadd double %area.037, %8
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !20
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%pol = alloca [2 x [100 x %struct.PP]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #11
call void @llvm.lifetime.start.p0(i64 3200, ptr nonnull %pol) #11
%call114 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%tobool115 = icmp ne i32 %call114, 0
%0 = load i32, ptr %n, align 4
%cmp116 = icmp sgt i32 %0, 0
%1 = select i1 %tobool115, i1 %cmp116, i1 false
br i1 %1, label %for.body, label %while.end
while.cond.loopexit: ; preds = %polygonArea.exit, %for.end25.thread, %for.end25
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%tobool = icmp ne i32 %call, 0
%2 = load i32, ptr %n, align 4
%cmp = icmp sgt i32 %2, 0
%3 = select i1 %tobool, i1 %cmp, i1 false
br i1 %3, label %for.body.backedge, label %while.end
for.body: ; preds = %entry, %for.body.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.body.backedge ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%4 = load i32, ptr %x, align 4, !tbaa !21
%conv = sitofp i32 %4 to double
%arrayidx = getelementptr inbounds [11 x %struct.PP], ptr @pi, i64 0, i64 %indvars.iv
store double %conv, ptr %arrayidx, align 16, !tbaa !5
%5 = load i32, ptr %y, align 4, !tbaa !21
%conv4 = sitofp i32 %5 to double
%y7 = getelementptr inbounds [11 x %struct.PP], ptr @pi, i64 0, i64 %indvars.iv, i32 1
store double %conv4, ptr %y7, align 8, !tbaa !10
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !21
%7 = sext i32 %6 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp1, label %for.body.backedge, label %for.end
for.body.backedge: ; preds = %for.body, %while.cond.loopexit
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.cond.loopexit ]
br label %for.body, !llvm.loop !23
for.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [11 x %struct.PP], ptr @pi, i64 0, i64 %7
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx9, ptr noundef nonnull align 16 dereferenceable(16) @pi, i64 16, i1 false), !tbaa.struct !17
%8 = load i32, ptr %m, align 4, !tbaa !21
%cmp11102 = icmp sgt i32 %8, 0
br i1 %cmp11102, label %for.body13, label %for.end25.thread
for.end25.thread: ; preds = %for.end
%.pre129 = sext i32 %8 to i64
%arrayidx27131 = getelementptr inbounds [11 x %struct.PP], ptr @pc, i64 0, i64 %.pre129
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx27131, ptr noundef nonnull align 16 dereferenceable(16) @pc, i64 16, i1 false), !tbaa.struct !17
br label %while.cond.loopexit
for.body13: ; preds = %for.end, %for.body13
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body13 ], [ 0, %for.end ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%9 = load i32, ptr %x, align 4, !tbaa !21
%conv15 = sitofp i32 %9 to double
%arrayidx17 = getelementptr inbounds [11 x %struct.PP], ptr @pc, i64 0, i64 %indvars.iv120
store double %conv15, ptr %arrayidx17, align 16, !tbaa !5
%10 = load i32, ptr %y, align 4, !tbaa !21
%conv19 = sitofp i32 %10 to double
%y22 = getelementptr inbounds [11 x %struct.PP], ptr @pc, i64 0, i64 %indvars.iv120, i32 1
store double %conv19, ptr %y22, align 8, !tbaa !10
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%11 = load i32, ptr %m, align 4, !tbaa !21
%12 = sext i32 %11 to i64
%cmp11 = icmp slt i64 %indvars.iv.next121, %12
br i1 %cmp11, label %for.body13, label %for.end25, !llvm.loop !24
for.end25: ; preds = %for.body13
%arrayidx27 = getelementptr inbounds [11 x %struct.PP], ptr @pc, i64 0, i64 %12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx27, ptr noundef nonnull align 16 dereferenceable(16) @pc, i64 16, i1 false), !tbaa.struct !17
%cmp29112 = icmp sgt i32 %11, 0
br i1 %cmp29112, label %for.body31, label %while.cond.loopexit
for.body31: ; preds = %for.end25, %polygonArea.exit
%indvars.iv126 = phi i64 [ %indvars.iv.next127, %polygonArea.exit ], [ 0, %for.end25 ]
%13 = phi i32 [ %84, %polygonArea.exit ], [ %11, %for.end25 ]
%14 = load i32, ptr %n, align 4, !tbaa !21
%add = add nsw i32 %14, 1
%conv33 = sext i32 %add to i64
%mul = shl nsw i64 %conv33, 4
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %pol, ptr nonnull align 16 @pi, i64 %mul, i1 false)
%cmp35105 = icmp sgt i32 %13, 0
br i1 %cmp35105, label %for.body37.lr.ph, label %for.end54
for.body37.lr.ph: ; preds = %for.body31
%arrayidx41 = getelementptr inbounds [11 x %struct.PP], ptr @pc, i64 0, i64 %indvars.iv126
%wide.trip.count = zext i32 %13 to i64
br label %for.body37
for.body37: ; preds = %for.body37.lr.ph, %for.inc52
%indvars.iv123 = phi i64 [ 0, %for.body37.lr.ph ], [ %indvars.iv.next124, %for.inc52 ]
%k2.0109 = phi i32 [ 1, %for.body37.lr.ph ], [ %k2.1, %for.inc52 ]
%k1.0108 = phi i32 [ 0, %for.body37.lr.ph ], [ %k1.1, %for.inc52 ]
%k.0107 = phi i32 [ %14, %for.body37.lr.ph ], [ %k.1, %for.inc52 ]
%cmp38 = icmp eq i64 %indvars.iv123, %indvars.iv126
br i1 %cmp38, label %for.inc52, label %if.end
if.end: ; preds = %for.body37
%arrayidx43 = getelementptr inbounds [11 x %struct.PP], ptr @pc, i64 0, i64 %indvars.iv123
%15 = load <2 x double>, ptr %arrayidx41, align 16
%16 = load <2 x double>, ptr %arrayidx43, align 16
%17 = fadd <2 x double> %15, %16
%18 = fmul <2 x double> %17, <double 5.000000e-01, double 5.000000e-01>
%19 = fsub <2 x double> %15, %16
%sub.i = extractelement <2 x double> %19, i64 1
%20 = call double @llvm.fabs.f64(double %sub.i)
%cmp.i = fcmp ugt double %20, 1.000000e-08
br i1 %cmp.i, label %if.else.i, label %if.then.i
if.then.i: ; preds = %if.end
%21 = fsub <2 x double> %16, %15
%sub13.i = extractelement <2 x double> %21, i64 0
%22 = extractelement <2 x double> %18, i64 1
%23 = call double @llvm.fmuladd.f64(double %sub13.i, double 1.000000e+02, double %22)
%24 = insertelement <2 x double> %18, double %23, i64 1
br label %bisector.exit
if.else.i: ; preds = %if.end
%25 = extractelement <2 x double> %18, i64 0
%26 = fsub <2 x double> %16, %15
%27 = extractelement <2 x double> %26, i64 1
%neg.i = fneg double %27
%28 = call double @llvm.fmuladd.f64(double %neg.i, double 1.000000e+02, double %25)
%sub23.i = fsub double %25, %28
%29 = extractelement <2 x double> %26, i64 0
%mul.i = fmul double %29, %sub23.i
%div30.i = fdiv double %mul.i, %27
%30 = extractelement <2 x double> %18, i64 1
%add31.i = fadd double %30, %div30.i
%31 = insertelement <2 x double> poison, double %28, i64 0
%32 = insertelement <2 x double> %31, double %add31.i, i64 1
br label %bisector.exit
bisector.exit: ; preds = %if.then.i, %if.else.i
%33 = phi <2 x double> [ %32, %if.else.i ], [ %24, %if.then.i ]
%idxprom44 = zext i32 %k1.0108 to i64
%arrayidx45 = getelementptr inbounds [2 x [100 x %struct.PP]], ptr %pol, i64 0, i64 %idxprom44
%idxprom47 = zext i32 %k2.0109 to i64
%arrayidx48 = getelementptr inbounds [2 x [100 x %struct.PP]], ptr %pol, i64 0, i64 %idxprom47
%cmp109.i = icmp sgt i32 %k.0107, 0
br i1 %cmp109.i, label %for.body.lr.ph.i, label %convex_cut.exit
for.body.lr.ph.i: ; preds = %bisector.exit
%wide.trip.count.i = zext i32 %k.0107 to i64
%34 = extractelement <2 x double> %18, i64 0
%35 = fsub <2 x double> %33, %18
%sub.i82 = extractelement <2 x double> %35, i64 0
%36 = extractelement <2 x double> %18, i64 1
%37 = fsub <2 x double> %33, %18
%sub5.i = extractelement <2 x double> %37, i64 1
%38 = fneg double %sub5.i
%39 = fneg <2 x double> %33
%40 = shufflevector <2 x double> %33, <2 x double> %18, <2 x i32> <i32 1, i32 3>
%41 = shufflevector <2 x double> %33, <2 x double> %18, <2 x i32> <i32 0, i32 2>
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.inc.i ]
%top.0111.i = phi i32 [ 0, %for.body.lr.ph.i ], [ %top.2.i, %for.inc.i ]
%arrayidx.i = getelementptr inbounds %struct.PP, ptr %arrayidx45, i64 %indvars.iv.i
%42 = load double, ptr %arrayidx.i, align 16, !tbaa !5
%sub9.i = fsub double %42, %34
%y12.i = getelementptr inbounds %struct.PP, ptr %arrayidx45, i64 %indvars.iv.i, i32 1
%43 = load double, ptr %y12.i, align 8, !tbaa !10
%sub15.i = fsub double %43, %36
%neg.i.i = fmul double %sub9.i, %38
%44 = call double @llvm.fmuladd.f64(double %sub.i82, double %sub15.i, double %neg.i.i)
%45 = call double @llvm.fabs.f64(double %44)
%cmp.i.i = fcmp olt double %45, 1.000000e-08
%cmp1.i.i = fcmp olt double %44, 0.000000e+00
%cond.i.i = select i1 %cmp1.i.i, i32 -1, i32 1
%retval.0.i.i = select i1 %cmp.i.i, i32 0, i32 %cond.i.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx28.i = getelementptr inbounds %struct.PP, ptr %arrayidx45, i64 %indvars.iv.next.i
%46 = load double, ptr %arrayidx28.i, align 16, !tbaa !5
%sub32.i = fsub double %46, %34
%y36.i = getelementptr inbounds %struct.PP, ptr %arrayidx45, i64 %indvars.iv.next.i, i32 1
%47 = load double, ptr %y36.i, align 8, !tbaa !10
%sub39.i = fsub double %47, %36
%neg.i103.i = fmul double %sub32.i, %38
%48 = call double @llvm.fmuladd.f64(double %sub.i82, double %sub39.i, double %neg.i103.i)
%49 = call double @llvm.fabs.f64(double %48)
%cmp.i104.i = fcmp olt double %49, 1.000000e-08
%cmp1.i105.i = fcmp olt double %48, 0.000000e+00
%cond.i106.i = select i1 %cmp1.i105.i, i32 -1, i32 1
%retval.0.i107.i = select i1 %cmp.i104.i, i32 0, i32 %cond.i106.i
%cmp42.i = icmp sgt i32 %retval.0.i.i, -1
br i1 %cmp42.i, label %if.then.i84, label %if.end.i
if.then.i84: ; preds = %for.body.i
%inc.i = add nsw i32 %top.0111.i, 1
%idxprom43.i = sext i32 %top.0111.i to i64
%arrayidx44.i = getelementptr inbounds %struct.PP, ptr %arrayidx48, i64 %idxprom43.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx44.i, ptr noundef nonnull align 16 dereferenceable(16) %arrayidx.i, i64 16, i1 false), !tbaa.struct !17
br label %if.end.i
if.end.i: ; preds = %if.then.i84, %for.body.i
%top.1.i = phi i32 [ %inc.i, %if.then.i84 ], [ %top.0111.i, %for.body.i ]
%mul.i83 = mul nsw i32 %retval.0.i107.i, %retval.0.i.i
%cmp47.i = icmp slt i32 %mul.i83, 0
br i1 %cmp47.i, label %if.then48.i, label %for.inc.i
if.then48.i: ; preds = %if.end.i
%inc49.i = add nsw i32 %top.1.i, 1
%idx.ext.i = sext i32 %top.1.i to i64
%add.ptr.i = getelementptr inbounds %struct.PP, ptr %arrayidx48, i64 %idx.ext.i
%add.ptr54.i = getelementptr inbounds %struct.PP, ptr %arrayidx.i, i64 1
%50 = load double, ptr %add.ptr54.i, align 16, !tbaa !5
%51 = load double, ptr %arrayidx.i, align 16, !tbaa !5
%sub.i.i = fsub double %50, %51
%y.i.i = getelementptr inbounds %struct.PP, ptr %arrayidx.i, i64 1, i32 1
%52 = load double, ptr %y.i.i, align 8, !tbaa !10
%53 = load double, ptr %y12.i, align 8, !tbaa !10
%sub3.i.i = fsub double %52, %53
%54 = fneg double %sub3.i.i
%55 = insertelement <2 x double> poison, double %51, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%57 = fsub <2 x double> %41, %56
%58 = insertelement <2 x double> poison, double %53, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
%60 = fsub <2 x double> %40, %59
%61 = insertelement <2 x double> poison, double %54, i64 0
%62 = shufflevector <2 x double> %61, <2 x double> poison, <2 x i32> zeroinitializer
%63 = fmul <2 x double> %57, %62
%64 = insertelement <2 x double> poison, double %sub.i.i, i64 0
%65 = shufflevector <2 x double> %64, <2 x double> poison, <2 x i32> zeroinitializer
%66 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> %60, <2 x double> %63)
%shift = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%67 = fsub <2 x double> %66, %shift
%68 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%69 = fmul <2 x double> %68, %39
%70 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> zeroinitializer
%71 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %70, <2 x double> %69)
%72 = shufflevector <2 x double> %67, <2 x double> poison, <2 x i32> zeroinitializer
%73 = fdiv <2 x double> %71, %72
store <2 x double> %73, ptr %add.ptr.i, align 16, !tbaa !11
br label %for.inc.i
for.inc.i: ; preds = %if.then48.i, %if.end.i
%top.2.i = phi i32 [ %inc49.i, %if.then48.i ], [ %top.1.i, %if.end.i ]
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %convex_cut.exit, label %for.body.i, !llvm.loop !18
convex_cut.exit: ; preds = %for.inc.i, %bisector.exit
%top.0.lcssa.i = phi i32 [ 0, %bisector.exit ], [ %top.2.i, %for.inc.i ]
%idxprom59.i = sext i32 %top.0.lcssa.i to i64
%arrayidx60.i = getelementptr inbounds %struct.PP, ptr %arrayidx48, i64 %idxprom59.i
%74 = load <2 x double>, ptr %arrayidx48, align 16, !tbaa !11
store <2 x double> %74, ptr %arrayidx60.i, align 16, !tbaa !11
%tobool51.not = icmp eq i32 %k2.0109, 0
%lnot.ext = zext i1 %tobool51.not to i32
br label %for.inc52
for.inc52: ; preds = %for.body37, %convex_cut.exit
%k.1 = phi i32 [ %k.0107, %for.body37 ], [ %top.0.lcssa.i, %convex_cut.exit ]
%k1.1 = phi i32 [ %k1.0108, %for.body37 ], [ %k2.0109, %convex_cut.exit ]
%k2.1 = phi i32 [ %k2.0109, %for.body37 ], [ %lnot.ext, %convex_cut.exit ]
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%exitcond.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count
br i1 %exitcond.not, label %for.end54, label %for.body37, !llvm.loop !25
for.end54: ; preds = %for.inc52, %for.body31
%k.0.lcssa = phi i32 [ %14, %for.body31 ], [ %k.1, %for.inc52 ]
%k1.0.lcssa = phi i32 [ 0, %for.body31 ], [ %k1.1, %for.inc52 ]
%idxprom55 = zext i32 %k1.0.lcssa to i64
%arrayidx56 = getelementptr inbounds [2 x [100 x %struct.PP]], ptr %pol, i64 0, i64 %idxprom55
%cmp36.i = icmp sgt i32 %k.0.lcssa, 2
br i1 %cmp36.i, label %for.body.lr.ph.i86, label %polygonArea.exit
for.body.lr.ph.i86: ; preds = %for.end54
%sub.i87 = add nsw i32 %k.0.lcssa, -1
%75 = load double, ptr %arrayidx56, align 16, !tbaa !5
%y7.i88 = getelementptr inbounds %struct.PP, ptr %arrayidx56, i64 0, i32 1
%76 = load double, ptr %y7.i88, align 8, !tbaa !10
%wide.trip.count.i89 = zext i32 %sub.i87 to i64
%arrayidx.phi.trans.insert.i = getelementptr inbounds %struct.PP, ptr %arrayidx56, i64 1
%.pre.i = load double, ptr %arrayidx.phi.trans.insert.i, align 16, !tbaa !5
%y.phi.trans.insert.i = getelementptr inbounds %struct.PP, ptr %arrayidx56, i64 1, i32 1
%.pre40.i = load double, ptr %y.phi.trans.insert.i, align 8, !tbaa !10
br label %for.body.i90
for.body.i90: ; preds = %for.body.i90, %for.body.lr.ph.i86
%77 = phi double [ %.pre40.i, %for.body.lr.ph.i86 ], [ %80, %for.body.i90 ]
%78 = phi double [ %.pre.i, %for.body.lr.ph.i86 ], [ %79, %for.body.i90 ]
%indvars.iv.i91 = phi i64 [ 1, %for.body.lr.ph.i86 ], [ %indvars.iv.next.i92, %for.body.i90 ]
%area.037.i = phi double [ 0.000000e+00, %for.body.lr.ph.i86 ], [ %add22.i, %for.body.i90 ]
%sub3.i = fsub double %78, %75
%sub8.i = fsub double %77, %76
%indvars.iv.next.i92 = add nuw nsw i64 %indvars.iv.i91, 1
%arrayidx10.i = getelementptr inbounds %struct.PP, ptr %arrayidx56, i64 %indvars.iv.next.i92
%79 = load double, ptr %arrayidx10.i, align 16, !tbaa !5
%sub14.i = fsub double %79, %75
%y18.i = getelementptr inbounds %struct.PP, ptr %arrayidx56, i64 %indvars.iv.next.i92, i32 1
%80 = load double, ptr %y18.i, align 8, !tbaa !10
%sub21.i = fsub double %80, %76
%81 = fneg double %sub8.i
%neg.i.i93 = fmul double %sub14.i, %81
%82 = call double @llvm.fmuladd.f64(double %sub3.i, double %sub21.i, double %neg.i.i93)
%add22.i = fadd double %area.037.i, %82
%exitcond.not.i94 = icmp eq i64 %indvars.iv.next.i92, %wide.trip.count.i89
br i1 %exitcond.not.i94, label %polygonArea.exit, label %for.body.i90, !llvm.loop !20
polygonArea.exit: ; preds = %for.body.i90, %for.end54
%area.0.lcssa.i = phi double [ 0.000000e+00, %for.end54 ], [ %add22.i, %for.body.i90 ]
%83 = call double @llvm.fabs.f64(double %area.0.lcssa.i)
%div.i85 = fmul double %83, 5.000000e-01
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div.i85)
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%84 = load i32, ptr %m, align 4, !tbaa !21
%85 = sext i32 %84 to i64
%cmp29 = icmp slt i64 %indvars.iv.next127, %85
br i1 %cmp29, label %for.body31, label %while.cond.loopexit, !llvm.loop !26
while.end: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 3200, ptr nonnull %pol) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; 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 <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #10
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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) 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 #7 = { nofree 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 #8 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !7, i64 16}
!13 = !{!"", !6, i64 0, !6, i64 16}
!14 = !{!13, !7, i64 0}
!15 = !{!13, !7, i64 24}
!16 = !{!13, !7, i64 8}
!17 = !{i64 0, i64 8, !11, i64 8, i64 8, !11}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !8, i64 0}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}
!25 = distinct !{!25, !19}
!26 = distinct !{!26, !19}
|
#include <stdio.h>
int main(){
char s[3];
int cnt=0;
scanf("%s",s);
for (int i=0; i<3; i++) cnt+= s[i]=='1';
printf("%d",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276130/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276130/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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%conv2 = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%conv2.1 = zext i1 %cmp1.1 to i32
%add.1 = add nuw nsw i32 %conv2, %conv2.1
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%conv2.2 = zext i1 %cmp1.2 to i32
%add.2 = add nuw nsw i32 %add.1, %conv2.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.2)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int count=0,i;
char s[4];
scanf("%s",s);
for(i=0;i<3;i++)
if(s[i]=='1')
count++;
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276181/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276181/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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #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"}
|
#include<stdio.h>
int main() {
char s[3];
int ans = 0;
scanf("%s", s);
for(int i = 0; i < 3; i++) ans += s[i] == '1';
printf("%d", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276275/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276275/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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%conv2 = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%conv2.1 = zext i1 %cmp1.1 to i32
%add.1 = add nuw nsw i32 %conv2, %conv2.1
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%conv2.2 = zext i1 %cmp1.2 to i32
%add.2 = add nuw nsw i32 %add.1, %conv2.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.2)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
char s[9];
int c = 0, i = 0;
scanf("%s", s);
for (; i < 3; i++)
{
if (s[i] == '1')
{
c++;
}
}
printf("%d", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276361/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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [9 x i8], align 1
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [9 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [9 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %s) #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"}
|
#include<stdio.h>
int main(void)
{
char s[4];
scanf("%s",&s);
int i=0;
if(s[0]=='1'){
++i;
}
if(s[1]=='1'){
++i;
}
if(s[2]=='1'){
++i;
}
printf("%d\n", i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276404/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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 49
%spec.select = zext i1 %cmp to i32
%arrayidx2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4 = icmp eq i8 %1, 49
%inc7 = select i1 %cmp, i32 2, i32 1
%i.1 = select i1 %cmp4, i32 %inc7, i32 %spec.select
%arrayidx9 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%cmp11 = icmp eq i8 %2, 49
%inc14 = zext i1 %cmp11 to i32
%i.2 = add nuw nsw i32 %i.1, %inc14
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #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"}
|
#include <stdio.h>
int main()
{
int cnt=0;
char s[4];
scanf("%s", s);
for (int i=0; i<3; i++) {
if (s[i]=='1') cnt++;
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276462/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276462/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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 49
%inc = zext i1 %cmp1 to i32
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,c=0,i;
for(i=0;i<3;i++){
scanf("%1d",&a);
if(a==1) c++;
}
printf("%d",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276505/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276505/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"%1d\00", align 1
@.str.1 = 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 i32, align 4
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 %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, 1
%inc = zext i1 %cmp1 to i32
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.1 = icmp eq i32 %1, 1
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.2 = icmp eq i32 %2, 1
%inc.2 = zext i1 %cmp1.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
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"}
|
#include<stdio.h>
int main(void) {
char s[3];
scanf("%c%c%c", &s[0], &s[1], &s[2]);
int cnt = 0;
for (int i = 0; i < 3; i++) {
if (s[i] == '1') cnt++;
}
printf("%d", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276549/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276549/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"%c%c%c\00", align 1
@.str.1 = 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:
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #3
%arrayidx1 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, 49
%inc = zext i1 %cmp4 to i32
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp4.1 = icmp eq i8 %1, 49
%inc.1 = zext i1 %cmp4.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%2 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4.2 = icmp eq i8 %2, 49
%inc.2 = zext i1 %cmp4.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
# include <stdio.h>
# include <ctype.h>
int main()
{
int c=0, s;
while( isdigit(s=getchar()))
c+= (s-'0');
printf("%d", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276592/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276592/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
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call ptr @__ctype_b_loc() #3
%0 = load ptr, ptr %call, align 8, !tbaa !5
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i4 = tail call i32 @getc(ptr noundef %1)
%idxprom5 = sext i32 %call.i4 to i64
%arrayidx6 = getelementptr inbounds i16, ptr %0, i64 %idxprom5
%2 = load i16, ptr %arrayidx6, align 2, !tbaa !9
%3 = and i16 %2, 2048
%tobool.not7 = icmp eq i16 %3, 0
br i1 %tobool.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call.i9 = phi i32 [ %call.i, %while.body ], [ %call.i4, %entry ]
%c.08 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%sub = add i32 %c.08, -48
%add = add i32 %sub, %call.i9
%4 = load ptr, ptr %call, align 8, !tbaa !5
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %5)
%idxprom = sext i32 %call.i to i64
%arrayidx = getelementptr inbounds i16, ptr %4, i64 %idxprom
%6 = load i16, ptr %arrayidx, align 2, !tbaa !9
%7 = and i16 %6, 2048
%tobool.not = icmp eq i16 %7, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %c.0.lcssa)
ret i32 0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) 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 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 #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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
// AOJ 2176: For the Peace
// 2017.12.15 bal4u@uu
#include <stdio.h>
#include <string.h>
#define ABS(a) ((a)>=0?(a):-(a))
int pool[10003], sz;
int *c[101], m[101], s[101];
char buf[50003], *p;
int getint()
{
int n = 0;
while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
p++;
return n;
}
int main()
{
int n, d, i, j, k, max, max2, f, g;
while (fgets(p=buf, 15, stdin) && *p != '0') {
n = getint(), d = getint();
sz = 0;
for (i = 0; i < n; i++) {
fgets(p=buf, sizeof(buf), stdin);
m[i] = getint(), s[i] = 0;
c[i] = pool + sz;
for (j = 0; j < m[i]; j++) c[i][j] = k = getint(), s[i] += k;
sz += m[i];
}
while (sz) {
max = max2 = 0;
for (i = 0; i < n; i++) {
if (s[i] >= max) max2 = max, max = s[i];
else if (s[i] > max2) max2 = s[i];
}
f = 0;
for (i = 0; i < n; i++) {
while (m[i] > 0) {
g = c[i][m[i]-1];
if (max - (s[i] - g) > d) break;
m[i]--, s[i] -= g, f = 1, sz--;
}
}
if (f) continue;
for (i = 0; i < n; i++) {
if (s[i] == max) {
while (m[i] > 0) {
g = c[i][m[i]-1];
if (ABS(s[i] - g - max2) > d) break;
m[i]--, s[i] -= g, f = 1, sz--;
}
}
}
if (!f) break;
}
puts(sz ? "No" : "Yes");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276642/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276642/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"
@p = dso_local local_unnamed_addr global ptr null, align 8
@buf = dso_local global [50003 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@sz = dso_local local_unnamed_addr global i32 0, align 4
@m = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@pool = dso_local global [10003 x i32] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [101 x ptr] 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
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @getint() local_unnamed_addr #0 {
entry:
%p.promoted = load ptr, ptr @p, align 8, !tbaa !5
%0 = load i8, ptr %p.promoted, align 1, !tbaa !9
%cmp9 = icmp sgt i8 %0, 47
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%n.011 = phi i32 [ %add4, %while.body ], [ 0, %entry ]
%incdec.ptr810 = phi ptr [ %incdec.ptr, %while.body ], [ %p.promoted, %entry ]
%add = mul i32 %n.011, 10
%incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr810, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %incdec.ptr810, align 1, !tbaa !9
%2 = and i8 %1, 15
%and = zext i8 %2 to i32
%add4 = add nsw i32 %add, %and
%3 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp = icmp sgt i8 %3, 47
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !10
while.end: ; preds = %while.body, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %add4, %while.body ]
%.lcssa = phi ptr [ %p.promoted, %entry ], [ %incdec.ptr, %while.body ]
%incdec.ptr5 = getelementptr inbounds i8, ptr %.lcssa, i64 1
store ptr %incdec.ptr5, ptr @p, align 8, !tbaa !5
ret i32 %n.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
store ptr @buf, ptr @p, align 8, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call334 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 15, ptr noundef %0)
%tobool.not335 = icmp eq ptr %call334, null
br i1 %tobool.not335, label %while.end151, label %land.rhs
land.rhs: ; preds = %entry, %38
%1 = load ptr, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %1, align 1, !tbaa !9
%cmp.not = icmp eq i8 %2, 48
br i1 %cmp.not, label %while.end151, label %while.body
while.body: ; preds = %land.rhs
%cmp9.i = icmp sgt i8 %2, 47
br i1 %cmp9.i, label %while.body.i, label %getint.exit
while.body.i: ; preds = %while.body, %while.body.i
%n.011.i = phi i32 [ %add4.i, %while.body.i ], [ 0, %while.body ]
%incdec.ptr810.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %1, %while.body ]
%add.i = mul i32 %n.011.i, 10
%incdec.ptr.i = getelementptr inbounds i8, ptr %incdec.ptr810.i, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
%3 = load i8, ptr %incdec.ptr810.i, align 1, !tbaa !9
%4 = and i8 %3, 15
%and.i = zext i8 %4 to i32
%add4.i = add nsw i32 %add.i, %and.i
%5 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%cmp.i = icmp sgt i8 %5, 47
br i1 %cmp.i, label %while.body.i, label %getint.exit, !llvm.loop !10
getint.exit: ; preds = %while.body.i, %while.body
%n.0.lcssa.i = phi i32 [ 0, %while.body ], [ %add4.i, %while.body.i ]
%.lcssa.i = phi ptr [ %1, %while.body ], [ %incdec.ptr.i, %while.body.i ]
%incdec.ptr5.i = getelementptr inbounds i8, ptr %.lcssa.i, i64 1
store ptr %incdec.ptr5.i, ptr @p, align 8, !tbaa !5
%6 = load i8, ptr %incdec.ptr5.i, align 1, !tbaa !9
%cmp9.i207 = icmp sgt i8 %6, 47
br i1 %cmp9.i207, label %while.body.i211, label %getint.exit219
while.body.i211: ; preds = %getint.exit, %while.body.i211
%n.011.i212 = phi i32 [ %add4.i217, %while.body.i211 ], [ 0, %getint.exit ]
%incdec.ptr810.i213 = phi ptr [ %incdec.ptr.i215, %while.body.i211 ], [ %incdec.ptr5.i, %getint.exit ]
%add.i214 = mul i32 %n.011.i212, 10
%incdec.ptr.i215 = getelementptr inbounds i8, ptr %incdec.ptr810.i213, i64 1
store ptr %incdec.ptr.i215, ptr @p, align 8, !tbaa !5
%7 = load i8, ptr %incdec.ptr810.i213, align 1, !tbaa !9
%8 = and i8 %7, 15
%and.i216 = zext i8 %8 to i32
%add4.i217 = add nsw i32 %add.i214, %and.i216
%9 = load i8, ptr %incdec.ptr.i215, align 1, !tbaa !9
%cmp.i218 = icmp sgt i8 %9, 47
br i1 %cmp.i218, label %while.body.i211, label %getint.exit219, !llvm.loop !10
getint.exit219: ; preds = %while.body.i211, %getint.exit
%n.0.lcssa.i208 = phi i32 [ 0, %getint.exit ], [ %add4.i217, %while.body.i211 ]
%10 = phi ptr [ %.lcssa.i, %getint.exit ], [ %incdec.ptr810.i213, %while.body.i211 ]
%incdec.ptr5.i210 = getelementptr inbounds i8, ptr %10, i64 2
store ptr %incdec.ptr5.i210, ptr @p, align 8, !tbaa !5
store i32 0, ptr @sz, align 4, !tbaa !12
%cmp4255 = icmp sgt i32 %n.0.lcssa.i, 0
br i1 %cmp4255, label %for.body.preheader, label %while.end147.thread
for.body.preheader: ; preds = %getint.exit219
%wide.trip.count342 = zext i32 %n.0.lcssa.i to i64
br label %for.body
while.cond31.preheader: ; preds = %for.end
%tobool32.old.not332 = icmp eq i32 %add27, 0
br i1 %tobool32.old.not332, label %while.end147.thread, label %while.body33.preheader.lr.ph
while.body33.preheader.lr.ph: ; preds = %while.cond31.preheader
%wide.trip.count357 = zext i32 %n.0.lcssa.i to i64
%wide.trip.count368 = zext i32 %n.0.lcssa.i to i64
%xtraiter = and i64 %wide.trip.count342, 1
%11 = icmp eq i32 %n.0.lcssa.i, 1
%unroll_iter = and i64 %wide.trip.count342, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %while.body33
for.body: ; preds = %for.body.preheader, %for.end
%indvars.iv339 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next340, %for.end ]
store ptr @buf, ptr @p, align 8, !tbaa !5
%12 = load ptr, ptr @stdin, align 8, !tbaa !5
%call6 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 50003, ptr noundef %12)
%p.promoted.i220 = load ptr, ptr @p, align 8, !tbaa !5
%13 = load i8, ptr %p.promoted.i220, align 1, !tbaa !9
%cmp9.i221 = icmp sgt i8 %13, 47
br i1 %cmp9.i221, label %while.body.i225, label %getint.exit233
while.body.i225: ; preds = %for.body, %while.body.i225
%n.011.i226 = phi i32 [ %add4.i231, %while.body.i225 ], [ 0, %for.body ]
%incdec.ptr810.i227 = phi ptr [ %incdec.ptr.i229, %while.body.i225 ], [ %p.promoted.i220, %for.body ]
%add.i228 = mul i32 %n.011.i226, 10
%incdec.ptr.i229 = getelementptr inbounds i8, ptr %incdec.ptr810.i227, i64 1
store ptr %incdec.ptr.i229, ptr @p, align 8, !tbaa !5
%14 = load i8, ptr %incdec.ptr810.i227, align 1, !tbaa !9
%15 = and i8 %14, 15
%and.i230 = zext i8 %15 to i32
%add4.i231 = add nsw i32 %add.i228, %and.i230
%16 = load i8, ptr %incdec.ptr.i229, align 1, !tbaa !9
%cmp.i232 = icmp sgt i8 %16, 47
br i1 %cmp.i232, label %while.body.i225, label %getint.exit233, !llvm.loop !10
getint.exit233: ; preds = %while.body.i225, %for.body
%n.0.lcssa.i222 = phi i32 [ 0, %for.body ], [ %add4.i231, %while.body.i225 ]
%.lcssa.i223 = phi ptr [ %p.promoted.i220, %for.body ], [ %incdec.ptr.i229, %while.body.i225 ]
%incdec.ptr5.i224 = getelementptr inbounds i8, ptr %.lcssa.i223, i64 1
store ptr %incdec.ptr5.i224, ptr @p, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [101 x i32], ptr @m, i64 0, i64 %indvars.iv339
store i32 %n.0.lcssa.i222, ptr %arrayidx, align 4, !tbaa !12
%arrayidx9 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %indvars.iv339
store i32 0, ptr %arrayidx9, align 4, !tbaa !12
%17 = load i32, ptr @sz, align 4, !tbaa !12
%idx.ext = sext i32 %17 to i64
%add.ptr = getelementptr inbounds i32, ptr @pool, i64 %idx.ext
%arrayidx11 = getelementptr inbounds [101 x ptr], ptr @c, i64 0, i64 %indvars.iv339
store ptr %add.ptr, ptr %arrayidx11, align 8, !tbaa !5
%cmp15252 = icmp sgt i32 %n.0.lcssa.i222, 0
br i1 %cmp15252, label %for.body17.lr.ph, label %for.end
for.body17.lr.ph: ; preds = %getint.exit233
%wide.trip.count = zext i32 %n.0.lcssa.i222 to i64
br label %for.body17
for.body17: ; preds = %for.body17.lr.ph, %getint.exit247
%indvars.iv = phi i64 [ 0, %for.body17.lr.ph ], [ %indvars.iv.next, %getint.exit247 ]
%18 = phi i32 [ 0, %for.body17.lr.ph ], [ %add, %getint.exit247 ]
%incdec.ptr.i243251253 = phi ptr [ %incdec.ptr5.i224, %for.body17.lr.ph ], [ %incdec.ptr5.i238, %getint.exit247 ]
%19 = load i8, ptr %incdec.ptr.i243251253, align 1, !tbaa !9
%cmp9.i235 = icmp sgt i8 %19, 47
br i1 %cmp9.i235, label %while.body.i239, label %getint.exit247
while.body.i239: ; preds = %for.body17, %while.body.i239
%n.011.i240 = phi i32 [ %add4.i245, %while.body.i239 ], [ 0, %for.body17 ]
%incdec.ptr810.i241 = phi ptr [ %incdec.ptr.i243, %while.body.i239 ], [ %incdec.ptr.i243251253, %for.body17 ]
%add.i242 = mul i32 %n.011.i240, 10
%incdec.ptr.i243 = getelementptr inbounds i8, ptr %incdec.ptr810.i241, i64 1
store ptr %incdec.ptr.i243, ptr @p, align 8, !tbaa !5
%20 = load i8, ptr %incdec.ptr810.i241, align 1, !tbaa !9
%21 = and i8 %20, 15
%and.i244 = zext i8 %21 to i32
%add4.i245 = add nsw i32 %add.i242, %and.i244
%22 = load i8, ptr %incdec.ptr.i243, align 1, !tbaa !9
%cmp.i246 = icmp sgt i8 %22, 47
br i1 %cmp.i246, label %while.body.i239, label %getint.exit247, !llvm.loop !10
getint.exit247: ; preds = %while.body.i239, %for.body17
%n.0.lcssa.i236 = phi i32 [ 0, %for.body17 ], [ %add4.i245, %while.body.i239 ]
%.lcssa.i237 = phi ptr [ %incdec.ptr.i243251253, %for.body17 ], [ %incdec.ptr.i243, %while.body.i239 ]
%incdec.ptr5.i238 = getelementptr inbounds i8, ptr %.lcssa.i237, i64 1
store ptr %incdec.ptr5.i238, ptr @p, align 8, !tbaa !5
%arrayidx22 = getelementptr inbounds i32, ptr %add.ptr, i64 %indvars.iv
store i32 %n.0.lcssa.i236, ptr %arrayidx22, align 4, !tbaa !12
%add = add nsw i32 %18, %n.0.lcssa.i236
store i32 %add, ptr %arrayidx9, align 4, !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.end, label %for.body17, !llvm.loop !14
for.end: ; preds = %getint.exit247, %getint.exit233
%add27 = add nsw i32 %n.0.lcssa.i222, %17
store i32 %add27, ptr @sz, align 4, !tbaa !12
%indvars.iv.next340 = add nuw nsw i64 %indvars.iv339, 1
%exitcond343.not = icmp eq i64 %indvars.iv.next340, %wide.trip.count342
br i1 %exitcond343.not, label %while.cond31.preheader, label %for.body, !llvm.loop !15
while.cond31.loopexit: ; preds = %for.end87
%tobool32.old.not = icmp eq i32 %sz.promoted322, 0
br i1 %tobool32.old.not, label %while.end147.thread, label %while.body33.backedge
while.body33: ; preds = %while.body33.backedge, %while.body33.preheader.lr.ph
%sz.promoted325 = phi i32 [ %add27, %while.body33.preheader.lr.ph ], [ %sz.promoted325.be, %while.body33.backedge ]
%sz.promoted290310 = phi i32 [ %add27, %while.body33.preheader.lr.ph ], [ %sz.promoted290310.be, %while.body33.backedge ]
br i1 %cmp4255, label %for.body37.preheader, label %while.end147
for.body37.preheader: ; preds = %while.body33
br i1 %11, label %for.cond55.preheader.unr-lcssa, label %for.body37
for.cond55.preheader.unr-lcssa: ; preds = %for.body37, %for.body37.preheader
%max.1.lcssa.ph = phi i32 [ undef, %for.body37.preheader ], [ %max.1.1, %for.body37 ]
%max2.1.lcssa.ph = phi i32 [ undef, %for.body37.preheader ], [ %max2.1.1, %for.body37 ]
%indvars.iv344.unr = phi i64 [ 0, %for.body37.preheader ], [ %indvars.iv.next345.1, %for.body37 ]
%max2.0260.unr = phi i32 [ 0, %for.body37.preheader ], [ %max2.1.1, %for.body37 ]
%max.0259.unr = phi i32 [ 0, %for.body37.preheader ], [ %max.1.1, %for.body37 ]
br i1 %lcmp.mod.not, label %for.cond55.preheader, label %for.body37.epil
for.body37.epil: ; preds = %for.cond55.preheader.unr-lcssa
%arrayidx39.epil = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %indvars.iv344.unr
%23 = load i32, ptr %arrayidx39.epil, align 4, !tbaa !12
%cmp40.not.epil = icmp slt i32 %23, %max.0259.unr
%spec.select.epil = tail call i32 @llvm.smax.i32(i32 %23, i32 %max2.0260.unr)
%max.1.epil = tail call i32 @llvm.smax.i32(i32 %23, i32 %max.0259.unr)
%max2.1.epil = select i1 %cmp40.not.epil, i32 %spec.select.epil, i32 %max.0259.unr
br label %for.cond55.preheader
for.cond55.preheader: ; preds = %for.cond55.preheader.unr-lcssa, %for.body37.epil
%max.1.lcssa = phi i32 [ %max.1.lcssa.ph, %for.cond55.preheader.unr-lcssa ], [ %max.1.epil, %for.body37.epil ]
%max2.1.lcssa = phi i32 [ %max2.1.lcssa.ph, %for.cond55.preheader.unr-lcssa ], [ %max2.1.epil, %for.body37.epil ]
br i1 %cmp4255, label %while.cond59.preheader, label %while.end147
for.body37: ; preds = %for.body37.preheader, %for.body37
%indvars.iv344 = phi i64 [ %indvars.iv.next345.1, %for.body37 ], [ 0, %for.body37.preheader ]
%max2.0260 = phi i32 [ %max2.1.1, %for.body37 ], [ 0, %for.body37.preheader ]
%max.0259 = phi i32 [ %max.1.1, %for.body37 ], [ 0, %for.body37.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body37 ], [ 0, %for.body37.preheader ]
%arrayidx39 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %indvars.iv344
%24 = load i32, ptr %arrayidx39, align 8, !tbaa !12
%cmp40.not = icmp slt i32 %24, %max.0259
%spec.select = tail call i32 @llvm.smax.i32(i32 %24, i32 %max2.0260)
%max.1 = tail call i32 @llvm.smax.i32(i32 %24, i32 %max.0259)
%max2.1 = select i1 %cmp40.not, i32 %spec.select, i32 %max.0259
%indvars.iv.next345 = or i64 %indvars.iv344, 1
%arrayidx39.1 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %indvars.iv.next345
%25 = load i32, ptr %arrayidx39.1, align 4, !tbaa !12
%cmp40.not.1 = icmp slt i32 %25, %max.1
%spec.select.1 = tail call i32 @llvm.smax.i32(i32 %25, i32 %max2.1)
%max.1.1 = tail call i32 @llvm.smax.i32(i32 %25, i32 %max.1)
%max2.1.1 = select i1 %cmp40.not.1, i32 %spec.select.1, i32 %max.1
%indvars.iv.next345.1 = add nuw nsw i64 %indvars.iv344, 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.cond55.preheader.unr-lcssa, label %for.body37, !llvm.loop !16
while.cond59.preheader: ; preds = %for.cond55.preheader, %for.inc85
%indvars.iv353 = phi i64 [ %indvars.iv.next354, %for.inc85 ], [ 0, %for.cond55.preheader ]
%sz.promoted324 = phi i32 [ %sz.promoted322, %for.inc85 ], [ %sz.promoted325, %for.cond55.preheader ]
%sz.promoted290309 = phi i32 [ %sz.promoted290307, %for.inc85 ], [ %sz.promoted290310, %for.cond55.preheader ]
%f.0279 = phi i32 [ %f.1.lcssa, %for.inc85 ], [ 0, %for.cond55.preheader ]
%sz.promoted274277 = phi i32 [ %sz.promoted272, %for.inc85 ], [ %sz.promoted290310, %for.cond55.preheader ]
%arrayidx61 = getelementptr inbounds [101 x i32], ptr @m, i64 0, i64 %indvars.iv353
%arrayidx61.promoted = load i32, ptr %arrayidx61, align 4, !tbaa !12
%cmp62264 = icmp sgt i32 %arrayidx61.promoted, 0
br i1 %cmp62264, label %while.body64.lr.ph, label %for.inc85
while.body64.lr.ph: ; preds = %while.cond59.preheader
%arrayidx66 = getelementptr inbounds [101 x ptr], ptr @c, i64 0, i64 %indvars.iv353
%26 = load ptr, ptr %arrayidx66, align 8, !tbaa !5
%arrayidx72 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %indvars.iv353
%arrayidx72.promoted = load i32, ptr %arrayidx72, align 4, !tbaa !12
%27 = zext i32 %arrayidx61.promoted to i64
%indvars.iv.next350.peel = add nsw i64 %27, -1
%arrayidx70.peel = getelementptr inbounds i32, ptr %26, i64 %indvars.iv.next350.peel
%28 = load i32, ptr %arrayidx70.peel, align 4, !tbaa !12
%sub73.neg.peel = add i32 %28, %max.1.lcssa
%sub74.peel = sub i32 %sub73.neg.peel, %arrayidx72.promoted
%cmp75.peel = icmp sgt i32 %sub74.peel, %n.0.lcssa.i208
br i1 %cmp75.peel, label %for.inc85, label %if.end78.peel
if.end78.peel: ; preds = %while.body64.lr.ph
%indvars.peel = trunc i64 %indvars.iv.next350.peel to i32
store i32 %indvars.peel, ptr %arrayidx61, align 4, !tbaa !12
%sub83.peel = sub nsw i32 %arrayidx72.promoted, %28
store i32 %sub83.peel, ptr %arrayidx72, align 4, !tbaa !12
%dec84.peel = add nsw i32 %sz.promoted274277, -1
store i32 %dec84.peel, ptr @sz, align 4, !tbaa !12
%cmp62.peel = icmp ugt i32 %arrayidx61.promoted, 1
br i1 %cmp62.peel, label %while.body64, label %for.inc85
while.body64: ; preds = %if.end78.peel, %if.end78
%indvars.iv349 = phi i64 [ %indvars.iv.next350, %if.end78 ], [ %indvars.iv.next350.peel, %if.end78.peel ]
%sz.promoted323 = phi i32 [ %dec84, %if.end78 ], [ %dec84.peel, %if.end78.peel ]
%sub83270 = phi i32 [ %sub83, %if.end78 ], [ %sub83.peel, %if.end78.peel ]
%indvars.iv.next350 = add nsw i64 %indvars.iv349, -1
%idxprom69 = and i64 %indvars.iv.next350, 4294967295
%arrayidx70 = getelementptr inbounds i32, ptr %26, i64 %idxprom69
%29 = load i32, ptr %arrayidx70, align 4, !tbaa !12
%sub73.neg = add i32 %29, %max.1.lcssa
%sub74 = sub i32 %sub73.neg, %sub83270
%cmp75 = icmp sgt i32 %sub74, %n.0.lcssa.i208
br i1 %cmp75, label %for.inc85, label %if.end78
if.end78: ; preds = %while.body64
%indvars = trunc i64 %indvars.iv.next350 to i32
store i32 %indvars, ptr %arrayidx61, align 4, !tbaa !12
%sub83 = sub nsw i32 %sub83270, %29
store i32 %sub83, ptr %arrayidx72, align 4, !tbaa !12
%dec84 = add nsw i32 %sz.promoted323, -1
store i32 %dec84, ptr @sz, align 4, !tbaa !12
%cmp62 = icmp ugt i64 %indvars.iv349, 1
br i1 %cmp62, label %while.body64, label %for.inc85, !llvm.loop !17
for.inc85: ; preds = %while.body64, %if.end78, %while.body64.lr.ph, %if.end78.peel, %while.cond59.preheader
%sz.promoted322 = phi i32 [ %sz.promoted324, %while.cond59.preheader ], [ %sz.promoted324, %while.body64.lr.ph ], [ %dec84.peel, %if.end78.peel ], [ %sz.promoted323, %while.body64 ], [ %dec84, %if.end78 ]
%sz.promoted290307 = phi i32 [ %sz.promoted290309, %while.cond59.preheader ], [ %sz.promoted290309, %while.body64.lr.ph ], [ %dec84.peel, %if.end78.peel ], [ %sz.promoted323, %while.body64 ], [ %dec84, %if.end78 ]
%sz.promoted272 = phi i32 [ %sz.promoted274277, %while.cond59.preheader ], [ %sz.promoted274277, %while.body64.lr.ph ], [ %dec84.peel, %if.end78.peel ], [ %sz.promoted323, %while.body64 ], [ %dec84, %if.end78 ]
%f.1.lcssa = phi i32 [ %f.0279, %while.cond59.preheader ], [ %f.0279, %while.body64.lr.ph ], [ 1, %if.end78.peel ], [ 1, %if.end78 ], [ 1, %while.body64 ]
%indvars.iv.next354 = add nuw nsw i64 %indvars.iv353, 1
%exitcond358.not = icmp eq i64 %indvars.iv.next354, %wide.trip.count357
br i1 %exitcond358.not, label %for.end87, label %while.cond59.preheader, !llvm.loop !19
for.end87: ; preds = %for.inc85
%tobool88.not = icmp eq i32 %f.1.lcssa, 0
br i1 %tobool88.not, label %for.cond91.preheader, label %while.cond31.loopexit
for.cond91.preheader: ; preds = %for.end87
br i1 %cmp4255, label %for.body94, label %while.end147
for.body94: ; preds = %for.cond91.preheader, %for.inc141
%indvars.iv364 = phi i64 [ %indvars.iv.next365, %for.inc141 ], [ 0, %for.cond91.preheader ]
%sz.promoted320 = phi i32 [ %sz.promoted317, %for.inc141 ], [ %sz.promoted322, %for.cond91.preheader ]
%sz.promoted290305 = phi i32 [ %sz.promoted290302, %for.inc141 ], [ %sz.promoted290307, %for.cond91.preheader ]
%f.2299 = phi i32 [ %f.4, %for.inc141 ], [ 0, %for.cond91.preheader ]
%sz.promoted294297 = phi i32 [ %sz.promoted291, %for.inc141 ], [ %sz.promoted290307, %for.cond91.preheader ]
%arrayidx96 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %indvars.iv364
%30 = load i32, ptr %arrayidx96, align 4, !tbaa !12
%cmp97 = icmp eq i32 %30, %max.1.lcssa
br i1 %cmp97, label %while.cond100.preheader, label %for.inc141
while.cond100.preheader: ; preds = %for.body94
%arrayidx102 = getelementptr inbounds [101 x i32], ptr @m, i64 0, i64 %indvars.iv364
%arrayidx102.promoted = load i32, ptr %arrayidx102, align 4, !tbaa !12
%cmp103283 = icmp sgt i32 %arrayidx102.promoted, 0
br i1 %cmp103283, label %while.body105.lr.ph, label %for.inc141
while.body105.lr.ph: ; preds = %while.cond100.preheader
%arrayidx107 = getelementptr inbounds [101 x ptr], ptr @c, i64 0, i64 %indvars.iv364
%31 = load ptr, ptr %arrayidx107, align 8, !tbaa !5
%32 = zext i32 %arrayidx102.promoted to i64
%indvars.iv.next360.peel = add nsw i64 %32, -1
%arrayidx112.peel = getelementptr inbounds i32, ptr %31, i64 %indvars.iv.next360.peel
%33 = load i32, ptr %arrayidx112.peel, align 4, !tbaa !12
%34 = add i32 %33, %max2.1.lcssa
%sub116.peel = sub i32 %max.1.lcssa, %34
%cond.peel = tail call i32 @llvm.abs.i32(i32 %sub116.peel, i1 true)
%cmp128.peel = icmp sgt i32 %cond.peel, %n.0.lcssa.i208
br i1 %cmp128.peel, label %for.inc141, label %if.end131.peel
if.end131.peel: ; preds = %while.body105.lr.ph
%indvars361.peel = trunc i64 %indvars.iv.next360.peel to i32
store i32 %indvars361.peel, ptr %arrayidx102, align 4, !tbaa !12
%sub137.peel = sub nsw i32 %max.1.lcssa, %33
store i32 %sub137.peel, ptr %arrayidx96, align 4, !tbaa !12
%dec138.peel = add nsw i32 %sz.promoted294297, -1
store i32 %dec138.peel, ptr @sz, align 4, !tbaa !12
%cmp103.peel = icmp ugt i32 %arrayidx102.promoted, 1
br i1 %cmp103.peel, label %while.body105, label %for.inc141
while.body105: ; preds = %if.end131.peel, %if.end131
%indvars.iv359 = phi i64 [ %indvars.iv.next360, %if.end131 ], [ %indvars.iv.next360.peel, %if.end131.peel ]
%sz.promoted319 = phi i32 [ %dec138, %if.end131 ], [ %dec138.peel, %if.end131.peel ]
%sub137289 = phi i32 [ %sub137, %if.end131 ], [ %sub137.peel, %if.end131.peel ]
%indvars.iv.next360 = add nsw i64 %indvars.iv359, -1
%idxprom111 = and i64 %indvars.iv.next360, 4294967295
%arrayidx112 = getelementptr inbounds i32, ptr %31, i64 %idxprom111
%35 = load i32, ptr %arrayidx112, align 4, !tbaa !12
%36 = add i32 %35, %max2.1.lcssa
%sub116 = sub i32 %sub137289, %36
%cond = tail call i32 @llvm.abs.i32(i32 %sub116, i1 true)
%cmp128 = icmp sgt i32 %cond, %n.0.lcssa.i208
br i1 %cmp128, label %for.inc141, label %if.end131
if.end131: ; preds = %while.body105
%indvars361 = trunc i64 %indvars.iv.next360 to i32
store i32 %indvars361, ptr %arrayidx102, align 4, !tbaa !12
%sub137 = sub nsw i32 %sub137289, %35
store i32 %sub137, ptr %arrayidx96, align 4, !tbaa !12
%dec138 = add nsw i32 %sz.promoted319, -1
store i32 %dec138, ptr @sz, align 4, !tbaa !12
%cmp103 = icmp ugt i64 %indvars.iv359, 1
br i1 %cmp103, label %while.body105, label %for.inc141, !llvm.loop !20
for.inc141: ; preds = %if.end131, %while.body105, %while.body105.lr.ph, %if.end131.peel, %while.cond100.preheader, %for.body94
%sz.promoted317 = phi i32 [ %sz.promoted320, %for.body94 ], [ %sz.promoted320, %while.cond100.preheader ], [ %sz.promoted320, %while.body105.lr.ph ], [ %dec138.peel, %if.end131.peel ], [ %sz.promoted319, %while.body105 ], [ %dec138, %if.end131 ]
%sz.promoted290302 = phi i32 [ %sz.promoted290305, %for.body94 ], [ %sz.promoted290305, %while.cond100.preheader ], [ %sz.promoted290305, %while.body105.lr.ph ], [ %dec138.peel, %if.end131.peel ], [ %sz.promoted319, %while.body105 ], [ %dec138, %if.end131 ]
%sz.promoted291 = phi i32 [ %sz.promoted294297, %for.body94 ], [ %sz.promoted294297, %while.cond100.preheader ], [ %sz.promoted294297, %while.body105.lr.ph ], [ %dec138.peel, %if.end131.peel ], [ %sz.promoted319, %while.body105 ], [ %dec138, %if.end131 ]
%f.4 = phi i32 [ %f.2299, %for.body94 ], [ %f.2299, %while.cond100.preheader ], [ %f.2299, %while.body105.lr.ph ], [ 1, %if.end131.peel ], [ 1, %while.body105 ], [ 1, %if.end131 ]
%indvars.iv.next365 = add nuw nsw i64 %indvars.iv364, 1
%exitcond369.not = icmp eq i64 %indvars.iv.next365, %wide.trip.count368
br i1 %exitcond369.not, label %for.end143, label %for.body94, !llvm.loop !21
for.end143: ; preds = %for.inc141
%tobool144 = icmp ne i32 %f.4, 0
%tobool32 = icmp ne i32 %sz.promoted290302, 0
%or.cond = select i1 %tobool144, i1 %tobool32, i1 false
br i1 %or.cond, label %while.body33.backedge, label %while.end147
while.body33.backedge: ; preds = %for.end143, %while.cond31.loopexit
%sz.promoted325.be = phi i32 [ %sz.promoted317, %for.end143 ], [ %sz.promoted322, %while.cond31.loopexit ]
%sz.promoted290310.be = phi i32 [ %sz.promoted290302, %for.end143 ], [ %sz.promoted322, %while.cond31.loopexit ]
br label %while.body33, !llvm.loop !22
while.end147: ; preds = %for.cond55.preheader, %while.body33, %for.cond91.preheader, %for.end143
%37 = phi i32 [ %sz.promoted317, %for.end143 ], [ %sz.promoted322, %for.cond91.preheader ], [ %sz.promoted325, %while.body33 ], [ %sz.promoted325, %for.cond55.preheader ]
%.fr = freeze i32 %37
%tobool148.not = icmp eq i32 %.fr, 0
br i1 %tobool148.not, label %while.end147.thread, label %38
while.end147.thread: ; preds = %while.cond31.loopexit, %getint.exit219, %while.cond31.preheader, %while.end147
br label %38
38: ; preds = %while.end147, %while.end147.thread
%39 = phi ptr [ @.str.1, %while.end147.thread ], [ @.str, %while.end147 ]
%call150 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %39)
store ptr @buf, ptr @p, align 8, !tbaa !5
%40 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 15, ptr noundef %40)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %while.end151, label %land.rhs, !llvm.loop !23
while.end151: ; preds = %land.rhs, %38, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree norecurse 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 = { 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 = { nocallback nofree nosync nounwind speculatable 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 = !{!"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"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11, !18}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
|
#include <stdio.h>
typedef struct {
int key, id;
} data;
typedef struct {
data obj[400001];
int size;
} min_heap;
void push(data x, min_heap* h)
{
int i = ++(h->size);
data tmp;
h->obj[i] = x;
while (i > 1) {
if (h->obj[i].key < h->obj[i>>1].key) {
tmp = h->obj[i>>1];
h->obj[i>>1] = h->obj[i];
h->obj[i] = tmp;
i >>= 1;
} else break;
}
}
data pop(min_heap* h)
{
int i = 1, j = 2;
data output = h->obj[1], tmp;
h->obj[1] = h->obj[(h->size)--];
while (j <= h->size) {
if (j < h->size && h->obj[j^1].key < h->obj[j].key) j ^= 1;
if (h->obj[j].key < h->obj[i].key) {
tmp = h->obj[j];
h->obj[j] = h->obj[i];
h->obj[i] = tmp;
i = j;
j = i << 1;
} else break;
}
return output;
}
void add_BIT(int N, int BIT[], int i, int k)
{
while (i <= N) {
BIT[i] += k;
i += (i & -i);
}
}
int sum_BIT(int BIT[], int r)
{
int sum = 0;
while (r > 0) {
sum += BIT[r];
r -= (r & -r);
}
return sum;
}
int main()
{
int i, H, W, A, B;
scanf("%d %d", &H, &W);
int j, k, s[200002], t[200002], left[200002], right[200002], BIT[200001] = {}, L, R, M, tmp;
data d;
min_heap h;
h.size = 0;
for (i = 0; i <= W + 1; i++) {
s[i] = i;
t[i] = i;
left[i] = i - 1;
right[i] = i + 1;
}
for (i = 1, d.key = 0; i <= W; i++) {
d.id = i;
push(d, &h);
add_BIT(W, BIT, i, 1);
}
for (i = 1; i <= H; i++) {
scanf("%d %d", &A, &B);
tmp = sum_BIT(BIT, A - 1);
if (sum_BIT(BIT, B) == tmp) {
printf("%d\n", h.obj[1].key + i);
continue;
}
L = A;
R = B++;
while (L < R) {
M = (L + R) / 2;
if (sum_BIT(BIT, M) > tmp) R = M;
else L = M + 1;
}
left[B] = left[L];
right[left[L]] = B;
if (s[B] < 0) add_BIT(W, BIT, B, 1);
for (j = L; j < B; j = right[j]) {
t[s[j]] = B;
s[B] = (s[j] > s[B])? s[j]: s[B];
s[j] = -1;
add_BIT(W, BIT, j, -1);
}
if (j != B) {
left[j] = B;
right[B] = j;
}
if (B <= W) {
d.key = B - s[B];
d.id = s[B];
push(d, &h);
}
while (h.size > 0 && t[h.obj[1].id] > h.obj[1].key + h.obj[1].id) pop(&h);
if (h.size > 0) printf("%d\n", h.obj[1].key + i);
else break;
}
for (; i <= H; i++) printf("-1\n");
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276686/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276686/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.min_heap = type { [400001 x %struct.data], i32 }
%struct.data = type { i32, i32 }
@.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
@stdout = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @push(i64 %x.coerce, ptr nocapture noundef %h) local_unnamed_addr #0 {
entry:
%size = getelementptr inbounds %struct.min_heap, ptr %h, i64 0, i32 1
%0 = load i32, ptr %size, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %size, align 4, !tbaa !5
%idxprom = sext i32 %inc to i64
%arrayidx = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom
store i64 %x.coerce, ptr %arrayidx, align 4, !tbaa.struct !10
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %while.body, label %while.end
while.body: ; preds = %entry, %if.then
%i.040 = phi i32 [ %shr, %if.then ], [ %inc, %entry ]
%idxprom2 = zext i32 %i.040 to i64
%arrayidx3 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !12
%shr = lshr i32 %i.040, 1
%idxprom5 = zext i32 %shr to i64
%arrayidx6 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !12
%cmp8 = icmp slt i32 %1, %2
br i1 %cmp8, label %if.then, label %while.end
if.then: ; preds = %while.body
%3 = load i64, ptr %arrayidx6, align 4
%4 = load i64, ptr %arrayidx3, align 4
store i64 %4, ptr %arrayidx6, align 4
store i64 %3, ptr %arrayidx3, align 4
%cmp = icmp ugt i32 %i.040, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !14
while.end: ; preds = %if.then, %while.body, %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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i64 @pop(ptr nocapture noundef %h) local_unnamed_addr #0 {
entry:
%arrayidx = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 1
%retval.sroa.0.0.copyload = load i64, ptr %arrayidx, align 4, !tbaa.struct !10
%size = getelementptr inbounds %struct.min_heap, ptr %h, i64 0, i32 1
%0 = load i32, ptr %size, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %size, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx4 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom
%1 = load i64, ptr %arrayidx4, align 4
store i64 %1, ptr %arrayidx, align 4
%cmp.not65 = icmp slt i32 %0, 3
br i1 %cmp.not65, label %while.end, label %while.body
while.body: ; preds = %entry, %if.then26
%2 = phi i32 [ %9, %if.then26 ], [ %dec, %entry ]
%j.067 = phi i32 [ %shl, %if.then26 ], [ 2, %entry ]
%i.066 = phi i32 [ %j.1, %if.then26 ], [ 1, %entry ]
%cmp7 = icmp slt i32 %j.067, %2
br i1 %cmp7, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.body
%xor64 = or i32 %j.067, 1
%idxprom9 = sext i32 %xor64 to i64
%arrayidx10 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom9
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !12
%idxprom12 = sext i32 %j.067 to i64
%arrayidx13 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom12
%4 = load i32, ptr %arrayidx13, align 4, !tbaa !12
%cmp15 = icmp slt i32 %3, %4
%spec.select = select i1 %cmp15, i32 %xor64, i32 %j.067
br label %if.end
if.end: ; preds = %land.lhs.true, %while.body
%j.1 = phi i32 [ %j.067, %while.body ], [ %spec.select, %land.lhs.true ]
%idxprom18 = sext i32 %j.1 to i64
%arrayidx19 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom18
%5 = load i32, ptr %arrayidx19, align 4, !tbaa !12
%idxprom22 = sext i32 %i.066 to i64
%arrayidx23 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom22
%6 = load i32, ptr %arrayidx23, align 4, !tbaa !12
%cmp25 = icmp slt i32 %5, %6
br i1 %cmp25, label %if.then26, label %while.end
if.then26: ; preds = %if.end
%7 = load i64, ptr %arrayidx19, align 4
%8 = load i64, ptr %arrayidx23, align 4
store i64 %8, ptr %arrayidx19, align 4
store i64 %7, ptr %arrayidx23, align 4
%shl = shl i32 %j.1, 1
%9 = load i32, ptr %size, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %shl, %9
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.then26, %if.end, %entry
ret i64 %retval.sroa.0.0.copyload
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @add_BIT(i32 noundef %N, ptr nocapture noundef %BIT, i32 noundef %i, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp.not6 = icmp sgt i32 %i, %N
br i1 %cmp.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%i.addr.07 = phi i32 [ %add1, %while.body ], [ %i, %entry ]
%idxprom = sext i32 %i.addr.07 to i64
%arrayidx = getelementptr inbounds i32, ptr %BIT, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%add = add nsw i32 %0, %k
store i32 %add, ptr %arrayidx, align 4, !tbaa !11
%sub = sub nsw i32 0, %i.addr.07
%and = and i32 %i.addr.07, %sub
%add1 = add nsw i32 %and, %i.addr.07
%cmp.not = icmp sgt i32 %add1, %N
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @sum_BIT(ptr nocapture noundef readonly %BIT, i32 noundef %r) local_unnamed_addr #2 {
entry:
%cmp7 = icmp sgt i32 %r, 0
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.09 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%r.addr.08 = phi i32 [ %sub1, %while.body ], [ %r, %entry ]
%idxprom = zext i32 %r.addr.08 to i64
%arrayidx = getelementptr inbounds i32, ptr %BIT, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%add = add nsw i32 %0, %sum.09
%sub.not = add nsw i32 %r.addr.08, -1
%sub1 = and i32 %sub.not, %r.addr.08
%cmp.not = icmp eq i32 %sub1, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%H = alloca i32, align 4
%W = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
%s = alloca [200002 x i32], align 16
%t = alloca [200002 x i32], align 16
%left = alloca [200002 x i32], align 16
%right = alloca [200002 x i32], align 16
%BIT = alloca [200001 x i32], align 16
%h = alloca %struct.min_heap, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W)
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %s) #8
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %t) #8
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %left) #8
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %right) #8
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %BIT) #8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800004) %BIT, i8 0, i64 800004, i1 false)
call void @llvm.lifetime.start.p0(i64 3200012, ptr nonnull %h) #8
%size = getelementptr inbounds %struct.min_heap, ptr %h, i64 0, i32 1
store i32 0, ptr %size, align 4, !tbaa !5
%0 = load i32, ptr %W, align 4, !tbaa !11
%cmp.not260 = icmp slt i32 %0, -1
br i1 %cmp.not260, label %for.cond14.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add i32 %0, 2
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body.preheader310, 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 i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.ind298 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next301, %vector.body ]
%vec.ind302 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next305, %vector.body ]
%step.add299 = add <4 x i32> %vec.ind298, <i32 4, i32 4, i32 4, i32 4>
%2 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %index
store <4 x i32> %vec.ind298, ptr %2, align 16, !tbaa !11
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> %step.add299, ptr %3, align 16, !tbaa !11
%4 = getelementptr inbounds [200002 x i32], ptr %t, i64 0, i64 %index
store <4 x i32> %vec.ind298, ptr %4, align 16, !tbaa !11
%5 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> %step.add299, ptr %5, align 16, !tbaa !11
%6 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %index
%7 = add <4 x i32> %vec.ind302, <i32 -1, i32 -1, i32 -1, i32 -1>
%8 = add <4 x i32> %vec.ind302, <i32 3, i32 3, i32 3, i32 3>
store <4 x i32> %7, ptr %6, align 16, !tbaa !11
%9 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %8, ptr %9, align 16, !tbaa !11
%10 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %index
%11 = trunc <4 x i64> %vec.ind to <4 x i32>
%12 = add <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%13 = trunc <4 x i64> %vec.ind to <4 x i32>
%14 = add <4 x i32> %13, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %12, ptr %10, align 16, !tbaa !11
%15 = getelementptr inbounds i32, ptr %10, i64 4
store <4 x i32> %14, ptr %15, align 16, !tbaa !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>
%vec.ind.next301 = add <4 x i32> %vec.ind298, <i32 8, i32 8, i32 8, i32 8>
%vec.ind.next305 = add <4 x i32> %vec.ind302, <i32 8, i32 8, i32 8, i32 8>
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond8.preheader, label %for.body.preheader310
for.body.preheader310: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond8.preheader: ; preds = %for.body, %middle.block
%cmp9.not262 = icmp slt i32 %0, 1
br i1 %cmp9.not262, label %for.cond14.preheader, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%17 = add nuw i32 %0, 1
%wide.trip.count286 = zext i32 %17 to i64
br label %for.body10
for.body: ; preds = %for.body.preheader310, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader310 ]
%arrayidx = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %indvars.iv
%18 = trunc i64 %indvars.iv to i32
store i32 %18, ptr %arrayidx, align 4, !tbaa !11
%arrayidx2 = getelementptr inbounds [200002 x i32], ptr %t, i64 0, i64 %indvars.iv
store i32 %18, ptr %arrayidx2, align 4, !tbaa !11
%arrayidx4 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %indvars.iv
%19 = trunc i64 %indvars.iv to i32
%20 = add i32 %19, -1
store i32 %20, ptr %arrayidx4, align 4, !tbaa !11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx7 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %indvars.iv
%21 = trunc i64 %indvars.iv.next to i32
store i32 %21, ptr %arrayidx7, align 4, !tbaa !11
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %for.cond8.preheader, label %for.body, !llvm.loop !22
for.cond14.preheader: ; preds = %add_BIT.exit, %entry, %for.cond8.preheader
%22 = load i32, ptr %H, align 4, !tbaa !11
%cmp15.not274 = icmp slt i32 %22, 1
br i1 %cmp15.not274, label %for.end124, label %for.body16.lr.ph
for.body16.lr.ph: ; preds = %for.cond14.preheader
%arrayidx97 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 1
%id98 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 1, i32 1
br label %for.body16
for.body10: ; preds = %for.body10.preheader, %add_BIT.exit
%indvars.iv283 = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next284, %add_BIT.exit ]
%d.sroa.6.0.insert.shift = shl nuw nsw i64 %indvars.iv283, 32
%23 = load i32, ptr %size, align 4, !tbaa !5
%inc.i = add nsw i32 %23, 1
store i32 %inc.i, ptr %size, align 4, !tbaa !5
%idxprom.i = sext i32 %inc.i to i64
%arrayidx.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom.i
store i64 %d.sroa.6.0.insert.shift, ptr %arrayidx.i, align 4, !tbaa.struct !10
%cmp39.i = icmp sgt i32 %23, 0
br i1 %cmp39.i, label %while.body.i, label %push.exit
while.body.i: ; preds = %for.body10, %if.then.i
%i.040.i = phi i32 [ %shr.i, %if.then.i ], [ %inc.i, %for.body10 ]
%idxprom2.i = zext i32 %i.040.i to i64
%arrayidx3.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom2.i
%24 = load i32, ptr %arrayidx3.i, align 4, !tbaa !12
%shr.i = lshr i32 %i.040.i, 1
%idxprom5.i = zext i32 %shr.i to i64
%arrayidx6.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom5.i
%25 = load i32, ptr %arrayidx6.i, align 4, !tbaa !12
%cmp8.i = icmp slt i32 %24, %25
br i1 %cmp8.i, label %if.then.i, label %push.exit
if.then.i: ; preds = %while.body.i
%26 = load i64, ptr %arrayidx6.i, align 4
%27 = load i64, ptr %arrayidx3.i, align 4
store i64 %27, ptr %arrayidx6.i, align 4
store i64 %26, ptr %arrayidx3.i, align 4
%cmp.i = icmp ugt i32 %i.040.i, 3
br i1 %cmp.i, label %while.body.i, label %push.exit, !llvm.loop !14
push.exit: ; preds = %while.body.i, %if.then.i, %for.body10
%28 = trunc i64 %indvars.iv283 to i32
br label %while.body.i181
while.body.i181: ; preds = %push.exit, %while.body.i181
%i.addr.07.i = phi i32 [ %add1.i, %while.body.i181 ], [ %28, %push.exit ]
%idxprom.i182 = sext i32 %i.addr.07.i to i64
%arrayidx.i183 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i182
%29 = load i32, ptr %arrayidx.i183, align 4, !tbaa !11
%add.i = add nsw i32 %29, 1
store i32 %add.i, ptr %arrayidx.i183, align 4, !tbaa !11
%sub.i = sub nsw i32 0, %i.addr.07.i
%and.i = and i32 %i.addr.07.i, %sub.i
%add1.i = add nsw i32 %and.i, %i.addr.07.i
%cmp.not.i = icmp sgt i32 %add1.i, %0
br i1 %cmp.not.i, label %add_BIT.exit, label %while.body.i181, !llvm.loop !17
add_BIT.exit: ; preds = %while.body.i181
%indvars.iv.next284 = add nuw nsw i64 %indvars.iv283, 1
%exitcond287.not = icmp eq i64 %indvars.iv.next284, %wide.trip.count286
br i1 %exitcond287.not, label %for.cond14.preheader, label %for.body10, !llvm.loop !23
for.body16: ; preds = %for.body16.lr.ph, %for.inc122
%i.2275 = phi i32 [ 1, %for.body16.lr.ph ], [ %inc123, %for.inc122 ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%30 = load i32, ptr %A, align 4, !tbaa !11
%cmp7.i = icmp sgt i32 %30, 1
br i1 %cmp7.i, label %while.body.i184.preheader, label %sum_BIT.exit
while.body.i184.preheader: ; preds = %for.body16
%sub19 = add nsw i32 %30, -1
br label %while.body.i184
while.body.i184: ; preds = %while.body.i184.preheader, %while.body.i184
%sum.09.i = phi i32 [ %add.i187, %while.body.i184 ], [ 0, %while.body.i184.preheader ]
%r.addr.08.i = phi i32 [ %sub1.i, %while.body.i184 ], [ %sub19, %while.body.i184.preheader ]
%idxprom.i185 = zext i32 %r.addr.08.i to i64
%arrayidx.i186 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i185
%31 = load i32, ptr %arrayidx.i186, align 4, !tbaa !11
%add.i187 = add nsw i32 %31, %sum.09.i
%sub.not.i = add nsw i32 %r.addr.08.i, -1
%sub1.i = and i32 %sub.not.i, %r.addr.08.i
%cmp.not.i188 = icmp eq i32 %sub1.i, 0
br i1 %cmp.not.i188, label %sum_BIT.exit, label %while.body.i184, !llvm.loop !18
sum_BIT.exit: ; preds = %while.body.i184, %for.body16
%sum.0.lcssa.i = phi i32 [ 0, %for.body16 ], [ %add.i187, %while.body.i184 ]
%32 = load i32, ptr %B, align 4, !tbaa !11
%cmp7.i189 = icmp sgt i32 %32, 0
br i1 %cmp7.i189, label %while.body.i191, label %sum_BIT.exit200
while.body.i191: ; preds = %sum_BIT.exit, %while.body.i191
%sum.09.i192 = phi i32 [ %add.i196, %while.body.i191 ], [ 0, %sum_BIT.exit ]
%r.addr.08.i193 = phi i32 [ %sub1.i198, %while.body.i191 ], [ %32, %sum_BIT.exit ]
%idxprom.i194 = zext i32 %r.addr.08.i193 to i64
%arrayidx.i195 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i194
%33 = load i32, ptr %arrayidx.i195, align 4, !tbaa !11
%add.i196 = add nsw i32 %33, %sum.09.i192
%sub.not.i197 = add nsw i32 %r.addr.08.i193, -1
%sub1.i198 = and i32 %sub.not.i197, %r.addr.08.i193
%cmp.not.i199 = icmp eq i32 %sub1.i198, 0
br i1 %cmp.not.i199, label %sum_BIT.exit200, label %while.body.i191, !llvm.loop !18
sum_BIT.exit200: ; preds = %while.body.i191, %sum_BIT.exit
%sum.0.lcssa.i190 = phi i32 [ 0, %sum_BIT.exit ], [ %add.i196, %while.body.i191 ]
%cmp23 = icmp eq i32 %sum.0.lcssa.i190, %sum.0.lcssa.i
br i1 %cmp23, label %if.then, label %if.end
if.then: ; preds = %sum_BIT.exit200
%34 = load i32, ptr %arrayidx97, align 4, !tbaa !12
br label %for.inc122
if.end: ; preds = %sum_BIT.exit200
%inc28 = add nsw i32 %32, 1
store i32 %inc28, ptr %B, align 4, !tbaa !11
%cmp29264 = icmp slt i32 %30, %32
br i1 %cmp29264, label %while.body, label %while.end
while.body: ; preds = %if.end, %sum_BIT.exit212
%L.0266 = phi i32 [ %L.1, %sum_BIT.exit212 ], [ %30, %if.end ]
%R.0265 = phi i32 [ %R.1, %sum_BIT.exit212 ], [ %32, %if.end ]
%add30 = add nsw i32 %L.0266, %R.0265
%div = sdiv i32 %add30, 2
%cmp7.i201 = icmp sgt i32 %add30, 1
br i1 %cmp7.i201, label %while.body.i203, label %sum_BIT.exit212
while.body.i203: ; preds = %while.body, %while.body.i203
%sum.09.i204 = phi i32 [ %add.i208, %while.body.i203 ], [ 0, %while.body ]
%r.addr.08.i205 = phi i32 [ %sub1.i210, %while.body.i203 ], [ %div, %while.body ]
%idxprom.i206 = zext i32 %r.addr.08.i205 to i64
%arrayidx.i207 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i206
%35 = load i32, ptr %arrayidx.i207, align 4, !tbaa !11
%add.i208 = add nsw i32 %35, %sum.09.i204
%sub.not.i209 = add nsw i32 %r.addr.08.i205, -1
%sub1.i210 = and i32 %sub.not.i209, %r.addr.08.i205
%cmp.not.i211 = icmp eq i32 %sub1.i210, 0
br i1 %cmp.not.i211, label %sum_BIT.exit212, label %while.body.i203, !llvm.loop !18
sum_BIT.exit212: ; preds = %while.body.i203, %while.body
%sum.0.lcssa.i202 = phi i32 [ 0, %while.body ], [ %add.i208, %while.body.i203 ]
%cmp33 = icmp sgt i32 %sum.0.lcssa.i202, %sum.0.lcssa.i
%add35 = add nsw i32 %div, 1
%R.1 = select i1 %cmp33, i32 %div, i32 %R.0265
%L.1 = select i1 %cmp33, i32 %L.0266, i32 %add35
%cmp29 = icmp slt i32 %L.1, %R.1
br i1 %cmp29, label %while.body, label %while.end, !llvm.loop !24
while.end: ; preds = %sum_BIT.exit212, %if.end
%L.0.lcssa = phi i32 [ %30, %if.end ], [ %L.1, %sum_BIT.exit212 ]
%idxprom37 = sext i32 %L.0.lcssa to i64
%arrayidx38 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %idxprom37
%36 = load i32, ptr %arrayidx38, align 4, !tbaa !11
%idxprom39 = sext i32 %inc28 to i64
%arrayidx40 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %idxprom39
store i32 %36, ptr %arrayidx40, align 4, !tbaa !11
%37 = load i32, ptr %arrayidx38, align 4, !tbaa !11
%idxprom43 = sext i32 %37 to i64
%arrayidx44 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %idxprom43
store i32 %inc28, ptr %arrayidx44, align 4, !tbaa !11
%arrayidx46 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %idxprom39
%38 = load i32, ptr %arrayidx46, align 4, !tbaa !11
%cmp47 = icmp slt i32 %38, 0
br i1 %cmp47, label %if.then48, label %if.end50
if.then48: ; preds = %while.end
%39 = load i32, ptr %W, align 4, !tbaa !11
%cmp.not6.i213.not = icmp slt i32 %32, %39
br i1 %cmp.not6.i213.not, label %while.body.i214, label %if.end50
while.body.i214: ; preds = %if.then48, %while.body.i214
%i.addr.07.i215 = phi i32 [ %add1.i221, %while.body.i214 ], [ %inc28, %if.then48 ]
%idxprom.i216 = sext i32 %i.addr.07.i215 to i64
%arrayidx.i217 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i216
%40 = load i32, ptr %arrayidx.i217, align 4, !tbaa !11
%add.i218 = add nsw i32 %40, 1
store i32 %add.i218, ptr %arrayidx.i217, align 4, !tbaa !11
%sub.i219 = sub nsw i32 0, %i.addr.07.i215
%and.i220 = and i32 %i.addr.07.i215, %sub.i219
%add1.i221 = add nsw i32 %and.i220, %i.addr.07.i215
%cmp.not.i222 = icmp sgt i32 %add1.i221, %39
br i1 %cmp.not.i222, label %if.end50, label %while.body.i214, !llvm.loop !17
if.end50: ; preds = %while.body.i214, %if.then48, %while.end
%cmp52.not268 = icmp sgt i32 %L.0.lcssa, %32
br i1 %cmp52.not268, label %for.end75, label %for.body53.lr.ph
for.body53.lr.ph: ; preds = %if.end50
%41 = load i32, ptr %W, align 4, !tbaa !11
br label %for.body53
for.body53: ; preds = %for.body53.lr.ph, %add_BIT.exit234
%j.0269 = phi i32 [ %L.0.lcssa, %for.body53.lr.ph ], [ %45, %add_BIT.exit234 ]
%idxprom54 = sext i32 %j.0269 to i64
%arrayidx55 = getelementptr inbounds [200002 x i32], ptr %s, i64 0, i64 %idxprom54
%42 = load i32, ptr %arrayidx55, align 4, !tbaa !11
%idxprom56 = sext i32 %42 to i64
%arrayidx57 = getelementptr inbounds [200002 x i32], ptr %t, i64 0, i64 %idxprom56
store i32 %inc28, ptr %arrayidx57, align 4, !tbaa !11
%43 = load i32, ptr %arrayidx46, align 4, !tbaa !11
%. = call i32 @llvm.smax.i32(i32 %42, i32 %43)
store i32 %., ptr %arrayidx46, align 4, !tbaa !11
store i32 -1, ptr %arrayidx55, align 4, !tbaa !11
%cmp.not6.i224 = icmp sgt i32 %j.0269, %41
br i1 %cmp.not6.i224, label %add_BIT.exit234, label %while.body.i225
while.body.i225: ; preds = %for.body53, %while.body.i225
%i.addr.07.i226 = phi i32 [ %add1.i232, %while.body.i225 ], [ %j.0269, %for.body53 ]
%idxprom.i227 = sext i32 %i.addr.07.i226 to i64
%arrayidx.i228 = getelementptr inbounds i32, ptr %BIT, i64 %idxprom.i227
%44 = load i32, ptr %arrayidx.i228, align 4, !tbaa !11
%add.i229 = add nsw i32 %44, -1
store i32 %add.i229, ptr %arrayidx.i228, align 4, !tbaa !11
%sub.i230 = sub nsw i32 0, %i.addr.07.i226
%and.i231 = and i32 %i.addr.07.i226, %sub.i230
%add1.i232 = add nsw i32 %and.i231, %i.addr.07.i226
%cmp.not.i233 = icmp sgt i32 %add1.i232, %41
br i1 %cmp.not.i233, label %add_BIT.exit234, label %while.body.i225, !llvm.loop !17
add_BIT.exit234: ; preds = %while.body.i225, %for.body53
%arrayidx74 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %idxprom54
%45 = load i32, ptr %arrayidx74, align 4, !tbaa !11
%cmp52.not = icmp sgt i32 %45, %32
br i1 %cmp52.not, label %for.end75, label %for.body53, !llvm.loop !25
for.end75: ; preds = %add_BIT.exit234, %if.end50
%j.0.lcssa = phi i32 [ %L.0.lcssa, %if.end50 ], [ %45, %add_BIT.exit234 ]
%cmp76.not = icmp eq i32 %j.0.lcssa, %inc28
br i1 %cmp76.not, label %if.end82, label %if.then77
if.then77: ; preds = %for.end75
%idxprom78 = sext i32 %j.0.lcssa to i64
%arrayidx79 = getelementptr inbounds [200002 x i32], ptr %left, i64 0, i64 %idxprom78
store i32 %inc28, ptr %arrayidx79, align 4, !tbaa !11
%arrayidx81 = getelementptr inbounds [200002 x i32], ptr %right, i64 0, i64 %idxprom39
store i32 %j.0.lcssa, ptr %arrayidx81, align 4, !tbaa !11
br label %if.end82
if.end82: ; preds = %if.then77, %for.end75
%46 = load i32, ptr %W, align 4, !tbaa !11
%cmp83.not.not = icmp slt i32 %32, %46
br i1 %cmp83.not.not, label %if.then84, label %if.end92
if.then84: ; preds = %if.end82
%47 = load i32, ptr %arrayidx46, align 4, !tbaa !11
%sub87 = sub nsw i32 %inc28, %47
%d.sroa.6.0.insert.ext138 = zext i32 %47 to i64
%d.sroa.6.0.insert.shift139 = shl nuw i64 %d.sroa.6.0.insert.ext138, 32
%d.sroa.0.0.insert.ext134 = zext i32 %sub87 to i64
%d.sroa.0.0.insert.insert136 = or i64 %d.sroa.6.0.insert.shift139, %d.sroa.0.0.insert.ext134
%48 = load i32, ptr %size, align 4, !tbaa !5
%inc.i236 = add nsw i32 %48, 1
store i32 %inc.i236, ptr %size, align 4, !tbaa !5
%idxprom.i237 = sext i32 %inc.i236 to i64
%arrayidx.i238 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom.i237
store i64 %d.sroa.0.0.insert.insert136, ptr %arrayidx.i238, align 4, !tbaa.struct !10
%cmp39.i239 = icmp sgt i32 %48, 0
br i1 %cmp39.i239, label %while.body.i240, label %if.end92
while.body.i240: ; preds = %if.then84, %if.then.i248
%i.040.i241 = phi i32 [ %shr.i244, %if.then.i248 ], [ %inc.i236, %if.then84 ]
%idxprom2.i242 = zext i32 %i.040.i241 to i64
%arrayidx3.i243 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom2.i242
%49 = load i32, ptr %arrayidx3.i243, align 4, !tbaa !12
%shr.i244 = lshr i32 %i.040.i241, 1
%idxprom5.i245 = zext i32 %shr.i244 to i64
%arrayidx6.i246 = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom5.i245
%50 = load i32, ptr %arrayidx6.i246, align 4, !tbaa !12
%cmp8.i247 = icmp slt i32 %49, %50
br i1 %cmp8.i247, label %if.then.i248, label %if.end92
if.then.i248: ; preds = %while.body.i240
%51 = load i64, ptr %arrayidx6.i246, align 4
%52 = load i64, ptr %arrayidx3.i243, align 4
store i64 %52, ptr %arrayidx6.i246, align 4
store i64 %51, ptr %arrayidx3.i243, align 4
%cmp.i249 = icmp ugt i32 %i.040.i241, 3
br i1 %cmp.i249, label %while.body.i240, label %if.end92, !llvm.loop !14
if.end92: ; preds = %if.then.i248, %while.body.i240, %if.then84, %if.end82
%53 = load i32, ptr %size, align 4, !tbaa !5
%cmp95271 = icmp sgt i32 %53, 0
br i1 %cmp95271, label %land.rhs, label %for.end124
land.rhs: ; preds = %if.end92, %pop.exit
%54 = phi i32 [ %67, %pop.exit ], [ %53, %if.end92 ]
%55 = load i32, ptr %id98, align 4, !tbaa !26
%idxprom99 = sext i32 %55 to i64
%arrayidx100 = getelementptr inbounds [200002 x i32], ptr %t, i64 0, i64 %idxprom99
%56 = load i32, ptr %arrayidx100, align 4, !tbaa !11
%57 = load i32, ptr %arrayidx97, align 4, !tbaa !12
%add107 = add nsw i32 %57, %55
%cmp108 = icmp sgt i32 %56, %add107
br i1 %cmp108, label %while.body109, label %for.inc122
while.body109: ; preds = %land.rhs
%dec.i = add nsw i32 %54, -1
store i32 %dec.i, ptr %size, align 4, !tbaa !5
%idxprom.i253 = zext i32 %54 to i64
%arrayidx4.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom.i253
%58 = load i64, ptr %arrayidx4.i, align 4
store i64 %58, ptr %arrayidx97, align 4
%cmp.not65.i = icmp ult i32 %54, 3
br i1 %cmp.not65.i, label %pop.exit, label %while.body.i254
while.body.i254: ; preds = %while.body109, %if.then26.i
%59 = phi i32 [ %66, %if.then26.i ], [ %dec.i, %while.body109 ]
%j.067.i = phi i32 [ %shl.i, %if.then26.i ], [ 2, %while.body109 ]
%i.066.i = phi i32 [ %j.1.i, %if.then26.i ], [ 1, %while.body109 ]
%cmp7.i255 = icmp slt i32 %j.067.i, %59
br i1 %cmp7.i255, label %land.lhs.true.i, label %if.end.i
land.lhs.true.i: ; preds = %while.body.i254
%xor64.i = or i32 %j.067.i, 1
%idxprom9.i = sext i32 %xor64.i to i64
%arrayidx10.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom9.i
%60 = load i32, ptr %arrayidx10.i, align 4, !tbaa !12
%idxprom12.i = sext i32 %j.067.i to i64
%arrayidx13.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom12.i
%61 = load i32, ptr %arrayidx13.i, align 4, !tbaa !12
%cmp15.i = icmp slt i32 %60, %61
%spec.select.i = select i1 %cmp15.i, i32 %xor64.i, i32 %j.067.i
br label %if.end.i
if.end.i: ; preds = %land.lhs.true.i, %while.body.i254
%j.1.i = phi i32 [ %j.067.i, %while.body.i254 ], [ %spec.select.i, %land.lhs.true.i ]
%idxprom18.i = sext i32 %j.1.i to i64
%arrayidx19.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom18.i
%62 = load i32, ptr %arrayidx19.i, align 4, !tbaa !12
%idxprom22.i = sext i32 %i.066.i to i64
%arrayidx23.i = getelementptr inbounds [400001 x %struct.data], ptr %h, i64 0, i64 %idxprom22.i
%63 = load i32, ptr %arrayidx23.i, align 4, !tbaa !12
%cmp25.i = icmp slt i32 %62, %63
br i1 %cmp25.i, label %if.then26.i, label %pop.exit
if.then26.i: ; preds = %if.end.i
%64 = load i64, ptr %arrayidx19.i, align 4
%65 = load i64, ptr %arrayidx23.i, align 4
store i64 %65, ptr %arrayidx19.i, align 4
store i64 %64, ptr %arrayidx23.i, align 4
%shl.i = shl i32 %j.1.i, 1
%66 = load i32, ptr %size, align 4, !tbaa !5
%cmp.not.i256 = icmp sgt i32 %shl.i, %66
br i1 %cmp.not.i256, label %pop.exit, label %while.body.i254, !llvm.loop !16
pop.exit: ; preds = %if.end.i, %if.then26.i, %while.body109
%67 = phi i32 [ %dec.i, %while.body109 ], [ %59, %if.end.i ], [ %66, %if.then26.i ]
%cmp95 = icmp sgt i32 %67, 0
br i1 %cmp95, label %land.rhs, label %for.end124, !llvm.loop !27
for.inc122: ; preds = %land.rhs, %if.then
%.lcssa290.sink = phi i32 [ %34, %if.then ], [ %57, %land.rhs ]
%add118 = add nsw i32 %.lcssa290.sink, %i.2275
%call119 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add118)
%inc123 = add nuw nsw i32 %i.2275, 1
%68 = load i32, ptr %H, align 4, !tbaa !11
%cmp15.not.not = icmp slt i32 %i.2275, %68
br i1 %cmp15.not.not, label %for.body16, label %for.end124, !llvm.loop !28
for.end124: ; preds = %for.inc122, %if.end92, %pop.exit, %for.cond14.preheader
%i.2259 = phi i32 [ 1, %for.cond14.preheader ], [ %i.2275, %pop.exit ], [ %i.2275, %if.end92 ], [ %inc123, %for.inc122 ]
%69 = load i32, ptr %H, align 4, !tbaa !11
%cmp126.not277 = icmp sgt i32 %i.2259, %69
br i1 %cmp126.not277, label %for.end131, label %for.body127
for.body127: ; preds = %for.end124, %for.body127
%i.3278 = phi i32 [ %inc130, %for.body127 ], [ %i.2259, %for.end124 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%inc130 = add nuw nsw i32 %i.3278, 1
%70 = load i32, ptr %H, align 4, !tbaa !11
%cmp126.not.not = icmp slt i32 %i.3278, %70
br i1 %cmp126.not.not, label %for.body127, label %for.end131, !llvm.loop !29
for.end131: ; preds = %for.body127, %for.end124
%71 = load ptr, ptr @stdout, align 8, !tbaa !30
%call132 = call i32 @fflush(ptr noundef %71)
call void @llvm.lifetime.end.p0(i64 3200012, ptr nonnull %h) #8
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %BIT) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %right) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %left) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %t) #8
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %s) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
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 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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, !9, i64 3200008}
!6 = !{!"", !7, i64 0, !9, i64 3200008}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
!11 = !{!9, !9, i64 0}
!12 = !{!13, !9, i64 0}
!13 = !{!"", !9, i64 0, !9, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !15, !21, !20}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}
!25 = distinct !{!25, !15}
!26 = !{!13, !9, i64 4}
!27 = distinct !{!27, !15}
!28 = distinct !{!28, !15}
!29 = distinct !{!29, !15}
!30 = !{!31, !31, i64 0}
!31 = !{!"any pointer", !7, i64 0}
|
#include<stdio.h>
int main(void)
{
int a,b,c,cnt,x;
scanf("%d %d %d",&a,&b,&c);
cnt=0; x=0;
while(1){
x+=a;
cnt++;
if(cnt%7==0) x+=b;
if(c<=x) break;
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276729/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276729/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 [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
%c = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4
%2 = load i32, ptr %c, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%cnt.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%x.0 = phi i32 [ 0, %entry ], [ %x.1, %while.cond ]
%add = add nsw i32 %0, %x.0
%inc = add nuw nsw i32 %cnt.0, 1
%rem = urem i32 %inc, 7
%cmp = icmp eq i32 %rem, 0
%add1 = select i1 %cmp, i32 %1, i32 0
%x.1 = add nsw i32 %add, %add1
%cmp2.not = icmp sgt i32 %2, %x.1
br i1 %cmp2.not, label %while.cond, label %while.end
while.end: ; preds = %while.cond
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %inc)
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"}
|
#include<stdio.h>
int main(){
int n,m,i,a,b,ans;
scanf("%d %d",&n,&m);
int h[n+1];
int count[n+1];
for(i=1;i<=n;i++){
scanf("%d",&h[i]);
count[i]=1;
}
for(i=1;i<=m;i++){
scanf("%d %d",&a,&b);
if(h[a]>=h[b]){
count[b]=0;
}
if(h[a]<=h[b])
count[a]=0;
}
for(i=1,ans=0;i<=n;i++){
if(count[i]==1)
ans++;
}
printf("%d",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276772/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276772/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
; 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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
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 = 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 !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%add1 = add nsw i32 %3, 1
%4 = zext i32 %add1 to i64
%vla2 = alloca i32, i64 %4, align 16
%cmp.not51 = icmp slt i32 %3, 1
br i1 %cmp.not51, label %for.cond6.preheader, label %for.body
for.cond6.preheader: ; preds = %for.body, %entry
%5 = phi i32 [ %3, %entry ], [ %7, %for.body ]
%6 = load i32, ptr %m, align 4, !tbaa !5
%cmp7.not53 = icmp slt i32 %6, 1
br i1 %cmp7.not53, label %for.cond29.preheader, label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx5 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv
store i32 1, ptr %arrayidx5, align 4, !tbaa !5
%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.not.not = icmp slt i64 %indvars.iv, %8
br i1 %cmp.not.not, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond29.preheader.loopexit: ; preds = %for.inc26
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond29.preheader
for.cond29.preheader: ; preds = %for.cond29.preheader.loopexit, %for.cond6.preheader
%9 = phi i32 [ %.pre, %for.cond29.preheader.loopexit ], [ %5, %for.cond6.preheader ]
%cmp30.not55 = icmp slt i32 %9, 1
br i1 %cmp30.not55, label %for.end40, label %for.body31.preheader
for.body31.preheader: ; preds = %for.cond29.preheader
%10 = add nuw i32 %9, 1
%wide.trip.count = zext i32 %10 to i64
%11 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %9, 8
br i1 %min.iters.check, label %for.body31.preheader64, label %vector.ph
vector.ph: ; preds = %for.body31.preheader
%n.vec = and i64 %11, -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 ], [ %18, %vector.body ]
%vec.phi62 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%offset.idx = or i64 %index, 1
%12 = getelementptr inbounds i32, ptr %vla2, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load63 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = icmp eq <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%15 = icmp eq <4 x i32> %wide.load63, <i32 1, i32 1, i32 1, i32 1>
%16 = zext <4 x i1> %14 to <4 x i32>
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = add <4 x i32> %vec.phi, %16
%19 = add <4 x i32> %vec.phi62, %17
%index.next = add nuw i64 %index, 8
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %19, %18
%21 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %11, %n.vec
br i1 %cmp.n, label %for.end40, label %for.body31.preheader64
for.body31.preheader64: ; preds = %for.body31.preheader, %middle.block
%indvars.iv59.ph = phi i64 [ 1, %for.body31.preheader ], [ %ind.end, %middle.block ]
%ans.056.ph = phi i32 [ 0, %for.body31.preheader ], [ %21, %middle.block ]
br label %for.body31
for.body8: ; preds = %for.cond6.preheader, %for.inc26
%i.154 = phi i32 [ %inc27, %for.inc26 ], [ 1, %for.cond6.preheader ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%22 = load i32, ptr %a, align 4, !tbaa !5
%idxprom10 = sext i32 %22 to i64
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10
%23 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%24 = load i32, ptr %b, align 4, !tbaa !5
%idxprom12 = sext i32 %24 to i64
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %idxprom12
%25 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14.not = icmp slt i32 %23, %25
br i1 %cmp14.not, label %if.end, label %if.then
if.then: ; preds = %for.body8
%arrayidx16 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom12
store i32 0, ptr %arrayidx16, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body8
%cmp21.not = icmp sgt i32 %23, %25
br i1 %cmp21.not, label %for.inc26, label %if.then22
if.then22: ; preds = %if.end
%arrayidx24 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom10
store i32 0, ptr %arrayidx24, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %if.end, %if.then22
%inc27 = add nuw nsw i32 %i.154, 1
%26 = load i32, ptr %m, align 4, !tbaa !5
%cmp7.not.not = icmp slt i32 %i.154, %26
br i1 %cmp7.not.not, label %for.body8, label %for.cond29.preheader.loopexit, !llvm.loop !14
for.body31: ; preds = %for.body31.preheader64, %for.body31
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.body31 ], [ %indvars.iv59.ph, %for.body31.preheader64 ]
%ans.056 = phi i32 [ %spec.select, %for.body31 ], [ %ans.056.ph, %for.body31.preheader64 ]
%arrayidx33 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv59
%27 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34 = icmp eq i32 %27, 1
%inc36 = zext i1 %cmp34 to i32
%spec.select = add nuw nsw i32 %ans.056, %inc36
%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.end40, label %for.body31, !llvm.loop !15
for.end40: ; preds = %for.body31, %middle.block, %for.cond29.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond29.preheader ], [ %21, %middle.block ], [ %spec.select, %for.body31 ]
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
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: 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.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 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
|
#include <stdio.h>
// #include <stdlib.h>
// const int MAX_TEMBODAI_NUMBER = 9999999;
typedef struct {
int height;
short is_good; // 0: 未定義, 1: 悪い展望台, 2: 良い展望台, 3: 引き分けなので保留
} Tembodai;
// 降順
/* static int compareFunction(const void *lhs, const void *rhs) { */
/* return ((Tembodai *)rhs)->height - ((Tembodai *)lhs)->height; */
/* } */
/**
*
* 0 -> 1: Ao
* 0 -> 2: Bo
* 0 -> 3: Co
* 1 -> 0: Dx
* 1 -> 2: Ex
* 1 -> 3: Fx
* 2 -> 0: Gx
* 2 -> 1: Ho
* 2 -> 3: Io
* 3 -> 0: Jx
* 3 -> 1: Ko
* 3 -> 2: Lx // これ要注意。引き分けは「一番」には含めない
*
*/
int main() {
int tembodai_count, temboway_count;
scanf("%d %d", &tembodai_count, &temboway_count);
Tembodai tembodai[tembodai_count];
for (int i = 0; i < tembodai_count; i += 1) {
scanf("%d", &tembodai[i].height);
tembodai[i].is_good = 0;
}
// qsort(tembodai, tembodai_count, sizeof(*tembodai), compareFunction);
for (int j = 0; j < temboway_count; j += 1) {
int tembodai_number_a, tembodai_number_b;
scanf("%d %d", &tembodai_number_a, &tembodai_number_b);
int tembodai_index_a = tembodai_number_a - 1;
int tembodai_index_b = tembodai_number_b - 1;
/* printf("%c", '\n'); */
/* printf("%s", "tembodai_index_a は "); */
/* printf("%d", tembodai_index_a); */
/* printf("%c", '\n'); */
/* printf("%s", "tembodai_index_b は "); */
/* printf("%d", tembodai_index_b); */
/* printf("%c", '\n'); */
if (tembodai[tembodai_index_a].height > tembodai[tembodai_index_b].height) {
// A の方が高いケース
if (tembodai[tembodai_index_a].is_good == 0/* || tembodai[tembodai_index_a].is_good == 3 */) {
// A が未定義の展望台または保留中の展望台だった場合
// A を良い展望台に変更
// <B>
tembodai[tembodai_index_a].is_good = 2;
}
if (tembodai[tembodai_index_b].is_good != 1) {
// B が良い展望台または未定義の展望台または保留中の展望台だった場合
// B を悪い展望台に変更
// <A>, <H>, <K>
tembodai[tembodai_index_b].is_good = 1;
}
} else if (tembodai[tembodai_index_a].height < tembodai[tembodai_index_b].height) {
// B の方が高いケース
if (tembodai[tembodai_index_b].is_good == 0/* || tembodai[tembodai_index_b].is_good == 3 */) {
// B が未定義の展望台または保留中の展望台だった場合のみ
// B を良い展望台に変更
// <B>
tembodai[tembodai_index_b].is_good = 2;
}
if (tembodai[tembodai_index_a].is_good != 1) {
// A が良い展望台または未定義の展望台または保留中の展望台だった場合
// A を悪い展望台に変更
// <A>, <H>, <K>
tembodai[tembodai_index_a].is_good = 1;
}
} else {
// 高さが同じケース
if (tembodai[tembodai_index_a].is_good == 0 || tembodai[tembodai_index_a].is_good == 2) {
// A が未定義の展望台または良い展望台だった場合
// A を保留中の展望台に変更
// <C>, <I>
tembodai[tembodai_index_a].is_good = 3;
}
if (tembodai[tembodai_index_b].is_good == 0 || tembodai[tembodai_index_b].is_good == 2) {
// B が未定義の展望台または良い展望台だった場合
// B を保留中の展望台に変更
// <C>, <I>
tembodai[tembodai_index_b].is_good = 3;
}
}
/* printf("%c", '\n'); */
/* printf("%s", "展望台 "); */
/* printf("%d", tembodai_index_a); */
/* printf("%s", " の評価は "); */
/* printf("%hd", tembodai[tembodai_index_a].is_good); */
/* printf("%c", '\n'); */
/* printf("%s", "展望台 "); */
/* printf("%d", tembodai_index_b); */
/* printf("%s", " の評価は "); */
/* printf("%hd", tembodai[tembodai_index_b].is_good); */
/* printf("%c", '\n'); */
}
int output = 0;
for (int k = 0; k < tembodai_count; k += 1) {
/* printf("%c", '\n'); */
/* printf("%s", "展望台 "); */
/* printf("%d", k); */
/* printf("%s", " の評価は "); */
/* printf("%hd", tembodai[k].is_good); */
/* printf("%c", '\n'); */
if (tembodai[k].is_good == 0) {
// 展望台k が未定義の展望台だった場合
// 展望台k は「一本の道を使って辿り着ける展望台が存在しない場合」に該当するので
// 展望台k を良い展望台に変更
tembodai[k].is_good = 2;
}
// if (tembodai[k].is_good == 3) {
// 展望台k が保留中の展望台だった場合
// 展望台k は一本の道を使って辿り着ける自身より低い展望台が存在しないので
// 展望台k を悪い展望台に変更
// tembodai[k].is_good = 1;
// }
if (tembodai[k].is_good == 2) {
output += 1;
}
}
printf("%d", output);
printf("%c", '\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276815/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276815/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.Tembodai = type { i32, i16 }
@.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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%tembodai_count = alloca i32, align 4
%temboway_count = alloca i32, align 4
%tembodai_number_a = alloca i32, align 4
%tembodai_number_b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tembodai_count) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temboway_count) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tembodai_count, ptr noundef nonnull %temboway_count)
%0 = load i32, ptr %tembodai_count, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.Tembodai, i64 %1, align 16
%3 = load i32, ptr %tembodai_count, align 4, !tbaa !5
%cmp165 = icmp sgt i32 %3, 0
br i1 %cmp165, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%4 = phi i32 [ %3, %entry ], [ %6, %for.body ]
%5 = load i32, ptr %temboway_count, align 4, !tbaa !5
%cmp5167 = icmp sgt i32 %5, 0
br i1 %cmp5167, label %for.body7, label %for.cond109.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%is_good = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %indvars.iv, i32 1
store i16 0, ptr %is_good, align 4, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %tembodai_count, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !12
for.cond109.preheader.loopexit: ; preds = %if.end105
%.pre = load i32, ptr %tembodai_count, align 4, !tbaa !5
br label %for.cond109.preheader
for.cond109.preheader: ; preds = %for.cond109.preheader.loopexit, %for.cond4.preheader
%8 = phi i32 [ %.pre, %for.cond109.preheader.loopexit ], [ %4, %for.cond4.preheader ]
%cmp110169 = icmp sgt i32 %8, 0
br i1 %cmp110169, label %for.body113.preheader, label %for.cond.cleanup112
for.body113.preheader: ; preds = %for.cond109.preheader
%wide.trip.count = zext i32 %8 to i64
%min.iters.check = icmp ult i32 %8, 9
br i1 %min.iters.check, label %for.body113.preheader192, label %vector.ph
vector.ph: ; preds = %for.body113.preheader
%n.mod.vf = and i64 %wide.trip.count, 7
%9 = icmp eq i64 %n.mod.vf, 0
%10 = select i1 %9, i64 8, i64 %n.mod.vf
%n.vec = sub nsw i64 %wide.trip.count, %10
br label %vector.body
vector.body: ; preds = %pred.store.continue190, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue190 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %58, %pred.store.continue190 ]
%vec.phi176 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %59, %pred.store.continue190 ]
%11 = or i64 %index, 1
%12 = or i64 %index, 2
%13 = or i64 %index, 3
%14 = or i64 %index, 4
%15 = or i64 %index, 5
%16 = or i64 %index, 6
%17 = or i64 %index, 7
%18 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %index, i32 1
%19 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %11, i32 1
%20 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %12, i32 1
%21 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %13, i32 1
%22 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %14, i32 1
%23 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %15, i32 1
%24 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %16, i32 1
%25 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %17, i32 1
%26 = load i16, ptr %18, align 4, !tbaa !9
%27 = load i16, ptr %19, align 4, !tbaa !9
%28 = load i16, ptr %20, align 4, !tbaa !9
%29 = load i16, ptr %21, align 4, !tbaa !9
%30 = insertelement <4 x i16> poison, i16 %26, i64 0
%31 = insertelement <4 x i16> %30, i16 %27, i64 1
%32 = insertelement <4 x i16> %31, i16 %28, i64 2
%33 = insertelement <4 x i16> %32, i16 %29, i64 3
%34 = load i16, ptr %22, align 4, !tbaa !9
%35 = load i16, ptr %23, align 4, !tbaa !9
%36 = load i16, ptr %24, align 4, !tbaa !9
%37 = load i16, ptr %25, align 4, !tbaa !9
%38 = insertelement <4 x i16> poison, i16 %34, i64 0
%39 = insertelement <4 x i16> %38, i16 %35, i64 1
%40 = insertelement <4 x i16> %39, i16 %36, i64 2
%41 = insertelement <4 x i16> %40, i16 %37, i64 3
%42 = icmp eq <4 x i16> %33, zeroinitializer
%43 = icmp eq <4 x i16> %41, zeroinitializer
%44 = extractelement <4 x i1> %42, i64 0
br i1 %44, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
store i16 2, ptr %18, align 4, !tbaa !9
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%45 = extractelement <4 x i1> %42, i64 1
br i1 %45, label %pred.store.if177, label %pred.store.continue178
pred.store.if177: ; preds = %pred.store.continue
store i16 2, ptr %19, align 4, !tbaa !9
br label %pred.store.continue178
pred.store.continue178: ; preds = %pred.store.if177, %pred.store.continue
%46 = extractelement <4 x i1> %42, i64 2
br i1 %46, label %pred.store.if179, label %pred.store.continue180
pred.store.if179: ; preds = %pred.store.continue178
store i16 2, ptr %20, align 4, !tbaa !9
br label %pred.store.continue180
pred.store.continue180: ; preds = %pred.store.if179, %pred.store.continue178
%47 = extractelement <4 x i1> %42, i64 3
br i1 %47, label %pred.store.if181, label %pred.store.continue182
pred.store.if181: ; preds = %pred.store.continue180
store i16 2, ptr %21, align 4, !tbaa !9
br label %pred.store.continue182
pred.store.continue182: ; preds = %pred.store.if181, %pred.store.continue180
%48 = extractelement <4 x i1> %43, i64 0
br i1 %48, label %pred.store.if183, label %pred.store.continue184
pred.store.if183: ; preds = %pred.store.continue182
store i16 2, ptr %22, align 4, !tbaa !9
br label %pred.store.continue184
pred.store.continue184: ; preds = %pred.store.if183, %pred.store.continue182
%49 = extractelement <4 x i1> %43, i64 1
br i1 %49, label %pred.store.if185, label %pred.store.continue186
pred.store.if185: ; preds = %pred.store.continue184
store i16 2, ptr %23, align 4, !tbaa !9
br label %pred.store.continue186
pred.store.continue186: ; preds = %pred.store.if185, %pred.store.continue184
%50 = extractelement <4 x i1> %43, i64 2
br i1 %50, label %pred.store.if187, label %pred.store.continue188
pred.store.if187: ; preds = %pred.store.continue186
store i16 2, ptr %24, align 4, !tbaa !9
br label %pred.store.continue188
pred.store.continue188: ; preds = %pred.store.if187, %pred.store.continue186
%51 = extractelement <4 x i1> %43, i64 3
br i1 %51, label %pred.store.if189, label %pred.store.continue190
pred.store.if189: ; preds = %pred.store.continue188
store i16 2, ptr %25, align 4, !tbaa !9
br label %pred.store.continue190
pred.store.continue190: ; preds = %pred.store.if189, %pred.store.continue188
%52 = icmp eq <4 x i16> %33, <i16 2, i16 2, i16 2, i16 2>
%53 = or <4 x i1> %42, %52
%54 = icmp eq <4 x i16> %41, <i16 2, i16 2, i16 2, i16 2>
%55 = or <4 x i1> %43, %54
%56 = zext <4 x i1> %53 to <4 x i32>
%57 = zext <4 x i1> %55 to <4 x i32>
%58 = add <4 x i32> %vec.phi, %56
%59 = add <4 x i32> %vec.phi176, %57
%index.next = add nuw i64 %index, 8
%60 = icmp eq i64 %index.next, %n.vec
br i1 %60, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %pred.store.continue190
%bin.rdx = add <4 x i32> %59, %58
%61 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br label %for.body113.preheader192
for.body113.preheader192: ; preds = %for.body113.preheader, %middle.block
%indvars.iv173.ph = phi i64 [ 0, %for.body113.preheader ], [ %n.vec, %middle.block ]
%output.0170.ph = phi i32 [ 0, %for.body113.preheader ], [ %61, %middle.block ]
br label %for.body113
for.body7: ; preds = %for.cond4.preheader, %if.end105
%j.0168 = phi i32 [ %add107, %if.end105 ], [ 0, %for.cond4.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tembodai_number_a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tembodai_number_b) #6
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tembodai_number_a, ptr noundef nonnull %tembodai_number_b)
%62 = load i32, ptr %tembodai_number_a, align 4, !tbaa !5
%sub = add nsw i32 %62, -1
%63 = load i32, ptr %tembodai_number_b, align 4, !tbaa !5
%sub9 = add nsw i32 %63, -1
%idxprom10 = sext i32 %sub to i64
%arrayidx11 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom10
%64 = load i32, ptr %arrayidx11, align 8, !tbaa !17
%idxprom13 = sext i32 %sub9 to i64
%arrayidx14 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom13
%65 = load i32, ptr %arrayidx14, align 8, !tbaa !17
%cmp16 = icmp sgt i32 %64, %65
br i1 %cmp16, label %if.then, label %if.else
if.then: ; preds = %for.body7
%is_good19 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom10, i32 1
%66 = load i16, ptr %is_good19, align 4, !tbaa !9
%cmp20 = icmp eq i16 %66, 0
br i1 %cmp20, label %if.then22, label %if.end
if.then22: ; preds = %if.then
store i16 2, ptr %is_good19, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then22, %if.then
%is_good28 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom13, i32 1
%67 = load i16, ptr %is_good28, align 4, !tbaa !9
%cmp30.not = icmp eq i16 %67, 1
br i1 %cmp30.not, label %if.end105, label %if.then32
if.then32: ; preds = %if.end
store i16 1, ptr %is_good28, align 4, !tbaa !9
br label %if.end105
if.else: ; preds = %for.body7
%cmp43 = icmp slt i32 %64, %65
br i1 %cmp43, label %if.then45, label %if.else68
if.then45: ; preds = %if.else
%is_good48 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom13, i32 1
%68 = load i16, ptr %is_good48, align 4, !tbaa !9
%cmp50 = icmp eq i16 %68, 0
br i1 %cmp50, label %if.then52, label %if.end56
if.then52: ; preds = %if.then45
store i16 2, ptr %is_good48, align 4, !tbaa !9
br label %if.end56
if.end56: ; preds = %if.then52, %if.then45
%is_good59 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom10, i32 1
%69 = load i16, ptr %is_good59, align 4, !tbaa !9
%cmp61.not = icmp eq i16 %69, 1
br i1 %cmp61.not, label %if.end105, label %if.then63
if.then63: ; preds = %if.end56
store i16 1, ptr %is_good59, align 4, !tbaa !9
br label %if.end105
if.else68: ; preds = %if.else
%is_good71 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom10, i32 1
%70 = load i16, ptr %is_good71, align 4, !tbaa !9
switch i16 %70, label %if.end85 [
i16 0, label %if.then81
i16 2, label %if.then81
]
if.then81: ; preds = %if.else68, %if.else68
store i16 3, ptr %is_good71, align 4, !tbaa !9
br label %if.end85
if.end85: ; preds = %if.else68, %if.then81
%is_good88 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %idxprom13, i32 1
%71 = load i16, ptr %is_good88, align 4, !tbaa !9
switch i16 %71, label %if.end105 [
i16 0, label %if.then99
i16 2, label %if.then99
]
if.then99: ; preds = %if.end85, %if.end85
store i16 3, ptr %is_good88, align 4, !tbaa !9
br label %if.end105
if.end105: ; preds = %if.end85, %if.then63, %if.end56, %if.then99, %if.end, %if.then32
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tembodai_number_b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tembodai_number_a) #6
%add107 = add nuw nsw i32 %j.0168, 1
%72 = load i32, ptr %temboway_count, align 4, !tbaa !5
%cmp5 = icmp slt i32 %add107, %72
br i1 %cmp5, label %for.body7, label %for.cond109.preheader.loopexit, !llvm.loop !18
for.cond.cleanup112: ; preds = %if.end124, %for.cond109.preheader
%output.0.lcssa = phi i32 [ 0, %for.cond109.preheader ], [ %spec.select, %if.end124 ]
%call137 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %output.0.lcssa)
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temboway_count) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tembodai_count) #6
ret i32 0
for.body113: ; preds = %for.body113.preheader192, %if.end124
%indvars.iv173 = phi i64 [ %indvars.iv.next174, %if.end124 ], [ %indvars.iv173.ph, %for.body113.preheader192 ]
%output.0170 = phi i32 [ %spec.select, %if.end124 ], [ %output.0170.ph, %for.body113.preheader192 ]
%is_good116 = getelementptr inbounds %struct.Tembodai, ptr %vla, i64 %indvars.iv173, i32 1
%73 = load i16, ptr %is_good116, align 4, !tbaa !9
%cmp118 = icmp eq i16 %73, 0
br i1 %cmp118, label %if.then120, label %if.end124
if.then120: ; preds = %for.body113
store i16 2, ptr %is_good116, align 4, !tbaa !9
br label %if.end124
if.end124: ; preds = %if.then120, %for.body113
%74 = phi i16 [ 2, %if.then120 ], [ %73, %for.body113 ]
%cmp129 = icmp eq i16 %74, 2
%add132 = zext i1 %cmp129 to i32
%spec.select = add nuw nsw i32 %output.0170, %add132
%indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
%exitcond.not = icmp eq i64 %indvars.iv.next174, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup112, label %for.body113, !llvm.loop !19
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
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 = !{!10, !11, i64 4}
!10 = !{!"", !6, i64 0, !11, i64 4}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = !{!10, !6, i64 0}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13, !16, !15}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int gcd(int a,int b);
int compare(const void* a, const void* b);
int main(void){
int N;
int M;
int add;
int i,j,k,ret;
long h;
long H[100000];
long Hr[100000];
int start[100000]; //M番目の道の始点
int end[100000]; //M番目の道の終点
int result[100000];
long max = 0;
ret = 0;
scanf("%d %d",&N,&M);
//高さ入力
for(i = 0 ; i < N; i++){
scanf("%ld",&h);
H[i] = h;
Hr[i] = h;
}
//ルート情報入力
//見晴らしがよくない展望台はH=0にする
for(i = 0 ; i < M ; i++){
scanf("%d %d",&(start[i]),&(end[i]));
start[i]--;
end[i]--;
if( H[start[i]] < H[end[i]]){ // endのほうが大きい場合
//startは見晴らしがよくない
Hr[start[i]] = 0;
}else if( H[start[i]] > H[end[i]]){
Hr[end[i]] = 0;
} //等しい場合は両方0
if (H[start[i]] == H[end[i]]){
//printf("hoge\n");
Hr[start[i]] = 0;
Hr[end[i]] = 0;
}
}
for(i=0;i<N;i++){
if(Hr[i]>0){
ret++;
}else{
// printf("%d : %ld\n",i,H[i]);
}
}
printf("%d\n",ret);
return 0;
//↓全探索ではTLE
// いい展望台か調べる
for(i = 0 ; i < N ; i++){
//startになっている道がある?
max = H[i];
add = 1;
for ( j = 0 ; j < M ; j++){
if (start[j] == i){
if (H[end[j]] >= max){ //H[i]より標高が高い?
add = 0;
//break;
}
}
if (end[j] == i){
if (H[start[j]] >= max){ //H[i]より標高が高い?
add = 0;
//break;
}
}
}
ret += add;
}
printf("%d\n",ret);
return 0;
}
int compare(const void* a, const void* b){
return strcmp(a, b);
}
// 最大公約数
int gcd(int a,int b){
int c;
int tmp;
if(b > a){ //bがaより大きい場合bとaを入れ替える
c = a;
a = b;
b = c;
}
tmp = a % b;
while(tmp!=0){
a = b;
b = tmp;
tmp = a % b;
}
return b;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276866/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276866/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"%ld\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
%h = alloca i64, align 8
%H = alloca [100000 x i64], align 16
%Hr = alloca [100000 x i64], align 16
%start = alloca [100000 x i32], align 16
%end = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #7
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %H) #7
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %Hr) #7
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %start) #7
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %end) #7
%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 !5
%cmp105 = icmp sgt i32 %0, 0
br i1 %cmp105, label %for.body, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %4, %for.body ]
%2 = load i32, ptr %M, align 4, !tbaa !5
%cmp5107 = icmp sgt i32 %2, 0
br i1 %cmp5107, label %for.body6, label %for.cond67.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%3 = load i64, ptr %h, align 8, !tbaa !9
%arrayidx = getelementptr inbounds [100000 x i64], ptr %H, i64 0, i64 %indvars.iv
store i64 %3, ptr %arrayidx, align 8, !tbaa !9
%arrayidx3 = getelementptr inbounds [100000 x i64], ptr %Hr, i64 0, i64 %indvars.iv
store i64 %3, ptr %arrayidx3, align 8, !tbaa !9
%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.cond4.preheader, !llvm.loop !11
for.cond67.preheader.loopexit: ; preds = %for.inc64
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.cond67.preheader
for.cond67.preheader: ; preds = %for.cond67.preheader.loopexit, %for.cond4.preheader
%6 = phi i32 [ %.pre, %for.cond67.preheader.loopexit ], [ %1, %for.cond4.preheader ]
%cmp68109 = icmp sgt i32 %6, 0
br i1 %cmp68109, label %for.body69.preheader, label %for.end79
for.body69.preheader: ; preds = %for.cond67.preheader
%wide.trip.count = zext i32 %6 to i64
%min.iters.check = icmp ult i32 %6, 4
br i1 %min.iters.check, label %for.body69.preheader121, label %vector.ph
vector.ph: ; preds = %for.body69.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
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 i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi119 = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%7 = getelementptr inbounds [100000 x i64], ptr %Hr, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %7, align 16, !tbaa !9
%8 = getelementptr inbounds i64, ptr %7, i64 2
%wide.load120 = load <2 x i64>, ptr %8, align 16, !tbaa !9
%9 = icmp sgt <2 x i64> %wide.load, zeroinitializer
%10 = icmp sgt <2 x i64> %wide.load120, zeroinitializer
%11 = zext <2 x i1> %9 to <2 x i32>
%12 = zext <2 x i1> %10 to <2 x i32>
%13 = add <2 x i32> %vec.phi, %11
%14 = add <2 x i32> %vec.phi119, %12
%index.next = add nuw i64 %index, 4
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end79, label %for.body69.preheader121
for.body69.preheader121: ; preds = %for.body69.preheader, %middle.block
%indvars.iv116.ph = phi i64 [ 0, %for.body69.preheader ], [ %n.vec, %middle.block ]
%ret.0110.ph = phi i32 [ 0, %for.body69.preheader ], [ %16, %middle.block ]
br label %for.body69
for.body6: ; preds = %for.cond4.preheader, %for.inc64
%indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.inc64 ], [ 0, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %start, i64 0, i64 %indvars.iv113
%arrayidx10 = getelementptr inbounds [100000 x i32], ptr %end, i64 0, i64 %indvars.iv113
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx10)
%17 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%dec = add nsw i32 %17, -1
store i32 %dec, ptr %arrayidx8, align 4, !tbaa !5
%18 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%dec16 = add nsw i32 %18, -1
store i32 %dec16, ptr %arrayidx10, align 4, !tbaa !5
%idxprom19 = sext i32 %dec to i64
%arrayidx20 = getelementptr inbounds [100000 x i64], ptr %H, i64 0, i64 %idxprom19
%19 = load i64, ptr %arrayidx20, align 8, !tbaa !9
%idxprom23 = sext i32 %dec16 to i64
%arrayidx24 = getelementptr inbounds [100000 x i64], ptr %H, i64 0, i64 %idxprom23
%20 = load i64, ptr %arrayidx24, align 8, !tbaa !9
%cmp25 = icmp slt i64 %19, %20
br i1 %cmp25, label %if.end44.sink.split, label %if.else
if.else: ; preds = %for.body6
%cmp38 = icmp sgt i64 %19, %20
br i1 %cmp38, label %if.end44.sink.split, label %if.end44
if.end44.sink.split: ; preds = %if.else, %for.body6
%idxprom23.sink = phi i64 [ %idxprom19, %for.body6 ], [ %idxprom23, %if.else ]
%arrayidx43 = getelementptr inbounds [100000 x i64], ptr %Hr, i64 0, i64 %idxprom23.sink
store i64 0, ptr %arrayidx43, align 8, !tbaa !9
br label %if.end44
if.end44: ; preds = %if.end44.sink.split, %if.else
%cmp53 = icmp eq i64 %19, %20
br i1 %cmp53, label %if.then54, label %for.inc64
if.then54: ; preds = %if.end44
%arrayidx58 = getelementptr inbounds [100000 x i64], ptr %Hr, i64 0, i64 %idxprom19
store i64 0, ptr %arrayidx58, align 8, !tbaa !9
%arrayidx62 = getelementptr inbounds [100000 x i64], ptr %Hr, i64 0, i64 %idxprom23
store i64 0, ptr %arrayidx62, align 8, !tbaa !9
br label %for.inc64
for.inc64: ; preds = %if.end44, %if.then54
%indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
%21 = load i32, ptr %M, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp5 = icmp slt i64 %indvars.iv.next114, %22
br i1 %cmp5, label %for.body6, label %for.cond67.preheader.loopexit, !llvm.loop !16
for.body69: ; preds = %for.body69.preheader121, %for.body69
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.body69 ], [ %indvars.iv116.ph, %for.body69.preheader121 ]
%ret.0110 = phi i32 [ %spec.select, %for.body69 ], [ %ret.0110.ph, %for.body69.preheader121 ]
%arrayidx71 = getelementptr inbounds [100000 x i64], ptr %Hr, i64 0, i64 %indvars.iv116
%23 = load i64, ptr %arrayidx71, align 8, !tbaa !9
%cmp72 = icmp sgt i64 %23, 0
%inc74 = zext i1 %cmp72 to i32
%spec.select = add nuw nsw i32 %ret.0110, %inc74
%indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
%exitcond.not = icmp eq i64 %indvars.iv.next117, %wide.trip.count
br i1 %exitcond.not, label %for.end79, label %for.body69, !llvm.loop !17
for.end79: ; preds = %for.body69, %middle.block, %for.cond67.preheader
%ret.0.lcssa = phi i32 [ 0, %for.cond67.preheader ], [ %16, %middle.block ], [ %spec.select, %for.body69 ]
%call80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ret.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %end) #7
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %start) #7
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %Hr) #7
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %H) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
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: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #8
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #5 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %b, i32 %a)
%spec.select12 = tail call i32 @llvm.smax.i32(i32 %b, i32 %a)
%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
%tmp.015 = phi i32 [ %rem2, %while.body ], [ %rem, %entry ]
%b.addr.114 = phi i32 [ %tmp.015, %while.body ], [ %spec.select, %entry ]
%rem2 = srem i32 %b.addr.114, %tmp.015
%cmp1.not = icmp eq i32 %rem2, 0
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %tmp.015, %while.body ]
ret i32 %b.addr.1.lcssa
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) #6
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) 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 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !15, !14}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
int main() {
int n, m, h[200000], dd[200010] = { 0 }, ans = 0;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &h[i]);
}
for (int i = 0; i < m; i++) {
int s, t;
scanf("%d%d", &s, &t);
if (h[s-1] >= h[t-1])dd[t]++;
if (h[s-1] <= h[t-1])dd[s]++;
}
for (int i = 1; i <= n; i++) {
if (dd[i] == 0)ans++;
}
printf("%d", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276909/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276909/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
; 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
%h = alloca [200000 x i32], align 16
%dd = alloca [200010 x i32], align 16
%s = alloca i32, align 4
%t = 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 void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %dd) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800040) %dd, i8 0, i64 800040, i1 false)
%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 !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp455 = icmp sgt i32 %2, 0
br i1 %cmp455, label %for.body6, label %for.cond33.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i32], ptr %h, 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
%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.cond3.preheader, !llvm.loop !9
for.cond33.preheader.loopexit: ; preds = %if.end28
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond33.preheader
for.cond33.preheader: ; preds = %for.cond33.preheader.loopexit, %for.cond3.preheader
%5 = phi i32 [ %.pre, %for.cond33.preheader.loopexit ], [ %1, %for.cond3.preheader ]
%cmp34.not57 = icmp slt i32 %5, 1
br i1 %cmp34.not57, label %for.cond.cleanup35, label %for.body36.preheader
for.body36.preheader: ; preds = %for.cond33.preheader
%6 = add nuw i32 %5, 1
%wide.trip.count = zext i32 %6 to i64
%7 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body36.preheader66, label %vector.ph
vector.ph: ; preds = %for.body36.preheader
%n.vec = and i64 %7, -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 ], [ %14, %vector.body ]
%vec.phi64 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%offset.idx = or i64 %index, 1
%8 = getelementptr inbounds [200010 x i32], ptr %dd, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load65 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = icmp eq <4 x i32> %wide.load, zeroinitializer
%11 = icmp eq <4 x i32> %wide.load65, zeroinitializer
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = add <4 x i32> %vec.phi, %12
%15 = add <4 x i32> %vec.phi64, %13
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %15, %14
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %for.cond.cleanup35, label %for.body36.preheader66
for.body36.preheader66: ; preds = %for.body36.preheader, %middle.block
%indvars.iv61.ph = phi i64 [ 1, %for.body36.preheader ], [ %ind.end, %middle.block ]
%ans.058.ph = phi i32 [ 0, %for.body36.preheader ], [ %17, %middle.block ]
br label %for.body36
for.body6: ; preds = %for.cond3.preheader, %if.end28
%i2.056 = phi i32 [ %inc30, %if.end28 ], [ 0, %for.cond3.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t)
%18 = load i32, ptr %s, align 4, !tbaa !5
%sub = add nsw i32 %18, -1
%idxprom8 = sext i32 %sub to i64
%arrayidx9 = getelementptr inbounds [200000 x i32], ptr %h, i64 0, i64 %idxprom8
%19 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%20 = load i32, ptr %t, align 4, !tbaa !5
%sub10 = add nsw i32 %20, -1
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds [200000 x i32], ptr %h, i64 0, i64 %idxprom11
%21 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13.not = icmp slt i32 %19, %21
br i1 %cmp13.not, label %if.end, label %if.then
if.then: ; preds = %for.body6
%idxprom14 = sext i32 %20 to i64
%arrayidx15 = getelementptr inbounds [200010 x i32], ptr %dd, i64 0, i64 %idxprom14
%22 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%inc16 = add nsw i32 %22, 1
store i32 %inc16, ptr %arrayidx15, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body6
%cmp23.not = icmp sgt i32 %19, %21
br i1 %cmp23.not, label %if.end28, label %if.then24
if.then24: ; preds = %if.end
%idxprom25 = sext i32 %18 to i64
%arrayidx26 = getelementptr inbounds [200010 x i32], ptr %dd, i64 0, i64 %idxprom25
%23 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%inc27 = add nsw i32 %23, 1
store i32 %inc27, ptr %arrayidx26, align 4, !tbaa !5
br label %if.end28
if.end28: ; preds = %if.then24, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
%inc30 = add nuw nsw i32 %i2.056, 1
%24 = load i32, ptr %m, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc30, %24
br i1 %cmp4, label %for.body6, label %for.cond33.preheader.loopexit, !llvm.loop !14
for.cond.cleanup35: ; preds = %for.body36, %middle.block, %for.cond33.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond33.preheader ], [ %17, %middle.block ], [ %spec.select, %for.body36 ]
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %dd) #5
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %h) #5
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
for.body36: ; preds = %for.body36.preheader66, %for.body36
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.body36 ], [ %indvars.iv61.ph, %for.body36.preheader66 ]
%ans.058 = phi i32 [ %spec.select, %for.body36 ], [ %ans.058.ph, %for.body36.preheader66 ]
%arrayidx38 = getelementptr inbounds [200010 x i32], ptr %dd, i64 0, i64 %indvars.iv61
%25 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%cmp39 = icmp eq i32 %25, 0
%inc41 = zext i1 %cmp39 to i32
%spec.select = add nuw nsw i32 %ans.058, %inc41
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup35, label %for.body36, !llvm.loop !15
}
; 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; 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 = { 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 = 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}
!15 = distinct !{!15, !10, !13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;
int h[100008];
int flag[100008];
int a[100008];
int b[100008];
int main(){
int n,m;
int i;
int cnt = 0;
scanf("%d %d", &n, &m);
for(i = 1;i <= n;i++){
scanf("%d", &h[i]);
flag[i] = 1;
}
for(i = 0;i < m;i++){
scanf("%d %d", &a[i], &b[i]);
if(h[a[i]] == h[b[i]]) flag[a[i]] = flag[b[i]] = 0;
else if(h[a[i]] > h[b[i]]) flag[b[i]] = 0;
else flag[a[i]] = 0;
}
for(i = 1;i <= n;i++){
if(flag[i] == 1) cnt++;
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276952/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276952/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
@h = dso_local global [100008 x i32] zeroinitializer, align 16
@flag = dso_local local_unnamed_addr global [100008 x i32] zeroinitializer, align 16
@a = dso_local global [100008 x i32] zeroinitializer, align 16
@b = dso_local global [100008 x i32] zeroinitializer, align 16
@.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
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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not85 = icmp slt i32 %0, 1
br i1 %cmp.not85, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp587 = icmp sgt i32 %2, 0
br i1 %cmp587, label %for.body6, label %for.cond52.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100008 x i32], ptr @h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx3 = getelementptr inbounds [100008 x i32], ptr @flag, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx3, align 4, !tbaa !5
%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.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond52.preheader.loopexit: ; preds = %for.inc49
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond52.preheader
for.cond52.preheader: ; preds = %for.cond52.preheader.loopexit, %for.cond4.preheader
%5 = phi i32 [ %.pre, %for.cond52.preheader.loopexit ], [ %1, %for.cond4.preheader ]
%cmp53.not89 = icmp slt i32 %5, 1
br i1 %cmp53.not89, label %for.end63, label %for.body54.preheader
for.body54.preheader: ; preds = %for.cond52.preheader
%6 = add nuw i32 %5, 1
%wide.trip.count = zext i32 %6 to i64
%7 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %5, 8
br i1 %min.iters.check, label %for.body54.preheader101, label %vector.ph
vector.ph: ; preds = %for.body54.preheader
%n.vec = and i64 %7, -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 ], [ %14, %vector.body ]
%vec.phi99 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%offset.idx = or i64 %index, 1
%8 = getelementptr inbounds [100008 x i32], ptr @flag, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load100 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = icmp eq <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%11 = icmp eq <4 x i32> %wide.load100, <i32 1, i32 1, i32 1, i32 1>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = add <4 x i32> %vec.phi, %12
%15 = add <4 x i32> %vec.phi99, %13
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %15, %14
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %for.end63, label %for.body54.preheader101
for.body54.preheader101: ; preds = %for.body54.preheader, %middle.block
%indvars.iv96.ph = phi i64 [ 1, %for.body54.preheader ], [ %ind.end, %middle.block ]
%cnt.091.ph = phi i32 [ 0, %for.body54.preheader ], [ %17, %middle.block ]
br label %for.body54
for.body6: ; preds = %for.cond4.preheader, %for.inc49
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.inc49 ], [ 0, %for.cond4.preheader ]
%arrayidx8 = getelementptr inbounds [100008 x i32], ptr @a, i64 0, i64 %indvars.iv93
%arrayidx10 = getelementptr inbounds [100008 x i32], ptr @b, i64 0, i64 %indvars.iv93
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx10)
%18 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%idxprom14 = sext i32 %18 to i64
%arrayidx15 = getelementptr inbounds [100008 x i32], ptr @h, i64 0, i64 %idxprom14
%19 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%20 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%idxprom18 = sext i32 %20 to i64
%arrayidx19 = getelementptr inbounds [100008 x i32], ptr @h, i64 0, i64 %idxprom18
%21 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20 = icmp eq i32 %19, %21
br i1 %cmp20, label %if.then, label %if.else
if.then: ; preds = %for.body6
%arrayidx24 = getelementptr inbounds [100008 x i32], ptr @flag, i64 0, i64 %idxprom18
store i32 0, ptr %arrayidx24, align 4, !tbaa !5
br label %for.inc49
if.else: ; preds = %for.body6
%cmp37 = icmp sgt i32 %19, %21
%idxprom18.idxprom14 = select i1 %cmp37, i64 %idxprom18, i64 %idxprom14
br label %for.inc49
for.inc49: ; preds = %if.else, %if.then
%idxprom14.sink = phi i64 [ %idxprom14, %if.then ], [ %idxprom18.idxprom14, %if.else ]
%arrayidx28 = getelementptr inbounds [100008 x i32], ptr @flag, i64 0, i64 %idxprom14.sink
store i32 0, ptr %arrayidx28, align 4, !tbaa !5
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%22 = load i32, ptr %m, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp5 = icmp slt i64 %indvars.iv.next94, %23
br i1 %cmp5, label %for.body6, label %for.cond52.preheader.loopexit, !llvm.loop !14
for.body54: ; preds = %for.body54.preheader101, %for.body54
%indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.body54 ], [ %indvars.iv96.ph, %for.body54.preheader101 ]
%cnt.091 = phi i32 [ %spec.select, %for.body54 ], [ %cnt.091.ph, %for.body54.preheader101 ]
%arrayidx56 = getelementptr inbounds [100008 x i32], ptr @flag, i64 0, i64 %indvars.iv96
%24 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%cmp57 = icmp eq i32 %24, 1
%inc59 = zext i1 %cmp57 to i32
%spec.select = add nuw nsw i32 %cnt.091, %inc59
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%exitcond.not = icmp eq i64 %indvars.iv.next97, %wide.trip.count
br i1 %exitcond.not, label %for.end63, label %for.body54, !llvm.loop !15
for.end63: ; preds = %for.body54, %middle.block, %for.cond52.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond52.preheader ], [ %17, %middle.block ], [ %spec.select, %for.body54 ]
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa)
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.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}
!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}
!15 = distinct !{!15, !10, !13, !12}
|
#include<stdio.h>
#define mod 998244353
long long sum[10][3000000];
long long base[3000000];
long long tree[3000000];
long long left[3000000];
long long right[3000000];
long long lazy[3000000];
int l,r,value;
void build(int l,int r,int k){
left[k]=l;right[k]=r;
if (l==r){
tree[k]=1;
return;
}
int mid=(l+r)/2;
build(l,mid,k*2);
build(mid+1,r,k*2+1);
tree[k]=((tree[k*2]*base[r-mid]% mod)+tree[k*2+1])% mod;
}
void laze(int k){
if (lazy[k]==0) return;
lazy[k*2]=lazy[k]; lazy[k*2+1]=lazy[k];
tree[k]=sum[lazy[k]][right[k]-left[k]+1];
lazy[k]=0;
}
void update(int l,int r,int k,int value){
laze(k);
if (r<left[k]||l>right[k]) return;
if (left[k]>=l&&right[k]<=r) {
lazy[k]=value;
laze(k);
return;
}
int mid=(left[k]+right[k])/2;
update(l,r,k*2,value);
update(l,r,k*2+1,value);
tree[k]=((tree[k*2]*base[right[k]-mid]% mod)+tree[k*2+1])% mod;
}
int main(){
int n,q;scanf("%d %d",&n,&q);
for (int i=1;i<=9;i++){
sum[i][1]=i;
for (int j=2;j<=n;j++){
sum[i][j]=((sum[i][j-1]*10% mod)+i)% mod;
}
}
base[0]=1;
for (int i=1;i<=n;i++){
base[i]=(base[i-1]*10)% mod;
}
build(1,n,1);
for (int i=1;i<=q;i++){
scanf("%d %d %d",&l,&r,&value);
update(l,r,1,value);
printf("%lld\n",tree[1]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_276996/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_276996/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"
@left = dso_local local_unnamed_addr global [3000000 x i64] zeroinitializer, align 16
@right = dso_local local_unnamed_addr global [3000000 x i64] zeroinitializer, align 16
@tree = dso_local local_unnamed_addr global [3000000 x i64] zeroinitializer, align 16
@base = dso_local local_unnamed_addr global [3000000 x i64] zeroinitializer, align 16
@lazy = dso_local local_unnamed_addr global [3000000 x i64] zeroinitializer, align 16
@sum = dso_local local_unnamed_addr global [10 x [3000000 x i64]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@l = dso_local global i32 0, align 4
@r = dso_local global i32 0, align 4
@value = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @build(i32 noundef %l, i32 noundef %r, i32 noundef %k) local_unnamed_addr #0 {
entry:
%conv = sext i32 %l to i64
%idxprom = sext i32 %k to i64
%arrayidx = getelementptr inbounds [3000000 x i64], ptr @left, i64 0, i64 %idxprom
store i64 %conv, ptr %arrayidx, align 8, !tbaa !5
%conv1 = sext i32 %r to i64
%arrayidx3 = getelementptr inbounds [3000000 x i64], ptr @right, i64 0, i64 %idxprom
store i64 %conv1, ptr %arrayidx3, align 8, !tbaa !5
%cmp = icmp eq i32 %l, %r
br i1 %cmp, label %common.ret, label %if.end
common.ret: ; preds = %entry, %if.end
%rem21.sink = phi i64 [ %rem21, %if.end ], [ 1, %entry ]
%0 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom
store i64 %rem21.sink, ptr %0, align 8
ret void
if.end: ; preds = %entry
%add = add nsw i32 %r, %l
%div = sdiv i32 %add, 2
%mul = shl nsw i32 %k, 1
tail call void @build(i32 noundef %l, i32 noundef %div, i32 noundef %mul)
%add7 = add nsw i32 %div, 1
%add9 = or i32 %mul, 1
tail call void @build(i32 noundef %add7, i32 noundef %r, i32 noundef %add9)
%idxprom11 = sext i32 %mul to i64
%arrayidx12 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom11
%1 = load i64, ptr %arrayidx12, align 16, !tbaa !5
%sub = sub nsw i32 %r, %div
%idxprom13 = sext i32 %sub to i64
%arrayidx14 = getelementptr inbounds [3000000 x i64], ptr @base, i64 0, i64 %idxprom13
%2 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%mul15 = mul nsw i64 %2, %1
%rem = srem i64 %mul15, 998244353
%idxprom18 = sext i32 %add9 to i64
%arrayidx19 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom18
%3 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%add20 = add nsw i64 %rem, %3
%rem21 = srem i64 %add20, 998244353
br label %common.ret
}
; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @laze(i32 noundef %k) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %k to i64
%arrayidx = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%mul = shl nsw i32 %k, 1
%idxprom3 = sext i32 %mul to i64
%arrayidx4 = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom3
store i64 %0, ptr %arrayidx4, align 16, !tbaa !5
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%add = or i32 %mul, 1
%idxprom8 = sext i32 %add to i64
%arrayidx9 = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom8
store i64 %1, ptr %arrayidx9, align 8, !tbaa !5
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx14 = getelementptr inbounds [3000000 x i64], ptr @right, i64 0, i64 %idxprom
%3 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%arrayidx16 = getelementptr inbounds [3000000 x i64], ptr @left, i64 0, i64 %idxprom
%4 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%sub = add i64 %3, 1
%add17 = sub i64 %sub, %4
%arrayidx18 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 %2, i64 %add17
%5 = load i64, ptr %arrayidx18, align 8, !tbaa !5
%arrayidx20 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom
store i64 %5, ptr %arrayidx20, align 8, !tbaa !5
store i64 0, ptr %arrayidx, align 8, !tbaa !5
br label %return
return: ; preds = %entry, %if.end
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @update(i32 noundef %l, i32 noundef %r, i32 noundef %k, i32 noundef %value) local_unnamed_addr #0 {
entry:
%idxprom.i = sext i32 %k to i64
%arrayidx.i = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom.i
%0 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%cmp.i = icmp eq i64 %0, 0
br i1 %cmp.i, label %entry.laze.exit_crit_edge, label %if.end.i
entry.laze.exit_crit_edge: ; preds = %entry
%arrayidx.phi.trans.insert = getelementptr inbounds [3000000 x i64], ptr @left, i64 0, i64 %idxprom.i
%.pre = load i64, ptr %arrayidx.phi.trans.insert, align 8, !tbaa !5
br label %laze.exit
if.end.i: ; preds = %entry
%mul.i = shl nsw i32 %k, 1
%idxprom3.i = sext i32 %mul.i to i64
%arrayidx4.i = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom3.i
store i64 %0, ptr %arrayidx4.i, align 16, !tbaa !5
%1 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%add.i = or i32 %mul.i, 1
%idxprom8.i = sext i32 %add.i to i64
%arrayidx9.i = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom8.i
store i64 %1, ptr %arrayidx9.i, align 8, !tbaa !5
%2 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%arrayidx14.i = getelementptr inbounds [3000000 x i64], ptr @right, i64 0, i64 %idxprom.i
%3 = load i64, ptr %arrayidx14.i, align 8, !tbaa !5
%arrayidx16.i = getelementptr inbounds [3000000 x i64], ptr @left, i64 0, i64 %idxprom.i
%4 = load i64, ptr %arrayidx16.i, align 8, !tbaa !5
%sub.i = add i64 %3, 1
%add17.i = sub i64 %sub.i, %4
%arrayidx18.i = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 %2, i64 %add17.i
%5 = load i64, ptr %arrayidx18.i, align 8, !tbaa !5
%arrayidx20.i = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom.i
store i64 %5, ptr %arrayidx20.i, align 8, !tbaa !5
store i64 0, ptr %arrayidx.i, align 8, !tbaa !5
br label %laze.exit
laze.exit: ; preds = %entry.laze.exit_crit_edge, %if.end.i
%6 = phi i64 [ %.pre, %entry.laze.exit_crit_edge ], [ %4, %if.end.i ]
%conv = sext i32 %r to i64
%cmp = icmp sgt i64 %6, %conv
br i1 %cmp, label %common.ret86, label %lor.lhs.false
lor.lhs.false: ; preds = %laze.exit
%conv2 = sext i32 %l to i64
%arrayidx4 = getelementptr inbounds [3000000 x i64], ptr @right, i64 0, i64 %idxprom.i
%7 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp5 = icmp slt i64 %7, %conv2
br i1 %cmp5, label %common.ret86, label %if.end
if.end: ; preds = %lor.lhs.false
%cmp10.not = icmp slt i64 %6, %conv2
%cmp15.not = icmp sgt i64 %7, %conv
%or.cond = or i1 %cmp10.not, %cmp15.not
br i1 %or.cond, label %if.end21, label %if.then17
if.then17: ; preds = %if.end
%conv18 = sext i32 %value to i64
store i64 %conv18, ptr %arrayidx.i, align 8, !tbaa !5
%cmp.i70 = icmp eq i32 %value, 0
br i1 %cmp.i70, label %common.ret86, label %if.end.i71
if.end.i71: ; preds = %if.then17
%mul.i72 = shl nsw i32 %k, 1
%idxprom3.i73 = sext i32 %mul.i72 to i64
%arrayidx4.i74 = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom3.i73
store i64 %conv18, ptr %arrayidx4.i74, align 16, !tbaa !5
%8 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%add.i75 = or i32 %mul.i72, 1
%idxprom8.i76 = sext i32 %add.i75 to i64
%arrayidx9.i77 = getelementptr inbounds [3000000 x i64], ptr @lazy, i64 0, i64 %idxprom8.i76
store i64 %8, ptr %arrayidx9.i77, align 8, !tbaa !5
%9 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%reass.sub = sub i64 %7, %6
%add17.i81 = add i64 %reass.sub, 1
%arrayidx18.i82 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 %9, i64 %add17.i81
%10 = load i64, ptr %arrayidx18.i82, align 8, !tbaa !5
%arrayidx20.i83 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom.i
store i64 %10, ptr %arrayidx20.i83, align 8, !tbaa !5
store i64 0, ptr %arrayidx.i, align 8, !tbaa !5
br label %common.ret86
common.ret86: ; preds = %if.end.i71, %if.then17, %laze.exit, %lor.lhs.false, %if.end21
ret void
if.end21: ; preds = %if.end
%add = add nsw i64 %7, %6
%div = sdiv i64 %add, 2
%mul = shl nsw i32 %k, 1
tail call void @update(i32 noundef %l, i32 noundef %r, i32 noundef %mul, i32 noundef %value)
%add28 = or i32 %mul, 1
tail call void @update(i32 noundef %l, i32 noundef %r, i32 noundef %add28, i32 noundef %value)
%idxprom30 = sext i32 %mul to i64
%arrayidx31 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom30
%11 = load i64, ptr %arrayidx31, align 16, !tbaa !5
%12 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%sext = shl i64 %div, 32
%conv34 = ashr exact i64 %sext, 32
%sub = sub nsw i64 %12, %conv34
%arrayidx35 = getelementptr inbounds [3000000 x i64], ptr @base, i64 0, i64 %sub
%13 = load i64, ptr %arrayidx35, align 8, !tbaa !5
%mul36 = mul nsw i64 %13, %11
%rem = srem i64 %mul36, 998244353
%idxprom39 = sext i32 %add28 to i64
%arrayidx40 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom39
%14 = load i64, ptr %arrayidx40, align 8, !tbaa !5
%add41 = add nsw i64 %rem, %14
%rem42 = srem i64 %add41, 998244353
%arrayidx44 = getelementptr inbounds [3000000 x i64], ptr @tree, i64 0, i64 %idxprom.i
store i64 %rem42, ptr %arrayidx44, align 8, !tbaa !5
br label %common.ret86
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%q = 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 %q) #5
%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 !9
%cmp3.not60 = icmp slt i32 %0, 2
br i1 %cmp3.not60, label %for.body.us.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
store i64 1, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 1, i64 1), align 8, !tbaa !5
%wide.trip.count = zext i32 %1 to i64
br label %for.body6
for.body.us.preheader: ; preds = %entry
store i64 1, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 1, i64 1), align 8, !tbaa !5
store i64 2, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 2, i64 1), align 8, !tbaa !5
store i64 3, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 3, i64 1), align 8, !tbaa !5
store i64 4, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 4, i64 1), align 8, !tbaa !5
store i64 5, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 5, i64 1), align 8, !tbaa !5
store i64 6, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 6, i64 1), align 8, !tbaa !5
store i64 7, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 7, i64 1), align 8, !tbaa !5
store i64 8, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 8, i64 1), align 8, !tbaa !5
store i64 9, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 9, i64 1), align 8, !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body6.8, %for.body.us.preheader
store i64 1, ptr @base, align 16, !tbaa !5
%cmp22.not63 = icmp slt i32 %0, 1
br i1 %cmp22.not63, label %for.cond.cleanup24, label %for.body25.preheader
for.body25.preheader: ; preds = %for.cond.cleanup
%2 = zext i32 %0 to i64
%xtraiter = and i64 %2, 1
%3 = icmp eq i32 %0, 1
br i1 %3, label %for.cond.cleanup24.loopexit.unr-lcssa, label %for.body25.preheader.new
for.body25.preheader.new: ; preds = %for.body25.preheader
%unroll_iter = and i64 %2, 4294967294
br label %for.body25
for.cond2.for.cond.cleanup5_crit_edge: ; preds = %for.body6
store i64 2, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 2, i64 1), align 8, !tbaa !5
br label %for.body6.1
for.body6.1: ; preds = %for.body6.1, %for.cond2.for.cond.cleanup5_crit_edge
%4 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge ], [ %rem12.1.sext, %for.body6.1 ]
%indvars.iv.1 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge ], [ %indvars.iv.next.1, %for.body6.1 ]
%mul.1 = mul nsw i64 %4, 10
%rem.1 = srem i64 %mul.1, 998244353
%5 = trunc i64 %rem.1 to i32
%rem12.1.lhs.trunc = add nsw i32 %5, 2
%rem12.185 = srem i32 %rem12.1.lhs.trunc, 998244353
%rem12.1.sext = sext i32 %rem12.185 to i64
%arrayidx16.1 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 2, i64 %indvars.iv.1
store i64 %rem12.1.sext, ptr %arrayidx16.1, align 8, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
%exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.1.not, label %for.cond2.for.cond.cleanup5_crit_edge.1, label %for.body6.1, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.1: ; preds = %for.body6.1
store i64 3, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 3, i64 1), align 8, !tbaa !5
br label %for.body6.2
for.body6.2: ; preds = %for.body6.2, %for.cond2.for.cond.cleanup5_crit_edge.1
%6 = phi i64 [ 3, %for.cond2.for.cond.cleanup5_crit_edge.1 ], [ %rem12.2.sext, %for.body6.2 ]
%indvars.iv.2 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.1 ], [ %indvars.iv.next.2, %for.body6.2 ]
%mul.2 = mul nsw i64 %6, 10
%rem.2 = srem i64 %mul.2, 998244353
%7 = trunc i64 %rem.2 to i32
%rem12.2.lhs.trunc = add nsw i32 %7, 3
%rem12.286 = srem i32 %rem12.2.lhs.trunc, 998244353
%rem12.2.sext = sext i32 %rem12.286 to i64
%arrayidx16.2 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 3, i64 %indvars.iv.2
store i64 %rem12.2.sext, ptr %arrayidx16.2, align 8, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
%exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %wide.trip.count
br i1 %exitcond.2.not, label %for.cond2.for.cond.cleanup5_crit_edge.2, label %for.body6.2, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.2: ; preds = %for.body6.2
store i64 4, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 4, i64 1), align 8, !tbaa !5
br label %for.body6.3
for.body6.3: ; preds = %for.body6.3, %for.cond2.for.cond.cleanup5_crit_edge.2
%8 = phi i64 [ 4, %for.cond2.for.cond.cleanup5_crit_edge.2 ], [ %rem12.3.sext, %for.body6.3 ]
%indvars.iv.3 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.2 ], [ %indvars.iv.next.3, %for.body6.3 ]
%mul.3 = mul nsw i64 %8, 10
%rem.3 = srem i64 %mul.3, 998244353
%9 = trunc i64 %rem.3 to i32
%rem12.3.lhs.trunc = add nsw i32 %9, 4
%rem12.387 = srem i32 %rem12.3.lhs.trunc, 998244353
%rem12.3.sext = sext i32 %rem12.387 to i64
%arrayidx16.3 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 4, i64 %indvars.iv.3
store i64 %rem12.3.sext, ptr %arrayidx16.3, align 8, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
%exitcond.3.not = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.3.not, label %for.cond2.for.cond.cleanup5_crit_edge.3, label %for.body6.3, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.3: ; preds = %for.body6.3
store i64 5, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 5, i64 1), align 8, !tbaa !5
br label %for.body6.4
for.body6.4: ; preds = %for.body6.4, %for.cond2.for.cond.cleanup5_crit_edge.3
%10 = phi i64 [ 5, %for.cond2.for.cond.cleanup5_crit_edge.3 ], [ %rem12.4.sext, %for.body6.4 ]
%indvars.iv.4 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.3 ], [ %indvars.iv.next.4, %for.body6.4 ]
%mul.4 = mul nsw i64 %10, 10
%rem.4 = srem i64 %mul.4, 998244353
%11 = trunc i64 %rem.4 to i32
%rem12.4.lhs.trunc = add nsw i32 %11, 5
%rem12.488 = srem i32 %rem12.4.lhs.trunc, 998244353
%rem12.4.sext = sext i32 %rem12.488 to i64
%arrayidx16.4 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 5, i64 %indvars.iv.4
store i64 %rem12.4.sext, ptr %arrayidx16.4, align 8, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv.4, 1
%exitcond.4.not = icmp eq i64 %indvars.iv.next.4, %wide.trip.count
br i1 %exitcond.4.not, label %for.cond2.for.cond.cleanup5_crit_edge.4, label %for.body6.4, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.4: ; preds = %for.body6.4
store i64 6, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 6, i64 1), align 8, !tbaa !5
br label %for.body6.5
for.body6.5: ; preds = %for.body6.5, %for.cond2.for.cond.cleanup5_crit_edge.4
%12 = phi i64 [ 6, %for.cond2.for.cond.cleanup5_crit_edge.4 ], [ %rem12.5.sext, %for.body6.5 ]
%indvars.iv.5 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.4 ], [ %indvars.iv.next.5, %for.body6.5 ]
%mul.5 = mul nsw i64 %12, 10
%rem.5 = srem i64 %mul.5, 998244353
%13 = trunc i64 %rem.5 to i32
%rem12.5.lhs.trunc = add nsw i32 %13, 6
%rem12.589 = srem i32 %rem12.5.lhs.trunc, 998244353
%rem12.5.sext = sext i32 %rem12.589 to i64
%arrayidx16.5 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 6, i64 %indvars.iv.5
store i64 %rem12.5.sext, ptr %arrayidx16.5, align 8, !tbaa !5
%indvars.iv.next.5 = add nuw nsw i64 %indvars.iv.5, 1
%exitcond.5.not = icmp eq i64 %indvars.iv.next.5, %wide.trip.count
br i1 %exitcond.5.not, label %for.cond2.for.cond.cleanup5_crit_edge.5, label %for.body6.5, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.5: ; preds = %for.body6.5
store i64 7, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 7, i64 1), align 8, !tbaa !5
br label %for.body6.6
for.body6.6: ; preds = %for.body6.6, %for.cond2.for.cond.cleanup5_crit_edge.5
%14 = phi i64 [ 7, %for.cond2.for.cond.cleanup5_crit_edge.5 ], [ %rem12.6.sext, %for.body6.6 ]
%indvars.iv.6 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.5 ], [ %indvars.iv.next.6, %for.body6.6 ]
%mul.6 = mul nsw i64 %14, 10
%rem.6 = srem i64 %mul.6, 998244353
%15 = trunc i64 %rem.6 to i32
%rem12.6.lhs.trunc = add nsw i32 %15, 7
%rem12.690 = srem i32 %rem12.6.lhs.trunc, 998244353
%rem12.6.sext = sext i32 %rem12.690 to i64
%arrayidx16.6 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 7, i64 %indvars.iv.6
store i64 %rem12.6.sext, ptr %arrayidx16.6, align 8, !tbaa !5
%indvars.iv.next.6 = add nuw nsw i64 %indvars.iv.6, 1
%exitcond.6.not = icmp eq i64 %indvars.iv.next.6, %wide.trip.count
br i1 %exitcond.6.not, label %for.cond2.for.cond.cleanup5_crit_edge.6, label %for.body6.6, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.6: ; preds = %for.body6.6
store i64 8, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 8, i64 1), align 8, !tbaa !5
br label %for.body6.7
for.body6.7: ; preds = %for.body6.7, %for.cond2.for.cond.cleanup5_crit_edge.6
%16 = phi i64 [ 8, %for.cond2.for.cond.cleanup5_crit_edge.6 ], [ %rem12.7.sext, %for.body6.7 ]
%indvars.iv.7 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.6 ], [ %indvars.iv.next.7, %for.body6.7 ]
%mul.7 = mul nsw i64 %16, 10
%rem.7 = srem i64 %mul.7, 998244353
%17 = trunc i64 %rem.7 to i32
%rem12.7.lhs.trunc = add nsw i32 %17, 8
%rem12.791 = srem i32 %rem12.7.lhs.trunc, 998244353
%rem12.7.sext = sext i32 %rem12.791 to i64
%arrayidx16.7 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 8, i64 %indvars.iv.7
store i64 %rem12.7.sext, ptr %arrayidx16.7, align 8, !tbaa !5
%indvars.iv.next.7 = add nuw nsw i64 %indvars.iv.7, 1
%exitcond.7.not = icmp eq i64 %indvars.iv.next.7, %wide.trip.count
br i1 %exitcond.7.not, label %for.cond2.for.cond.cleanup5_crit_edge.7, label %for.body6.7, !llvm.loop !11
for.cond2.for.cond.cleanup5_crit_edge.7: ; preds = %for.body6.7
store i64 9, ptr getelementptr inbounds ([10 x [3000000 x i64]], ptr @sum, i64 0, i64 9, i64 1), align 8, !tbaa !5
br label %for.body6.8
for.body6.8: ; preds = %for.body6.8, %for.cond2.for.cond.cleanup5_crit_edge.7
%18 = phi i64 [ 9, %for.cond2.for.cond.cleanup5_crit_edge.7 ], [ %rem12.8.sext, %for.body6.8 ]
%indvars.iv.8 = phi i64 [ 2, %for.cond2.for.cond.cleanup5_crit_edge.7 ], [ %indvars.iv.next.8, %for.body6.8 ]
%mul.8 = mul nsw i64 %18, 10
%rem.8 = srem i64 %mul.8, 998244353
%19 = trunc i64 %rem.8 to i32
%rem12.8.lhs.trunc = add nsw i32 %19, 9
%rem12.892 = srem i32 %rem12.8.lhs.trunc, 998244353
%rem12.8.sext = sext i32 %rem12.892 to i64
%arrayidx16.8 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 9, i64 %indvars.iv.8
store i64 %rem12.8.sext, ptr %arrayidx16.8, align 8, !tbaa !5
%indvars.iv.next.8 = add nuw nsw i64 %indvars.iv.8, 1
%exitcond.8.not = icmp eq i64 %indvars.iv.next.8, %wide.trip.count
br i1 %exitcond.8.not, label %for.cond.cleanup, label %for.body6.8, !llvm.loop !11
for.body6: ; preds = %for.body.preheader, %for.body6
%20 = phi i64 [ 1, %for.body.preheader ], [ %rem12.sext, %for.body6 ]
%indvars.iv = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next, %for.body6 ]
%mul = mul nsw i64 %20, 10
%rem = srem i64 %mul, 998244353
%21 = trunc i64 %rem to i32
%rem12.lhs.trunc = add nsw i32 %21, 1
%rem1284 = srem i32 %rem12.lhs.trunc, 998244353
%rem12.sext = sext i32 %rem1284 to i64
%arrayidx16 = getelementptr inbounds [10 x [3000000 x i64]], ptr @sum, i64 0, i64 1, i64 %indvars.iv
store i64 %rem12.sext, ptr %arrayidx16, align 8, !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.cond2.for.cond.cleanup5_crit_edge, label %for.body6, !llvm.loop !11
for.cond.cleanup24.loopexit.unr-lcssa.loopexit: ; preds = %for.body25
%22 = mul nsw i64 %rem30.1, 10
%23 = srem i64 %22, 998244353
br label %for.cond.cleanup24.loopexit.unr-lcssa
for.cond.cleanup24.loopexit.unr-lcssa: ; preds = %for.cond.cleanup24.loopexit.unr-lcssa.loopexit, %for.body25.preheader
%.unr = phi i64 [ 10, %for.body25.preheader ], [ %23, %for.cond.cleanup24.loopexit.unr-lcssa.loopexit ]
%indvars.iv78.unr = phi i64 [ 1, %for.body25.preheader ], [ %indvars.iv.next79.1, %for.cond.cleanup24.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup24, label %for.body25.epil
for.body25.epil: ; preds = %for.cond.cleanup24.loopexit.unr-lcssa
%arrayidx32.epil = getelementptr inbounds [3000000 x i64], ptr @base, i64 0, i64 %indvars.iv78.unr
store i64 %.unr, ptr %arrayidx32.epil, align 8, !tbaa !5
br label %for.cond.cleanup24
for.cond.cleanup24: ; preds = %for.body25.epil, %for.cond.cleanup24.loopexit.unr-lcssa, %for.cond.cleanup
call void @build(i32 noundef 1, i32 noundef %0, i32 noundef 1)
%24 = load i32, ptr %q, align 4, !tbaa !9
%cmp38.not65 = icmp slt i32 %24, 1
br i1 %cmp38.not65, label %for.cond.cleanup40, label %for.body41
for.body25: ; preds = %for.body25, %for.body25.preheader.new
%25 = phi i64 [ 1, %for.body25.preheader.new ], [ %rem30.1, %for.body25 ]
%indvars.iv78 = phi i64 [ 1, %for.body25.preheader.new ], [ %indvars.iv.next79.1, %for.body25 ]
%niter = phi i64 [ 0, %for.body25.preheader.new ], [ %niter.next.1, %for.body25 ]
%mul29 = mul nsw i64 %25, 10
%rem30 = srem i64 %mul29, 998244353
%arrayidx32 = getelementptr inbounds [3000000 x i64], ptr @base, i64 0, i64 %indvars.iv78
store i64 %rem30, ptr %arrayidx32, align 8, !tbaa !5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%mul29.1 = mul nsw i64 %rem30, 10
%rem30.1 = srem i64 %mul29.1, 998244353
%arrayidx32.1 = getelementptr inbounds [3000000 x i64], ptr @base, i64 0, i64 %indvars.iv.next79
store i64 %rem30.1, ptr %arrayidx32.1, align 8, !tbaa !5
%indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 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.cond.cleanup24.loopexit.unr-lcssa.loopexit, label %for.body25, !llvm.loop !13
for.cond.cleanup40: ; preds = %for.body41, %for.cond.cleanup24
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body41: ; preds = %for.cond.cleanup24, %for.body41
%i36.066 = phi i32 [ %inc45, %for.body41 ], [ 1, %for.cond.cleanup24 ]
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @l, ptr noundef nonnull @r, ptr noundef nonnull @value)
%26 = load i32, ptr @l, align 4, !tbaa !9
%27 = load i32, ptr @r, align 4, !tbaa !9
%28 = load i32, ptr @value, align 4, !tbaa !9
call void @update(i32 noundef %26, i32 noundef %27, i32 noundef 1, i32 noundef %28)
%29 = load i64, ptr getelementptr inbounds ([3000000 x i64], ptr @tree, i64 0, i64 1), align 8, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %29)
%inc45 = add nuw nsw i32 %i36.066, 1
%30 = load i32, ptr %q, align 4, !tbaa !9
%cmp38.not.not = icmp slt i32 %i36.066, %30
br i1 %cmp38.not.not, label %for.body41, label %for.cond.cleanup40, !llvm.loop !14
}
; 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 nosync nounwind memory(readwrite, argmem: none, 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, 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 #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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
#include <string.h>
int main(){
int n;
scanf("%d", &n);
printf("ABC%d", n);
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277089/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277089/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"ABC%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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, 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: 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"}
|
#include<stdio.h>
int main()
{
int n;
while(~scanf("%d",&n))
{
if(n>=100&&n<=999)
printf("ABC%d\n",n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277139/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277139/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"ABC%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) #3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not4 = icmp eq i32 %call3, -1
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %n, align 4
%1 = add i32 %0, -100
%or.cond = icmp ult i32 %1, 900
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %while.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %while.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
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"}
|
//set many funcs template
//Ver.20190820
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<assert.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;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
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;}
void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}
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);}
void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;}
void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;}
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);}
int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
void shuffledget(int x[],int n){
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;
}
void prarr(int arr[],int n){
int i;
for(i=0;i<n;i++){
if(i){printf(" ");}
printf("%d",arr[i]);
}
printf("\n");
return;
}
void getperm(int a[],int n){
int i,p;
for(i=0;i<n;i++){
a[i]=i;
}
for(i=n-1;i>=1;i--){
p=rand()%(i+1);
swap(&a[p],&a[i]);
}
}
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;
}
void coordinate_comp(int a[],int n){
int i,c=0;
sd dat[524288];
for(i=0;i<n;i++){
dat[i].val=a[i];
dat[i].node=i;
}
qsort(dat,n,sizeof(dat[0]),sdsortfnc);
a[dat[0].node]=c;
for(i=1;i<n;i++){
if(dat[i-1].val!=dat[i].val){c++;}
a[dat[i].node]=c;
}
}
int main(void){
int i,j,n,m,k,a,b,c,h,w,r=0,l,t;
int dlt=1,re;
scanf("%d%d",&n,&m);
re=(m/2)*2;
for(i=0;i<m;i++){
//printf("<%d %d %d>\n",i,n,dlt);
if(dlt%2==1){
printf("%d %d\n",i+1,((i+n-dlt)%n)+1);
}
else{
printf("%d %d\n",i+1,((i+dlt)%n)+1);
}
if(dlt%2==0){dlt-=2;}
else{
dlt+=2;
if(dlt>m){dlt=re;}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277377/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277377/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.sd = type { i32, i32 }
@.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.3 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"%d %d\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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
store i32 %1, ptr %a, align 4, !tbaa !16
store i32 %0, ptr %b, align 4, !tbaa !16
ret void
}
; 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 !20
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 !20
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 !21
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 !21
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 !22
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 !23
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 !25
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 !26
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 !27
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 !28
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(argmem: readwrite) uwtable
define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
store i64 %1, ptr %a, align 8, !tbaa !29
store i64 %0, ptr %b, align 8, !tbaa !29
ret void
}
; 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: readwrite) uwtable
define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
store double %1, ptr %a, align 8, !tbaa !31
store double %0, ptr %b, align 8, !tbaa !31
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
store i8 %1, ptr %a, align 1, !tbaa !33
store i8 %0, ptr %b, align 1, !tbaa !33
ret void
}
; 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 #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%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 #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%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 #5 {
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 #5 {
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 #5 {
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 #5 {
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 #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; 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 #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp sgt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 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 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 {
entry:
%b = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #17
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.body.preheader, label %for.end25
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.preheader57, 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 !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16
%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 !34
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57
for.body.preheader57: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
br i1 %cmp40, label %for.body3.preheader, label %for.end25
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader57, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ]
%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 !16
%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.cond1.preheader, label %for.body, !llvm.loop !35
for.cond15.preheader: ; preds = %for.body3
br i1 %cmp40, label %for.body17.preheader, label %for.end25
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count54 = zext i32 %n to i64
br label %for.body17
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ]
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv47 to i32
%rem = srem i32 %call, %5
%indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
%idxprom4 = and i64 %indvars.iv.next48, 4294967295
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%idxprom6 = sext i32 %rem to i64
%arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv47, 1
br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36
for.body17: ; preds = %for.body17.preheader, %for.body17
%indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ]
%arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !16
%idxprom20 = sext i32 %8 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20
%call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54
br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37
for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #17
ret void
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; 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 #11 {
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 !16
%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 !38
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %arr, align 4, !tbaa !16
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, 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.end, label %if.end, !llvm.loop !39
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nounwind uwtable
define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%cmp20 = icmp sgt i32 %n, 0
br i1 %cmp20, label %for.body.preheader, label %for.end9
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.preheader30, 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 i32, ptr %a, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16
%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 !41
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader30
for.body.preheader30: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
%cmp222 = icmp sgt i32 %n, 1
br i1 %cmp222, label %for.body3.preheader, label %for.end9
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader30, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%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.cond1.preheader, label %for.body, !llvm.loop !42
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ]
%indvars.iv.next26 = add nsw i64 %indvars.iv25, -1
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv25 to i32
%rem = srem i32 %call, %5
%idxprom4 = sext i32 %rem to i64
%arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4
%idxprom6 = and i64 %indvars.iv.next26, 4294967295
%arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv25, 2
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43
for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader
ret void
}
; 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) #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !44
%1 = load i32, ptr %b, align 4, !tbaa !44
%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: nofree nounwind uwtable
define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 {
entry:
%dat = alloca [524288 x %struct.sd], align 16
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #17
%cmp46 = icmp sgt i32 %n, 0
br i1 %cmp46, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 4
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, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%0 = or i64 %index, 2
%1 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16
%2 = getelementptr inbounds i32, ptr %1, i64 2
%wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16
%3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index
%4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0
%interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16
%interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, 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.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 i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv
store i32 %6, ptr %arrayidx2, align 8, !tbaa !44
%node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %node, align 4, !tbaa !47
%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 !48
for.end: ; preds = %for.body, %middle.block, %entry
%conv = sext i32 %n to i64
call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #17
%node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1
%8 = load i32, ptr %node6, align 4, !tbaa !47
%idxprom7 = sext i32 %8 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 0, ptr %arrayidx8, align 4, !tbaa !16
%cmp1048 = icmp sgt i32 %n, 1
br i1 %cmp1048, label %for.body12.preheader, label %for.end29
for.body12.preheader: ; preds = %for.end
%wide.trip.count56 = zext i32 %n to i64
%.pre = load i32, ptr %dat, align 16, !tbaa !44
%9 = add nsw i64 %wide.trip.count56, -1
%xtraiter = and i64 %9, 1
%10 = icmp eq i32 %n, 2
br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i64 %9, -2
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ]
%indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ]
%niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ]
%arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52
%12 = load i32, ptr %arrayidx17, align 8, !tbaa !44
%cmp19.not = icmp ne i32 %11, %12
%inc21 = zext i1 %cmp19.not to i32
%spec.select = add nuw nsw i32 %c.050, %inc21
%node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1
%13 = load i32, ptr %node24, align 4, !tbaa !47
%idxprom25 = sext i32 %13 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25
store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53
%14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44
%cmp19.not.1 = icmp ne i32 %12, %14
%inc21.1 = zext i1 %cmp19.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1
%node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1
%15 = load i32, ptr %node24.1, align 4, !tbaa !47
%idxprom25.1 = sext i32 %15 to i64
%arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1
store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16
%indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 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.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49
for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ]
%indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil
for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr
%16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44
%cmp19.not.epil = icmp ne i32 %.unr, %16
%inc21.epil = zext i1 %cmp19.not.epil to i32
%spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil
%node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1
%17 = load i32, ptr %node24.epil, align 4, !tbaa !47
%idxprom25.epil = sext i32 %17 to i64
%arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil
store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16
br label %for.end29
for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #17
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #12 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #17
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !16
%div = sdiv i32 %0, 2
%mul = shl nsw i32 %div, 1
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.035 = phi i32 [ %add, %for.inc ], [ 0, %entry ]
%dlt.034 = phi i32 [ %dlt.1, %for.inc ], [ 1, %entry ]
%rem = srem i32 %dlt.034, 2
%cmp1 = icmp eq i32 %rem, 1
%add = add nuw nsw i32 %i.035, 1
br i1 %cmp1, label %if.end.thread, label %if.end
if.end.thread: ; preds = %for.body
%1 = load i32, ptr %n, align 4, !tbaa !16
%add2 = sub i32 %i.035, %dlt.034
%sub = add i32 %add2, %1
%rem3 = srem i32 %sub, %1
%add4 = add nsw i32 %rem3, 1
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %add, i32 noundef %add4)
br label %if.else15
if.end: ; preds = %for.body
%add7 = add nsw i32 %i.035, %dlt.034
%2 = load i32, ptr %n, align 4, !tbaa !16
%rem8 = srem i32 %add7, %2
%add9 = add nsw i32 %rem8, 1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %add, i32 noundef %add9)
%cmp12 = icmp eq i32 %rem, 0
br i1 %cmp12, label %if.then13, label %if.else15
if.then13: ; preds = %if.end
%sub14 = add nsw i32 %dlt.034, -2
%.pre = load i32, ptr %m, align 4, !tbaa !16
br label %for.inc
if.else15: ; preds = %if.end.thread, %if.end
%add16 = add nsw i32 %dlt.034, 2
%3 = load i32, ptr %m, align 4, !tbaa !16
%cmp17 = icmp sgt i32 %add16, %3
%spec.select = select i1 %cmp17, i32 %mul, i32 %add16
br label %for.inc
for.inc: ; preds = %if.else15, %if.then13
%4 = phi i32 [ %3, %if.else15 ], [ %.pre, %if.then13 ]
%dlt.1 = phi i32 [ %spec.select, %if.else15 ], [ %sub14, %if.then13 ]
%cmp = icmp slt i32 %add, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !50
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #17
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #15
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: 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 #9 = { 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 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 #11 = { 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 #12 = { 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 #13 = { 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 #14 = { nofree nounwind }
attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #16 = { nounwind willreturn memory(read) }
attributes #17 = { 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 = !{!17, !17, i64 0}
!17 = !{!"int", !18, i64 0}
!18 = !{!"omnipotent char", !19, i64 0}
!19 = !{!"Simple C/C++ TBAA"}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !6}
!28 = distinct !{!28, !6}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !18, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !18, i64 0}
!33 = !{!18, !18, i64 0}
!34 = distinct !{!34, !6, !9, !10}
!35 = distinct !{!35, !6, !10, !9}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = distinct !{!38, !6}
!39 = distinct !{!39, !6, !40}
!40 = !{!"llvm.loop.peeled.count", i32 1}
!41 = distinct !{!41, !6, !9, !10}
!42 = distinct !{!42, !6, !10, !9}
!43 = distinct !{!43, !6}
!44 = !{!45, !17, i64 0}
!45 = !{!"", !17, i64 0, !17, i64 4}
!46 = distinct !{!46, !6, !9, !10}
!47 = !{!45, !17, i64 4}
!48 = distinct !{!48, !6, !10, !9}
!49 = distinct !{!49, !6}
!50 = distinct !{!50, !6}
|
#include <stdio.h>
int max(int a, int b, int c, int d) {
int max1, max2;
max1 = a > b ? a : b;
max2 = c > d ? c : d;
return max1 > max2 ? max1 : max2;
}
int main(int argc, char const *argv[])
{
int n, sx, sy, x, y, top = 0, left = 0, right = 0, bottom = 0, c;
scanf("%d %d %d", &n, &sx, &sy);
for (int i = 0; i < n; ++i) {
scanf("%d %d", &x, &y);
if (y > sy) {
++top;
}
if (y < sy) {
++bottom;
}
if (x > sx) {
++right;
}
if (x < sx) {
++left;
}
}
if (sy == 1000*1000*1000) top = 0;
if (sy == 0) bottom = 0;
if (sx == 1000*1000*1000) right = 0;
if (sx == 0) left = 0;
c = max(top, bottom, right, left);
printf("%d\n", c);
if (top == c) {
printf("%d %d\n", sx, sy + 1);
} else if (bottom == c) {
printf("%d %d\n", sx, sy - 1);
} else if (right == c) {
printf("%d %d\n", sx + 1, sy);
} else if (left == c) {
printf("%d %d\n", sx - 1, sy);
} else {
printf("wtf?\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_27742/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_27742/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 [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@str = private unnamed_addr constant [5 x i8] c"wtf?\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond5 = tail call i32 @llvm.smax.i32(i32 %c, i32 %d)
%cond10 = tail call i32 @llvm.smax.i32(i32 %cond, i32 %cond5)
ret i32 %cond10
}
; 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%sx = alloca i32, align 4
%sy = alloca i32, align 4
%x = alloca i32, align 4
%y = 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 %sx) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sy) #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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %sx, ptr noundef nonnull %sy)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = load i32, ptr %sy, align 4, !tbaa !5
%.pre75 = load i32, ptr %sx, align 4, !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%1 = phi i32 [ %.pre75, %entry.for.cond.cleanup_crit_edge ], [ %6, %for.body ]
%2 = phi i32 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %4, %for.body ]
%left.0.lcssa = phi i32 [ 0, %entry.for.cond.cleanup_crit_edge ], [ %left.1, %for.body ]
%right.0.lcssa = phi i32 [ 0, %entry.for.cond.cleanup_crit_edge ], [ %right.1, %for.body ]
%bottom.0.lcssa = phi i32 [ 0, %entry.for.cond.cleanup_crit_edge ], [ %bottom.1, %for.body ]
%top.0.lcssa = phi i32 [ 0, %entry.for.cond.cleanup_crit_edge ], [ %spec.select65, %for.body ]
%cmp16 = icmp eq i32 %2, 1000000000
%spec.select = select i1 %cmp16, i32 0, i32 %top.0.lcssa
%cmp19 = icmp eq i32 %2, 0
%bottom.2 = select i1 %cmp19, i32 0, i32 %bottom.0.lcssa
%cmp22 = icmp eq i32 %1, 1000000000
%right.2 = select i1 %cmp22, i32 0, i32 %right.0.lcssa
%cmp25 = icmp eq i32 %1, 0
%left.2 = select i1 %cmp25, i32 0, i32 %left.0.lcssa
%cond.i = call i32 @llvm.smax.i32(i32 %spec.select, i32 %bottom.2)
%cond5.i = call i32 @llvm.smax.i32(i32 %right.2, i32 %left.2)
%cond10.i = call i32 @llvm.smax.i32(i32 %cond.i, i32 %cond5.i)
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cond10.i)
%cmp30 = icmp eq i32 %spec.select, %cond10.i
br i1 %cmp30, label %if.then31, label %if.else
for.body: ; preds = %entry, %for.body
%i.071 = phi i32 [ %inc15, %for.body ], [ 0, %entry ]
%top.070 = phi i32 [ %spec.select65, %for.body ], [ 0, %entry ]
%bottom.069 = phi i32 [ %bottom.1, %for.body ], [ 0, %entry ]
%right.068 = phi i32 [ %right.1, %for.body ], [ 0, %entry ]
%left.067 = phi i32 [ %left.1, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%3 = load i32, ptr %y, align 4, !tbaa !5
%4 = load i32, ptr %sy, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %3, %4
%inc = zext i1 %cmp2 to i32
%spec.select65 = add nuw nsw i32 %top.070, %inc
%cmp3 = icmp slt i32 %3, %4
%inc5 = zext i1 %cmp3 to i32
%bottom.1 = add nuw nsw i32 %bottom.069, %inc5
%5 = load i32, ptr %x, align 4, !tbaa !5
%6 = load i32, ptr %sx, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %5, %6
%inc9 = zext i1 %cmp7 to i32
%right.1 = add nuw nsw i32 %right.068, %inc9
%cmp11 = icmp slt i32 %5, %6
%inc13 = zext i1 %cmp11 to i32
%left.1 = add nuw nsw i32 %left.067, %inc13
%inc15 = add nuw nsw i32 %i.071, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc15, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then31: ; preds = %for.cond.cleanup
%8 = load i32, ptr %sx, align 4, !tbaa !5
%9 = load i32, ptr %sy, align 4, !tbaa !5
%add = add nsw i32 %9, 1
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8, i32 noundef %add)
br label %if.end51
if.else: ; preds = %for.cond.cleanup
%cmp33 = icmp eq i32 %bottom.2, %cond10.i
br i1 %cmp33, label %if.then34, label %if.else36
if.then34: ; preds = %if.else
%10 = load i32, ptr %sx, align 4, !tbaa !5
%11 = load i32, ptr %sy, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10, i32 noundef %sub)
br label %if.end51
if.else36: ; preds = %if.else
%cmp37 = icmp eq i32 %right.2, %cond10.i
br i1 %cmp37, label %if.then38, label %if.else41
if.then38: ; preds = %if.else36
%12 = load i32, ptr %sx, align 4, !tbaa !5
%add39 = add nsw i32 %12, 1
%13 = load i32, ptr %sy, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add39, i32 noundef %13)
br label %if.end51
if.else41: ; preds = %if.else36
%cmp42 = icmp eq i32 %left.2, %cond10.i
br i1 %cmp42, label %if.then43, label %if.else46
if.then43: ; preds = %if.else41
%14 = load i32, ptr %sx, align 4, !tbaa !5
%sub44 = add nsw i32 %14, -1
%15 = load i32, ptr %sy, align 4, !tbaa !5
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub44, i32 noundef %15)
br label %if.end51
if.else46: ; preds = %if.else41
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end51
if.end51: ; preds = %if.then34, %if.then43, %if.else46, %if.then38, %if.then31
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 %sy) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sx) #6
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: nofree nounwind
declare noundef i32 @printf(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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}
|
#include <stdio.h>
#include <stdlib.h>
int main () {
int N;
int M;
scanf("%d", &N);
scanf("%d", &M);
int *L = malloc((M + 1) * sizeof(int));
int *R = malloc((M + 1) * sizeof(int));
int start = 0;
int end = 0;
for (int i = 1; i <= M; i++) {
scanf("%d", &L[i]);
scanf("%d", &R[i]);
if (start == 0)
start = L[i];
if (end == 0)
end = R[i];
if (start <= L[i])
start = L[i];
if (end >= R[i])
end = R[i];
}
int ans;
if (start > end)
ans = 0;
else
ans = (end - start) + 1;
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277485/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277485/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:
%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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M)
%0 = load i32, ptr %M, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call2 = call noalias ptr @malloc(i64 noundef %mul) #6
%call6 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp.not66 = icmp slt i32 %0, 1
br i1 %cmp.not66, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %if.end, %entry
%start.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %if.end ]
%end.0.lcssa = phi i32 [ 0, %entry ], [ %end.2, %if.end ]
%cmp38 = icmp sgt i32 %start.0.lcssa, %end.0.lcssa
%reass.sub = sub i32 %end.0.lcssa, %start.0.lcssa
%add41 = add i32 %reass.sub, 1
%ans.0 = select i1 %cmp38, i32 0, i32 %add41
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
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
for.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %entry ]
%end.068 = phi i32 [ %end.2, %if.end ], [ 0, %entry ]
%start.067 = phi i32 [ %spec.select, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx10 = getelementptr inbounds i32, ptr %call6, i64 %indvars.iv
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10)
%cmp12 = icmp eq i32 %start.067, 0
br i1 %cmp12, label %if.then, label %if.end
if.then: ; preds = %for.body
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body
%start.1 = phi i32 [ %1, %if.then ], [ %start.067, %for.body ]
%cmp16 = icmp eq i32 %end.068, 0
%.pre = load i32, ptr %arrayidx10, align 4, !tbaa !5
%spec.select72 = select i1 %cmp16, i32 %.pre, i32 %end.068
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %start.1, i32 %2)
%end.2 = call i32 @llvm.smin.i32(i32 %spec.select72, i32 %.pre)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %M, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}
|
#include <stdio.h>
int max(int x, int y) {
return x > y ? x : y;
}
int min(int x, int y) {
return x < y ? x : y;
}
int main() {
int N, M;
int i, j;
int L[100000];
int R[100000];
int maxL = 1;
scanf("%d %d", &N, &M);
int minR = N;
for (i = 0; i < M; i++) {
scanf("%d %d", &L[i], &R[i]);
}
for (i = 0; i < M; i++) {
maxL = max(maxL, L[i]);
minR = min(minR, R[i]);
}
if (maxL <= minR) {
printf("%d\n", minR - maxL + 1);
}
else {
printf("%d\n", 0);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277528/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277528/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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%L = alloca [100000 x i32], align 16
%R = alloca [100000 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 %M) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %R) #5
%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 !5
%1 = load i32, ptr %M, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %1, 0
br i1 %cmp31, label %for.body, label %for.end15
for.cond4.preheader: ; preds = %for.body
%cmp533 = icmp sgt i32 %13, 0
br i1 %cmp533, label %for.body6.preheader, label %for.end15
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %13 to i64
%min.iters.check = icmp ult i32 %13, 8
br i1 %min.iters.check, label %for.body6.preheader54, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> 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.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %8, %vector.body ]
%vec.phi46 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ]
%vec.phi47 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %4, %vector.body ]
%vec.phi48 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %5, %vector.body ]
%2 = getelementptr inbounds [100000 x i32], ptr %L, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load49 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi47, <4 x i32> %wide.load)
%5 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi48, <4 x i32> %wide.load49)
%6 = getelementptr inbounds [100000 x i32], ptr %R, i64 0, i64 %index
%wide.load50 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load51 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load50)
%9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi46, <4 x i32> %wide.load51)
%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 !9
middle.block: ; preds = %vector.body
%rdx.minmax52 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %4, <4 x i32> %5)
%11 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax52)
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %8, <4 x i32> %9)
%12 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end15, label %for.body6.preheader54
for.body6.preheader54: ; preds = %for.body6.preheader, %middle.block
%indvars.iv41.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
%minR.036.ph = phi i32 [ %0, %for.body6.preheader ], [ %12, %middle.block ]
%maxL.035.ph = phi i32 [ 1, %for.body6.preheader ], [ %11, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %L, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100000 x i32], ptr %R, 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
%13 = load i32, ptr %M, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !13
for.body6: ; preds = %for.body6.preheader54, %for.body6
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body6 ], [ %indvars.iv41.ph, %for.body6.preheader54 ]
%minR.036 = phi i32 [ %cond.i30, %for.body6 ], [ %minR.036.ph, %for.body6.preheader54 ]
%maxL.035 = phi i32 [ %cond.i, %for.body6 ], [ %maxL.035.ph, %for.body6.preheader54 ]
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %L, i64 0, i64 %indvars.iv41
%15 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cond.i = call i32 @llvm.smax.i32(i32 %maxL.035, i32 %15)
%arrayidx11 = getelementptr inbounds [100000 x i32], ptr %R, i64 0, i64 %indvars.iv41
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cond.i30 = call i32 @llvm.smin.i32(i32 %minR.036, i32 %16)
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
br i1 %exitcond.not, label %for.end15, label %for.body6, !llvm.loop !14
for.end15: ; preds = %for.body6, %middle.block, %entry, %for.cond4.preheader
%maxL.0.lcssa = phi i32 [ 1, %for.cond4.preheader ], [ 1, %entry ], [ %11, %middle.block ], [ %cond.i, %for.body6 ]
%minR.0.lcssa = phi i32 [ %0, %for.cond4.preheader ], [ %0, %entry ], [ %12, %middle.block ], [ %cond.i30, %for.body6 ]
%cmp16.not = icmp sgt i32 %maxL.0.lcssa, %minR.0.lcssa
%reass.sub = sub i32 %minR.0.lcssa, %maxL.0.lcssa
%add = add i32 %reass.sub, 1
%.sink = select i1 %cmp16.not, i32 0, i32 %add
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %R) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %L) #5
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) #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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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.smax.v4i32(<4 x i32>, <4 x 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 i32 @llvm.vector.reduce.smin.v4i32(<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 = { 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 = { 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 = { 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, !12, !11}
|
#include <stdio.h>
int min(int a,int b){
if(a < b){
return a;
}
return b;
}
int max(int a,int b){
if(a > b){
return a;
}
return b;
}
int main(void){
int N,M;
scanf("%d%d",&N,&M);
int left,right,L,R;
for (int i = 0; i < M; i++) {
scanf("%d%d",&L,&R);
if(i == 0){
left = L;
right = R;
}
left = max(left,L);
right = min(right,R);
}
printf("%d\n",max(0,right-left+1));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277571/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277571/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: 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 @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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%L = alloca i32, align 4
%R = 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)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #5
%0 = load i32, ptr %M, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %0, 0
br i1 %cmp13, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %R)
%1 = load i32, ptr %L, align 4
%2 = load i32, ptr %R, align 4
%3 = load i32, ptr %M, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %3, 1
br i1 %cmp.peel, label %for.body, label %for.cond.cleanup.loopexit
for.cond.cleanup.loopexit: ; preds = %for.body, %for.body.preheader
%a.b.i11.lcssa = phi i32 [ %1, %for.body.preheader ], [ %a.b.i11, %for.body ]
%a.b.i12.lcssa = phi i32 [ %2, %for.body.preheader ], [ %a.b.i12, %for.body ]
%4 = sub nsw i32 %a.b.i12.lcssa, %a.b.i11.lcssa
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%sub = phi i32 [ undef, %entry ], [ %4, %for.cond.cleanup.loopexit ]
%5 = call i32 @llvm.smax.i32(i32 %sub, i32 -1)
%a.b.i = add nsw i32 %5, 1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.b.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #5
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
for.body: ; preds = %for.body.preheader, %for.body
%i.016 = phi i32 [ %inc, %for.body ], [ 1, %for.body.preheader ]
%right.015 = phi i32 [ %a.b.i12, %for.body ], [ %2, %for.body.preheader ]
%left.014 = phi i32 [ %a.b.i11, %for.body ], [ %1, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %R)
%6 = load i32, ptr %L, align 4
%7 = load i32, ptr %R, align 4
%a.b.i11 = call i32 @llvm.smax.i32(i32 %left.014, i32 %6)
%a.b.i12 = call i32 @llvm.smin.i32(i32 %right.015, i32 %7)
%inc = add nuw nsw i32 %i.016, 1
%8 = load i32, ptr %M, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !9
}
; 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 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: 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 = { 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 = { 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 = { 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LLINF 1<<63-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007
#define NUM 100001
int cmp(const void *x,const void *y){
return *(int*)x-*(int*)y;
}
void swap(int* x,int* y){
int tmp=*x;*x=*y;*y=tmp;
}
int main() {
int i,N,M,min=1,ans=0;
scanf("%d%d",&N,&M);
int max=N,a,b;
for(i=0;i<M;i++){
scanf("%d%d",&a,&b);
if(a>min)min=a;
if(b<max)max=b;
}
ans=max-min+1;
if(ans<0)ans=0;
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277621/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277621/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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; 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 #1 {
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) #2
; 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 uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
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) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #6
%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 !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6
%1 = load i32, ptr %M, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %1, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%max.018 = phi i32 [ %max.1, %for.body ], [ %0, %entry ]
%min.017 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%i.016 = phi i32 [ %inc, %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
%spec.select = call i32 @llvm.smax.i32(i32 %2, i32 %min.017)
%3 = load i32, ptr %b, align 4, !tbaa !5
%max.1 = call i32 @llvm.smin.i32(i32 %3, i32 %max.018)
%inc = add nuw nsw i32 %i.016, 1
%4 = load i32, ptr %M, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%min.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select, %for.body ]
%max.0.lcssa = phi i32 [ %0, %entry ], [ %max.1, %for.body ]
%sub = sub nsw i32 %max.0.lcssa, %min.0.lcssa
%5 = call i32 @llvm.smax.i32(i32 %sub, i32 -1)
%spec.store.select = add nsw i32 %5, 1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.store.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6
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 #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; 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 i32 @llvm.smin.i32(i32, i32) #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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define max(a, b) (((a) > (b)) ? (a) : (b))
int
main(void)
{
int N;
int M;
scanf("%d %d", &N, &M);
int L;
int R;
int min_R = N;
int max_L = 1;
for (int i = 0; i < M; i++) {
scanf("%d %d\n", &L, &R);
if (max_L < L)
max_L = L;
if (R < min_R)
min_R = R;
}
printf("%d", max(0, min_R - max_L + 1));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277665/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277665/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 [7 x i8] c"%d %d\0A\00", align 1
@.str.2 = 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
%M = alloca i32, align 4
%L = alloca i32, align 4
%R = 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 4, ptr nonnull %L) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #4
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = load i32, ptr %M, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %1, 0
br i1 %cmp16, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%min_R.0.lcssa = phi i32 [ %0, %entry ], [ %min_R.1, %for.body ]
%max_L.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select, %for.body ]
%sub = sub nsw i32 %min_R.0.lcssa, %max_L.0.lcssa
%2 = call i32 @llvm.smax.i32(i32 %sub, i32 -1)
%cond = add nsw i32 %2, 1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #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.body: ; preds = %entry, %for.body
%i.019 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%max_L.018 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%min_R.017 = phi i32 [ %min_R.1, %for.body ], [ %0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %L, ptr noundef nonnull %R)
%3 = load i32, ptr %L, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %max_L.018, i32 %3)
%4 = load i32, ptr %R, align 4, !tbaa !5
%min_R.1 = call i32 @llvm.smin.i32(i32 %4, i32 %min_R.017)
%inc = add nuw nsw i32 %i.019, 1
%5 = load i32, ptr %M, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %5
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
typedef int32_t i32;
void run (void) {
i32 n;
scanf ("%" SCNi32, &n);
i32 *x = (i32 *) calloc (n + 1, sizeof (i32));
for (i32 i = 1; i <= n; ++i) {
scanf ("%" SCNi32, x + i);
}
x[0] = n * n + 1;
i32 *ans = (i32 *) calloc (n * n + 1, sizeof (i32));
for (i32 i = 1; i <= n; ++i) {
ans[x[i]] = i;
}
uint8_t *used = (uint8_t *) calloc (n + 1, sizeof (uint8_t));
for (i32 i = 0; i < n; ++i) {
i32 min = 0;
for (i32 j = 1; j <= n; ++j) {
if (!used[j] && x[min] > x[j]) min = j;
}
used[min] = 1;
i32 k = min - 1;
for (i32 j = 1; j < x[min] && k > 0; ++j) {
if (ans[j] > 0) continue;
ans[j] = min;
k--;
}
if (k > 0) {
puts ("No");
return;
}
}
memset (used, 0, sizeof (uint8_t) * (n + 1));
x[0] = 0;
for (i32 i = 0; i < n; ++i) {
i32 max = 0;
for (i32 j = 1; j <= n; ++j) {
if (!used[j] && x[max] < x[j]) max = j;
}
used[max] = 1;
i32 k = n - max;
for (i32 j = n * n; j > x[max] && k > 0; --j) {
if (ans[j] > 0) continue;
ans[j] = max;
k--;
}
if (k > 0) {
puts ("No");
return;
}
}
puts ("Yes");
for (i32 i = 1; i <= n * n; ++i) {
printf ("%" PRIi32, ans[i]);
putchar (" \n"[i < n * n ? 0 : 1]);
}
}
int main (void) {
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277708/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277708/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"%i\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
@.str.3 = private unnamed_addr constant [3 x i8] c" \0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() 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
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #6
%cmp.not247 = icmp slt i32 %0, 1
br i1 %cmp.not247, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %6, %for.body ]
%mul = mul i32 %1, %1
%add4 = add nuw nsw i32 %mul, 1
store i32 %add4, ptr %call1, align 4, !tbaa !5
%conv7 = zext i32 %add4 to i64
%call8 = call noalias ptr @calloc(i64 noundef %conv7, i64 noundef 4) #6
%cmp11.not249 = icmp slt i32 %1, 1
br i1 %cmp11.not249, label %for.end155.sink.split, label %for.body14.preheader
for.body14.preheader: ; preds = %for.cond.cleanup
%2 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%4 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %3, 3
%5 = icmp ult i64 %4, 3
br i1 %5, label %for.cond.cleanup13.unr-lcssa, label %for.body14.preheader.new
for.body14.preheader.new: ; preds = %for.body14.preheader
%unroll_iter = and i64 %3, -4
br label %for.body14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup13.unr-lcssa: ; preds = %for.body14, %for.body14.preheader
%indvars.iv280.unr = phi i64 [ 1, %for.body14.preheader ], [ %indvars.iv.next281.3, %for.body14 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup13, label %for.body14.epil
for.body14.epil: ; preds = %for.cond.cleanup13.unr-lcssa, %for.body14.epil
%indvars.iv280.epil = phi i64 [ %indvars.iv.next281.epil, %for.body14.epil ], [ %indvars.iv280.unr, %for.cond.cleanup13.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body14.epil ], [ 0, %for.cond.cleanup13.unr-lcssa ]
%arrayidx15.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv280.epil
%8 = load i32, ptr %arrayidx15.epil, align 4, !tbaa !5
%idxprom16.epil = sext i32 %8 to i64
%arrayidx17.epil = getelementptr inbounds i32, ptr %call8, i64 %idxprom16.epil
%9 = trunc i64 %indvars.iv280.epil to i32
store i32 %9, ptr %arrayidx17.epil, align 4, !tbaa !5
%indvars.iv.next281.epil = add nuw nsw i64 %indvars.iv280.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.cond.cleanup13, label %for.body14.epil, !llvm.loop !11
for.cond.cleanup13: ; preds = %for.body14.epil, %for.cond.cleanup13.unr-lcssa
%conv22 = sext i32 %2 to i64
%call23 = call noalias ptr @calloc(i64 noundef %conv22, i64 noundef 1) #6
%cmp26.not260 = icmp sgt i32 %1, 0
br i1 %cmp26.not260, label %for.cond30.preheader.lr.ph, label %for.end155.sink.split
for.cond30.preheader.lr.ph: ; preds = %for.cond.cleanup13
%xtraiter326 = and i64 %3, 1
%10 = icmp eq i64 %4, 0
%unroll_iter330 = and i64 %3, -2
%lcmp.mod328.not = icmp eq i64 %xtraiter326, 0
br label %for.body34.preheader
for.body14: ; preds = %for.body14, %for.body14.preheader.new
%indvars.iv280 = phi i64 [ 1, %for.body14.preheader.new ], [ %indvars.iv.next281.3, %for.body14 ]
%niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.3, %for.body14 ]
%arrayidx15 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv280
%11 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%idxprom16 = sext i32 %11 to i64
%arrayidx17 = getelementptr inbounds i32, ptr %call8, i64 %idxprom16
%12 = trunc i64 %indvars.iv280 to i32
store i32 %12, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv.next281 = add nuw nsw i64 %indvars.iv280, 1
%arrayidx15.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next281
%13 = load i32, ptr %arrayidx15.1, align 4, !tbaa !5
%idxprom16.1 = sext i32 %13 to i64
%arrayidx17.1 = getelementptr inbounds i32, ptr %call8, i64 %idxprom16.1
%14 = trunc i64 %indvars.iv.next281 to i32
store i32 %14, ptr %arrayidx17.1, align 4, !tbaa !5
%indvars.iv.next281.1 = add nuw nsw i64 %indvars.iv280, 2
%arrayidx15.2 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next281.1
%15 = load i32, ptr %arrayidx15.2, align 4, !tbaa !5
%idxprom16.2 = sext i32 %15 to i64
%arrayidx17.2 = getelementptr inbounds i32, ptr %call8, i64 %idxprom16.2
%16 = trunc i64 %indvars.iv.next281.1 to i32
store i32 %16, ptr %arrayidx17.2, align 4, !tbaa !5
%indvars.iv.next281.2 = add nuw nsw i64 %indvars.iv280, 3
%arrayidx15.3 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next281.2
%17 = load i32, ptr %arrayidx15.3, align 4, !tbaa !5
%idxprom16.3 = sext i32 %17 to i64
%arrayidx17.3 = getelementptr inbounds i32, ptr %call8, i64 %idxprom16.3
%18 = trunc i64 %indvars.iv.next281.2 to i32
store i32 %18, ptr %arrayidx17.3, align 4, !tbaa !5
%indvars.iv.next281.3 = add nuw nsw i64 %indvars.iv280, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup13.unr-lcssa, label %for.body14, !llvm.loop !13
for.cond25: ; preds = %for.cond.cleanup56
%inc76 = add nuw nsw i32 %i24.0261, 1
%exitcond291.not = icmp eq i32 %inc76, %1
br i1 %exitcond291.not, label %for.end79, label %for.body34.preheader, !llvm.loop !14
for.body34.preheader: ; preds = %for.cond25, %for.cond30.preheader.lr.ph
%i24.0261 = phi i32 [ 0, %for.cond30.preheader.lr.ph ], [ %inc76, %for.cond25 ]
br i1 %10, label %for.cond.cleanup33.unr-lcssa, label %for.body34
for.cond.cleanup33.unr-lcssa: ; preds = %for.inc43.1, %for.body34.preheader
%min.1.lcssa.ph = phi i32 [ undef, %for.body34.preheader ], [ %min.1.1, %for.inc43.1 ]
%indvars.iv283.unr = phi i64 [ 1, %for.body34.preheader ], [ %indvars.iv.next284.1, %for.inc43.1 ]
%min.0252.unr = phi i32 [ 0, %for.body34.preheader ], [ %min.1.1, %for.inc43.1 ]
br i1 %lcmp.mod328.not, label %for.cond.cleanup33, label %for.body34.epil
for.body34.epil: ; preds = %for.cond.cleanup33.unr-lcssa
%arrayidx36.epil = getelementptr inbounds i8, ptr %call23, i64 %indvars.iv283.unr
%19 = load i8, ptr %arrayidx36.epil, align 1, !tbaa !15
%tobool.not.epil = icmp eq i8 %19, 0
br i1 %tobool.not.epil, label %land.lhs.true.epil, label %for.cond.cleanup33
land.lhs.true.epil: ; preds = %for.body34.epil
%idxprom37.epil = sext i32 %min.0252.unr to i64
%arrayidx38.epil = getelementptr inbounds i32, ptr %call1, i64 %idxprom37.epil
%20 = load i32, ptr %arrayidx38.epil, align 4, !tbaa !5
%arrayidx40.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv283.unr
%21 = load i32, ptr %arrayidx40.epil, align 4, !tbaa !5
%cmp41.epil = icmp sgt i32 %20, %21
%22 = trunc i64 %indvars.iv283.unr to i32
%spec.select.epil = select i1 %cmp41.epil, i32 %22, i32 %min.0252.unr
br label %for.cond.cleanup33
for.cond.cleanup33: ; preds = %for.body34.epil, %land.lhs.true.epil, %for.cond.cleanup33.unr-lcssa
%min.1.lcssa = phi i32 [ %min.1.lcssa.ph, %for.cond.cleanup33.unr-lcssa ], [ %min.0252.unr, %for.body34.epil ], [ %spec.select.epil, %land.lhs.true.epil ]
%idxprom46 = sext i32 %min.1.lcssa to i64
%arrayidx47 = getelementptr inbounds i8, ptr %call23, i64 %idxprom46
store i8 1, ptr %arrayidx47, align 1, !tbaa !15
%arrayidx51 = getelementptr inbounds i32, ptr %call1, i64 %idxprom46
%23 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%cmp52255 = icmp sgt i32 %23, 1
%cmp54256 = icmp sgt i32 %min.1.lcssa, 1
%24 = and i1 %cmp52255, %cmp54256
br i1 %24, label %for.body57.preheader, label %for.cond.cleanup56
for.body57.preheader: ; preds = %for.cond.cleanup33
%sub = add nsw i32 %min.1.lcssa, -1
%25 = zext i32 %23 to i64
br label %for.body57
for.body34: ; preds = %for.body34.preheader, %for.inc43.1
%indvars.iv283 = phi i64 [ %indvars.iv.next284.1, %for.inc43.1 ], [ 1, %for.body34.preheader ]
%min.0252 = phi i32 [ %min.1.1, %for.inc43.1 ], [ 0, %for.body34.preheader ]
%niter331 = phi i64 [ %niter331.next.1, %for.inc43.1 ], [ 0, %for.body34.preheader ]
%arrayidx36 = getelementptr inbounds i8, ptr %call23, i64 %indvars.iv283
%26 = load i8, ptr %arrayidx36, align 1, !tbaa !15
%tobool.not = icmp eq i8 %26, 0
br i1 %tobool.not, label %land.lhs.true, label %for.inc43
land.lhs.true: ; preds = %for.body34
%idxprom37 = sext i32 %min.0252 to i64
%arrayidx38 = getelementptr inbounds i32, ptr %call1, i64 %idxprom37
%27 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%arrayidx40 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv283
%28 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %27, %28
%29 = trunc i64 %indvars.iv283 to i32
%spec.select = select i1 %cmp41, i32 %29, i32 %min.0252
br label %for.inc43
for.inc43: ; preds = %land.lhs.true, %for.body34
%min.1 = phi i32 [ %min.0252, %for.body34 ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next284 = add nuw nsw i64 %indvars.iv283, 1
%arrayidx36.1 = getelementptr inbounds i8, ptr %call23, i64 %indvars.iv.next284
%30 = load i8, ptr %arrayidx36.1, align 1, !tbaa !15
%tobool.not.1 = icmp eq i8 %30, 0
br i1 %tobool.not.1, label %land.lhs.true.1, label %for.inc43.1
land.lhs.true.1: ; preds = %for.inc43
%idxprom37.1 = sext i32 %min.1 to i64
%arrayidx38.1 = getelementptr inbounds i32, ptr %call1, i64 %idxprom37.1
%31 = load i32, ptr %arrayidx38.1, align 4, !tbaa !5
%arrayidx40.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next284
%32 = load i32, ptr %arrayidx40.1, align 4, !tbaa !5
%cmp41.1 = icmp sgt i32 %31, %32
%33 = trunc i64 %indvars.iv.next284 to i32
%spec.select.1 = select i1 %cmp41.1, i32 %33, i32 %min.1
br label %for.inc43.1
for.inc43.1: ; preds = %land.lhs.true.1, %for.inc43
%min.1.1 = phi i32 [ %min.1, %for.inc43 ], [ %spec.select.1, %land.lhs.true.1 ]
%indvars.iv.next284.1 = add nuw nsw i64 %indvars.iv283, 2
%niter331.next.1 = add i64 %niter331, 2
%niter331.ncmp.1 = icmp eq i64 %niter331.next.1, %unroll_iter330
br i1 %niter331.ncmp.1, label %for.cond.cleanup33.unr-lcssa, label %for.body34, !llvm.loop !16
for.cond.cleanup56: ; preds = %for.inc66, %for.cond.cleanup33
%cmp54.lcssa = phi i1 [ %cmp54256, %for.cond.cleanup33 ], [ %cmp54, %for.inc66 ]
br i1 %cmp54.lcssa, label %cleanup178.sink.split, label %for.cond25
for.body57: ; preds = %for.body57.preheader, %for.inc66
%indvars.iv288 = phi i64 [ 1, %for.body57.preheader ], [ %indvars.iv.next289, %for.inc66 ]
%k.0257 = phi i32 [ %sub, %for.body57.preheader ], [ %k.1, %for.inc66 ]
%arrayidx59 = getelementptr inbounds i32, ptr %call8, i64 %indvars.iv288
%34 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %34, 0
br i1 %cmp60, label %for.inc66, label %if.end63
if.end63: ; preds = %for.body57
store i32 %min.1.lcssa, ptr %arrayidx59, align 4, !tbaa !5
%dec = add nsw i32 %k.0257, -1
br label %for.inc66
for.inc66: ; preds = %for.body57, %if.end63
%k.1 = phi i32 [ %k.0257, %for.body57 ], [ %dec, %if.end63 ]
%indvars.iv.next289 = add nuw nsw i64 %indvars.iv288, 1
%cmp52 = icmp ult i64 %indvars.iv.next289, %25
%cmp54 = icmp sgt i32 %k.1, 0
%35 = select i1 %cmp52, i1 %cmp54, i1 false
br i1 %35, label %for.body57, label %for.cond.cleanup56, !llvm.loop !17
for.end79: ; preds = %for.cond25
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %call23, i8 0, i64 %conv22, i1 false)
store i32 0, ptr %call1, align 4, !tbaa !5
br i1 %cmp26.not260, label %for.cond91.preheader.lr.ph, label %for.end155
for.cond91.preheader.lr.ph: ; preds = %for.end79
%36 = sext i32 %mul to i64
%xtraiter332 = and i64 %3, 1
%37 = icmp eq i64 %4, 0
%unroll_iter336 = and i64 %3, -2
%lcmp.mod334.not = icmp eq i64 %xtraiter332, 0
br label %for.body95.preheader
for.cond85: ; preds = %for.cond.cleanup127
%inc152 = add nuw nsw i32 %i84.0272, 1
%exitcond300.not = icmp eq i32 %inc152, %1
br i1 %exitcond300.not, label %for.end155, label %for.body95.preheader, !llvm.loop !18
for.body95.preheader: ; preds = %for.cond85, %for.cond91.preheader.lr.ph
%i84.0272 = phi i32 [ 0, %for.cond91.preheader.lr.ph ], [ %inc152, %for.cond85 ]
br i1 %37, label %for.cond.cleanup94.unr-lcssa, label %for.body95
for.cond.cleanup94.unr-lcssa: ; preds = %for.inc108.1, %for.body95.preheader
%max.1.lcssa.ph = phi i32 [ undef, %for.body95.preheader ], [ %max.1.1, %for.inc108.1 ]
%indvars.iv292.unr = phi i64 [ 1, %for.body95.preheader ], [ %indvars.iv.next293.1, %for.inc108.1 ]
%max.0263.unr = phi i32 [ 0, %for.body95.preheader ], [ %max.1.1, %for.inc108.1 ]
br i1 %lcmp.mod334.not, label %for.cond.cleanup94, label %for.body95.epil
for.body95.epil: ; preds = %for.cond.cleanup94.unr-lcssa
%arrayidx97.epil = getelementptr inbounds i8, ptr %call23, i64 %indvars.iv292.unr
%38 = load i8, ptr %arrayidx97.epil, align 1, !tbaa !15
%tobool98.not.epil = icmp eq i8 %38, 0
br i1 %tobool98.not.epil, label %land.lhs.true99.epil, label %for.cond.cleanup94
land.lhs.true99.epil: ; preds = %for.body95.epil
%idxprom100.epil = sext i32 %max.0263.unr to i64
%arrayidx101.epil = getelementptr inbounds i32, ptr %call1, i64 %idxprom100.epil
%39 = load i32, ptr %arrayidx101.epil, align 4, !tbaa !5
%arrayidx103.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv292.unr
%40 = load i32, ptr %arrayidx103.epil, align 4, !tbaa !5
%cmp104.epil = icmp slt i32 %39, %40
%41 = trunc i64 %indvars.iv292.unr to i32
%spec.select246.epil = select i1 %cmp104.epil, i32 %41, i32 %max.0263.unr
br label %for.cond.cleanup94
for.cond.cleanup94: ; preds = %for.body95.epil, %land.lhs.true99.epil, %for.cond.cleanup94.unr-lcssa
%max.1.lcssa = phi i32 [ %max.1.lcssa.ph, %for.cond.cleanup94.unr-lcssa ], [ %max.0263.unr, %for.body95.epil ], [ %spec.select246.epil, %land.lhs.true99.epil ]
%idxprom112 = sext i32 %max.1.lcssa to i64
%arrayidx113 = getelementptr inbounds i8, ptr %call23, i64 %idxprom112
store i8 1, ptr %arrayidx113, align 1, !tbaa !15
%sub115 = sub nsw i32 %1, %max.1.lcssa
%arrayidx120 = getelementptr inbounds i32, ptr %call1, i64 %idxprom112
%42 = load i32, ptr %arrayidx120, align 4, !tbaa !5
%cmp121266 = icmp sgt i32 %mul, %42
%cmp124267 = icmp sgt i32 %sub115, 0
%43 = select i1 %cmp121266, i1 %cmp124267, i1 false
br i1 %43, label %for.body128.preheader, label %for.cond.cleanup127
for.body128.preheader: ; preds = %for.cond.cleanup94
%44 = sext i32 %42 to i64
br label %for.body128
for.body95: ; preds = %for.body95.preheader, %for.inc108.1
%indvars.iv292 = phi i64 [ %indvars.iv.next293.1, %for.inc108.1 ], [ 1, %for.body95.preheader ]
%max.0263 = phi i32 [ %max.1.1, %for.inc108.1 ], [ 0, %for.body95.preheader ]
%niter337 = phi i64 [ %niter337.next.1, %for.inc108.1 ], [ 0, %for.body95.preheader ]
%arrayidx97 = getelementptr inbounds i8, ptr %call23, i64 %indvars.iv292
%45 = load i8, ptr %arrayidx97, align 1, !tbaa !15
%tobool98.not = icmp eq i8 %45, 0
br i1 %tobool98.not, label %land.lhs.true99, label %for.inc108
land.lhs.true99: ; preds = %for.body95
%idxprom100 = sext i32 %max.0263 to i64
%arrayidx101 = getelementptr inbounds i32, ptr %call1, i64 %idxprom100
%46 = load i32, ptr %arrayidx101, align 4, !tbaa !5
%arrayidx103 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv292
%47 = load i32, ptr %arrayidx103, align 4, !tbaa !5
%cmp104 = icmp slt i32 %46, %47
%48 = trunc i64 %indvars.iv292 to i32
%spec.select246 = select i1 %cmp104, i32 %48, i32 %max.0263
br label %for.inc108
for.inc108: ; preds = %land.lhs.true99, %for.body95
%max.1 = phi i32 [ %max.0263, %for.body95 ], [ %spec.select246, %land.lhs.true99 ]
%indvars.iv.next293 = add nuw nsw i64 %indvars.iv292, 1
%arrayidx97.1 = getelementptr inbounds i8, ptr %call23, i64 %indvars.iv.next293
%49 = load i8, ptr %arrayidx97.1, align 1, !tbaa !15
%tobool98.not.1 = icmp eq i8 %49, 0
br i1 %tobool98.not.1, label %land.lhs.true99.1, label %for.inc108.1
land.lhs.true99.1: ; preds = %for.inc108
%idxprom100.1 = sext i32 %max.1 to i64
%arrayidx101.1 = getelementptr inbounds i32, ptr %call1, i64 %idxprom100.1
%50 = load i32, ptr %arrayidx101.1, align 4, !tbaa !5
%arrayidx103.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next293
%51 = load i32, ptr %arrayidx103.1, align 4, !tbaa !5
%cmp104.1 = icmp slt i32 %50, %51
%52 = trunc i64 %indvars.iv.next293 to i32
%spec.select246.1 = select i1 %cmp104.1, i32 %52, i32 %max.1
br label %for.inc108.1
for.inc108.1: ; preds = %land.lhs.true99.1, %for.inc108
%max.1.1 = phi i32 [ %max.1, %for.inc108 ], [ %spec.select246.1, %land.lhs.true99.1 ]
%indvars.iv.next293.1 = add nuw nsw i64 %indvars.iv292, 2
%niter337.next.1 = add i64 %niter337, 2
%niter337.ncmp.1 = icmp eq i64 %niter337.next.1, %unroll_iter336
br i1 %niter337.ncmp.1, label %for.cond.cleanup94.unr-lcssa, label %for.body95, !llvm.loop !19
for.cond.cleanup127: ; preds = %for.inc138, %for.cond.cleanup94
%cmp124.lcssa = phi i1 [ %cmp124267, %for.cond.cleanup94 ], [ %cmp124, %for.inc138 ]
br i1 %cmp124.lcssa, label %cleanup178.sink.split, label %for.cond85
for.body128: ; preds = %for.body128.preheader, %for.inc138
%indvars.iv297 = phi i64 [ %36, %for.body128.preheader ], [ %indvars.iv.next298, %for.inc138 ]
%k114.0268 = phi i32 [ %sub115, %for.body128.preheader ], [ %k114.1, %for.inc138 ]
%arrayidx130 = getelementptr inbounds i32, ptr %call8, i64 %indvars.iv297
%53 = load i32, ptr %arrayidx130, align 4, !tbaa !5
%cmp131 = icmp sgt i32 %53, 0
br i1 %cmp131, label %for.inc138, label %if.end134
if.end134: ; preds = %for.body128
store i32 %max.1.lcssa, ptr %arrayidx130, align 4, !tbaa !5
%dec137 = add nsw i32 %k114.0268, -1
br label %for.inc138
for.inc138: ; preds = %for.body128, %if.end134
%k114.1 = phi i32 [ %k114.0268, %for.body128 ], [ %dec137, %if.end134 ]
%indvars.iv.next298 = add nsw i64 %indvars.iv297, -1
%cmp121 = icmp sgt i64 %indvars.iv.next298, %44
%cmp124 = icmp sgt i32 %k114.1, 0
%54 = select i1 %cmp121, i1 %cmp124, i1 false
br i1 %54, label %for.body128, label %for.cond.cleanup127, !llvm.loop !20
for.end155.sink.split: ; preds = %for.cond.cleanup13, %for.cond.cleanup
store i32 0, ptr %call1, align 4, !tbaa !5
br label %for.end155
for.end155: ; preds = %for.cond85, %for.end155.sink.split, %for.end79
%call156 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
%55 = load i32, ptr %n, align 4, !tbaa !5
%cmp160.not274 = icmp eq i32 %55, 0
br i1 %cmp160.not274, label %cleanup178, label %for.body163
for.body163: ; preds = %for.end155, %for.body163
%indvars.iv301 = phi i64 [ %indvars.iv.next302, %for.body163 ], [ 1, %for.end155 ]
%arrayidx165 = getelementptr inbounds i32, ptr %call8, i64 %indvars.iv301
%56 = load i32, ptr %arrayidx165, align 4, !tbaa !5
%call166 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %56)
%57 = load i32, ptr %n, align 4, !tbaa !5
%mul167 = mul nsw i32 %57, %57
%58 = zext i32 %mul167 to i64
%cmp168 = icmp uge i64 %indvars.iv301, %58
%idxprom170 = zext i1 %cmp168 to i64
%arrayidx171 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %idxprom170
%59 = load i8, ptr %arrayidx171, align 1, !tbaa !15
%conv172 = sext i8 %59 to i32
%60 = load ptr, ptr @stdout, align 8, !tbaa !21
%call.i = call i32 @putc(i32 noundef %conv172, ptr noundef %60)
%indvars.iv.next302 = add nuw nsw i64 %indvars.iv301, 1
%61 = load i32, ptr %n, align 4, !tbaa !5
%mul159 = mul nsw i32 %61, %61
%62 = zext i32 %mul159 to i64
%cmp160.not.not = icmp ult i64 %indvars.iv301, %62
br i1 %cmp160.not.not, label %for.body163, label %cleanup178, !llvm.loop !23
cleanup178.sink.split: ; preds = %for.cond.cleanup56, %for.cond.cleanup127
%call72 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup178
cleanup178: ; preds = %for.body163, %cleanup178.sink.split, %for.end155
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 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 #2
; 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: 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:
tail call void @run()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) 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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }
!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}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = !{!22, !22, i64 0}
!22 = !{!"any pointer", !7, i64 0}
!23 = distinct !{!23, !10}
|
#include <stdio.h>
#include <stdlib.h>
int min(int a, int b){
return a <= b ? a : b;
}
int main(){
int N, i;
scanf("%d", &N);
char *S = (char *)malloc(sizeof(char) * (N + 2));
scanf("%s", &S[1]);
int *A = (int *)malloc(sizeof(int) * (N + 1));
int *B = (int *)malloc(sizeof(int) * (N + 1));
A[0] = 0;
B[0] = 0;
for(i = 1; i <= N; i++){
A[i] = A[i - 1];
B[i] = B[i - 1];
if(S[i] == '#'){
A[i]++;
}
else{
B[i]++;
}
}
int ans = N;
for(i = 0; i <= N; i++){
ans = min(ans, A[i] + B[N] - B[i]);
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277766/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277766/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
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; 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:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
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
%add = add nsw i32 %0, 2
%conv = sext i32 %add to i64
%call1 = call noalias ptr @malloc(i64 noundef %conv) #7
%arrayidx = getelementptr inbounds i8, ptr %call1, i64 1
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %N, align 4, !tbaa !5
%add3 = add i32 %1, 1
%conv4 = sext i32 %add3 to i64
%mul5 = shl nsw i64 %conv4, 2
%call6 = call noalias ptr @malloc(i64 noundef %mul5) #7
%call10 = call noalias ptr @malloc(i64 noundef %mul5) #7
store i32 0, ptr %call6, align 4, !tbaa !5
store i32 0, ptr %call10, align 4, !tbaa !5
%cmp.not74 = icmp slt i32 %1, 1
br i1 %cmp.not74, label %for.cond33.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %add3 to i64
br label %for.body
for.cond33.preheader: ; preds = %for.inc, %entry
%cmp34.not76 = icmp slt i32 %1, 0
br i1 %cmp34.not76, label %for.end48, label %for.body36.lr.ph
for.body36.lr.ph: ; preds = %for.cond33.preheader
%idxprom39 = zext i32 %1 to i64
%arrayidx40 = getelementptr inbounds i32, ptr %call10, i64 %idxprom39
%2 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%wide.trip.count84 = zext i32 %add3 to i64
%min.iters.check = icmp ult i32 %add3, 8
br i1 %min.iters.check, label %for.body36.preheader, label %vector.ph
vector.ph: ; preds = %for.body36.lr.ph
%n.vec = and i64 %wide.trip.count84, 4294967288
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %1, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %2, 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 i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %11, %vector.body ]
%vec.phi86 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %12, %vector.body ]
%3 = getelementptr inbounds i32, ptr %call6, i64 %index
%wide.load = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load87 = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = add nsw <4 x i32> %broadcast.splat, %wide.load
%6 = add nsw <4 x i32> %broadcast.splat, %wide.load87
%7 = getelementptr inbounds i32, ptr %call10, i64 %index
%wide.load88 = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load89 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = sub <4 x i32> %5, %wide.load88
%10 = sub <4 x i32> %6, %wide.load89
%11 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %9)
%12 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi86, <4 x i32> %10)
%index.next = add nuw i64 %index, 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
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %11, <4 x i32> %12)
%14 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count84
br i1 %cmp.n, label %for.end48, label %for.body36.preheader
for.body36.preheader: ; preds = %for.body36.lr.ph, %middle.block
%indvars.iv81.ph = phi i64 [ 0, %for.body36.lr.ph ], [ %n.vec, %middle.block ]
%ans.078.ph = phi i32 [ %1, %for.body36.lr.ph ], [ %14, %middle.block ]
br label %for.body36
for.body: ; preds = %for.body.preheader, %for.inc
%15 = phi i32 [ 0, %for.body.preheader ], [ %18, %for.inc ]
%16 = phi i32 [ 0, %for.body.preheader ], [ %19, %for.inc ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx16 = getelementptr inbounds i32, ptr %call6, i64 %indvars.iv
store i32 %16, ptr %arrayidx16, align 4, !tbaa !5
%arrayidx21 = getelementptr inbounds i32, ptr %call10, i64 %indvars.iv
store i32 %15, ptr %arrayidx21, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds i8, ptr %call1, i64 %indvars.iv
%17 = load i8, ptr %arrayidx23, align 1, !tbaa !13
%cmp25 = icmp eq i8 %17, 35
br i1 %cmp25, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %16, 1
store i32 %inc, ptr %arrayidx16, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%inc31 = add nsw i32 %15, 1
store i32 %inc31, ptr %arrayidx21, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%18 = phi i32 [ %15, %if.then ], [ %inc31, %if.else ]
%19 = phi i32 [ %inc, %if.then ], [ %16, %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.cond33.preheader, label %for.body, !llvm.loop !14
for.body36: ; preds = %for.body36.preheader, %for.body36
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body36 ], [ %indvars.iv81.ph, %for.body36.preheader ]
%ans.078 = phi i32 [ %cond.i, %for.body36 ], [ %ans.078.ph, %for.body36.preheader ]
%arrayidx38 = getelementptr inbounds i32, ptr %call6, i64 %indvars.iv81
%20 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%add41 = add nsw i32 %2, %20
%arrayidx43 = getelementptr inbounds i32, ptr %call10, i64 %indvars.iv81
%21 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%sub44 = sub i32 %add41, %21
%cond.i = call i32 @llvm.smin.i32(i32 %ans.078, i32 %sub44)
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end48, label %for.body36, !llvm.loop !15
for.end48: ; preds = %for.body36, %middle.block, %for.cond33.preheader
%ans.0.lcssa = phi i32 [ %1, %for.cond33.preheader ], [ %14, %middle.block ], [ %cond.i, %for.body36 ]
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
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 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; 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 <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #5
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 = { 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 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12, !11}
|
#include<stdio.h>
int isprime(int n){
int i;
for(i = 2; i < n; i ++ ){
if(n % i == 0)return 0;
}
return 1;
}
int main(void){
const int NUM = 10000;
int i,n,prime[NUM],p1,q1;
for(i = 2; i < NUM; i ++ ){
prime[i] = isprime(i);
}
while(1){
scanf("%d",&n);
if(n == 0)break;
for(i = n; i >= 2; i --){
if(prime[i] == 1 && prime[i - 2] == 1){
q1 = i;
p1 = i - 2;
printf("%d %d\n",p1,q1);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277809/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277809/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:
%cmp5 = icmp sgt i32 %n, 2
br i1 %cmp5, label %for.body, label %cleanup
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.06, 1
%exitcond.not = icmp eq i32 %inc, %n
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %entry, %for.cond
%i.06 = phi i32 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i32 %n, %i.06
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.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 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%0 = tail call ptr @llvm.stacksave.p0()
%vla27 = alloca [10000 x i32], align 16
br label %for.body
while.cond.preheader: ; preds = %isprime.exit
%call133 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !7
%cmp234 = icmp eq i32 %1, 0
br i1 %cmp234, label %while.end, label %for.cond3.preheader
for.body: ; preds = %entry, %isprime.exit
%indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %isprime.exit ]
%cmp5.i = icmp ugt i64 %indvars.iv, 2
br i1 %cmp5.i, label %for.body.i.preheader, label %isprime.exit
for.body.i.preheader: ; preds = %for.body
%2 = trunc i64 %indvars.iv to i32
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.06.i, 1
%3 = zext i32 %inc.i to i64
%exitcond.not.i = icmp eq i64 %indvars.iv, %3
br i1 %exitcond.not.i, label %isprime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.body.i.preheader, %for.cond.i
%i.06.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.body.i.preheader ]
%rem.i = urem i32 %2, %i.06.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %isprime.exit, label %for.cond.i
isprime.exit: ; preds = %for.cond.i, %for.body.i, %for.body
%retval.0.i = phi i32 [ 1, %for.body ], [ 0, %for.body.i ], [ 1, %for.cond.i ]
%arrayidx = getelementptr inbounds i32, ptr %vla27, i64 %indvars.iv
store i32 %retval.0.i, ptr %arrayidx, align 4, !tbaa !7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 10000
br i1 %exitcond.not, label %while.cond.preheader, label %for.body, !llvm.loop !11
for.cond3.preheader: ; preds = %while.cond.preheader, %for.end17
%4 = phi i32 [ %8, %for.end17 ], [ %1, %while.cond.preheader ]
%cmp431 = icmp sgt i32 %4, 1
br i1 %cmp431, label %for.body5.preheader, label %for.end17
for.body5.preheader: ; preds = %for.cond3.preheader
%5 = zext i32 %4 to i64
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.inc16
%indvars.iv37 = phi i64 [ %5, %for.body5.preheader ], [ %indvars.iv.next38, %for.inc16 ]
%arrayidx7 = getelementptr inbounds i32, ptr %vla27, i64 %indvars.iv37
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !7
%cmp8 = icmp eq i32 %6, 1
br i1 %cmp8, label %land.lhs.true, label %for.inc16
land.lhs.true: ; preds = %for.body5
%indvars39 = trunc i64 %indvars.iv37 to i32
%sub = add nsw i32 %indvars39, -2
%idxprom9 = zext i32 %sub to i64
%arrayidx10 = getelementptr inbounds i32, ptr %vla27, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !7
%cmp11 = icmp eq i32 %7, 1
br i1 %cmp11, label %if.then12, label %for.inc16
if.then12: ; preds = %land.lhs.true
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %indvars39)
br label %for.end17
for.inc16: ; preds = %for.body5, %land.lhs.true
%indvars.iv.next38 = add nsw i64 %indvars.iv37, -1
%cmp4 = icmp sgt i64 %indvars.iv37, 2
br i1 %cmp4, label %for.body5, label %for.end17, !llvm.loop !12
for.end17: ; preds = %for.inc16, %for.cond3.preheader, %if.then12
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%8 = load i32, ptr %n, align 4, !tbaa !7
%cmp2 = icmp eq i32 %8, 0
br i1 %cmp2, label %while.end, label %for.cond3.preheader
while.end: ; preds = %for.end17, %while.cond.preheader
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #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
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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.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}
|
#include <stdio.h>
int is_prime(int n)
{
int i;
if (n % 2 == 0){
return (0);
}
for (i = 3; i * i <= n; i += 2){
if (n % i == 0){
return (0);
}
}
return (1);
}
int main(void)
{
int n;
int i;
while (scanf("%d", &n) * n != 0){
i = n;
while (is_prime(i) != 1 || is_prime(i - 2) != 1){
i--;
}
printf("%d %d\n", i - 2, i);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_277852/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_277852/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 @is_prime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%0 = and i32 %n, 1
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp1.not11 = icmp slt i32 %n, 9
br i1 %cmp1.not11, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.012, 2
%mul = mul nsw i32 %add, %add
%cmp1.not = icmp sgt i32 %mul, %n
br i1 %cmp1.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.012 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem2 = srem i32 %n, %i.012
%cmp3 = icmp eq i32 %rem2, 0
br i1 %cmp3, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.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 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%mul38 = mul nsw i32 %0, %call37
%cmp.not39 = icmp eq i32 %mul38, 0
br i1 %cmp.not39, label %while.end9, label %while.cond1
while.cond1: ; preds = %entry, %while.cond1.backedge
%i.0 = phi i32 [ %i.0.be, %while.cond1.backedge ], [ %0, %entry ]
%1 = and i32 %i.0, 1
%cmp.i = icmp eq i32 %1, 0
br i1 %cmp.i, label %while.body6, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %while.cond1
%cmp1.not11.i = icmp slt i32 %i.0, 9
br i1 %cmp1.not11.i, label %for.cond.preheader.i15.thread, label %for.body.i
for.cond.preheader.i15.thread: ; preds = %for.cond.preheader.i
%sub46 = add nsw i32 %i.0, -2
br label %while.end
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.012.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp1.not.i = icmp sgt i32 %mul.i, %i.0
br i1 %cmp1.not.i, label %for.cond.preheader.i15, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.012.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem2.i = srem i32 %i.0, %i.012.i
%cmp3.i = icmp eq i32 %rem2.i, 0
br i1 %cmp3.i, label %while.body6, label %for.cond.i
for.cond.preheader.i15: ; preds = %for.cond.i
%sub = add nsw i32 %i.0, -2
%cmp1.not11.i16 = icmp slt i32 %i.0, 11
br i1 %cmp1.not11.i16, label %while.end, label %for.body.i17
for.cond.i21: ; preds = %for.body.i17
%add.i22 = add nuw nsw i32 %i.012.i18, 2
%mul.i23 = mul nsw i32 %add.i22, %add.i22
%cmp1.not.i24 = icmp sgt i32 %mul.i23, %sub
br i1 %cmp1.not.i24, label %while.end, label %for.body.i17, !llvm.loop !5
for.body.i17: ; preds = %for.cond.preheader.i15, %for.cond.i21
%i.012.i18 = phi i32 [ %add.i22, %for.cond.i21 ], [ 3, %for.cond.preheader.i15 ]
%rem2.i19 = srem i32 %sub, %i.012.i18
%cmp3.i20 = icmp eq i32 %rem2.i19, 0
br i1 %cmp3.i20, label %while.body6, label %for.cond.i21
while.body6: ; preds = %for.body.i, %for.body.i17, %while.cond1
%dec = add nsw i32 %i.0, -1
br label %while.cond1.backedge
while.cond1.backedge: ; preds = %while.body6, %while.end
%i.0.be = phi i32 [ %dec, %while.body6 ], [ %2, %while.end ]
br label %while.cond1, !llvm.loop !11
while.end: ; preds = %for.cond.i21, %for.cond.preheader.i15, %for.cond.preheader.i15.thread
%sub48 = phi i32 [ %sub46, %for.cond.preheader.i15.thread ], [ %sub, %for.cond.preheader.i15 ], [ %sub, %for.cond.i21 ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub48, i32 noundef %i.0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !7
%mul = mul nsw i32 %2, %call
%cmp.not = icmp eq i32 %mul, 0
br i1 %cmp.not, label %while.end9, label %while.cond1.backedge
while.end9: ; preds = %while.end, %entry
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(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"}
!11 = distinct !{!11, !6}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.