Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(){
int n;
int a,i;
double b;
scanf("%d",&n);
a=0;
for(i=1;i<=n;i++){
if (i%2!=0)
a=a+1;
}
b=a*1.0/n;
printf("%.10f",b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235061/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"%.10f\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
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader13, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %0, -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> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%vec.phi11 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%2 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%3 = add <4 x i32> %vec.phi, %1
%4 = add <4 x i32> %vec.phi11, %2
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%5 = icmp eq i32 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %4, %3
%6 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %0, %n.vec
br i1 %cmp.n, label %for.end.loopexit, label %for.body.preheader13
for.body.preheader13: ; preds = %for.body.preheader, %middle.block
%a.09.ph = phi i32 [ 0, %for.body.preheader ], [ %6, %middle.block ]
%i.08.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader13, %for.body
%a.09 = phi i32 [ %spec.select, %for.body ], [ %a.09.ph, %for.body.preheader13 ]
%i.08 = phi i32 [ %inc, %for.body ], [ %i.08.ph, %for.body.preheader13 ]
%rem = and i32 %i.08, 1
%spec.select = add i32 %a.09, %rem
%inc = add nuw i32 %i.08, 1
%exitcond.not = icmp eq i32 %i.08, %0
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !13
for.end.loopexit: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %6, %middle.block ], [ %spec.select, %for.body ]
%7 = sitofp i32 %spec.select.lcssa to double
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%a.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %7, %for.end.loopexit ]
%conv2 = sitofp i32 %0 to double
%div = fdiv double %a.0.lcssa, %conv2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div)
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, !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>
int main(){
int n;
scanf("%d",&n);
if(n==1) printf("1\n");
else if(n%2==0) printf("0.5\n");
else{
double all = n;
double odd = n/2+1;
printf("%.7f\n",odd/all);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235111/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235111/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 [6 x i8] c"%.7f\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"0.5\00", align 1
@str.4 = private unnamed_addr constant [2 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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts10 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end9
if.else: ; preds = %entry
%1 = and i32 %0, 1
%cmp2 = icmp eq i32 %1, 0
br i1 %cmp2, label %if.then3, label %if.else5
if.then3: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end9
if.else5: ; preds = %if.else
%conv = sitofp i32 %0 to double
%div = sdiv i32 %0, 2
%add = add nsw i32 %div, 1
%conv6 = sitofp i32 %add to double
%div7 = fdiv double %conv6, %conv
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %div7)
br label %if.end9
if.end9: ; preds = %if.then3, %if.else5, %if.then
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 @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(){
int a;
scanf("%d",&a);
float s;
s=(float)((a+1)/2)/a;
printf("%f",s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235155/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235155/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"%f\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
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%conv = sitofp i32 %div to float
%conv1 = sitofp i32 %0 to float
%div2 = fdiv float %conv, %conv1
%conv3 = fpext float %div2 to double
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv3)
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>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define MOD (ll)1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n, m) for (int i = (n), i < (m); i++)
ll gcd(ll a, ll b) {
if (a == 0 || b == 0) return a + b;
if (b > a) return gcd(b, a);
return gcd(b, a % b);
}
char pp[1000000] = {};
int
main(int argc, char *argv[])
{
int n;
scanf("%d", &n);
int k = 0;
for (int i = 1; i <= n; i++) if (i % 2 == 1) k++;
printf("%f\n", (float)k/(float)n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235199/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235199/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"
@pp = dso_local local_unnamed_addr global [1000000 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp15 = icmp eq i64 %a, 0
%cmp116 = icmp eq i64 %b, 0
%or.cond17 = or i1 %cmp15, %cmp116
br i1 %or.cond17, label %if.then, label %if.end
if.then: ; preds = %tailrecurse.backedge, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr19, %tailrecurse.backedge ]
%b.tr.lcssa = phi i64 [ %b, %entry ], [ %b.tr.be, %tailrecurse.backedge ]
%add = add nsw i64 %b.tr.lcssa, %a.tr.lcssa
ret i64 %add
if.end: ; preds = %entry, %tailrecurse.backedge
%b.tr19 = phi i64 [ %b.tr.be, %tailrecurse.backedge ], [ %b, %entry ]
%a.tr18 = phi i64 [ %b.tr19, %tailrecurse.backedge ], [ %a, %entry ]
%cmp2 = icmp sgt i64 %b.tr19, %a.tr18
br i1 %cmp2, label %tailrecurse.backedge, label %if.end4
if.end4: ; preds = %if.end
%rem = srem i64 %a.tr18, %b.tr19
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.end4, %if.end
%b.tr.be = phi i64 [ %rem, %if.end4 ], [ %a.tr18, %if.end ]
%cmp1 = icmp eq i64 %b.tr.be, 0
br i1 %cmp1, label %if.then, label %if.end
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
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
%cmp.not9 = icmp slt i32 %0, 1
br i1 %cmp.not9, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %0, -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.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%vec.phi14 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ]
%1 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%2 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%3 = add <4 x i32> %1, %vec.phi
%4 = add <4 x i32> %2, %vec.phi14
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%5 = icmp eq i32 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %4, %3
%6 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup.loopexit, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%i.011.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%k.010.ph = phi i32 [ 0, %for.body.preheader ], [ %6, %middle.block ]
br label %for.body
for.cond.cleanup.loopexit: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %6, %middle.block ], [ %spec.select, %for.body ]
%7 = sitofp i32 %spec.select.lcssa to float
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%k.0.lcssa = phi float [ 0.000000e+00, %entry ], [ %7, %for.cond.cleanup.loopexit ]
%conv3 = sitofp i32 %0 to float
%div = fdiv float %k.0.lcssa, %conv3
%conv4 = fpext float %div to double
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %for.body.preheader15, %for.body
%i.011 = phi i32 [ %inc2, %for.body ], [ %i.011.ph, %for.body.preheader15 ]
%k.010 = phi i32 [ %spec.select, %for.body ], [ %k.010.ph, %for.body.preheader15 ]
%rem = and i32 %i.011, 1
%spec.select = add i32 %rem, %k.010
%inc2 = add nuw i32 %i.011, 1
%exitcond.not = icmp eq i32 %i.011, %0
br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !13
}
; 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.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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, !12, !11}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
return *(long int*)b - *(long int*)a; // 大きい順
}
// 公約数
long int gcd(long int a, long int b){
if(b == 0){
return a;
}else{
return gcd(b, a % b);
}
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
return a * b / gcd(a, b);
}
// min
int main(void){
int n;
float ans = 0;
scanf("%d", &n);
if(n == 1){
ans = 1;
}else if(n % 2 == 0){
ans = 0.5;
}else{
ans = (((n - 1.0)/ 2.0) + 1.0) /n;
}
fprintf(stderr, "n / 2 = %f\n", 3.0/5.0);
printf("%f\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235241/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235241/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
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [12 x i8] c"n / 2 = %f\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%cmp4 = icmp eq i64 %b, 0
br i1 %cmp4, label %return, label %if.else
if.else: ; preds = %entry, %if.else
%b.tr6 = phi i64 [ %rem, %if.else ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.else ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.else, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.else ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%cmp4.i = icmp eq i64 %b, 0
br i1 %cmp4.i, label %gcd.exit, label %if.else.i
if.else.i: ; preds = %entry, %if.else.i
%b.tr6.i = phi i64 [ %rem.i, %if.else.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.else.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.else.i
gcd.exit: ; preds = %if.else.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.else.i ]
%mul = mul nsw i64 %b, %a
%div = sdiv i64 %mul, %a.tr.lcssa.i
ret i64 %div
}
; 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
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.end7, label %if.else
if.else: ; preds = %entry
%1 = and i32 %0, 1
%cmp1 = icmp eq i32 %1, 0
br i1 %cmp1, label %if.end7, label %if.else3
if.else3: ; preds = %if.else
%conv = sitofp i32 %0 to double
%sub = fadd double %conv, -1.000000e+00
%div = fmul double %sub, 5.000000e-01
%add = fadd double %div, 1.000000e+00
%div5 = fdiv double %add, %conv
%conv6 = fptrunc double %div5 to float
%2 = fpext float %conv6 to double
br label %if.end7
if.end7: ; preds = %if.else, %entry, %if.else3
%ans.0 = phi double [ %2, %if.else3 ], [ 1.000000e+00, %entry ], [ 5.000000e-01, %if.else ]
%3 = load ptr, ptr @stderr, align 8, !tbaa !11
%call8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.1, double noundef 6.000000e-01) #6
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %ans.0)
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) #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 @fprintf(ptr nocapture noundef, 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree 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 #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 = { nounwind }
attributes #6 = { cold }
!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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b) (((a) > (b)) ? (a) : (b)) /* 2個の値の最大値 */
#define min(a, b) (((a) < (b)) ? (a) : (b)) /* 2個の値の最小値 */
#define ENTER printf("\n") /* 改行プリント */
int DBG = 1; /* デバッグプリント 提出時は0 */
/* main *************************************************************/
int main()
{
int a,b,c,i,j,k,n,m,x,y;
char str[256];
double ans;
scanf("%d", &n);
a = n / 2;
b = n - a;
ans = (double)b / n;
printf("%f\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235285/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235285/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"
@DBG = dso_local local_unnamed_addr global i32 1, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\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
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%div.neg = sdiv i32 %0, -2
%sub = add i32 %div.neg, %0
%conv = sitofp i32 %sub to double
%conv1 = sitofp i32 %0 to double
%div2 = fdiv double %conv, %conv1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div2)
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"}
|
#include <stdio.h>
#include <math.h>
int main(){
int N,X,x;
double r=0,h;
scanf("%d%d",&N,&X);
for(int i=0;i<N;i++){
scanf("%d%lf",&x,&h);
r=fmax(r,h/x);
}
printf("%f\n",r*X);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235328/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235328/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 [6 x i8] c"%d%lf\00", align 1
@.str.2 = 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:
%N = alloca i32, align 4
%X = alloca i32, align 4
%x = alloca i32, align 4
%h = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %X)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%r.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %4, %for.body ]
%1 = load i32, ptr %X, align 4, !tbaa !5
%conv2 = sitofp i32 %1 to double
%mul = fmul double %r.0.lcssa, %conv2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %mul)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%r.07 = phi double [ %4, %for.body ], [ 0.000000e+00, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %h)
%2 = load double, ptr %h, align 8, !tbaa !9
%3 = load i32, ptr %x, align 4, !tbaa !5
%conv = sitofp i32 %3 to double
%div = fdiv double %2, %conv
%4 = call double @llvm.maxnum.f64(double %r.07, double %div)
%inc = add nuw nsw i32 %i.08, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %5
br i1 %cmp, label %for.body, label %for.cond.cleanup, !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 speculatable willreturn memory(none)
declare double @llvm.maxnum.f64(double, double) #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 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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h> // printf(), scanf()
#define MAX_N 100000
int
main(int argc, char** argv)
{
int n, q;
int a[MAX_N];
int i;
scanf("%d %d", &n, &q);
for (i = 0; i < n; ++i)
scanf("%d", &a[i]);
for (i = 0; i < q; ++i)
{
long x;
scanf("%ld", &x);
long count = 0;
long sum = 0;
int s, t;
for (s = 0, t = 0; s < n; ++s)
{
sum += a[s];
while (sum > x)
sum -= a[t++];
count += s - t + 1;
}
printf("%ld\n", count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235379/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235379/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%a = alloca [100000 x i32], align 16
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %q, align 4, !tbaa !5
%cmp351 = icmp sgt i32 %1, 0
br i1 %cmp351, label %for.body4, label %for.end27
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.end23
%i.152 = phi i32 [ %inc26, %for.end23 ], [ 0, %for.cond2.preheader ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp745 = icmp sgt i32 %4, 0
br i1 %cmp745, label %for.body8.lr.ph, label %for.end23
for.body8.lr.ph: ; preds = %for.body4
%5 = load i64, ptr %x, align 8, !tbaa !11
%wide.trip.count = zext i32 %4 to i64
br label %for.body8
for.body8: ; preds = %for.body8.lr.ph, %while.end
%indvars.iv57 = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next58, %while.end ]
%t.049 = phi i32 [ 0, %for.body8.lr.ph ], [ %t.1.lcssa, %while.end ]
%sum.047 = phi i64 [ 0, %for.body8.lr.ph ], [ %sum.1.lcssa, %while.end ]
%count.046 = phi i64 [ 0, %for.body8.lr.ph ], [ %add20, %while.end ]
%arrayidx10 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv57
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%conv = sext i32 %6 to i64
%add = add nsw i64 %sum.047, %conv
%cmp1141 = icmp sgt i64 %add, %5
br i1 %cmp1141, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %for.body8
%7 = sext i32 %t.049 to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv54 = phi i64 [ %7, %while.body.preheader ], [ %indvars.iv.next55, %while.body ]
%sum.142 = phi i64 [ %add, %while.body.preheader ], [ %sub, %while.body ]
%indvars.iv.next55 = add i64 %indvars.iv54, 1
%arrayidx15 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%conv16 = sext i32 %8 to i64
%sub = sub nsw i64 %sum.142, %conv16
%cmp11 = icmp sgt i64 %sub, %5
br i1 %cmp11, label %while.body, label %while.end.loopexit, !llvm.loop !13
while.end.loopexit: ; preds = %while.body
%9 = trunc i64 %indvars.iv.next55 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %for.body8
%sum.1.lcssa = phi i64 [ %add, %for.body8 ], [ %sub, %while.end.loopexit ]
%t.1.lcssa = phi i32 [ %t.049, %for.body8 ], [ %9, %while.end.loopexit ]
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%10 = trunc i64 %indvars.iv.next58 to i32
%add18 = sub i32 %10, %t.1.lcssa
%conv19 = sext i32 %add18 to i64
%add20 = add nsw i64 %count.046, %conv19
%exitcond.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count
br i1 %exitcond.not, label %for.end23, label %for.body8, !llvm.loop !14
for.end23: ; preds = %while.end, %for.body4
%count.0.lcssa = phi i64 [ 0, %for.body4 ], [ %add20, %while.end ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
%inc26 = add nuw nsw i32 %i.152, 1
%11 = load i32, ptr %q, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc26, %11
br i1 %cmp3, label %for.body4, label %for.end27, !llvm.loop !15
for.end27: ; preds = %for.end23, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define mem(x,y) (x*)malloc(sizeof(x)*(y));
int crack(int x,int y,int** list,int m,int n)
{
int c[4] = {0,0,0,0};
list[x][y] = 0;
if(x <(m-1))
{
if(list[x+1][y] == 1)
{
c[0] = crack(x+1,y,list,m,n);
}
}
if(x > 0)
{
if(list[x-1][y] == 1)
{
c[1] = crack(x-1,y,list,m,n);
}
}
if(y <(n-1))
{
if(list[x][y+1] == 1)
{
c[2] = crack(x,y+1,list,m,n);
}
}
if(y > 0)
{
if(list[x][y-1] == 1)
{
c[3] = crack(x,y-1,list,m,n);
}
}
list[x][y] = 1;
int i,max = 0;
for(i = 0;i < 4;i++)
{
if(c[i] > max)
{
max = c[i];
}
}
return max+1;
}
int main()
{
int m,n;
int** list;
int i,j,k;
while(scanf("%d",&m),m)
{
scanf("%d",&n);
list = mem(int*,m);
for(i = 0;i < m;i++)
{
list[i] = mem(int,n);
for(j = 0;j < n;j++)
{
scanf("%d",&list[i][j]);
}
}
int max = 0;
for(i = 0;i < m;i++)
{
for(j = 0;j < n;j++)
{
if(list[i][j] == 1)
{
int k = crack(i,j,list,m,n);
if(k > max)
{
max = k;
}
}
}
}
printf("%d\n",max);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235421/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235421/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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @crack(i32 noundef %x, i32 noundef %y, ptr noundef %list, i32 noundef %m, i32 noundef %n) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds ptr, ptr %list, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%idxprom1 = sext i32 %y to i64
%arrayidx2 = getelementptr inbounds i32, ptr %0, i64 %idxprom1
store i32 0, ptr %arrayidx2, align 4, !tbaa !9
%sub = add nsw i32 %m, -1
%cmp = icmp sgt i32 %sub, %x
br i1 %cmp, label %if.then, label %if.end11
if.then: ; preds = %entry
%add = add nsw i32 %x, 1
%idxprom3 = sext i32 %add to i64
%arrayidx4 = getelementptr inbounds ptr, ptr %list, i64 %idxprom3
%1 = load ptr, ptr %arrayidx4, align 8, !tbaa !5
%arrayidx6 = getelementptr inbounds i32, ptr %1, i64 %idxprom1
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !9
%cmp7 = icmp eq i32 %2, 1
br i1 %cmp7, label %if.then8, label %if.end11
if.then8: ; preds = %if.then
%call = tail call i32 @crack(i32 noundef %add, i32 noundef %y, ptr noundef nonnull %list, i32 noundef %m, i32 noundef %n), !range !11
br label %if.end11
if.end11: ; preds = %if.then, %if.then8, %entry
%c.sroa.0.0 = phi i32 [ %call, %if.then8 ], [ 0, %if.then ], [ 0, %entry ]
%cmp12 = icmp sgt i32 %x, 0
br i1 %cmp12, label %if.then13, label %if.end25
if.then13: ; preds = %if.end11
%sub14 = add nsw i32 %x, -1
%idxprom15 = zext i32 %sub14 to i64
%arrayidx16 = getelementptr inbounds ptr, ptr %list, i64 %idxprom15
%3 = load ptr, ptr %arrayidx16, align 8, !tbaa !5
%arrayidx18 = getelementptr inbounds i32, ptr %3, i64 %idxprom1
%4 = load i32, ptr %arrayidx18, align 4, !tbaa !9
%cmp19 = icmp eq i32 %4, 1
br i1 %cmp19, label %if.then20, label %if.end25
if.then20: ; preds = %if.then13
%call22 = tail call i32 @crack(i32 noundef %sub14, i32 noundef %y, ptr noundef nonnull %list, i32 noundef %m, i32 noundef %n), !range !11
br label %if.end25
if.end25: ; preds = %if.then13, %if.then20, %if.end11
%c.sroa.5.0 = phi i32 [ %call22, %if.then20 ], [ 0, %if.then13 ], [ 0, %if.end11 ]
%sub26 = add nsw i32 %n, -1
%cmp27 = icmp sgt i32 %sub26, %y
%.pre114.pre115 = load ptr, ptr %arrayidx, align 8, !tbaa !5
br i1 %cmp27, label %if.then28, label %if.end40
if.then28: ; preds = %if.end25
%add31 = add nsw i32 %y, 1
%idxprom32 = sext i32 %add31 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %.pre114.pre115, i64 %idxprom32
%5 = load i32, ptr %arrayidx33, align 4, !tbaa !9
%cmp34 = icmp eq i32 %5, 1
br i1 %cmp34, label %if.then35, label %if.end40
if.then35: ; preds = %if.then28
%call37 = tail call i32 @crack(i32 noundef %x, i32 noundef %add31, ptr noundef nonnull %list, i32 noundef %m, i32 noundef %n), !range !11
%.pre114.pre = load ptr, ptr %arrayidx, align 8, !tbaa !5
br label %if.end40
if.end40: ; preds = %if.then28, %if.then35, %if.end25
%.pre114 = phi ptr [ %.pre114.pre, %if.then35 ], [ %.pre114.pre115, %if.then28 ], [ %.pre114.pre115, %if.end25 ]
%c.sroa.7.0 = phi i32 [ %call37, %if.then35 ], [ 0, %if.then28 ], [ 0, %if.end25 ]
%cmp41 = icmp sgt i32 %y, 0
br i1 %cmp41, label %if.then42, label %if.end54
if.then42: ; preds = %if.end40
%sub45 = add nsw i32 %y, -1
%idxprom46 = zext i32 %sub45 to i64
%arrayidx47 = getelementptr inbounds i32, ptr %.pre114, i64 %idxprom46
%6 = load i32, ptr %arrayidx47, align 4, !tbaa !9
%cmp48 = icmp eq i32 %6, 1
br i1 %cmp48, label %if.then49, label %if.end54
if.then49: ; preds = %if.then42
%call51 = tail call i32 @crack(i32 noundef %x, i32 noundef %sub45, ptr noundef nonnull %list, i32 noundef %m, i32 noundef %n), !range !11
%.pre = load ptr, ptr %arrayidx, align 8, !tbaa !5
br label %if.end54
if.end54: ; preds = %if.then42, %if.then49, %if.end40
%7 = phi ptr [ %.pre, %if.then49 ], [ %.pre114, %if.then42 ], [ %.pre114, %if.end40 ]
%c.sroa.9.0 = phi i32 [ %call51, %if.then49 ], [ 0, %if.then42 ], [ 0, %if.end40 ]
%arrayidx58 = getelementptr inbounds i32, ptr %7, i64 %idxprom1
store i32 1, ptr %arrayidx58, align 4, !tbaa !9
%spec.select = tail call i32 @llvm.smax.i32(i32 %c.sroa.0.0, i32 %c.sroa.5.0)
%spec.select.1 = tail call i32 @llvm.smax.i32(i32 %spec.select, i32 %c.sroa.7.0)
%spec.select.2 = tail call i32 @llvm.smax.i32(i32 %spec.select.1, i32 %c.sroa.9.0)
%spec.select.3 = tail call i32 @llvm.smax.i32(i32 %spec.select.2, i32 0)
%add67 = add nuw nsw i32 %spec.select.3, 1
ret i32 %add67
}
; 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:
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !9
%tobool.not76 = icmp eq i32 %0, 0
br i1 %tobool.not76, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end44
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %m, align 4, !tbaa !9
%conv = sext i32 %1 to i64
%mul = shl nsw i64 %conv, 3
%call2 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp66 = icmp sgt i32 %1, 0
br i1 %cmp66, label %for.body.lr.ph, label %for.end44
for.body.lr.ph: ; preds = %while.body
%2 = load i32, ptr %n, align 4, !tbaa !9
%3 = icmp sgt i32 %2, 0
br i1 %3, label %for.body, label %for.body.lr.ph.split.us
for.body.lr.ph.split.us: ; preds = %for.body.lr.ph
%conv4.us = sext i32 %2 to i64
%mul5.us = shl nsw i64 %conv4.us, 2
%wide.trip.count = zext i32 %1 to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us, %for.body.lr.ph.split.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body.us ], [ 0, %for.body.lr.ph.split.us ]
%call6.us = call noalias ptr @malloc(i64 noundef %mul5.us) #7
%arrayidx.us = getelementptr inbounds ptr, ptr %call2, i64 %indvars.iv
store ptr %call6.us, ptr %arrayidx.us, 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.cond19.preheader, label %for.body.us, !llvm.loop !12
for.cond19.preheader: ; preds = %for.body.us, %for.inc16
%4 = phi i32 [ %12, %for.inc16 ], [ %1, %for.body.us ]
%cmp2071 = icmp sgt i32 %4, 0
%5 = load i32, ptr %n, align 4
%6 = icmp sgt i32 %5, 0
%or.cond = select i1 %cmp2071, i1 %6, i1 false
br i1 %or.cond, label %for.cond23.preheader, label %for.end44
for.body: ; preds = %for.body.lr.ph, %for.inc16
%7 = phi i32 [ %12, %for.inc16 ], [ %1, %for.body.lr.ph ]
%8 = phi i32 [ %13, %for.inc16 ], [ %2, %for.body.lr.ph ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc16 ], [ 0, %for.body.lr.ph ]
%conv4 = sext i32 %8 to i64
%mul5 = shl nsw i64 %conv4, 2
%call6 = call noalias ptr @malloc(i64 noundef %mul5) #7
%arrayidx = getelementptr inbounds ptr, ptr %call2, i64 %indvars.iv83
store ptr %call6, ptr %arrayidx, align 8, !tbaa !5
%cmp864 = icmp sgt i32 %8, 0
br i1 %cmp864, label %for.body10, label %for.inc16
for.body10: ; preds = %for.body, %for.body10
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body10 ], [ 0, %for.body ]
%9 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%arrayidx14 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv80
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx14)
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%10 = load i32, ptr %n, align 4, !tbaa !9
%11 = sext i32 %10 to i64
%cmp8 = icmp slt i64 %indvars.iv.next81, %11
br i1 %cmp8, label %for.body10, label %for.inc16.loopexit, !llvm.loop !14
for.inc16.loopexit: ; preds = %for.body10
%.pre = load i32, ptr %m, align 4, !tbaa !9
br label %for.inc16
for.inc16: ; preds = %for.inc16.loopexit, %for.body
%12 = phi i32 [ %.pre, %for.inc16.loopexit ], [ %7, %for.body ]
%13 = phi i32 [ %10, %for.inc16.loopexit ], [ %8, %for.body ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%14 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next84, %14
br i1 %cmp, label %for.body, label %for.cond19.preheader, !llvm.loop !15
for.cond23.preheader: ; preds = %for.cond19.preheader, %for.inc42
%15 = phi i32 [ %27, %for.inc42 ], [ %4, %for.cond19.preheader ]
%16 = phi i32 [ %28, %for.inc42 ], [ %5, %for.cond19.preheader ]
%17 = phi i32 [ %29, %for.inc42 ], [ %5, %for.cond19.preheader ]
%indvars.iv89 = phi i64 [ %indvars.iv.next90, %for.inc42 ], [ 0, %for.cond19.preheader ]
%max.072 = phi i32 [ %max.1.lcssa, %for.inc42 ], [ 0, %for.cond19.preheader ]
%cmp2468 = icmp sgt i32 %17, 0
br i1 %cmp2468, label %for.body26.lr.ph, label %for.inc42
for.body26.lr.ph: ; preds = %for.cond23.preheader
%arrayidx28 = getelementptr inbounds ptr, ptr %call2, i64 %indvars.iv89
%18 = trunc i64 %indvars.iv89 to i32
br label %for.body26
for.body26: ; preds = %for.body26.lr.ph, %for.inc39
%19 = phi i32 [ %16, %for.body26.lr.ph ], [ %25, %for.inc39 ]
%indvars.iv86 = phi i64 [ 0, %for.body26.lr.ph ], [ %indvars.iv.next87, %for.inc39 ]
%20 = phi i32 [ %17, %for.body26.lr.ph ], [ %25, %for.inc39 ]
%max.170 = phi i32 [ %max.072, %for.body26.lr.ph ], [ %max.3, %for.inc39 ]
%21 = load ptr, ptr %arrayidx28, align 8, !tbaa !5
%arrayidx30 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv86
%22 = load i32, ptr %arrayidx30, align 4, !tbaa !9
%cmp31 = icmp eq i32 %22, 1
br i1 %cmp31, label %if.then, label %for.inc39
if.then: ; preds = %for.body26
%23 = load i32, ptr %m, align 4, !tbaa !9
%24 = trunc i64 %indvars.iv86 to i32
%call34 = call i32 @crack(i32 noundef %18, i32 noundef %24, ptr noundef nonnull %call2, i32 noundef %23, i32 noundef %20), !range !11
%spec.select = call i32 @llvm.smax.i32(i32 %call34, i32 %max.170)
%.pre92 = load i32, ptr %n, align 4, !tbaa !9
br label %for.inc39
for.inc39: ; preds = %for.body26, %if.then
%25 = phi i32 [ %.pre92, %if.then ], [ %19, %for.body26 ]
%max.3 = phi i32 [ %spec.select, %if.then ], [ %max.170, %for.body26 ]
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%26 = sext i32 %25 to i64
%cmp24 = icmp slt i64 %indvars.iv.next87, %26
br i1 %cmp24, label %for.body26, label %for.inc42.loopexit, !llvm.loop !17
for.inc42.loopexit: ; preds = %for.inc39
%.pre93 = load i32, ptr %m, align 4, !tbaa !9
br label %for.inc42
for.inc42: ; preds = %for.inc42.loopexit, %for.cond23.preheader
%27 = phi i32 [ %15, %for.cond23.preheader ], [ %.pre93, %for.inc42.loopexit ]
%28 = phi i32 [ %16, %for.cond23.preheader ], [ %25, %for.inc42.loopexit ]
%29 = phi i32 [ %17, %for.cond23.preheader ], [ %25, %for.inc42.loopexit ]
%max.1.lcssa = phi i32 [ %max.072, %for.cond23.preheader ], [ %max.3, %for.inc42.loopexit ]
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%30 = sext i32 %27 to i64
%cmp20 = icmp slt i64 %indvars.iv.next90, %30
br i1 %cmp20, label %for.cond23.preheader, label %for.end44, !llvm.loop !18
for.end44: ; preds = %for.inc42, %while.body, %for.cond19.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond19.preheader ], [ 0, %while.body ], [ %max.1.lcssa, %for.inc42 ]
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%31 = load i32, ptr %m, align 4, !tbaa !9
%tobool.not = icmp eq i32 %31, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !19
while.end: ; preds = %for.end44, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @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) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"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 = !{i32 1, i32 -2147483647}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13, !16}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
int main(void) {
int i, N;
long long A[200000];
long long cnt = 0;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
for (i = 0; i < N-1; i++) {
if(A[i]>A[i+1]){
cnt += (A[i] - A[i + 1]);
A[i + 1] = A[i];
}
}
printf("%lld", cnt);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235465/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235465/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"%lld\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 [200000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.end24
for.cond2.preheader: ; preds = %for.body
%cmp340 = icmp sgt i32 %2, 1
br i1 %cmp340, label %for.body4.preheader, label %for.end24
for.body4.preheader: ; preds = %for.cond2.preheader
%sub = add i32 %2, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i64, ptr %A, align 16, !tbaa !9
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
br i1 %1, label %for.end24.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i64], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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 !11
for.body4: ; preds = %for.inc22.1, %for.body4.preheader.new
%4 = phi i64 [ %.pre, %for.body4.preheader.new ], [ %8, %for.inc22.1 ]
%indvars.iv46 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next47.1, %for.inc22.1 ]
%cnt.042 = phi i64 [ 0, %for.body4.preheader.new ], [ %cnt.1.1, %for.inc22.1 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.inc22.1 ]
%indvars.iv.next47 = or i64 %indvars.iv46, 1
%arrayidx8 = getelementptr inbounds [200000 x i64], ptr %A, i64 0, i64 %indvars.iv.next47
%5 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%cmp9 = icmp sgt i64 %4, %5
br i1 %cmp9, label %if.then, label %for.inc22
if.then: ; preds = %for.body4
%sub15 = add i64 %4, %cnt.042
%add16 = sub i64 %sub15, %5
store i64 %4, ptr %arrayidx8, align 8, !tbaa !9
br label %for.inc22
for.inc22: ; preds = %for.body4, %if.then
%6 = phi i64 [ %4, %if.then ], [ %5, %for.body4 ]
%cnt.1 = phi i64 [ %add16, %if.then ], [ %cnt.042, %for.body4 ]
%indvars.iv.next47.1 = add nuw nsw i64 %indvars.iv46, 2
%arrayidx8.1 = getelementptr inbounds [200000 x i64], ptr %A, i64 0, i64 %indvars.iv.next47.1
%7 = load i64, ptr %arrayidx8.1, align 16, !tbaa !9
%cmp9.1 = icmp sgt i64 %6, %7
br i1 %cmp9.1, label %if.then.1, label %for.inc22.1
if.then.1: ; preds = %for.inc22
%sub15.1 = add i64 %6, %cnt.1
%add16.1 = sub i64 %sub15.1, %7
store i64 %6, ptr %arrayidx8.1, align 16, !tbaa !9
br label %for.inc22.1
for.inc22.1: ; preds = %if.then.1, %for.inc22
%8 = phi i64 [ %6, %if.then.1 ], [ %7, %for.inc22 ]
%cnt.1.1 = phi i64 [ %add16.1, %if.then.1 ], [ %cnt.1, %for.inc22 ]
%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.end24.loopexit.unr-lcssa.loopexit, label %for.body4, !llvm.loop !13
for.end24.loopexit.unr-lcssa.loopexit: ; preds = %for.inc22.1
%9 = add nuw nsw i64 %indvars.iv46, 3
br label %for.end24.loopexit.unr-lcssa
for.end24.loopexit.unr-lcssa: ; preds = %for.end24.loopexit.unr-lcssa.loopexit, %for.body4.preheader
%cnt.1.lcssa.ph = phi i64 [ undef, %for.body4.preheader ], [ %cnt.1.1, %for.end24.loopexit.unr-lcssa.loopexit ]
%.unr = phi i64 [ %.pre, %for.body4.preheader ], [ %8, %for.end24.loopexit.unr-lcssa.loopexit ]
%indvars.iv46.unr = phi i64 [ 1, %for.body4.preheader ], [ %9, %for.end24.loopexit.unr-lcssa.loopexit ]
%cnt.042.unr = phi i64 [ 0, %for.body4.preheader ], [ %cnt.1.1, %for.end24.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end24, label %for.body4.epil
for.body4.epil: ; preds = %for.end24.loopexit.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [200000 x i64], ptr %A, i64 0, i64 %indvars.iv46.unr
%10 = load i64, ptr %arrayidx8.epil, align 8, !tbaa !9
%cmp9.epil = icmp sgt i64 %.unr, %10
br i1 %cmp9.epil, label %if.then.epil, label %for.end24
if.then.epil: ; preds = %for.body4.epil
%sub15.epil = add i64 %.unr, %cnt.042.unr
%add16.epil = sub i64 %sub15.epil, %10
store i64 %.unr, ptr %arrayidx8.epil, align 8, !tbaa !9
br label %for.end24
for.end24: ; preds = %for.end24.loopexit.unr-lcssa, %if.then.epil, %for.body4.epil, %entry, %for.cond2.preheader
%cnt.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %cnt.1.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %add16.epil, %if.then.epil ], [ %cnt.042.unr, %for.body4.epil ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1600000, 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
long long n,a[200001],i,ans=0;
int main(void)
{
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
if(i!=0&&a[i]<a[i-1]){
ans+=a[i-1]-a[i];
a[i]=a[i-1];
}
}
printf("%lld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235508/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235508/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"
@ans = dso_local local_unnamed_addr global i64 0, align 8
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@n = dso_local global i64 0, align 8
@i = dso_local local_unnamed_addr global i64 0, align 8
@a = dso_local global [200001 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i64 0, ptr @i, align 8, !tbaa !5
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp17 = icmp sgt i64 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%storemerge18 = phi i64 [ %inc, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200001 x i64], ptr @a, i64 0, i64 %storemerge18
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i64, ptr @i, align 8, !tbaa !5
%cmp2.not = icmp eq i64 %1, 0
br i1 %cmp2.not, label %for.inc, label %land.lhs.true
land.lhs.true: ; preds = %for.body
%arrayidx3 = getelementptr inbounds [200001 x i64], ptr @a, i64 0, i64 %1
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%sub = add nsw i64 %1, -1
%arrayidx4 = getelementptr inbounds [200001 x i64], ptr @a, i64 0, i64 %sub
%3 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp5 = icmp slt i64 %2, %3
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%sub9 = sub i64 %3, %2
%4 = load i64, ptr @ans, align 8, !tbaa !5
%add = add nsw i64 %sub9, %4
store i64 %add, ptr @ans, align 8, !tbaa !5
store i64 %3, ptr %arrayidx3, align 8, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%inc = add nsw i64 %1, 1
store i64 %inc, ptr @i, align 8, !tbaa !5
%5 = load i64, ptr @n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%6 = load i64, ptr @ans, align 8, !tbaa !5
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %6)
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
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" }
!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(){
long long i,n,number[1000000],a=0,ans=0;
scanf("%lld",&n);
for(i = 0; i < n; i++){
scanf("%lld",&number[i]);
if(i == 0)continue;
a = number[i-1] - number[i];
//printf("number = %lld number-1 = %lld a = %lld\n",number[i] ,number[i-1] ,a);
if(a > 0){
ans += a;
number[i] = number[i-1];
}
//printf("ans = %lld number = %lld\n",ans ,number[i]);
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235551/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 [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%number = alloca [1000000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8000000, ptr nonnull %number) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp22 = icmp sgt i64 %0, 0
br i1 %cmp22, 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 %number)
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp.peel = icmp sgt i64 %1, 1
br i1 %cmp.peel, label %if.end, label %for.end
if.end: ; preds = %for.inc.peel, %for.inc
%ans.024 = phi i64 [ %ans.1, %for.inc ], [ 0, %for.inc.peel ]
%i.023 = phi i64 [ %inc, %for.inc ], [ 1, %for.inc.peel ]
%arrayidx = getelementptr inbounds [1000000 x i64], ptr %number, i64 0, i64 %i.023
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%sub = add nsw i64 %i.023, -1
%arrayidx3 = getelementptr inbounds [1000000 x i64], ptr %number, i64 0, i64 %sub
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !5
%3 = load i64, ptr %arrayidx, align 8, !tbaa !5
%sub5 = sub nsw i64 %2, %3
%cmp6 = icmp sgt i64 %sub5, 0
br i1 %cmp6, label %if.then7, label %for.inc
if.then7: ; preds = %if.end
%add = add nsw i64 %sub5, %ans.024
store i64 %2, ptr %arrayidx, align 8, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then7
%ans.1 = phi i64 [ %add, %if.then7 ], [ %ans.024, %if.end ]
%inc = add nuw nsw i64 %i.023, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %4
br i1 %cmp, label %if.end, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.inc.peel, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ 0, %for.inc.peel ], [ %ans.1, %for.inc ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8000000, ptr nonnull %number) #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 long", !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>
int main(void){
int n;
long long k;
long long h=0;
scanf("%d",&n);
int a[n];
a[0] = 0;
for(int i=1; i<=n; i++){
scanf("%d",&a[i]);
}
for(int i=1; i<=n; i++){
k = a[i-1]-a[i];
if(k > 0){
h += k;
a[i] = a[i-1];
}
}
printf("%lld",h);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235595/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235595/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"%lld\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
store i32 0, ptr %vla, align 16, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not33 = icmp slt i32 %3, 1
br i1 %cmp.not33, label %for.cond.cleanup6, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not35 = icmp slt i32 %7, 1
br i1 %cmp5.not35, label %for.cond.cleanup6, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond4.preheader
%4 = add i32 %7, 1
%wide.trip.count = zext i32 %4 to i64
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%5 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %5, 1
%6 = icmp eq i32 %4, 2
br i1 %6, label %for.cond.cleanup6.loopexit.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %5, -2
%invariant.gep = getelementptr i32, ptr %vla, i64 1
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%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.cond4.preheader, !llvm.loop !9
for.cond.cleanup6.loopexit.unr-lcssa: ; preds = %for.inc20.1, %for.body7.preheader
%h.1.lcssa.ph = phi i64 [ undef, %for.body7.preheader ], [ %h.1.1, %for.inc20.1 ]
%.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %14, %for.inc20.1 ]
%indvars.iv41.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next42.1, %for.inc20.1 ]
%h.036.unr = phi i64 [ 0, %for.body7.preheader ], [ %h.1.1, %for.inc20.1 ]
%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
%arrayidx11.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv41.unr
%9 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%sub12.epil = sub nsw i32 %.unr, %9
%cmp13.epil = icmp sgt i32 %sub12.epil, 0
br i1 %cmp13.epil, label %if.then.epil, label %for.cond.cleanup6
if.then.epil: ; preds = %for.body7.epil
%conv.epil = zext i32 %sub12.epil to i64
%add.epil = add nsw i64 %h.036.unr, %conv.epil
store i32 %.unr, ptr %arrayidx11.epil, align 4, !tbaa !5
br label %for.cond.cleanup6
for.cond.cleanup6: ; preds = %for.cond.cleanup6.loopexit.unr-lcssa, %if.then.epil, %for.body7.epil, %entry, %for.cond4.preheader
%h.0.lcssa = phi i64 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %h.1.lcssa.ph, %for.cond.cleanup6.loopexit.unr-lcssa ], [ %add.epil, %if.then.epil ], [ %h.036.unr, %for.body7.epil ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %h.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body7: ; preds = %for.inc20.1, %for.body7.preheader.new
%10 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %14, %for.inc20.1 ]
%indvars.iv41 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next42.1, %for.inc20.1 ]
%h.036 = phi i64 [ 0, %for.body7.preheader.new ], [ %h.1.1, %for.inc20.1 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.inc20.1 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv41
%11 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%sub12 = sub nsw i32 %10, %11
%cmp13 = icmp sgt i32 %sub12, 0
br i1 %cmp13, label %if.then, label %for.inc20
if.then: ; preds = %for.body7
%conv = zext i32 %sub12 to i64
%add = add nsw i64 %h.036, %conv
store i32 %10, ptr %arrayidx11, align 4, !tbaa !5
br label %for.inc20
for.inc20: ; preds = %for.body7, %if.then
%12 = phi i32 [ %10, %if.then ], [ %11, %for.body7 ]
%h.1 = phi i64 [ %add, %if.then ], [ %h.036, %for.body7 ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv41
%13 = load i32, ptr %gep, align 4, !tbaa !5
%sub12.1 = sub nsw i32 %12, %13
%cmp13.1 = icmp sgt i32 %sub12.1, 0
br i1 %cmp13.1, label %if.then.1, label %for.inc20.1
if.then.1: ; preds = %for.inc20
%conv.1 = zext i32 %sub12.1 to i64
%add.1 = add nsw i64 %h.1, %conv.1
store i32 %12, ptr %gep, align 4, !tbaa !5
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.inc20
%14 = phi i32 [ %12, %if.then.1 ], [ %13, %for.inc20 ]
%h.1.1 = phi i64 [ %add.1, %if.then.1 ], [ %h.1, %for.inc20 ]
%indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 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, i;
long int dif=0;
scanf("%d", &N);
long int A[N];
for(i=0; i<N; i++){
scanf("%ld", &A[i]);
}
i=0;
while(i < (N-1)) {
if(A[i] > A[i+1]) {
dif += A[i] - A[i+1];
A[i+1] += A[i] - A[i+1];
}
i++;
}
printf("%ld\n", dif);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235638/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235638/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"%ld\00", align 1
@.str.2 = 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 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 i64, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %3, 0
br i1 %cmp40, label %for.body, label %while.end
while.cond.preheader: ; preds = %for.body
%cmp242 = icmp sgt i32 %5, 1
br i1 %cmp242, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%sub = add i32 %5, -1
%wide.trip.count = zext i32 %sub to i64
%.pre = load i64, ptr %vla, align 16, !tbaa !9
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %sub, 1
br i1 %4, label %while.end.loopexit.unr-lcssa, label %while.body.preheader.new
while.body.preheader.new: ; preds = %while.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, 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
%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 %while.cond.preheader, !llvm.loop !11
while.body: ; preds = %if.end.1, %while.body.preheader.new
%7 = phi i64 [ %.pre, %while.body.preheader.new ], [ %11, %if.end.1 ]
%indvars.iv48 = phi i64 [ 0, %while.body.preheader.new ], [ %indvars.iv.next49.1, %if.end.1 ]
%dif.043 = phi i64 [ 0, %while.body.preheader.new ], [ %dif.1.1, %if.end.1 ]
%niter = phi i64 [ 0, %while.body.preheader.new ], [ %niter.next.1, %if.end.1 ]
%indvars.iv.next49 = or i64 %indvars.iv48, 1
%arrayidx6 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next49
%8 = load i64, ptr %arrayidx6, align 8, !tbaa !9
%cmp7 = icmp sgt i64 %7, %8
br i1 %cmp7, label %if.then, label %if.end
if.then: ; preds = %while.body
%sub13 = add i64 %7, %dif.043
%add14 = sub i64 %sub13, %8
store i64 %7, ptr %arrayidx6, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %while.body
%9 = phi i64 [ %7, %if.then ], [ %8, %while.body ]
%dif.1 = phi i64 [ %add14, %if.then ], [ %dif.043, %while.body ]
%indvars.iv.next49.1 = add nuw nsw i64 %indvars.iv48, 2
%arrayidx6.1 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next49.1
%10 = load i64, ptr %arrayidx6.1, align 16, !tbaa !9
%cmp7.1 = icmp sgt i64 %9, %10
br i1 %cmp7.1, label %if.then.1, label %if.end.1
if.then.1: ; preds = %if.end
%sub13.1 = add i64 %9, %dif.1
%add14.1 = sub i64 %sub13.1, %10
store i64 %9, ptr %arrayidx6.1, align 16, !tbaa !9
br label %if.end.1
if.end.1: ; preds = %if.then.1, %if.end
%11 = phi i64 [ %9, %if.then.1 ], [ %10, %if.end ]
%dif.1.1 = phi i64 [ %add14.1, %if.then.1 ], [ %dif.1, %if.end ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %while.end.loopexit.unr-lcssa.loopexit, label %while.body, !llvm.loop !13
while.end.loopexit.unr-lcssa.loopexit: ; preds = %if.end.1
%12 = add nuw nsw i64 %indvars.iv48, 3
br label %while.end.loopexit.unr-lcssa
while.end.loopexit.unr-lcssa: ; preds = %while.end.loopexit.unr-lcssa.loopexit, %while.body.preheader
%dif.1.lcssa.ph = phi i64 [ undef, %while.body.preheader ], [ %dif.1.1, %while.end.loopexit.unr-lcssa.loopexit ]
%.unr = phi i64 [ %.pre, %while.body.preheader ], [ %11, %while.end.loopexit.unr-lcssa.loopexit ]
%indvars.iv48.unr = phi i64 [ 1, %while.body.preheader ], [ %12, %while.end.loopexit.unr-lcssa.loopexit ]
%dif.043.unr = phi i64 [ 0, %while.body.preheader ], [ %dif.1.1, %while.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body.epil
while.body.epil: ; preds = %while.end.loopexit.unr-lcssa
%arrayidx6.epil = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv48.unr
%13 = load i64, ptr %arrayidx6.epil, align 8, !tbaa !9
%cmp7.epil = icmp sgt i64 %.unr, %13
br i1 %cmp7.epil, label %if.then.epil, label %while.end
if.then.epil: ; preds = %while.body.epil
%sub13.epil = add i64 %.unr, %dif.043.unr
%add14.epil = sub i64 %sub13.epil, %13
store i64 %.unr, ptr %arrayidx6.epil, align 8, !tbaa !9
br label %while.end
while.end: ; preds = %while.end.loopexit.unr-lcssa, %if.then.epil, %while.body.epil, %entry, %while.cond.preheader
%dif.0.lcssa = phi i64 [ 0, %while.cond.preheader ], [ 0, %entry ], [ %dif.1.lcssa.ph, %while.end.loopexit.unr-lcssa ], [ %add14.epil, %if.then.epil ], [ %dif.043.unr, %while.body.epil ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %dif.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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
int main(void){
char s[200005];
ll a,b,c,d,n;
scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
scanf("%s",s);
// ll [n];
rep(i,a,c){
if(s[i]=='#' && s[i-1]=='#' ){
NO;
return 0;
}
}
if(c<d){
rep(i,b,d){
if(s[i]=='#' && s[i-1]=='#' ){
NO;
return 0;
}
}
YES;
}else{
ll row=0;
rep(i,b-2,d+1){
if(s[i]=='.'){
row++;
if(row>2){
YES;
return 0;
}
}else{
row=0;
}
}
NO;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235689/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235689/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 [21 x i8] c"%lld%lld%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.6 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.7 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
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 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
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 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #2 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #3 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 1152921504606846976, i64 1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ 1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #3 {
entry:
%cmp5 = icmp sgt i64 %n, 0
br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %2, %vector.body ]
%vec.phi8 = phi <2 x i64> [ <i64 -1152921504606846976, i64 -1152921504606846976>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load9 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi8, <2 x i64> %wide.load9)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.06.ph = phi i64 [ -1152921504606846976, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -1152921504606846976, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader10 ]
%b.06 = phi i64 [ %cond.i, %for.body ], [ %b.06.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.07
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.06, i64 %6)
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @ABS(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !16
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod(i64 noundef %n) local_unnamed_addr #5 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%n.nonneg = sub i64 0, %n
%0 = urem i64 %n.nonneg, 1000000007
%1 = add nsw i64 %0, %n
%mul = sub i64 1000000007, %1
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, 1000000007
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #6 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #6 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #7 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #12
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #7 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #12
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #6 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !19
%1 = load i64, ptr %q, align 8, !tbaa !19
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp2(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #6 {
entry:
%0 = load i64, ptr %q, align 8, !tbaa !19
%1 = load i64, ptr %p, align 8, !tbaa !19
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #7 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp1) #12
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #7 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp2) #12
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%s = alloca [200005 x i8], align 16
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 200005, ptr nonnull %s) #12
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #12
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #12
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #12
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #12
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #12
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %c, align 8, !tbaa !5
%cmp.not91 = icmp slt i64 %0, %1
br i1 %cmp.not91, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.092 = phi i64 [ %inc, %for.inc ], [ %0, %entry ]
%arrayidx = getelementptr inbounds [200005 x i8], ptr %s, i64 0, i64 %i.092
%2 = load i8, ptr %arrayidx, align 1, !tbaa !21
%cmp2 = icmp eq i8 %2, 35
br i1 %cmp2, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%sub = add nsw i64 %i.092, -1
%arrayidx4 = getelementptr inbounds [200005 x i8], ptr %s, i64 0, i64 %sub
%3 = load i8, ptr %arrayidx4, align 1, !tbaa !21
%cmp6 = icmp eq i8 %3, 35
br i1 %cmp6, label %cleanup66, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true
%inc = add i64 %i.092, 1
%exitcond.not = icmp eq i64 %inc, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !22
for.end: ; preds = %for.inc, %entry
%4 = load i64, ptr %d, align 8, !tbaa !5
%cmp9 = icmp slt i64 %1, %4
%5 = load i64, ptr %b, align 8, !tbaa !5
br i1 %cmp9, label %if.then11, label %if.else
if.then11: ; preds = %for.end
%cmp14.not96 = icmp slt i64 %5, %4
br i1 %cmp14.not96, label %for.body17, label %cleanup66
for.body17: ; preds = %if.then11, %for.inc31
%i12.097 = phi i64 [ %inc32, %for.inc31 ], [ %5, %if.then11 ]
%arrayidx18 = getelementptr inbounds [200005 x i8], ptr %s, i64 0, i64 %i12.097
%6 = load i8, ptr %arrayidx18, align 1, !tbaa !21
%cmp20 = icmp eq i8 %6, 35
br i1 %cmp20, label %land.lhs.true22, label %for.inc31
land.lhs.true22: ; preds = %for.body17
%sub23 = add nsw i64 %i12.097, -1
%arrayidx24 = getelementptr inbounds [200005 x i8], ptr %s, i64 0, i64 %sub23
%7 = load i8, ptr %arrayidx24, align 1, !tbaa !21
%cmp26 = icmp eq i8 %7, 35
br i1 %cmp26, label %cleanup66, label %for.inc31
for.inc31: ; preds = %for.body17, %land.lhs.true22
%inc32 = add i64 %i12.097, 1
%exitcond99.not = icmp eq i64 %inc32, %4
br i1 %exitcond99.not, label %cleanup66, label %for.body17, !llvm.loop !23
if.else: ; preds = %for.end
%sub38 = add nsw i64 %5, -2
%cmp40.not93 = icmp sgt i64 %sub38, %4
br i1 %cmp40.not93, label %cleanup66, label %for.body43
for.body43: ; preds = %if.else, %for.inc57
%i37.095 = phi i64 [ %inc58, %for.inc57 ], [ %sub38, %if.else ]
%row.094 = phi i64 [ %row.1, %for.inc57 ], [ 0, %if.else ]
%arrayidx44 = getelementptr inbounds [200005 x i8], ptr %s, i64 0, i64 %i37.095
%8 = load i8, ptr %arrayidx44, align 1, !tbaa !21
%cmp46 = icmp eq i8 %8, 46
br i1 %cmp46, label %if.then48, label %for.inc57
if.then48: ; preds = %for.body43
%inc49 = add nsw i64 %row.094, 1
%cmp50 = icmp sgt i64 %row.094, 1
br i1 %cmp50, label %cleanup66, label %for.inc57
for.inc57: ; preds = %for.body43, %if.then48
%row.1 = phi i64 [ %inc49, %if.then48 ], [ 0, %for.body43 ]
%inc58 = add i64 %i37.095, 1
%exitcond98.not = icmp eq i64 %i37.095, %4
br i1 %exitcond98.not, label %cleanup66, label %for.body43, !llvm.loop !24
cleanup66: ; preds = %land.lhs.true, %for.inc57, %if.then48, %for.inc31, %land.lhs.true22, %if.else, %if.then11
%str.4.sink = phi ptr [ @str.7, %if.then11 ], [ @str.6, %if.else ], [ @str.6, %land.lhs.true22 ], [ @str.7, %for.inc31 ], [ @str.7, %if.then48 ], [ @str.6, %for.inc57 ], [ @str.6, %land.lhs.true ]
%puts87 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #12
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #12
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #12
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #12
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #12
call void @llvm.lifetime.end.p0(i64 200005, ptr nonnull %s) #12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #10
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #10
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 #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 = { nofree nounwind }
attributes #12 = { 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, !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, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 0}
!20 = !{!"", !6, i64 0, !6, i64 8}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
|
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
char S[200000];
int one_move(int *p, int *o, int target)
{
int P = *p;
int O = *o;
// printf("P=%d target=%d\n", P, target);
if (P < (target - 1)) {
if (((P+2) != O) &&
(S[P+2] == '.')) {
P += 2;
*p = P;
// printf("P=%d target=%d (moved)\n", P, target);
return 0;
}
}
if (P < (target - 0)) {
if (((P+1) != O) &&
(S[P+1] == '.')) {
P += 1;
*p = P;
// printf("P=%d target=%d (moved)\n", P, target);
return 0;
}
}
return 1;
}
int move_to_wait(int *p, int *o, int target)
{
int P = *p;
int O = *o;
// printf("P=%d target=%d\n", P, target);
while (1) {
if ((S[P - 1] == '.') && (S[P + 1] == '.')) return 0;
if (P < (target - 0)) {
if (((P+1) != O) &&
(S[P+1] == '.')) {
P += 1;
*p = P;
// printf("P=%d target=%d (moved)\n", P, target);
continue;
}
}
if (P < (target - 1)) {
if (((P+2) != O) &&
(S[P+2] == '.')) {
P += 2;
*p = P;
// printf("P=%d target=%d (moved)\n", P, target);
continue;
}
}
break;
}//while
return 1;
}
int main()
{
int cnt;
int i;
int N,A,B,C,D;
int comp = 0;
int ret;
cnt = scanf("%d %d %d %d %d", &N, &A, &B, &C, &D);
cnt = scanf("%s", S);
// printf("%s\n", S);
A--;
B--;
C--;
D--;
if (C > D) {
move_to_wait(&B, &A, D);
}
while (comp == 0) {
if ((A == C) && (B == D)) {
printf("Yes");
return 0;
}
if (A < C) {
ret = one_move(&A, &B, C);
if (ret == 0) continue;
ret = one_move(&B, &A, D);
if (ret == 0) continue;
printf("No");
return 0;
}
if (B < D) {
ret = one_move(&B, &A, D);
if (ret == 0) continue;
ret = one_move(&A, &B, C);
if (ret == 0) continue;
printf("No");
return 0;
}
}// while
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235731/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235731/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local global [200000 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @one_move(ptr nocapture noundef %p, ptr nocapture noundef readonly %o, i32 noundef %target) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %p, align 4, !tbaa !5
%1 = load i32, ptr %o, align 4, !tbaa !5
%sub = add nsw i32 %target, -1
%cmp = icmp slt i32 %0, %sub
br i1 %cmp, label %if.then, label %if.end7
if.then: ; preds = %entry
%add = add nsw i32 %0, 2
%cmp1.not = icmp eq i32 %add, %1
br i1 %cmp1.not, label %if.end7, label %land.lhs.true
land.lhs.true: ; preds = %if.then
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp3 = icmp eq i8 %2, 46
br i1 %cmp3, label %cleanup.sink.split, label %if.end7
if.end7: ; preds = %if.then, %land.lhs.true, %entry
%cmp9 = icmp slt i32 %0, %target
br i1 %cmp9, label %if.then11, label %cleanup
if.then11: ; preds = %if.end7
%add12 = add nsw i32 %0, 1
%cmp13.not = icmp eq i32 %add12, %1
br i1 %cmp13.not, label %cleanup, label %land.lhs.true15
land.lhs.true15: ; preds = %if.then11
%idxprom17 = sext i32 %add12 to i64
%arrayidx18 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom17
%3 = load i8, ptr %arrayidx18, align 1, !tbaa !9
%cmp20 = icmp eq i8 %3, 46
br i1 %cmp20, label %cleanup.sink.split, label %cleanup
cleanup.sink.split: ; preds = %land.lhs.true15, %land.lhs.true
%add12.sink = phi i32 [ %add, %land.lhs.true ], [ %add12, %land.lhs.true15 ]
store i32 %add12.sink, ptr %p, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %cleanup.sink.split, %if.end7, %land.lhs.true15, %if.then11
%retval.0 = phi i32 [ 1, %if.then11 ], [ 1, %land.lhs.true15 ], [ 1, %if.end7 ], [ 0, %cleanup.sink.split ]
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 norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @move_to_wait(ptr nocapture noundef %p, ptr nocapture noundef readonly %o, i32 noundef %target) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %p, align 4, !tbaa !5
%1 = load i32, ptr %o, align 4, !tbaa !5
%sub25 = add nsw i32 %target, -1
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %entry
%P.0 = phi i32 [ %0, %entry ], [ %P.0.be, %while.cond.backedge ]
%sub = add nsw i32 %P.0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp = icmp eq i8 %2, 46
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.cond
%add = add nsw i32 %P.0, 1
%idxprom2 = sext i32 %add to i64
%arrayidx3 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom2
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !9
%cmp5 = icmp eq i8 %3, 46
br i1 %cmp5, label %cleanup, label %if.end
if.end: ; preds = %land.lhs.true, %while.cond
%cmp8 = icmp slt i32 %P.0, %target
br i1 %cmp8, label %if.then10, label %if.end24
if.then10: ; preds = %if.end
%add11 = add nsw i32 %P.0, 1
%cmp12.not = icmp eq i32 %add11, %1
br i1 %cmp12.not, label %if.end24, label %land.lhs.true14
land.lhs.true14: ; preds = %if.then10
%idxprom16 = sext i32 %add11 to i64
%arrayidx17 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom16
%4 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%cmp19 = icmp eq i8 %4, 46
br i1 %cmp19, label %while.cond.backedge, label %if.end24
while.cond.backedge: ; preds = %land.lhs.true32, %land.lhs.true14
%P.0.be = phi i32 [ %add11, %land.lhs.true14 ], [ %add29, %land.lhs.true32 ]
store i32 %P.0.be, ptr %p, align 4, !tbaa !5
br label %while.cond
if.end24: ; preds = %if.then10, %land.lhs.true14, %if.end
%cmp26 = icmp slt i32 %P.0, %sub25
br i1 %cmp26, label %if.then28, label %cleanup
if.then28: ; preds = %if.end24
%add29 = add nsw i32 %P.0, 2
%cmp30.not = icmp eq i32 %add29, %1
br i1 %cmp30.not, label %cleanup, label %land.lhs.true32
land.lhs.true32: ; preds = %if.then28
%idxprom34 = sext i32 %add29 to i64
%arrayidx35 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom34
%5 = load i8, ptr %arrayidx35, align 1, !tbaa !9
%cmp37 = icmp eq i8 %5, 46
br i1 %cmp37, label %while.cond.backedge, label %cleanup
cleanup: ; preds = %if.then28, %land.lhs.true32, %if.end24, %land.lhs.true
%retval.0 = phi i32 [ 0, %land.lhs.true ], [ 1, %if.end24 ], [ 1, %land.lhs.true32 ], [ 1, %if.then28 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%D = 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 %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @S)
%0 = load i32, ptr %A, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%dec2 = add nsw i32 %1, -1
store i32 %dec2, ptr %B, align 4, !tbaa !5
%2 = load i32, ptr %C, align 4, !tbaa !5
%dec3 = add nsw i32 %2, -1
store i32 %dec3, ptr %C, align 4, !tbaa !5
%3 = load i32, ptr %D, align 4, !tbaa !5
%dec4 = add nsw i32 %3, -1
store i32 %dec4, ptr %D, align 4, !tbaa !5
%cmp = icmp sgt i32 %2, %3
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%sub25.i = add nsw i32 %3, -2
br label %while.cond.i
while.cond.i: ; preds = %while.cond.backedge.i, %if.then
%P.0.i = phi i32 [ %dec2, %if.then ], [ %P.0.be.i, %while.cond.backedge.i ]
%sub.i = add nsw i32 %P.0.i, -1
%idxprom.i = sext i32 %sub.i to i64
%arrayidx.i = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom.i
%4 = load i8, ptr %arrayidx.i, align 1, !tbaa !9
%cmp.i = icmp eq i8 %4, 46
br i1 %cmp.i, label %land.lhs.true.i, label %if.end.i
land.lhs.true.i: ; preds = %while.cond.i
%add.i = add nsw i32 %P.0.i, 1
%idxprom2.i = sext i32 %add.i to i64
%arrayidx3.i = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom2.i
%5 = load i8, ptr %arrayidx3.i, align 1, !tbaa !9
%cmp5.i = icmp eq i8 %5, 46
br i1 %cmp5.i, label %if.end, label %if.end.i
if.end.i: ; preds = %land.lhs.true.i, %while.cond.i
%cmp8.i = icmp slt i32 %P.0.i, %dec4
br i1 %cmp8.i, label %if.then10.i, label %if.end24.i
if.then10.i: ; preds = %if.end.i
%add11.i = add nsw i32 %P.0.i, 1
%cmp12.not.i = icmp eq i32 %add11.i, %dec
br i1 %cmp12.not.i, label %if.end24.i, label %land.lhs.true14.i
land.lhs.true14.i: ; preds = %if.then10.i
%idxprom16.i = sext i32 %add11.i to i64
%arrayidx17.i = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom16.i
%6 = load i8, ptr %arrayidx17.i, align 1, !tbaa !9
%cmp19.i = icmp eq i8 %6, 46
br i1 %cmp19.i, label %while.cond.backedge.i, label %if.end24.i
while.cond.backedge.i: ; preds = %land.lhs.true32.i, %land.lhs.true14.i
%P.0.be.i = phi i32 [ %add11.i, %land.lhs.true14.i ], [ %add29.i, %land.lhs.true32.i ]
store i32 %P.0.be.i, ptr %B, align 4, !tbaa !5
br label %while.cond.i
if.end24.i: ; preds = %land.lhs.true14.i, %if.then10.i, %if.end.i
%cmp26.i = icmp slt i32 %P.0.i, %sub25.i
br i1 %cmp26.i, label %if.then28.i, label %if.end
if.then28.i: ; preds = %if.end24.i
%add29.i = add nsw i32 %P.0.i, 2
%cmp30.not.i = icmp eq i32 %add29.i, %dec
br i1 %cmp30.not.i, label %if.end, label %land.lhs.true32.i
land.lhs.true32.i: ; preds = %if.then28.i
%idxprom34.i = sext i32 %add29.i to i64
%arrayidx35.i = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom34.i
%7 = load i8, ptr %arrayidx35.i, align 1, !tbaa !9
%cmp37.i = icmp eq i8 %7, 46
br i1 %cmp37.i, label %while.cond.backedge.i, label %if.end
if.end: ; preds = %land.lhs.true32.i, %if.then28.i, %if.end24.i, %land.lhs.true.i, %entry
%B.promoted = phi i32 [ %dec2, %entry ], [ %P.0.i, %land.lhs.true.i ], [ %P.0.i, %if.end24.i ], [ %P.0.i, %if.then28.i ], [ %P.0.i, %land.lhs.true32.i ]
%cmp7132 = icmp eq i32 %0, %2
%cmp8133 = icmp eq i32 %B.promoted, %dec4
%or.cond134 = select i1 %cmp7132, i1 %cmp8133, i1 false
br i1 %or.cond134, label %cleanup, label %if.end11.lr.ph
if.end11.lr.ph: ; preds = %if.end
%sub.i78 = add nsw i32 %3, -2
%sub.i49 = add nsw i32 %2, -2
br label %if.end11
if.end11: ; preds = %if.end11.lr.ph, %while.cond.backedge
%add.i115131135 = phi i32 [ %dec, %if.end11.lr.ph ], [ %add.i115130, %while.cond.backedge ]
%8 = phi i32 [ %B.promoted, %if.end11.lr.ph ], [ %13, %while.cond.backedge ]
%cmp12 = icmp slt i32 %add.i115131135, %dec3
br i1 %cmp12, label %if.then13, label %if.end23
if.then13: ; preds = %if.end11
%cmp.i50 = icmp slt i32 %add.i115131135, %sub.i49
br i1 %cmp.i50, label %if.then.i, label %if.then11.i
if.then.i: ; preds = %if.then13
%add.i52 = add nsw i32 %add.i115131135, 2
%cmp1.not.i = icmp eq i32 %add.i52, %8
br i1 %cmp1.not.i, label %if.then11.i, label %land.lhs.true.i53
land.lhs.true.i53: ; preds = %if.then.i
%idxprom.i54 = sext i32 %add.i52 to i64
%arrayidx.i55 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom.i54
%9 = load i8, ptr %arrayidx.i55, align 1, !tbaa !9
%cmp3.i = icmp eq i8 %9, 46
br i1 %cmp3.i, label %one_move.exit, label %if.then11.i
if.then11.i: ; preds = %if.then13, %if.then.i, %land.lhs.true.i53
%add12.i = add nsw i32 %add.i115131135, 1
%cmp13.not.i = icmp eq i32 %add12.i, %8
br i1 %cmp13.not.i, label %if.end17, label %land.lhs.true15.i
land.lhs.true15.i: ; preds = %if.then11.i
%idxprom17.i = sext i32 %add12.i to i64
%arrayidx18.i = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom17.i
%10 = load i8, ptr %arrayidx18.i, align 1, !tbaa !9
%cmp20.i = icmp eq i8 %10, 46
br i1 %cmp20.i, label %one_move.exit, label %if.end17
one_move.exit: ; preds = %land.lhs.true.i53, %land.lhs.true15.i
%add12.sink.i = phi i32 [ %add.i52, %land.lhs.true.i53 ], [ %add12.i, %land.lhs.true15.i ]
store i32 %add12.sink.i, ptr %A, align 4, !tbaa !5
br label %while.cond.backedge
if.end17: ; preds = %if.then11.i, %land.lhs.true15.i
%cmp.i57 = icmp slt i32 %8, %sub.i78
br i1 %cmp.i57, label %if.then.i70, label %if.end7.i58
if.then.i70: ; preds = %if.end17
%add.i71 = add nsw i32 %8, 2
%cmp1.not.i72 = icmp eq i32 %add.i71, %add.i115131135
br i1 %cmp1.not.i72, label %if.end7.i58, label %land.lhs.true.i73
land.lhs.true.i73: ; preds = %if.then.i70
%idxprom.i74 = sext i32 %add.i71 to i64
%arrayidx.i75 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom.i74
%11 = load i8, ptr %arrayidx.i75, align 1, !tbaa !9
%cmp3.i76 = icmp eq i8 %11, 46
br i1 %cmp3.i76, label %one_move.exit77, label %if.end7.i58
if.end7.i58: ; preds = %land.lhs.true.i73, %if.then.i70, %if.end17
%cmp9.i59 = icmp slt i32 %8, %dec4
br i1 %cmp9.i59, label %if.then11.i61, label %cleanup
if.then11.i61: ; preds = %if.end7.i58
%add12.i62 = add nsw i32 %8, 1
%cmp13.not.i63 = icmp eq i32 %add12.i62, %add.i115131135
br i1 %cmp13.not.i63, label %cleanup, label %land.lhs.true15.i64
land.lhs.true15.i64: ; preds = %if.then11.i61
%idxprom17.i65 = sext i32 %add12.i62 to i64
%arrayidx18.i66 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom17.i65
%12 = load i8, ptr %arrayidx18.i66, align 1, !tbaa !9
%cmp20.i67 = icmp eq i8 %12, 46
br i1 %cmp20.i67, label %one_move.exit77, label %cleanup
one_move.exit77: ; preds = %land.lhs.true.i73, %land.lhs.true15.i64
%add12.sink.i69 = phi i32 [ %add.i71, %land.lhs.true.i73 ], [ %add12.i62, %land.lhs.true15.i64 ]
store i32 %add12.sink.i69, ptr %B, align 4, !tbaa !5
br label %while.cond.backedge
if.end23: ; preds = %if.end11
%cmp24 = icmp slt i32 %8, %dec4
br i1 %cmp24, label %if.then25, label %while.cond.backedge
while.cond.backedge: ; preds = %if.end23, %one_move.exit, %one_move.exit77, %one_move.exit99
%13 = phi i32 [ %8, %if.end23 ], [ %8, %one_move.exit ], [ %add12.sink.i69, %one_move.exit77 ], [ %add12.sink.i91, %one_move.exit99 ]
%add.i115130 = phi i32 [ %add.i115131135, %if.end23 ], [ %add12.sink.i, %one_move.exit ], [ %add.i115131135, %one_move.exit77 ], [ %add.i115131135, %one_move.exit99 ]
%cmp7 = icmp eq i32 %add.i115130, %dec3
%cmp8 = icmp eq i32 %13, %dec4
%or.cond = select i1 %cmp7, i1 %cmp8, i1 false
br i1 %or.cond, label %cleanup, label %if.end11, !llvm.loop !10
if.then25: ; preds = %if.end23
%cmp.i79 = icmp slt i32 %8, %sub.i78
br i1 %cmp.i79, label %if.then.i92, label %if.then11.i83
if.then.i92: ; preds = %if.then25
%add.i93 = add nsw i32 %8, 2
%cmp1.not.i94 = icmp eq i32 %add.i93, %add.i115131135
br i1 %cmp1.not.i94, label %if.then11.i83, label %land.lhs.true.i95
land.lhs.true.i95: ; preds = %if.then.i92
%idxprom.i96 = sext i32 %add.i93 to i64
%arrayidx.i97 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom.i96
%14 = load i8, ptr %arrayidx.i97, align 1, !tbaa !9
%cmp3.i98 = icmp eq i8 %14, 46
br i1 %cmp3.i98, label %one_move.exit99, label %if.then11.i83
if.then11.i83: ; preds = %if.then25, %if.then.i92, %land.lhs.true.i95
%add12.i84 = add nsw i32 %8, 1
%cmp13.not.i85 = icmp eq i32 %add12.i84, %add.i115131135
br i1 %cmp13.not.i85, label %cleanup, label %land.lhs.true15.i86
land.lhs.true15.i86: ; preds = %if.then11.i83
%idxprom17.i87 = sext i32 %add12.i84 to i64
%arrayidx18.i88 = getelementptr inbounds [200000 x i8], ptr @S, i64 0, i64 %idxprom17.i87
%15 = load i8, ptr %arrayidx18.i88, align 1, !tbaa !9
%cmp20.i89 = icmp eq i8 %15, 46
br i1 %cmp20.i89, label %one_move.exit99, label %cleanup
one_move.exit99: ; preds = %land.lhs.true.i95, %land.lhs.true15.i86
%add12.sink.i91 = phi i32 [ %add.i93, %land.lhs.true.i95 ], [ %add12.i84, %land.lhs.true15.i86 ]
store i32 %add12.sink.i91, ptr %B, align 4, !tbaa !5
br label %while.cond.backedge
cleanup: ; preds = %if.then11.i83, %land.lhs.true15.i86, %if.end7.i58, %land.lhs.true15.i64, %if.then11.i61, %while.cond.backedge, %if.end
%.str.3.sink = phi ptr [ @.str.2, %if.end ], [ @.str.2, %while.cond.backedge ], [ @.str.3, %if.then11.i61 ], [ @.str.3, %land.lhs.true15.i64 ], [ @.str.3, %if.end7.i58 ], [ @.str.3, %land.lhs.true15.i86 ], [ @.str.3, %if.then11.i83 ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #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 #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, 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 norecurse nosync nounwind memory(read, argmem: readwrite, 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 = !{!"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>
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
int dp[60][60][110][2][2];
int check[60][60][110][2][2];
//dp[n][m][x][c][p];
//デッキのn,m枚目を次に使い、スタックにx枚積んであり、
//手番がcで、直前がパス(p?である:でない)
int a[60],b[60];
int calc(int n,int m,int x,int c){
int ttt=0;
int b0=0,b1=0;
for(int i=0;i<x;i++){
if(i%2==c){
if(a[--n]==-1)b1=1;
else if(!b0)ttt+=a[n];
}else{
if(b[--m]==-1)b0=1;
else if(!b1)ttt-=b[m];
}
}
// printf("%d %d %d %d %d\n",n,m,x,c,ttt);
return ttt;
}
int N,M;
int f(int n,int m,int x,int c,int p){
if(check[n][m][x][c][p]++)return dp[n][m][x][c][p];
int temp;
if(c==0){
temp=-1e9;
//テイク
if(n<N)temp=max(temp,f(n+1,m,x+1,c^1,0));
//パス
//スタックの解消
int ttt=calc(n,m,x,1);
if(p)temp=max(temp,ttt);
else temp=max(temp,ttt+f(n,m,0,c^1,!x));
}else{
temp=1e9;
//テイク
if(m<M)temp=min(temp,f(n,m+1,x+1,c^1,0));
//パス
//スタックの解消
int ttt=calc(n,m,x,0);
if(p)temp=min(temp,ttt);
else temp=min(temp,ttt+f(n,m,0,c^1,!x));
}
return dp[n][m][x][c][p]=temp;
}
int main(){
scanf("%d%d",&N,&M);
for(int i=0;i<N;i++)scanf("%d",a+i);
for(int i=0;i<M;i++)scanf("%d",b+i);
printf("%d\n",f(0,0,0,0,0));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235775/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235775/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"
@a = dso_local global [60 x i32] zeroinitializer, align 16
@b = dso_local global [60 x i32] zeroinitializer, align 16
@check = dso_local local_unnamed_addr global [60 x [60 x [110 x [2 x [2 x i32]]]]] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [60 x [60 x [110 x [2 x [2 x i32]]]]] zeroinitializer, align 16
@N = dso_local global i32 0, align 4
@M = dso_local global i32 0, align 4
@.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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @calc(i32 noundef %n, i32 noundef %m, i32 noundef %x, i32 noundef %c) local_unnamed_addr #0 {
entry:
%cmp32 = icmp sgt i32 %x, 0
br i1 %cmp32, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
%ttt.0.lcssa = phi i32 [ 0, %entry ], [ %ttt.1, %for.inc ]
ret i32 %ttt.0.lcssa
for.body: ; preds = %entry, %for.inc
%i.038 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%b1.037 = phi i32 [ %b1.1, %for.inc ], [ 0, %entry ]
%b0.036 = phi i32 [ %b0.1, %for.inc ], [ 0, %entry ]
%ttt.035 = phi i32 [ %ttt.1, %for.inc ], [ 0, %entry ]
%n.addr.034 = phi i32 [ %n.addr.1, %for.inc ], [ %n, %entry ]
%m.addr.033 = phi i32 [ %m.addr.1, %for.inc ], [ %m, %entry ]
%rem = and i32 %i.038, 1
%cmp1 = icmp eq i32 %rem, %c
br i1 %cmp1, label %if.then, label %if.else8
if.then: ; preds = %for.body
%dec = add nsw i32 %n.addr.034, -1
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [60 x i32], ptr @a, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2 = icmp eq i32 %0, -1
br i1 %cmp2, label %for.inc, label %if.else
if.else: ; preds = %if.then
%tobool.not = icmp ne i32 %b0.036, 0
%add = select i1 %tobool.not, i32 0, i32 %0
%spec.select = add nsw i32 %add, %ttt.035
%spec.select29 = zext i1 %tobool.not to i32
br label %for.inc
if.else8: ; preds = %for.body
%dec9 = add nsw i32 %m.addr.033, -1
%idxprom10 = sext i32 %dec9 to i64
%arrayidx11 = getelementptr inbounds [60 x i32], ptr @b, i64 0, i64 %idxprom10
%1 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %1, -1
br i1 %cmp12, label %for.inc, label %if.else14
if.else14: ; preds = %if.else8
%tobool15.not = icmp ne i32 %b1.037, 0
%sub = select i1 %tobool15.not, i32 0, i32 %1
%spec.select30 = sub nsw i32 %ttt.035, %sub
%spec.select31 = zext i1 %tobool15.not to i32
br label %for.inc
for.inc: ; preds = %if.else14, %if.else, %if.else8, %if.then
%m.addr.1 = phi i32 [ %m.addr.033, %if.then ], [ %m.addr.033, %if.else ], [ %dec9, %if.else8 ], [ %dec9, %if.else14 ]
%n.addr.1 = phi i32 [ %dec, %if.then ], [ %dec, %if.else ], [ %n.addr.034, %if.else8 ], [ %n.addr.034, %if.else14 ]
%ttt.1 = phi i32 [ %ttt.035, %if.then ], [ %spec.select, %if.else ], [ %ttt.035, %if.else8 ], [ %spec.select30, %if.else14 ]
%b0.1 = phi i32 [ %b0.036, %if.then ], [ %spec.select29, %if.else ], [ 1, %if.else8 ], [ %b0.036, %if.else14 ]
%b1.1 = phi i32 [ 1, %if.then ], [ %b1.037, %if.else ], [ %b1.037, %if.else8 ], [ %spec.select31, %if.else14 ]
%inc = add nuw nsw i32 %i.038, 1
%exitcond.not = icmp eq i32 %inc, %x
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @f(i32 noundef %n, i32 noundef %m, i32 noundef %x, i32 noundef %c, i32 noundef %p) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %n to i64
%idxprom1 = sext i32 %m to i64
%idxprom3 = sext i32 %x to i64
%idxprom5 = sext i32 %c to i64
%idxprom7 = sext i32 %p to i64
%arrayidx8 = getelementptr inbounds [60 x [60 x [110 x [2 x [2 x i32]]]]], ptr @check, i64 0, i64 %idxprom, i64 %idxprom1, i64 %idxprom3, i64 %idxprom5, i64 %idxprom7
%0 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %arrayidx8, align 4, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %entry
%arrayidx18 = getelementptr inbounds [60 x [60 x [110 x [2 x [2 x i32]]]]], ptr @dp, i64 0, i64 %idxprom, i64 %idxprom1, i64 %idxprom3, i64 %idxprom5, i64 %idxprom7
%1 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %return
if.end: ; preds = %entry
%cmp = icmp eq i32 %c, 0
br i1 %cmp, label %if.then19, label %if.else53
if.then19: ; preds = %if.end
%2 = load i32, ptr @N, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %2, %n
br i1 %cmp20, label %if.then21, label %if.end28
if.then21: ; preds = %if.then19
%add = add nsw i32 %n, 1
%add22 = add nsw i32 %x, 1
%call = tail call i32 @f(i32 noundef %add, i32 noundef %m, i32 noundef %add22, i32 noundef 1, i32 noundef 0)
%cmp23 = icmp slt i32 %call, -1000000000
br i1 %cmp23, label %if.end28, label %cond.false
cond.false: ; preds = %if.then21
%call27 = tail call i32 @f(i32 noundef %add, i32 noundef %m, i32 noundef %add22, i32 noundef 1, i32 noundef 0)
br label %if.end28
if.end28: ; preds = %cond.false, %if.then21, %if.then19
%temp.0 = phi i32 [ -1000000000, %if.then19 ], [ %call27, %cond.false ], [ -1000000000, %if.then21 ]
%cmp32.i = icmp sgt i32 %x, 0
br i1 %cmp32.i, label %for.body.i, label %calc.exit
for.body.i: ; preds = %if.end28, %for.inc.i
%i.038.i = phi i32 [ %inc.i, %for.inc.i ], [ 0, %if.end28 ]
%b1.037.i = phi i32 [ %b1.1.i, %for.inc.i ], [ 0, %if.end28 ]
%b0.036.i = phi i32 [ %b0.1.i, %for.inc.i ], [ 0, %if.end28 ]
%ttt.035.i = phi i32 [ %ttt.1.i, %for.inc.i ], [ 0, %if.end28 ]
%n.addr.034.i = phi i32 [ %n.addr.1.i, %for.inc.i ], [ %n, %if.end28 ]
%m.addr.033.i = phi i32 [ %m.addr.1.i, %for.inc.i ], [ %m, %if.end28 ]
%rem.i = and i32 %i.038.i, 1
%cmp1.i.not = icmp eq i32 %rem.i, 0
br i1 %cmp1.i.not, label %if.else8.i, label %if.then.i
if.then.i: ; preds = %for.body.i
%dec.i = add nsw i32 %n.addr.034.i, -1
%idxprom.i = sext i32 %dec.i to i64
%arrayidx.i = getelementptr inbounds [60 x i32], ptr @a, i64 0, i64 %idxprom.i
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp2.i = icmp eq i32 %3, -1
br i1 %cmp2.i, label %for.inc.i, label %if.else.i
if.else.i: ; preds = %if.then.i
%tobool.not.i = icmp ne i32 %b0.036.i, 0
%add.i = select i1 %tobool.not.i, i32 0, i32 %3
%spec.select.i = add nsw i32 %add.i, %ttt.035.i
%spec.select29.i = zext i1 %tobool.not.i to i32
br label %for.inc.i
if.else8.i: ; preds = %for.body.i
%dec9.i = add nsw i32 %m.addr.033.i, -1
%idxprom10.i = sext i32 %dec9.i to i64
%arrayidx11.i = getelementptr inbounds [60 x i32], ptr @b, i64 0, i64 %idxprom10.i
%4 = load i32, ptr %arrayidx11.i, align 4, !tbaa !5
%cmp12.i = icmp eq i32 %4, -1
br i1 %cmp12.i, label %for.inc.i, label %if.else14.i
if.else14.i: ; preds = %if.else8.i
%tobool15.not.i = icmp ne i32 %b1.037.i, 0
%sub.i = select i1 %tobool15.not.i, i32 0, i32 %4
%spec.select30.i = sub nsw i32 %ttt.035.i, %sub.i
%spec.select31.i = zext i1 %tobool15.not.i to i32
br label %for.inc.i
for.inc.i: ; preds = %if.else14.i, %if.else8.i, %if.else.i, %if.then.i
%m.addr.1.i = phi i32 [ %m.addr.033.i, %if.then.i ], [ %m.addr.033.i, %if.else.i ], [ %dec9.i, %if.else8.i ], [ %dec9.i, %if.else14.i ]
%n.addr.1.i = phi i32 [ %dec.i, %if.then.i ], [ %dec.i, %if.else.i ], [ %n.addr.034.i, %if.else8.i ], [ %n.addr.034.i, %if.else14.i ]
%ttt.1.i = phi i32 [ %ttt.035.i, %if.then.i ], [ %spec.select.i, %if.else.i ], [ %ttt.035.i, %if.else8.i ], [ %spec.select30.i, %if.else14.i ]
%b0.1.i = phi i32 [ %b0.036.i, %if.then.i ], [ %spec.select29.i, %if.else.i ], [ 1, %if.else8.i ], [ %b0.036.i, %if.else14.i ]
%b1.1.i = phi i32 [ 1, %if.then.i ], [ %b1.037.i, %if.else.i ], [ %b1.037.i, %if.else8.i ], [ %spec.select31.i, %if.else14.i ]
%inc.i = add nuw nsw i32 %i.038.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, %x
br i1 %exitcond.not.i, label %calc.exit, label %for.body.i, !llvm.loop !9
calc.exit: ; preds = %for.inc.i, %if.end28
%ttt.0.lcssa.i = phi i32 [ 0, %if.end28 ], [ %ttt.1.i, %for.inc.i ]
%tobool30.not = icmp eq i32 %p, 0
br i1 %tobool30.not, label %if.else, label %if.then31
if.then31: ; preds = %calc.exit
%cond36 = tail call i32 @llvm.smax.i32(i32 %temp.0, i32 %ttt.0.lcssa.i)
br label %if.end98
if.else: ; preds = %calc.exit
%tobool38.not = icmp eq i32 %x, 0
%lnot.ext = zext i1 %tobool38.not to i32
%call39 = tail call i32 @f(i32 noundef %n, i32 noundef %m, i32 noundef 0, i32 noundef 1, i32 noundef %lnot.ext)
%add40 = add nsw i32 %call39, %ttt.0.lcssa.i
%cmp41 = icmp sgt i32 %temp.0, %add40
br i1 %cmp41, label %if.end98, label %cond.false43
cond.false43: ; preds = %if.else
%call48 = tail call i32 @f(i32 noundef %n, i32 noundef %m, i32 noundef 0, i32 noundef 1, i32 noundef %lnot.ext)
%add49 = add nsw i32 %call48, %ttt.0.lcssa.i
br label %if.end98
if.else53: ; preds = %if.end
%5 = load i32, ptr @M, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %5, %m
br i1 %cmp54, label %if.then55, label %if.end69
if.then55: ; preds = %if.else53
%add56 = add nsw i32 %m, 1
%add57 = add nsw i32 %x, 1
%xor58 = xor i32 %c, 1
%call59 = tail call i32 @f(i32 noundef %n, i32 noundef %add56, i32 noundef %add57, i32 noundef %xor58, i32 noundef 0)
%cmp60 = icmp sgt i32 %call59, 1000000000
br i1 %cmp60, label %if.end69, label %cond.false62
cond.false62: ; preds = %if.then55
%call66 = tail call i32 @f(i32 noundef %n, i32 noundef %add56, i32 noundef %add57, i32 noundef %xor58, i32 noundef 0)
br label %if.end69
if.end69: ; preds = %cond.false62, %if.then55, %if.else53
%temp.2 = phi i32 [ 1000000000, %if.else53 ], [ %call66, %cond.false62 ], [ 1000000000, %if.then55 ]
%cmp32.i180 = icmp sgt i32 %x, 0
br i1 %cmp32.i180, label %for.body.i182, label %calc.exit219
for.body.i182: ; preds = %if.end69, %for.inc.i201
%i.038.i183 = phi i32 [ %inc.i207, %for.inc.i201 ], [ 0, %if.end69 ]
%b1.037.i184 = phi i32 [ %b1.1.i206, %for.inc.i201 ], [ 0, %if.end69 ]
%b0.036.i185 = phi i32 [ %b0.1.i205, %for.inc.i201 ], [ 0, %if.end69 ]
%ttt.035.i186 = phi i32 [ %ttt.1.i204, %for.inc.i201 ], [ 0, %if.end69 ]
%n.addr.034.i187 = phi i32 [ %n.addr.1.i203, %for.inc.i201 ], [ %n, %if.end69 ]
%m.addr.033.i188 = phi i32 [ %m.addr.1.i202, %for.inc.i201 ], [ %m, %if.end69 ]
%rem.i189 = and i32 %i.038.i183, 1
%cmp1.i190 = icmp eq i32 %rem.i189, 0
br i1 %cmp1.i190, label %if.then.i209, label %if.else8.i191
if.then.i209: ; preds = %for.body.i182
%dec.i210 = add nsw i32 %n.addr.034.i187, -1
%idxprom.i211 = sext i32 %dec.i210 to i64
%arrayidx.i212 = getelementptr inbounds [60 x i32], ptr @a, i64 0, i64 %idxprom.i211
%6 = load i32, ptr %arrayidx.i212, align 4, !tbaa !5
%cmp2.i213 = icmp eq i32 %6, -1
br i1 %cmp2.i213, label %for.inc.i201, label %if.else.i214
if.else.i214: ; preds = %if.then.i209
%tobool.not.i215 = icmp ne i32 %b0.036.i185, 0
%add.i216 = select i1 %tobool.not.i215, i32 0, i32 %6
%spec.select.i217 = add nsw i32 %add.i216, %ttt.035.i186
%spec.select29.i218 = zext i1 %tobool.not.i215 to i32
br label %for.inc.i201
if.else8.i191: ; preds = %for.body.i182
%dec9.i192 = add nsw i32 %m.addr.033.i188, -1
%idxprom10.i193 = sext i32 %dec9.i192 to i64
%arrayidx11.i194 = getelementptr inbounds [60 x i32], ptr @b, i64 0, i64 %idxprom10.i193
%7 = load i32, ptr %arrayidx11.i194, align 4, !tbaa !5
%cmp12.i195 = icmp eq i32 %7, -1
br i1 %cmp12.i195, label %for.inc.i201, label %if.else14.i196
if.else14.i196: ; preds = %if.else8.i191
%tobool15.not.i197 = icmp ne i32 %b1.037.i184, 0
%sub.i198 = select i1 %tobool15.not.i197, i32 0, i32 %7
%spec.select30.i199 = sub nsw i32 %ttt.035.i186, %sub.i198
%spec.select31.i200 = zext i1 %tobool15.not.i197 to i32
br label %for.inc.i201
for.inc.i201: ; preds = %if.else14.i196, %if.else8.i191, %if.else.i214, %if.then.i209
%m.addr.1.i202 = phi i32 [ %m.addr.033.i188, %if.then.i209 ], [ %m.addr.033.i188, %if.else.i214 ], [ %dec9.i192, %if.else8.i191 ], [ %dec9.i192, %if.else14.i196 ]
%n.addr.1.i203 = phi i32 [ %dec.i210, %if.then.i209 ], [ %dec.i210, %if.else.i214 ], [ %n.addr.034.i187, %if.else8.i191 ], [ %n.addr.034.i187, %if.else14.i196 ]
%ttt.1.i204 = phi i32 [ %ttt.035.i186, %if.then.i209 ], [ %spec.select.i217, %if.else.i214 ], [ %ttt.035.i186, %if.else8.i191 ], [ %spec.select30.i199, %if.else14.i196 ]
%b0.1.i205 = phi i32 [ %b0.036.i185, %if.then.i209 ], [ %spec.select29.i218, %if.else.i214 ], [ 1, %if.else8.i191 ], [ %b0.036.i185, %if.else14.i196 ]
%b1.1.i206 = phi i32 [ 1, %if.then.i209 ], [ %b1.037.i184, %if.else.i214 ], [ %b1.037.i184, %if.else8.i191 ], [ %spec.select31.i200, %if.else14.i196 ]
%inc.i207 = add nuw nsw i32 %i.038.i183, 1
%exitcond.not.i208 = icmp eq i32 %inc.i207, %x
br i1 %exitcond.not.i208, label %calc.exit219, label %for.body.i182, !llvm.loop !9
calc.exit219: ; preds = %for.inc.i201, %if.end69
%ttt.0.lcssa.i181 = phi i32 [ 0, %if.end69 ], [ %ttt.1.i204, %for.inc.i201 ]
%tobool72.not = icmp eq i32 %p, 0
br i1 %tobool72.not, label %if.else79, label %if.then73
if.then73: ; preds = %calc.exit219
%cond78 = tail call i32 @llvm.smin.i32(i32 %temp.2, i32 %ttt.0.lcssa.i181)
br label %if.end98
if.else79: ; preds = %calc.exit219
%xor80 = xor i32 %c, 1
%tobool81.not = icmp eq i32 %x, 0
%lnot.ext83 = zext i1 %tobool81.not to i32
%call84 = tail call i32 @f(i32 noundef %n, i32 noundef %m, i32 noundef 0, i32 noundef %xor80, i32 noundef %lnot.ext83)
%add85 = add nsw i32 %call84, %ttt.0.lcssa.i181
%cmp86 = icmp slt i32 %temp.2, %add85
br i1 %cmp86, label %if.end98, label %cond.false88
cond.false88: ; preds = %if.else79
%call93 = tail call i32 @f(i32 noundef %n, i32 noundef %m, i32 noundef 0, i32 noundef %xor80, i32 noundef %lnot.ext83)
%add94 = add nsw i32 %call93, %ttt.0.lcssa.i181
br label %if.end98
if.end98: ; preds = %if.then73, %if.else79, %cond.false88, %if.then31, %if.else, %cond.false43
%temp.4 = phi i32 [ %cond36, %if.then31 ], [ %add49, %cond.false43 ], [ %temp.0, %if.else ], [ %cond78, %if.then73 ], [ %add94, %cond.false88 ], [ %temp.2, %if.else79 ]
%arrayidx108 = getelementptr inbounds [60 x [60 x [110 x [2 x [2 x i32]]]]], ptr @dp, i64 0, i64 %idxprom, i64 %idxprom1, i64 %idxprom3, i64 %idxprom5, i64 %idxprom7
store i32 %temp.4, ptr %arrayidx108, align 4, !tbaa !5
br label %return
return: ; preds = %if.end98, %if.then
%retval.0 = phi i32 [ %1, %if.then ], [ %temp.4, %if.end98 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%call = tail 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
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr @M, align 4, !tbaa !5
%cmp421 = icmp sgt i32 %1, 0
br i1 %cmp421, label %for.body6, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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 !11
for.cond.cleanup5: ; preds = %for.body6, %for.cond3.preheader
%call13 = tail call i32 @f(i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0)
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call13)
ret i32 0
for.body6: ; preds = %for.cond3.preheader, %for.body6
%indvars.iv24 = phi i64 [ %indvars.iv.next25, %for.body6 ], [ 0, %for.cond3.preheader ]
%add.ptr8 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv24
%call9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr8)
%indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
%4 = load i32, ptr @M, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp4 = icmp slt i64 %indvars.iv.next25, %5
br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !12
}
; 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.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree norecurse nosync nounwind memory(read, 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 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 #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) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
int i,n,ans=0;
char s[55]={};
scanf("%d %s",&n,s);
for(i=0; i<n-2; i++){
if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')ans++;
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235818/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235818/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 %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:
%n = alloca i32, align 4
%s = alloca [55 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 55, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(55) %s, i8 0, i64 55, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 2
br i1 %cmp22, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%sub = add i32 %0, -2
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %8, %for.inc.1 ]
%ans.024 = phi i32 [ 0, %for.body.preheader.new ], [ %ans.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 2, !tbaa !9
%cmp1 = icmp eq i8 %2, 65
%3 = or i64 %indvars.iv, 1
br i1 %cmp1, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx4 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %3
%4 = load i8, ptr %arrayidx4, align 1, !tbaa !9
%cmp6 = icmp eq i8 %4, 66
br i1 %cmp6, label %land.lhs.true8, label %for.inc
land.lhs.true8: ; preds = %land.lhs.true
%5 = add nuw nsw i64 %indvars.iv, 2
%arrayidx11 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %5
%6 = load i8, ptr %arrayidx11, align 2, !tbaa !9
%cmp13 = icmp eq i8 %6, 67
%inc = zext i1 %cmp13 to i32
%spec.select = add nsw i32 %ans.024, %inc
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true8, %land.lhs.true
%ans.1 = phi i32 [ %spec.select, %land.lhs.true8 ], [ %ans.024, %land.lhs.true ], [ %ans.024, %for.body ]
%arrayidx.1 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %3
%7 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%cmp1.1 = icmp eq i8 %7, 65
%8 = add nuw nsw i64 %indvars.iv, 2
br i1 %cmp1.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.inc
%arrayidx4.1 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %8
%9 = load i8, ptr %arrayidx4.1, align 2, !tbaa !9
%cmp6.1 = icmp eq i8 %9, 66
br i1 %cmp6.1, label %land.lhs.true8.1, label %for.inc.1
land.lhs.true8.1: ; preds = %land.lhs.true.1
%10 = add nuw nsw i64 %indvars.iv, 3
%arrayidx11.1 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %10
%11 = load i8, ptr %arrayidx11.1, align 1, !tbaa !9
%cmp13.1 = icmp eq i8 %11, 67
%inc.1 = zext i1 %cmp13.1 to i32
%spec.select.1 = add nsw i32 %ans.1, %inc.1
br label %for.inc.1
for.inc.1: ; preds = %land.lhs.true8.1, %land.lhs.true.1, %for.inc
%ans.1.1 = phi i32 [ %spec.select.1, %land.lhs.true8.1 ], [ %ans.1, %land.lhs.true.1 ], [ %ans.1, %for.inc ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %ans.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %8, %for.inc.1 ]
%ans.024.unr = phi i32 [ 0, %for.body.preheader ], [ %ans.1.1, %for.inc.1 ]
%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
%arrayidx.epil = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%12 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%cmp1.epil = icmp eq i8 %12, 65
br i1 %cmp1.epil, label %land.lhs.true.epil, label %for.end
land.lhs.true.epil: ; preds = %for.body.epil
%13 = add nuw nsw i64 %indvars.iv.unr, 1
%arrayidx4.epil = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %13
%14 = load i8, ptr %arrayidx4.epil, align 1, !tbaa !9
%cmp6.epil = icmp eq i8 %14, 66
br i1 %cmp6.epil, label %land.lhs.true8.epil, label %for.end
land.lhs.true8.epil: ; preds = %land.lhs.true.epil
%15 = add nuw nsw i64 %indvars.iv.unr, 2
%arrayidx11.epil = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %15
%16 = load i8, ptr %arrayidx11.epil, align 1, !tbaa !9
%cmp13.epil = icmp eq i8 %16, 67
%inc.epil = zext i1 %cmp13.epil to i32
%spec.select.epil = add nsw i32 %ans.024.unr, %inc.epil
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %land.lhs.true8.epil, %land.lhs.true.epil, %for.body.epil, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %land.lhs.true8.epil ], [ %ans.024.unr, %land.lhs.true.epil ], [ %ans.024.unr, %for.body.epil ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 55, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n,ans=0,i;
char s[60];
scanf("%d%s",&n,s);
for(i=0;s[i]!='\0';i++)
if((s[i]=='A')&&(s[i+1]=='B')&&(s[i+2]=='C'))
ans++;
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235861/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235861/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%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:
%n = alloca i32, align 4
%s = alloca [60 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
br label %for.cond.outer
for.cond.outer: ; preds = %land.lhs.true12, %entry
%indvars.iv.ph = phi i64 [ %1, %land.lhs.true12 ], [ 0, %entry ]
%ans.0.ph = phi i32 [ %spec.select, %land.lhs.true12 ], [ 0, %entry ]
br label %for.cond
for.cond: ; preds = %for.cond.backedge, %for.cond.outer
%indvars.iv = phi i64 [ %indvars.iv.ph, %for.cond.outer ], [ %indvars.iv.be, %for.cond.backedge ]
%arrayidx = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %0, label %for.cond.for.inc_crit_edge [
i8 0, label %for.end
i8 65, label %land.lhs.true
]
for.cond.for.inc_crit_edge: ; preds = %for.cond
%.pre = add nuw i64 %indvars.iv, 1
br label %for.cond.backedge
for.cond.backedge: ; preds = %for.cond.for.inc_crit_edge, %land.lhs.true
%indvars.iv.be = phi i64 [ %.pre, %for.cond.for.inc_crit_edge ], [ %1, %land.lhs.true ]
br label %for.cond, !llvm.loop !8
land.lhs.true: ; preds = %for.cond
%1 = add nuw i64 %indvars.iv, 1
%arrayidx8 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %1
%2 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%cmp10 = icmp eq i8 %2, 66
br i1 %cmp10, label %land.lhs.true12, label %for.cond.backedge
land.lhs.true12: ; preds = %land.lhs.true
%3 = add nuw nsw i64 %indvars.iv, 2
%arrayidx15 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %3
%4 = load i8, ptr %arrayidx15, align 1, !tbaa !5
%cmp17 = icmp eq i8 %4, 67
%inc = zext i1 %cmp17 to i32
%spec.select = add nuw nsw i32 %ans.0.ph, %inc
br label %for.cond.outer, !llvm.loop !8
for.end: ; preds = %for.cond
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.ph)
call void @llvm.lifetime.end.p0(i64 60, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
char s[60] = {};
int n, i, cnt, ans;
int a[60] = {};
scanf("%d%s", &n, s);
cnt=0;
for(i=0; i<n-2; i++){
if(s[i]=='A'){
a[cnt]=i;
cnt++;
}
}
ans = 0;
for(i=0; i<cnt; i++){
if(s[a[i]+1]=='B'&&s[a[i]+2]=='C'){
ans++;
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235911/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235911/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%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 [60 x i8], align 16
%n = alloca i32, align 4
%a = alloca [60 x i32], align 16
call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) %s, i8 0, i64 60, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240) %a, i8 0, i64 240, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 2
br i1 %cmp42, label %for.body.preheader, label %for.end30
for.body.preheader: ; preds = %entry
%sub = add i32 %0, -2
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
br i1 %1, label %for.cond6.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond6.preheader.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%cnt.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %cnt.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%cnt.044.unr = phi i32 [ 0, %for.body.preheader ], [ %cnt.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond6.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond6.preheader.unr-lcssa
%arrayidx.epil = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%2 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%cmp1.epil = icmp eq i8 %2, 65
br i1 %cmp1.epil, label %if.then.epil, label %for.cond6.preheader
if.then.epil: ; preds = %for.body.epil
%idxprom3.epil = sext i32 %cnt.044.unr to i64
%arrayidx4.epil = getelementptr inbounds [60 x i32], ptr %a, i64 0, i64 %idxprom3.epil
%3 = trunc i64 %indvars.iv.unr to i32
store i32 %3, ptr %arrayidx4.epil, align 4, !tbaa !5
%inc.epil = add nsw i32 %cnt.044.unr, 1
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body.epil, %if.then.epil, %for.cond6.preheader.unr-lcssa
%cnt.1.lcssa = phi i32 [ %cnt.1.lcssa.ph, %for.cond6.preheader.unr-lcssa ], [ %inc.epil, %if.then.epil ], [ %cnt.044.unr, %for.body.epil ]
%cmp745 = icmp sgt i32 %cnt.1.lcssa, 0
br i1 %cmp745, label %for.body9.preheader, label %for.end30
for.body9.preheader: ; preds = %for.cond6.preheader
%wide.trip.count53 = zext i32 %cnt.1.lcssa to i64
br label %for.body9
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%cnt.044 = phi i32 [ 0, %for.body.preheader.new ], [ %cnt.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx, align 2, !tbaa !9
%cmp1 = icmp eq i8 %4, 65
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %for.body
%idxprom3 = sext i32 %cnt.044 to i64
%arrayidx4 = getelementptr inbounds [60 x i32], ptr %a, i64 0, i64 %idxprom3
%5 = trunc i64 %indvars.iv to i32
store i32 %5, ptr %arrayidx4, align 4, !tbaa !5
%inc = add nsw i32 %cnt.044, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%cnt.1 = phi i32 [ %inc, %if.then ], [ %cnt.044, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%6 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%cmp1.1 = icmp eq i8 %6, 65
br i1 %cmp1.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%idxprom3.1 = sext i32 %cnt.1 to i64
%arrayidx4.1 = getelementptr inbounds [60 x i32], ptr %a, i64 0, i64 %idxprom3.1
%7 = trunc i64 %indvars.iv.next to i32
store i32 %7, ptr %arrayidx4.1, align 4, !tbaa !5
%inc.1 = add nsw i32 %cnt.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%cnt.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %cnt.1, %for.inc ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond6.preheader.unr-lcssa, label %for.body, !llvm.loop !10
for.body9: ; preds = %for.body9.preheader, %for.inc28
%indvars.iv50 = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next51, %for.inc28 ]
%ans.047 = phi i32 [ 0, %for.body9.preheader ], [ %ans.1, %for.inc28 ]
%arrayidx11 = getelementptr inbounds [60 x i32], ptr %a, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add = add nsw i32 %8, 1
%idxprom12 = sext i32 %add to i64
%arrayidx13 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %idxprom12
%9 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%cmp15 = icmp eq i8 %9, 66
br i1 %cmp15, label %land.lhs.true, label %for.inc28
land.lhs.true: ; preds = %for.body9
%add19 = add nsw i32 %8, 2
%idxprom20 = sext i32 %add19 to i64
%arrayidx21 = getelementptr inbounds [60 x i8], ptr %s, i64 0, i64 %idxprom20
%10 = load i8, ptr %arrayidx21, align 1, !tbaa !9
%cmp23 = icmp eq i8 %10, 67
%inc26 = zext i1 %cmp23 to i32
%spec.select = add nsw i32 %ans.047, %inc26
br label %for.inc28
for.inc28: ; preds = %land.lhs.true, %for.body9
%ans.1 = phi i32 [ %ans.047, %for.body9 ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
br i1 %exitcond54.not, label %for.end30, label %for.body9, !llvm.loop !12
for.end30: ; preds = %for.inc28, %entry, %for.cond6.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %ans.1, %for.inc28 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(){
int N;
char s[51];
scanf("%d",&N);
int a,count;
a=0,count=0;
for(int i =0;i<N;i++){
scanf("%s",&s[i]);
if(s[i]=='A'){
a=1;
}else if(s[i]=='B'){
if(a==1){
a = 2 ;
}else{
a=0;
}
}else if(s[i] == 'C'){
if(a==2){
count++;
a=0;
}else{
a =0;
}
}
}
printf("%d",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235955/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235955/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%s = alloca [51 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 51, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1, %for.inc ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 51, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%count.042 = phi i32 [ %count.1, %for.inc ], [ 0, %entry ]
%a.041 = phi i32 [ %a.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
switch i8 %1, label %for.inc.fold.split [
i8 65, label %for.inc
i8 66, label %if.then11
i8 67, label %if.then22
]
if.then11: ; preds = %for.body
%cmp12 = icmp eq i32 %a.041, 1
%. = select i1 %cmp12, i32 2, i32 0
br label %for.inc
if.then22: ; preds = %for.body
%cmp23 = icmp eq i32 %a.041, 2
%inc = zext i1 %cmp23 to i32
%spec.select = add nsw i32 %count.042, %inc
br label %for.inc
for.inc.fold.split: ; preds = %for.body
br label %for.inc
for.inc: ; preds = %if.then22, %for.body, %for.inc.fold.split, %if.then11
%a.1 = phi i32 [ 1, %for.body ], [ %., %if.then11 ], [ %a.041, %for.inc.fold.split ], [ 0, %if.then22 ]
%count.1 = phi i32 [ %count.042, %for.body ], [ %count.042, %if.then11 ], [ %count.042, %for.inc.fold.split ], [ %spec.select, %if.then22 ]
%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.cond.cleanup, !llvm.loop !10
}
; 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int N, x, i;
char S[100];
scanf("%d%s", &N, S);
x=0;
for (i=0; i<=N-3; i++) {
if (S[i]=='A' && S[i+1]=='B' && S[i+2]=='C') x++;
}
printf("%d", x);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_235999/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_235999/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%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:
%N = alloca i32, align 4
%S = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %S)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 3
br i1 %cmp.not22, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add i32 %0, -2
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %1, 1
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %9, %for.inc.1 ]
%x.023 = phi i32 [ 0, %for.body.preheader.new ], [ %x.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %indvars.iv
%3 = load i8, ptr %arrayidx, align 2, !tbaa !9
%cmp1 = icmp eq i8 %3, 65
%4 = or i64 %indvars.iv, 1
br i1 %cmp1, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx4 = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %4
%5 = load i8, ptr %arrayidx4, align 1, !tbaa !9
%cmp6 = icmp eq i8 %5, 66
br i1 %cmp6, label %land.lhs.true8, label %for.inc
land.lhs.true8: ; preds = %land.lhs.true
%6 = add nuw nsw i64 %indvars.iv, 2
%arrayidx11 = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %6
%7 = load i8, ptr %arrayidx11, align 2, !tbaa !9
%cmp13 = icmp eq i8 %7, 67
%inc = zext i1 %cmp13 to i32
%spec.select = add nsw i32 %x.023, %inc
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true8, %land.lhs.true
%x.1 = phi i32 [ %spec.select, %land.lhs.true8 ], [ %x.023, %land.lhs.true ], [ %x.023, %for.body ]
%arrayidx.1 = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %4
%8 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
%cmp1.1 = icmp eq i8 %8, 65
%9 = add nuw nsw i64 %indvars.iv, 2
br i1 %cmp1.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.inc
%arrayidx4.1 = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %9
%10 = load i8, ptr %arrayidx4.1, align 2, !tbaa !9
%cmp6.1 = icmp eq i8 %10, 66
br i1 %cmp6.1, label %land.lhs.true8.1, label %for.inc.1
land.lhs.true8.1: ; preds = %land.lhs.true.1
%11 = add nuw nsw i64 %indvars.iv, 3
%arrayidx11.1 = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %11
%12 = load i8, ptr %arrayidx11.1, align 1, !tbaa !9
%cmp13.1 = icmp eq i8 %12, 67
%inc.1 = zext i1 %cmp13.1 to i32
%spec.select.1 = add nsw i32 %x.1, %inc.1
br label %for.inc.1
for.inc.1: ; preds = %land.lhs.true8.1, %land.lhs.true.1, %for.inc
%x.1.1 = phi i32 [ %spec.select.1, %land.lhs.true8.1 ], [ %x.1, %land.lhs.true.1 ], [ %x.1, %for.inc ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%x.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %x.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %9, %for.inc.1 ]
%x.023.unr = phi i32 [ 0, %for.body.preheader ], [ %x.1.1, %for.inc.1 ]
%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
%arrayidx.epil = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %indvars.iv.unr
%13 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
%cmp1.epil = icmp eq i8 %13, 65
br i1 %cmp1.epil, label %land.lhs.true.epil, label %for.end
land.lhs.true.epil: ; preds = %for.body.epil
%14 = add nuw nsw i64 %indvars.iv.unr, 1
%arrayidx4.epil = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %14
%15 = load i8, ptr %arrayidx4.epil, align 1, !tbaa !9
%cmp6.epil = icmp eq i8 %15, 66
br i1 %cmp6.epil, label %land.lhs.true8.epil, label %for.end
land.lhs.true8.epil: ; preds = %land.lhs.true.epil
%16 = add nuw nsw i64 %indvars.iv.unr, 2
%arrayidx11.epil = getelementptr inbounds [100 x i8], ptr %S, i64 0, i64 %16
%17 = load i8, ptr %arrayidx11.epil, align 1, !tbaa !9
%cmp13.epil = icmp eq i8 %17, 67
%inc.epil = zext i1 %cmp13.epil to i32
%spec.select.epil = add nsw i32 %x.023.unr, %inc.epil
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %land.lhs.true8.epil, %land.lhs.true.epil, %for.body.epil, %entry
%x.0.lcssa = phi i32 [ 0, %entry ], [ %x.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %land.lhs.true8.epil ], [ %x.023.unr, %land.lhs.true.epil ], [ %x.023.unr, %for.body.epil ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.0.lcssa)
call void @llvm.lifetime.end.p0(i64 100, 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int foundwords(char s[],int flag)
{
int L=0,g=0;
char f[4]={'A','B','C'};
for(int i=flag;f[g]!='\0';i++)
{
if(s[i]==f[g++]) L=1;
else return 0;
}
return L;
}
int main()
{
int n,count=0;
char s[1000];
scanf("%d",&n);
scanf("%s",s);
for(int i=0;i<strlen(s);i++)
if(s[i]=='A')
if(foundwords(s,i)) count++;
printf("%d",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236040/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236040/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
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @foundwords(ptr nocapture noundef readonly %s, i32 noundef %flag) local_unnamed_addr #0 {
entry:
%0 = sext i32 %flag to i64
%arrayidx3 = getelementptr inbounds i8, ptr %s, i64 %0
%1 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, 65
br i1 %cmp8, label %if.then, label %cleanup
if.then: ; preds = %entry
%2 = getelementptr i8, ptr %s, i64 %0
%arrayidx3.1 = getelementptr i8, ptr %2, i64 1
%3 = load i8, ptr %arrayidx3.1, align 1, !tbaa !5
%cmp8.1 = icmp eq i8 %3, 66
br i1 %cmp8.1, label %if.then.1, label %cleanup
if.then.1: ; preds = %if.then
%4 = getelementptr i8, ptr %s, i64 %0
%arrayidx3.2 = getelementptr i8, ptr %4, i64 2
%5 = load i8, ptr %arrayidx3.2, align 1, !tbaa !5
%cmp8.2 = icmp eq i8 %5, 67
%spec.select23 = zext i1 %cmp8.2 to i32
br label %cleanup
cleanup: ; preds = %if.then.1, %if.then, %entry
%spec.select = phi i32 [ 0, %entry ], [ 0, %if.then ], [ %spec.select23, %if.then.1 ]
ret i32 %spec.select
}
; 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
%s = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %s) #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 %s)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp22.not = icmp eq i64 %call3, 0
br i1 %cmp22.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call3, 1
%0 = icmp eq i64 %call3, 1
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call3, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%count.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%count.023.unr = phi i32 [ 0, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%1 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%cmp6.epil = icmp eq i8 %1, 65
br i1 %cmp6.epil, label %if.then.i.epil, label %for.cond.cleanup
if.then.i.epil: ; preds = %for.body.epil
%arrayidx3.1.i.epil = getelementptr i8, ptr %arrayidx.epil, i64 1
%2 = load i8, ptr %arrayidx3.1.i.epil, align 1, !tbaa !5
%cmp8.1.i.epil = icmp eq i8 %2, 66
br i1 %cmp8.1.i.epil, label %foundwords.exit.epil, label %foundwords.exit.thread.epil
foundwords.exit.epil: ; preds = %if.then.i.epil
%arrayidx3.2.i.epil = getelementptr i8, ptr %arrayidx.epil, i64 2
%3 = load i8, ptr %arrayidx3.2.i.epil, align 1, !tbaa !5
%.fr.epil = freeze i8 %3
%cmp8.2.i.not.epil = icmp eq i8 %.fr.epil, 67
%inc.epil = add nsw i32 %count.023.unr, 1
br i1 %cmp8.2.i.not.epil, label %for.cond.cleanup, label %foundwords.exit.thread.epil
foundwords.exit.thread.epil: ; preds = %foundwords.exit.epil, %if.then.i.epil
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %foundwords.exit.thread.epil, %foundwords.exit.epil, %for.body.epil, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %count.023.unr, %for.body.epil ], [ %count.023.unr, %foundwords.exit.thread.epil ], [ %inc.epil, %foundwords.exit.epil ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%count.023 = phi i32 [ 0, %for.body.preheader.new ], [ %count.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv
%4 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp6 = icmp eq i8 %4, 65
br i1 %cmp6, label %if.then.i, label %for.inc
if.then.i: ; preds = %for.body
%arrayidx3.1.i = getelementptr i8, ptr %arrayidx, i64 1
%5 = load i8, ptr %arrayidx3.1.i, align 1, !tbaa !5
%cmp8.1.i = icmp eq i8 %5, 66
br i1 %cmp8.1.i, label %foundwords.exit, label %foundwords.exit.thread
foundwords.exit: ; preds = %if.then.i
%arrayidx3.2.i = getelementptr i8, ptr %arrayidx, i64 2
%6 = load i8, ptr %arrayidx3.2.i, align 2, !tbaa !5
%.fr = freeze i8 %6
%cmp8.2.i.not = icmp eq i8 %.fr, 67
%inc = add nsw i32 %count.023, 1
br i1 %cmp8.2.i.not, label %for.inc, label %foundwords.exit.thread
foundwords.exit.thread: ; preds = %if.then.i, %foundwords.exit
br label %for.inc
for.inc: ; preds = %foundwords.exit.thread, %foundwords.exit, %for.body
%count.1 = phi i32 [ %count.023, %for.body ], [ %count.023, %foundwords.exit.thread ], [ %inc, %foundwords.exit ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%7 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp6.1 = icmp eq i8 %7, 65
br i1 %cmp6.1, label %if.then.i.1, label %for.inc.1
if.then.i.1: ; preds = %for.inc
%arrayidx3.1.i.1 = getelementptr i8, ptr %arrayidx.1, i64 1
%8 = load i8, ptr %arrayidx3.1.i.1, align 2, !tbaa !5
%cmp8.1.i.1 = icmp eq i8 %8, 66
br i1 %cmp8.1.i.1, label %foundwords.exit.1, label %foundwords.exit.thread.1
foundwords.exit.1: ; preds = %if.then.i.1
%arrayidx3.2.i.1 = getelementptr i8, ptr %arrayidx.1, i64 2
%9 = load i8, ptr %arrayidx3.2.i.1, align 1, !tbaa !5
%.fr.1 = freeze i8 %9
%cmp8.2.i.not.1 = icmp eq i8 %.fr.1, 67
%inc.1 = add nsw i32 %count.1, 1
br i1 %cmp8.2.i.not.1, label %for.inc.1, label %foundwords.exit.thread.1
foundwords.exit.thread.1: ; preds = %foundwords.exit.1, %if.then.i.1
br label %for.inc.1
for.inc.1: ; preds = %foundwords.exit.thread.1, %foundwords.exit.1, %for.inc
%count.1.1 = phi i32 [ %count.1, %for.inc ], [ %count.1, %foundwords.exit.thread.1 ], [ %inc.1, %foundwords.exit.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn 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 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
char a[60];
int ans,n;
int main()
{
scanf("%d\n",&n);
scanf("%s",a);
int i,j,k;
for(i=0;i<n-2;i++)
{
if(a[i]=='A')
{
if(a[i+1]=='B')
{
if(a[i+2]=='C')
ans++;
}
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236091/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236091/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
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@a = dso_local global [60 x i8] zeroinitializer, align 16
@ans = dso_local local_unnamed_addr global i32 0, align 4
; 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)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @a)
%0 = load i32, ptr @n, align 4, !tbaa !5
%ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 2
br i1 %cmp27, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %0, -2
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %2, %for.inc ]
%inc2628 = phi i32 [ %ans.promoted, %for.body.preheader ], [ %inc25, %for.inc ]
%arrayidx = getelementptr inbounds [60 x i8], ptr @a, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %1, 65
%2 = add nuw nsw i64 %indvars.iv, 1
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
%arrayidx5 = getelementptr inbounds [60 x i8], ptr @a, i64 0, i64 %2
%3 = load i8, ptr %arrayidx5, align 1, !tbaa !9
%cmp7 = icmp eq i8 %3, 66
br i1 %cmp7, label %if.then9, label %for.inc
if.then9: ; preds = %if.then
%4 = add nuw nsw i64 %indvars.iv, 2
%arrayidx12 = getelementptr inbounds [60 x i8], ptr @a, i64 0, i64 %4
%5 = load i8, ptr %arrayidx12, align 1, !tbaa !9
%cmp14 = icmp eq i8 %5, 67
br i1 %cmp14, label %if.then16, label %for.inc
if.then16: ; preds = %if.then9
%inc = add nsw i32 %inc2628, 1
store i32 %inc, ptr @ans, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then9, %if.then16, %if.then
%inc25 = phi i32 [ %inc2628, %if.then9 ], [ %inc, %if.then16 ], [ %inc2628, %if.then ], [ %inc2628, %for.body ]
%exitcond.not = icmp eq i64 %2, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.inc, %entry
%6 = phi i32 [ %ans.promoted, %entry ], [ %inc25, %for.inc ]
%call20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
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
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" }
!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;
int room[4][3][10]={0};
scanf(" %d", &n);
for(int i=0; i<n; ++i){
int b, f, r, v;
scanf(" %d %d %d %d", &b, &f, &r, &v);
room[b-1][f-1][r-1] += v;
}
for(int i=0; i<4; ++i){
for(int j=0; j<3; ++j){
for(int k=0; k<10; ++k){
printf(" %d", room[i][j][k]);
}
printf("\n");
}
if(i!=3){
for(int j=0; j<20; ++j)
printf("#");
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236134/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236134/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\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c" %d %d %d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%room = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %room) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %room, i8 0, i64 480, 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
%cmp60 = icmp sgt i32 %0, 0
br i1 %cmp60, label %for.body, label %for.cond13.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.061 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
%inc = add nuw nsw i32 %i.061, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond13.preheader.preheader, !llvm.loop !9
for.cond13.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %for.inc46
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc46 ], [ 0, %for.cond13.preheader.preheader ]
%arrayidx26 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx26, align 8, !tbaa !5
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%arrayidx26.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%call27.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
%arrayidx26.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx26.2, align 8, !tbaa !5
%call27.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
%arrayidx26.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx26.3, align 4, !tbaa !5
%call27.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10)
%arrayidx26.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx26.4, align 8, !tbaa !5
%call27.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11)
%arrayidx26.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx26.5, align 4, !tbaa !5
%call27.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
%arrayidx26.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx26.6, align 8, !tbaa !5
%call27.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%arrayidx26.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx26.7, align 4, !tbaa !5
%call27.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %14)
%arrayidx26.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx26.8, align 8, !tbaa !5
%call27.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%arrayidx26.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx26.9, align 4, !tbaa !5
%call27.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
%putchar59 = call i32 @putchar(i32 10)
%arrayidx26.168 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx26.168, align 8, !tbaa !5
%call27.169 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17)
%arrayidx26.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx26.1.1, align 4, !tbaa !5
%call27.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %18)
%arrayidx26.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx26.2.1, align 8, !tbaa !5
%call27.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %19)
%arrayidx26.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx26.3.1, align 4, !tbaa !5
%call27.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20)
%arrayidx26.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx26.4.1, align 8, !tbaa !5
%call27.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %21)
%arrayidx26.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx26.5.1, align 4, !tbaa !5
%call27.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %22)
%arrayidx26.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx26.6.1, align 8, !tbaa !5
%call27.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23)
%arrayidx26.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx26.7.1, align 4, !tbaa !5
%call27.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %24)
%arrayidx26.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx26.8.1, align 8, !tbaa !5
%call27.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %25)
%arrayidx26.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx26.9.1, align 4, !tbaa !5
%call27.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %26)
%putchar59.1 = call i32 @putchar(i32 10)
%arrayidx26.270 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx26.270, align 8, !tbaa !5
%call27.271 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %27)
%arrayidx26.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx26.1.2, align 4, !tbaa !5
%call27.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28)
%arrayidx26.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx26.2.2, align 8, !tbaa !5
%call27.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %29)
%arrayidx26.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx26.3.2, align 4, !tbaa !5
%call27.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %30)
%arrayidx26.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx26.4.2, align 8, !tbaa !5
%call27.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %31)
%arrayidx26.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx26.5.2, align 4, !tbaa !5
%call27.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %32)
%arrayidx26.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx26.6.2, align 8, !tbaa !5
%call27.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %33)
%arrayidx26.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx26.7.2, align 4, !tbaa !5
%call27.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %34)
%arrayidx26.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx26.8.2, align 8, !tbaa !5
%call27.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %35)
%arrayidx26.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %room, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx26.9.2, align 4, !tbaa !5
%call27.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %36)
%putchar59.2 = call i32 @putchar(i32 10)
%cmp35.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp35.not, label %for.cond.cleanup11, label %for.inc46
for.cond.cleanup11: ; preds = %for.cond13.preheader
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %room) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.inc46: ; preds = %for.cond13.preheader
%putchar58 = call i32 @putchar(i32 35)
%putchar58.1 = call i32 @putchar(i32 35)
%putchar58.2 = call i32 @putchar(i32 35)
%putchar58.3 = call i32 @putchar(i32 35)
%putchar58.4 = call i32 @putchar(i32 35)
%putchar58.5 = call i32 @putchar(i32 35)
%putchar58.6 = call i32 @putchar(i32 35)
%putchar58.7 = call i32 @putchar(i32 35)
%putchar58.8 = call i32 @putchar(i32 35)
%putchar58.9 = call i32 @putchar(i32 35)
%putchar58.10 = call i32 @putchar(i32 35)
%putchar58.11 = call i32 @putchar(i32 35)
%putchar58.12 = call i32 @putchar(i32 35)
%putchar58.13 = call i32 @putchar(i32 35)
%putchar58.14 = call i32 @putchar(i32 35)
%putchar58.15 = call i32 @putchar(i32 35)
%putchar58.16 = call i32 @putchar(i32 35)
%putchar58.17 = call i32 @putchar(i32 35)
%putchar58.18 = call i32 @putchar(i32 35)
%putchar58.19 = call i32 @putchar(i32 35)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond13.preheader
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 t[4][3][10]={0};
int b,f,r,v,i,j,k,n;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d%d%d",&b,&f,&r,&v);
t[b-1][f-1][r-1]=t[b-1][f-1][r-1]+v;
}
for(i=0;i<4;i++){
for(j=0;j<3;j++){
for(k=0;k<10;k++){
printf(" %d",t[i][j][k]);
}
printf("\n");
}
if(i!=3)printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236178/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236178/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %t) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %t, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
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
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body, label %for.cond20.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.055 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%idxprom = sext i32 %sub to i64
%2 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %2, -1
%idxprom3 = sext i32 %sub2 to i64
%3 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %3, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr %v, align 4, !tbaa !5
%add = add nsw i32 %5, %4
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.055, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond20.preheader.preheader, !llvm.loop !9
for.cond20.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.inc42
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc42 ], [ 0, %for.cond20.preheader.preheader ]
%arrayidx31 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx31, align 8, !tbaa !5
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx31.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx31.1, align 4, !tbaa !5
%call32.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx31.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx31.2, align 8, !tbaa !5
%call32.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx31.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx31.3, align 4, !tbaa !5
%call32.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx31.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx31.4, align 8, !tbaa !5
%call32.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx31.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx31.5, align 4, !tbaa !5
%call32.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx31.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx31.6, align 8, !tbaa !5
%call32.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx31.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx31.7, align 4, !tbaa !5
%call32.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx31.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx31.8, align 8, !tbaa !5
%call32.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx31.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx31.9, align 4, !tbaa !5
%call32.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx31.161 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx31.161, align 8, !tbaa !5
%call32.162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx31.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx31.1.1, align 4, !tbaa !5
%call32.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx31.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx31.2.1, align 8, !tbaa !5
%call32.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx31.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx31.3.1, align 4, !tbaa !5
%call32.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx31.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx31.4.1, align 8, !tbaa !5
%call32.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx31.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx31.5.1, align 4, !tbaa !5
%call32.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx31.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx31.6.1, align 8, !tbaa !5
%call32.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx31.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx31.7.1, align 4, !tbaa !5
%call32.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx31.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx31.8.1, align 8, !tbaa !5
%call32.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx31.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx31.9.1, align 4, !tbaa !5
%call32.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx31.263 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx31.263, align 8, !tbaa !5
%call32.264 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx31.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx31.1.2, align 4, !tbaa !5
%call32.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx31.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx31.2.2, align 8, !tbaa !5
%call32.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx31.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx31.3.2, align 4, !tbaa !5
%call32.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx31.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx31.4.2, align 8, !tbaa !5
%call32.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx31.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx31.5.2, align 4, !tbaa !5
%call32.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx31.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx31.6.2, align 8, !tbaa !5
%call32.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx31.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx31.7.2, align 4, !tbaa !5
%call32.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx31.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx31.8.2, align 8, !tbaa !5
%call32.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx31.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx31.9.2, align 4, !tbaa !5
%call32.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp40.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp40.not, label %for.end44, label %for.inc42
for.inc42: ; preds = %for.cond20.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond20.preheader
for.end44: ; preds = %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 a[4][3][10]={},b,f,r,v,n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d%d%d",&b,&f,&r,&v);
a[b-1][f-1][r-1]+=v;
}
for(b=0;b<4;b++)
{
for(f=0;f<3;f++)
{
for(v=0;v<10;v++)
{
printf(" %d",a[b][f][v]);
}
printf("\n");
}
if(b!=3){
for(i=0;i<20 ;i++ ){printf("#");}
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236228/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236228/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %a, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
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
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body, %entry
store i32 0, ptr %b, align 4, !tbaa !5
br label %for.cond11.preheader
for.body: ; preds = %entry, %for.body
%i.051 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %a, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.051, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.cond8.preheader, %for.inc40
store i32 0, ptr %f, align 4, !tbaa !5
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.end26
store i32 0, ptr %v, align 4, !tbaa !5
br label %for.body16
for.body16: ; preds = %for.cond14.preheader, %for.body16
%storemerge4852 = phi i32 [ 0, %for.cond14.preheader ], [ %inc25, %for.body16 ]
%7 = load i32, ptr %b, align 4, !tbaa !5
%idxprom17 = sext i32 %7 to i64
%8 = load i32, ptr %f, align 4, !tbaa !5
%idxprom19 = sext i32 %8 to i64
%idxprom21 = sext i32 %storemerge4852 to i64
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %a, i64 0, i64 %idxprom17, i64 %idxprom19, i64 %idxprom21
%9 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%10 = load i32, ptr %v, align 4, !tbaa !5
%inc25 = add nsw i32 %10, 1
store i32 %inc25, ptr %v, align 4, !tbaa !5
%cmp15 = icmp slt i32 %10, 9
br i1 %cmp15, label %for.body16, label %for.end26, !llvm.loop !11
for.end26: ; preds = %for.body16
%putchar49 = call i32 @putchar(i32 10)
%11 = load i32, ptr %f, align 4, !tbaa !5
%inc29 = add nsw i32 %11, 1
store i32 %inc29, ptr %f, align 4, !tbaa !5
%cmp12 = icmp slt i32 %11, 2
br i1 %cmp12, label %for.cond14.preheader, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.end26
%12 = load i32, ptr %b, align 4, !tbaa !5
%cmp31.not = icmp eq i32 %12, 3
br i1 %cmp31.not, label %for.end42, label %for.inc40
for.inc40: ; preds = %for.end30
%putchar47 = call i32 @putchar(i32 35)
%putchar47.1 = call i32 @putchar(i32 35)
%putchar47.2 = call i32 @putchar(i32 35)
%putchar47.3 = call i32 @putchar(i32 35)
%putchar47.4 = call i32 @putchar(i32 35)
%putchar47.5 = call i32 @putchar(i32 35)
%putchar47.6 = call i32 @putchar(i32 35)
%putchar47.7 = call i32 @putchar(i32 35)
%putchar47.8 = call i32 @putchar(i32 35)
%putchar47.9 = call i32 @putchar(i32 35)
%putchar47.10 = call i32 @putchar(i32 35)
%putchar47.11 = call i32 @putchar(i32 35)
%putchar47.12 = call i32 @putchar(i32 35)
%putchar47.13 = call i32 @putchar(i32 35)
%putchar47.14 = call i32 @putchar(i32 35)
%putchar47.15 = call i32 @putchar(i32 35)
%putchar47.16 = call i32 @putchar(i32 35)
%putchar47.17 = call i32 @putchar(i32 35)
%putchar47.18 = call i32 @putchar(i32 35)
%putchar47.19 = call i32 @putchar(i32 35)
%putchar = call i32 @putchar(i32 10)
%.pre = load i32, ptr %b, align 4, !tbaa !5
%inc41 = add nsw i32 %.pre, 1
store i32 %inc41, ptr %b, align 4, !tbaa !5
%cmp9 = icmp slt i32 %.pre, 3
br i1 %cmp9, label %for.cond11.preheader, label %for.end42, !llvm.loop !13
for.end42: ; preds = %for.inc40, %for.end30
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 to1[3][10]={0},to2[3][10]={0},to3[3][10]={0},to4[3][10]={0};
int a,n,b,f,r,v,i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
if(b==1)to1[f-1][r-1]+=v;
if(b==2)to2[f-1][r-1]+=v;
if(b==3)to3[f-1][r-1]+=v;
if(b==4)to4[f-1][r-1]+=v;
}
for(a=1;a<=4;a++){
for(i=0;i<3;i++){
for(j=0;j<10;j++){
if(a==1)printf(" %d",to1[i][j]);
if(a==2)printf(" %d",to2[i][j]);
if(a==3)printf(" %d",to3[i][j]);
if(a==4)printf(" %d",to4[i][j]);
}
printf("\n");
}
if(a!=4)printf("####################\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236271/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236271/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%to1 = alloca [3 x [10 x i32]], align 16
%to2 = alloca [3 x [10 x i32]], align 16
%to3 = alloca [3 x [10 x i32]], align 16
%to4 = alloca [3 x [10 x i32]], align 16
%n = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %to1) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %to1, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %to2) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %to2, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %to3) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %to3, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %to4) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %to4, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp112 = icmp sgt i32 %0, 0
br i1 %cmp112, label %for.body, label %for.cond36.preheader
for.cond36.preheader: ; preds = %for.inc, %entry
%arrayidx66.us.us.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 1
%arrayidx66.us.us.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 2
%arrayidx66.us.us.3 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 3
%arrayidx66.us.us.4 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 4
%arrayidx66.us.us.5 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 5
%arrayidx66.us.us.6 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 6
%arrayidx66.us.us.7 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 7
%arrayidx66.us.us.8 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 8
%arrayidx66.us.us.9 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 0, i64 9
%arrayidx66.us.us.1192 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 0
%arrayidx66.us.us.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 1
%arrayidx66.us.us.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 2
%arrayidx66.us.us.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 3
%arrayidx66.us.us.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 4
%arrayidx66.us.us.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 5
%arrayidx66.us.us.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 6
%arrayidx66.us.us.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 7
%arrayidx66.us.us.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 8
%arrayidx66.us.us.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 1, i64 9
%arrayidx66.us.us.2194 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 0
%arrayidx66.us.us.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 1
%arrayidx66.us.us.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 2
%arrayidx66.us.us.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 3
%arrayidx66.us.us.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 4
%arrayidx66.us.us.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 5
%arrayidx66.us.us.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 6
%arrayidx66.us.us.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 7
%arrayidx66.us.us.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 8
%arrayidx66.us.us.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 2, i64 9
%arrayidx58.us.us.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 1
%arrayidx58.us.us.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 2
%arrayidx58.us.us.3 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 3
%arrayidx58.us.us.4 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 4
%arrayidx58.us.us.5 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 5
%arrayidx58.us.us.6 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 6
%arrayidx58.us.us.7 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 7
%arrayidx58.us.us.8 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 8
%arrayidx58.us.us.9 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 0, i64 9
%arrayidx58.us.us.1198 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 0
%arrayidx58.us.us.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 1
%arrayidx58.us.us.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 2
%arrayidx58.us.us.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 3
%arrayidx58.us.us.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 4
%arrayidx58.us.us.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 5
%arrayidx58.us.us.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 6
%arrayidx58.us.us.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 7
%arrayidx58.us.us.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 8
%arrayidx58.us.us.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 1, i64 9
%arrayidx58.us.us.2200 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 0
%arrayidx58.us.us.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 1
%arrayidx58.us.us.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 2
%arrayidx58.us.us.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 3
%arrayidx58.us.us.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 4
%arrayidx58.us.us.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 5
%arrayidx58.us.us.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 6
%arrayidx58.us.us.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 7
%arrayidx58.us.us.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 8
%arrayidx58.us.us.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 2, i64 9
%arrayidx50.us.us.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 1
%arrayidx50.us.us.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 2
%arrayidx50.us.us.3 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 3
%arrayidx50.us.us.4 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 4
%arrayidx50.us.us.5 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 5
%arrayidx50.us.us.6 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 6
%arrayidx50.us.us.7 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 7
%arrayidx50.us.us.8 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 8
%arrayidx50.us.us.9 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 0, i64 9
%arrayidx50.us.us.1204 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 0
%arrayidx50.us.us.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 1
%arrayidx50.us.us.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 2
%arrayidx50.us.us.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 3
%arrayidx50.us.us.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 4
%arrayidx50.us.us.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 5
%arrayidx50.us.us.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 6
%arrayidx50.us.us.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 7
%arrayidx50.us.us.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 8
%arrayidx50.us.us.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 1, i64 9
%arrayidx50.us.us.2206 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 0
%arrayidx50.us.us.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 1
%arrayidx50.us.us.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 2
%arrayidx50.us.us.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 3
%arrayidx50.us.us.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 4
%arrayidx50.us.us.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 5
%arrayidx50.us.us.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 6
%arrayidx50.us.us.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 7
%arrayidx50.us.us.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 8
%arrayidx50.us.us.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 2, i64 9
br label %for.cond39.preheader
for.body: ; preds = %entry, %for.inc
%i.0113 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %b, align 4, !tbaa !5
switch i32 %1, label %for.inc [
i32 1, label %if.end.thread
i32 2, label %if.then7
i32 3, label %if.then17
i32 4, label %if.then27
]
if.end.thread: ; preds = %for.body
%2 = load i32, ptr %f, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %r, align 4, !tbaa !5
%sub3 = add nsw i32 %3, -1
%idxprom4 = sext i32 %sub3 to i64
%arrayidx5 = getelementptr inbounds [3 x [10 x i32]], ptr %to1, i64 0, i64 %idxprom, i64 %idxprom4
br label %for.inc.sink.split
if.then7: ; preds = %for.body
%4 = load i32, ptr %f, align 4, !tbaa !5
%sub8 = add nsw i32 %4, -1
%idxprom9 = sext i32 %sub8 to i64
%5 = load i32, ptr %r, align 4, !tbaa !5
%sub11 = add nsw i32 %5, -1
%idxprom12 = sext i32 %sub11 to i64
%arrayidx13 = getelementptr inbounds [3 x [10 x i32]], ptr %to2, i64 0, i64 %idxprom9, i64 %idxprom12
br label %for.inc.sink.split
if.then17: ; preds = %for.body
%6 = load i32, ptr %f, align 4, !tbaa !5
%sub18 = add nsw i32 %6, -1
%idxprom19 = sext i32 %sub18 to i64
%7 = load i32, ptr %r, align 4, !tbaa !5
%sub21 = add nsw i32 %7, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [3 x [10 x i32]], ptr %to3, i64 0, i64 %idxprom19, i64 %idxprom22
br label %for.inc.sink.split
if.then27: ; preds = %for.body
%8 = load i32, ptr %f, align 4, !tbaa !5
%sub28 = add nsw i32 %8, -1
%idxprom29 = sext i32 %sub28 to i64
%9 = load i32, ptr %r, align 4, !tbaa !5
%sub31 = add nsw i32 %9, -1
%idxprom32 = sext i32 %sub31 to i64
%arrayidx33 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 %idxprom29, i64 %idxprom32
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %if.then27, %if.then17, %if.end.thread, %if.then7
%arrayidx13.sink212 = phi ptr [ %arrayidx13, %if.then7 ], [ %arrayidx5, %if.end.thread ], [ %arrayidx23, %if.then17 ], [ %arrayidx33, %if.then27 ]
%.sink211 = load i32, ptr %v, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx13.sink212, align 4, !tbaa !5
%add14 = add nsw i32 %10, %.sink211
store i32 %add14, ptr %arrayidx13.sink212, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body
%inc = add nuw nsw i32 %i.0113, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %11
br i1 %cmp, label %for.body, label %for.cond36.preheader, !llvm.loop !9
for.cond39.preheader: ; preds = %for.inc88, %for.cond36.preheader
%a.0179 = phi i32 [ 1, %for.cond36.preheader ], [ %inc89, %for.inc88 ]
switch i32 %a.0179, label %for.cond42.preheader.preheader [
i32 1, label %for.cond42.preheader.us.preheader
i32 2, label %for.cond42.preheader.us138.preheader
i32 3, label %for.cond42.preheader.us152.preheader
i32 4, label %for.end90
]
for.cond42.preheader.us152.preheader: ; preds = %for.cond39.preheader
%12 = load i32, ptr %to3, align 16, !tbaa !5
%call67.us.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%13 = load i32, ptr %arrayidx66.us.us.1, align 4, !tbaa !5
%call67.us.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%14 = load i32, ptr %arrayidx66.us.us.2, align 8, !tbaa !5
%call67.us.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%15 = load i32, ptr %arrayidx66.us.us.3, align 4, !tbaa !5
%call67.us.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%16 = load i32, ptr %arrayidx66.us.us.4, align 16, !tbaa !5
%call67.us.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%17 = load i32, ptr %arrayidx66.us.us.5, align 4, !tbaa !5
%call67.us.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%18 = load i32, ptr %arrayidx66.us.us.6, align 8, !tbaa !5
%call67.us.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%19 = load i32, ptr %arrayidx66.us.us.7, align 4, !tbaa !5
%call67.us.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%20 = load i32, ptr %arrayidx66.us.us.8, align 16, !tbaa !5
%call67.us.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%21 = load i32, ptr %arrayidx66.us.us.9, align 4, !tbaa !5
%call67.us.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%putchar.us159 = call i32 @putchar(i32 10)
%22 = load i32, ptr %arrayidx66.us.us.1192, align 8, !tbaa !5
%call67.us.us.1193 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%23 = load i32, ptr %arrayidx66.us.us.1.1, align 4, !tbaa !5
%call67.us.us.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%24 = load i32, ptr %arrayidx66.us.us.2.1, align 16, !tbaa !5
%call67.us.us.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%25 = load i32, ptr %arrayidx66.us.us.3.1, align 4, !tbaa !5
%call67.us.us.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%26 = load i32, ptr %arrayidx66.us.us.4.1, align 8, !tbaa !5
%call67.us.us.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%27 = load i32, ptr %arrayidx66.us.us.5.1, align 4, !tbaa !5
%call67.us.us.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%28 = load i32, ptr %arrayidx66.us.us.6.1, align 16, !tbaa !5
%call67.us.us.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%29 = load i32, ptr %arrayidx66.us.us.7.1, align 4, !tbaa !5
%call67.us.us.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%30 = load i32, ptr %arrayidx66.us.us.8.1, align 8, !tbaa !5
%call67.us.us.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%31 = load i32, ptr %arrayidx66.us.us.9.1, align 4, !tbaa !5
%call67.us.us.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%putchar.us159.1 = call i32 @putchar(i32 10)
%32 = load i32, ptr %arrayidx66.us.us.2194, align 16, !tbaa !5
%call67.us.us.2195 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%33 = load i32, ptr %arrayidx66.us.us.1.2, align 4, !tbaa !5
%call67.us.us.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%34 = load i32, ptr %arrayidx66.us.us.2.2, align 8, !tbaa !5
%call67.us.us.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%35 = load i32, ptr %arrayidx66.us.us.3.2, align 4, !tbaa !5
%call67.us.us.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%36 = load i32, ptr %arrayidx66.us.us.4.2, align 16, !tbaa !5
%call67.us.us.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%37 = load i32, ptr %arrayidx66.us.us.5.2, align 4, !tbaa !5
%call67.us.us.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %37)
%38 = load i32, ptr %arrayidx66.us.us.6.2, align 8, !tbaa !5
%call67.us.us.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38)
%39 = load i32, ptr %arrayidx66.us.us.7.2, align 4, !tbaa !5
%call67.us.us.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %39)
%40 = load i32, ptr %arrayidx66.us.us.8.2, align 16, !tbaa !5
%call67.us.us.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %40)
%41 = load i32, ptr %arrayidx66.us.us.9.2, align 4, !tbaa !5
%call67.us.us.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %41)
br label %for.inc88
for.cond42.preheader.us138.preheader: ; preds = %for.cond39.preheader
%42 = load i32, ptr %to2, align 16, !tbaa !5
%call59.us.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %42)
%43 = load i32, ptr %arrayidx58.us.us.1, align 4, !tbaa !5
%call59.us.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %43)
%44 = load i32, ptr %arrayidx58.us.us.2, align 8, !tbaa !5
%call59.us.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %44)
%45 = load i32, ptr %arrayidx58.us.us.3, align 4, !tbaa !5
%call59.us.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %45)
%46 = load i32, ptr %arrayidx58.us.us.4, align 16, !tbaa !5
%call59.us.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %46)
%47 = load i32, ptr %arrayidx58.us.us.5, align 4, !tbaa !5
%call59.us.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %47)
%48 = load i32, ptr %arrayidx58.us.us.6, align 8, !tbaa !5
%call59.us.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %48)
%49 = load i32, ptr %arrayidx58.us.us.7, align 4, !tbaa !5
%call59.us.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %49)
%50 = load i32, ptr %arrayidx58.us.us.8, align 16, !tbaa !5
%call59.us.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %50)
%51 = load i32, ptr %arrayidx58.us.us.9, align 4, !tbaa !5
%call59.us.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %51)
%putchar.us145 = call i32 @putchar(i32 10)
%52 = load i32, ptr %arrayidx58.us.us.1198, align 8, !tbaa !5
%call59.us.us.1199 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %52)
%53 = load i32, ptr %arrayidx58.us.us.1.1, align 4, !tbaa !5
%call59.us.us.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %53)
%54 = load i32, ptr %arrayidx58.us.us.2.1, align 16, !tbaa !5
%call59.us.us.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %54)
%55 = load i32, ptr %arrayidx58.us.us.3.1, align 4, !tbaa !5
%call59.us.us.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %55)
%56 = load i32, ptr %arrayidx58.us.us.4.1, align 8, !tbaa !5
%call59.us.us.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %56)
%57 = load i32, ptr %arrayidx58.us.us.5.1, align 4, !tbaa !5
%call59.us.us.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %57)
%58 = load i32, ptr %arrayidx58.us.us.6.1, align 16, !tbaa !5
%call59.us.us.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %58)
%59 = load i32, ptr %arrayidx58.us.us.7.1, align 4, !tbaa !5
%call59.us.us.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %59)
%60 = load i32, ptr %arrayidx58.us.us.8.1, align 8, !tbaa !5
%call59.us.us.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %60)
%61 = load i32, ptr %arrayidx58.us.us.9.1, align 4, !tbaa !5
%call59.us.us.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %61)
%putchar.us145.1 = call i32 @putchar(i32 10)
%62 = load i32, ptr %arrayidx58.us.us.2200, align 16, !tbaa !5
%call59.us.us.2201 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %62)
%63 = load i32, ptr %arrayidx58.us.us.1.2, align 4, !tbaa !5
%call59.us.us.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %63)
%64 = load i32, ptr %arrayidx58.us.us.2.2, align 8, !tbaa !5
%call59.us.us.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %64)
%65 = load i32, ptr %arrayidx58.us.us.3.2, align 4, !tbaa !5
%call59.us.us.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %65)
%66 = load i32, ptr %arrayidx58.us.us.4.2, align 16, !tbaa !5
%call59.us.us.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %66)
%67 = load i32, ptr %arrayidx58.us.us.5.2, align 4, !tbaa !5
%call59.us.us.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %67)
%68 = load i32, ptr %arrayidx58.us.us.6.2, align 8, !tbaa !5
%call59.us.us.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %68)
%69 = load i32, ptr %arrayidx58.us.us.7.2, align 4, !tbaa !5
%call59.us.us.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %69)
%70 = load i32, ptr %arrayidx58.us.us.8.2, align 16, !tbaa !5
%call59.us.us.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %70)
%71 = load i32, ptr %arrayidx58.us.us.9.2, align 4, !tbaa !5
%call59.us.us.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %71)
br label %for.inc88
for.cond42.preheader.us.preheader: ; preds = %for.cond39.preheader
%72 = load i32, ptr %to1, align 16, !tbaa !5
%call51.us.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %72)
%73 = load i32, ptr %arrayidx50.us.us.1, align 4, !tbaa !5
%call51.us.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %73)
%74 = load i32, ptr %arrayidx50.us.us.2, align 8, !tbaa !5
%call51.us.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %74)
%75 = load i32, ptr %arrayidx50.us.us.3, align 4, !tbaa !5
%call51.us.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %75)
%76 = load i32, ptr %arrayidx50.us.us.4, align 16, !tbaa !5
%call51.us.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %76)
%77 = load i32, ptr %arrayidx50.us.us.5, align 4, !tbaa !5
%call51.us.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %77)
%78 = load i32, ptr %arrayidx50.us.us.6, align 8, !tbaa !5
%call51.us.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %78)
%79 = load i32, ptr %arrayidx50.us.us.7, align 4, !tbaa !5
%call51.us.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %79)
%80 = load i32, ptr %arrayidx50.us.us.8, align 16, !tbaa !5
%call51.us.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %80)
%81 = load i32, ptr %arrayidx50.us.us.9, align 4, !tbaa !5
%call51.us.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %81)
%putchar.us = call i32 @putchar(i32 10)
%82 = load i32, ptr %arrayidx50.us.us.1204, align 8, !tbaa !5
%call51.us.us.1205 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %82)
%83 = load i32, ptr %arrayidx50.us.us.1.1, align 4, !tbaa !5
%call51.us.us.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %83)
%84 = load i32, ptr %arrayidx50.us.us.2.1, align 16, !tbaa !5
%call51.us.us.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %84)
%85 = load i32, ptr %arrayidx50.us.us.3.1, align 4, !tbaa !5
%call51.us.us.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %85)
%86 = load i32, ptr %arrayidx50.us.us.4.1, align 8, !tbaa !5
%call51.us.us.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %86)
%87 = load i32, ptr %arrayidx50.us.us.5.1, align 4, !tbaa !5
%call51.us.us.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %87)
%88 = load i32, ptr %arrayidx50.us.us.6.1, align 16, !tbaa !5
%call51.us.us.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %88)
%89 = load i32, ptr %arrayidx50.us.us.7.1, align 4, !tbaa !5
%call51.us.us.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %89)
%90 = load i32, ptr %arrayidx50.us.us.8.1, align 8, !tbaa !5
%call51.us.us.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %90)
%91 = load i32, ptr %arrayidx50.us.us.9.1, align 4, !tbaa !5
%call51.us.us.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %91)
%putchar.us.1 = call i32 @putchar(i32 10)
%92 = load i32, ptr %arrayidx50.us.us.2206, align 16, !tbaa !5
%call51.us.us.2207 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %92)
%93 = load i32, ptr %arrayidx50.us.us.1.2, align 4, !tbaa !5
%call51.us.us.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %93)
%94 = load i32, ptr %arrayidx50.us.us.2.2, align 8, !tbaa !5
%call51.us.us.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %94)
%95 = load i32, ptr %arrayidx50.us.us.3.2, align 4, !tbaa !5
%call51.us.us.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %95)
%96 = load i32, ptr %arrayidx50.us.us.4.2, align 16, !tbaa !5
%call51.us.us.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %96)
%97 = load i32, ptr %arrayidx50.us.us.5.2, align 4, !tbaa !5
%call51.us.us.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %97)
%98 = load i32, ptr %arrayidx50.us.us.6.2, align 8, !tbaa !5
%call51.us.us.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %98)
%99 = load i32, ptr %arrayidx50.us.us.7.2, align 4, !tbaa !5
%call51.us.us.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %99)
%100 = load i32, ptr %arrayidx50.us.us.8.2, align 16, !tbaa !5
%call51.us.us.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %100)
%101 = load i32, ptr %arrayidx50.us.us.9.2, align 4, !tbaa !5
%call51.us.us.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %101)
br label %for.inc88
for.cond42.preheader.preheader: ; preds = %for.cond39.preheader
%putchar = call i32 @putchar(i32 10)
%putchar.1 = call i32 @putchar(i32 10)
br label %for.inc88
for.inc88: ; preds = %for.cond42.preheader.preheader, %for.cond42.preheader.us.preheader, %for.cond42.preheader.us138.preheader, %for.cond42.preheader.us152.preheader
%putchar.2 = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%inc89 = add nuw nsw i32 %a.0179, 1
br label %for.cond39.preheader
for.end90: ; preds = %for.cond39.preheader
%102 = load i32, ptr %to4, align 16, !tbaa !5
%call75.us.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %102)
%arrayidx74.us.us.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 1
%103 = load i32, ptr %arrayidx74.us.us.1, align 4, !tbaa !5
%call75.us.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %103)
%arrayidx74.us.us.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 2
%104 = load i32, ptr %arrayidx74.us.us.2, align 8, !tbaa !5
%call75.us.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %104)
%arrayidx74.us.us.3 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 3
%105 = load i32, ptr %arrayidx74.us.us.3, align 4, !tbaa !5
%call75.us.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %105)
%arrayidx74.us.us.4 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 4
%106 = load i32, ptr %arrayidx74.us.us.4, align 16, !tbaa !5
%call75.us.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %106)
%arrayidx74.us.us.5 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 5
%107 = load i32, ptr %arrayidx74.us.us.5, align 4, !tbaa !5
%call75.us.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %107)
%arrayidx74.us.us.6 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 6
%108 = load i32, ptr %arrayidx74.us.us.6, align 8, !tbaa !5
%call75.us.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %108)
%arrayidx74.us.us.7 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 7
%109 = load i32, ptr %arrayidx74.us.us.7, align 4, !tbaa !5
%call75.us.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %109)
%arrayidx74.us.us.8 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 8
%110 = load i32, ptr %arrayidx74.us.us.8, align 16, !tbaa !5
%call75.us.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %110)
%arrayidx74.us.us.9 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 0, i64 9
%111 = load i32, ptr %arrayidx74.us.us.9, align 4, !tbaa !5
%call75.us.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %111)
%putchar.us173 = call i32 @putchar(i32 10)
%arrayidx74.us.us.1186 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 0
%112 = load i32, ptr %arrayidx74.us.us.1186, align 8, !tbaa !5
%call75.us.us.1187 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %112)
%arrayidx74.us.us.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 1
%113 = load i32, ptr %arrayidx74.us.us.1.1, align 4, !tbaa !5
%call75.us.us.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %113)
%arrayidx74.us.us.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 2
%114 = load i32, ptr %arrayidx74.us.us.2.1, align 16, !tbaa !5
%call75.us.us.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %114)
%arrayidx74.us.us.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 3
%115 = load i32, ptr %arrayidx74.us.us.3.1, align 4, !tbaa !5
%call75.us.us.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %115)
%arrayidx74.us.us.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 4
%116 = load i32, ptr %arrayidx74.us.us.4.1, align 8, !tbaa !5
%call75.us.us.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %116)
%arrayidx74.us.us.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 5
%117 = load i32, ptr %arrayidx74.us.us.5.1, align 4, !tbaa !5
%call75.us.us.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %117)
%arrayidx74.us.us.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 6
%118 = load i32, ptr %arrayidx74.us.us.6.1, align 16, !tbaa !5
%call75.us.us.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %118)
%arrayidx74.us.us.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 7
%119 = load i32, ptr %arrayidx74.us.us.7.1, align 4, !tbaa !5
%call75.us.us.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %119)
%arrayidx74.us.us.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 8
%120 = load i32, ptr %arrayidx74.us.us.8.1, align 8, !tbaa !5
%call75.us.us.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %120)
%arrayidx74.us.us.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 1, i64 9
%121 = load i32, ptr %arrayidx74.us.us.9.1, align 4, !tbaa !5
%call75.us.us.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %121)
%putchar.us173.1 = call i32 @putchar(i32 10)
%arrayidx74.us.us.2188 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 0
%122 = load i32, ptr %arrayidx74.us.us.2188, align 16, !tbaa !5
%call75.us.us.2189 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %122)
%arrayidx74.us.us.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 1
%123 = load i32, ptr %arrayidx74.us.us.1.2, align 4, !tbaa !5
%call75.us.us.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %123)
%arrayidx74.us.us.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 2
%124 = load i32, ptr %arrayidx74.us.us.2.2, align 8, !tbaa !5
%call75.us.us.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %124)
%arrayidx74.us.us.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 3
%125 = load i32, ptr %arrayidx74.us.us.3.2, align 4, !tbaa !5
%call75.us.us.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %125)
%arrayidx74.us.us.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 4
%126 = load i32, ptr %arrayidx74.us.us.4.2, align 16, !tbaa !5
%call75.us.us.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %126)
%arrayidx74.us.us.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 5
%127 = load i32, ptr %arrayidx74.us.us.5.2, align 4, !tbaa !5
%call75.us.us.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %127)
%arrayidx74.us.us.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 6
%128 = load i32, ptr %arrayidx74.us.us.6.2, align 8, !tbaa !5
%call75.us.us.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %128)
%arrayidx74.us.us.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 7
%129 = load i32, ptr %arrayidx74.us.us.7.2, align 4, !tbaa !5
%call75.us.us.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %129)
%arrayidx74.us.us.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 8
%130 = load i32, ptr %arrayidx74.us.us.8.2, align 16, !tbaa !5
%call75.us.us.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %130)
%arrayidx74.us.us.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %to4, i64 0, i64 2, i64 9
%131 = load i32, ptr %arrayidx74.us.us.9.2, align 4, !tbaa !5
%call75.us.us.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %131)
%putchar.us173.2 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %to4) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %to3) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %to2) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %to1) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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,nai[5][4][11]={0};
int b,f,r,v,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
nai[b][f][r]+=v;
}
for(b=1;b<5;b++){
for(f=1;f<4;f++){
for(r=1;r<11;r++){
printf(" %d",nai[b][f][r]);
}
printf("\n");
}
if(b!=4){
printf("####################\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236314/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236314/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%nai = alloca [5 x [4 x [11 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 880, ptr nonnull %nai) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(880) %nai, i8 0, i64 880, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%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 %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body, %entry
store i32 1, ptr %b, align 4, !tbaa !5
br label %for.cond9.preheader
for.body: ; preds = %entry, %for.body
%i.038 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%idxprom2 = sext i32 %3 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%idxprom4 = sext i32 %4 to i64
%arrayidx5 = getelementptr inbounds [5 x [4 x [11 x i32]]], ptr %nai, i64 0, i64 %idxprom, i64 %idxprom2, i64 %idxprom4
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx5, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.038, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond9.preheader: ; preds = %for.cond6.preheader, %for.inc31
store i32 1, ptr %f, align 4, !tbaa !5
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond9.preheader, %for.end24
store i32 1, ptr %r, align 4, !tbaa !5
br label %for.body14
for.body14: ; preds = %for.cond12.preheader, %for.body14
%storemerge3639 = phi i32 [ 1, %for.cond12.preheader ], [ %inc23, %for.body14 ]
%7 = load i32, ptr %b, align 4, !tbaa !5
%idxprom15 = sext i32 %7 to i64
%8 = load i32, ptr %f, align 4, !tbaa !5
%idxprom17 = sext i32 %8 to i64
%idxprom19 = sext i32 %storemerge3639 to i64
%arrayidx20 = getelementptr inbounds [5 x [4 x [11 x i32]]], ptr %nai, i64 0, i64 %idxprom15, i64 %idxprom17, i64 %idxprom19
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%10 = load i32, ptr %r, align 4, !tbaa !5
%inc23 = add nsw i32 %10, 1
store i32 %inc23, ptr %r, align 4, !tbaa !5
%cmp13 = icmp slt i32 %10, 10
br i1 %cmp13, label %for.body14, label %for.end24, !llvm.loop !11
for.end24: ; preds = %for.body14
%putchar = call i32 @putchar(i32 10)
%11 = load i32, ptr %f, align 4, !tbaa !5
%inc27 = add nsw i32 %11, 1
store i32 %inc27, ptr %f, align 4, !tbaa !5
%cmp10 = icmp slt i32 %11, 3
br i1 %cmp10, label %for.cond12.preheader, label %for.end28, !llvm.loop !12
for.end28: ; preds = %for.end24
%12 = load i32, ptr %b, align 4, !tbaa !5
%cmp29.not = icmp eq i32 %12, 4
br i1 %cmp29.not, label %for.end33, label %for.inc31
for.inc31: ; preds = %for.end28
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %b, align 4, !tbaa !5
%inc32 = add nsw i32 %.pre, 1
store i32 %inc32, ptr %b, align 4, !tbaa !5
%cmp7 = icmp slt i32 %.pre, 4
br i1 %cmp7, label %for.cond9.preheader, label %for.end33, !llvm.loop !13
for.end33: ; preds = %for.inc31, %for.end28
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 880, ptr nonnull %nai) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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<math.h>
int main() {
int heya[4][3][10]={0};
int b,f,r,v=0,i,n,B,F,R;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
heya[b-1][f-1][r-1]=heya[b-1][f-1][r-1]+v;
}
for(B=0;B<=3;B++){
for(F=0;F<=2;F++){
for(R=0;R<=9;R++){
printf(" %d",heya[B][F][R]);
}
printf("\n");
}
if(B!=3){
printf("####################\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236358/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236358/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%heya = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %heya) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %heya, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
store i32 0, ptr %v, align 4, !tbaa !5
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
%cmp.not53 = icmp slt i32 %0, 1
br i1 %cmp.not53, label %for.cond20.preheader.preheader, label %for.body
for.body: ; preds = %entry, %for.body
%i.054 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%idxprom = sext i32 %sub to i64
%2 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %2, -1
%idxprom3 = sext i32 %sub2 to i64
%3 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %3, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr %v, align 4, !tbaa !5
%add = add nsw i32 %5, %4
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.054, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.054, %6
br i1 %cmp.not.not, label %for.body, label %for.cond20.preheader.preheader, !llvm.loop !9
for.cond20.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.inc42
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc42 ], [ 0, %for.cond20.preheader.preheader ]
%arrayidx31 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx31, align 8, !tbaa !5
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx31.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx31.1, align 4, !tbaa !5
%call32.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx31.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx31.2, align 8, !tbaa !5
%call32.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx31.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx31.3, align 4, !tbaa !5
%call32.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx31.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx31.4, align 8, !tbaa !5
%call32.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx31.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx31.5, align 4, !tbaa !5
%call32.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx31.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx31.6, align 8, !tbaa !5
%call32.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx31.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx31.7, align 4, !tbaa !5
%call32.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx31.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx31.8, align 8, !tbaa !5
%call32.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx31.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx31.9, align 4, !tbaa !5
%call32.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx31.160 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx31.160, align 8, !tbaa !5
%call32.161 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx31.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx31.1.1, align 4, !tbaa !5
%call32.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx31.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx31.2.1, align 8, !tbaa !5
%call32.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx31.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx31.3.1, align 4, !tbaa !5
%call32.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx31.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx31.4.1, align 8, !tbaa !5
%call32.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx31.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx31.5.1, align 4, !tbaa !5
%call32.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx31.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx31.6.1, align 8, !tbaa !5
%call32.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx31.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx31.7.1, align 4, !tbaa !5
%call32.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx31.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx31.8.1, align 8, !tbaa !5
%call32.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx31.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx31.9.1, align 4, !tbaa !5
%call32.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx31.262 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx31.262, align 8, !tbaa !5
%call32.263 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx31.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx31.1.2, align 4, !tbaa !5
%call32.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx31.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx31.2.2, align 8, !tbaa !5
%call32.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx31.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx31.3.2, align 4, !tbaa !5
%call32.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx31.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx31.4.2, align 8, !tbaa !5
%call32.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx31.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx31.5.2, align 4, !tbaa !5
%call32.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx31.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx31.6.2, align 8, !tbaa !5
%call32.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx31.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx31.7.2, align 4, !tbaa !5
%call32.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx31.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx31.8.2, align 8, !tbaa !5
%call32.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx31.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %heya, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx31.9.2, align 4, !tbaa !5
%call32.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp40.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp40.not, label %for.end44, label %for.inc42
for.inc42: ; preds = %for.cond20.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond20.preheader
for.end44: ; preds = %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %heya) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 house 4
#define floor 3
#define room 10
int main()
{
short people[house][floor][room] = {0};
short n;
fscanf(stdin, "%hd", &n);
short i, b, f, r, v;
for (i = 0; i < n; i++) {
fscanf(stdin, "%hd %hd %hd %hd", &b, &f, &r, &v);
people[b - 1][f - 1][r - 1] += v;
}
short j, k;
for (i = 0; i < house; i++) {
for (j = 0; j < floor; j++) {
for (k = 0; k < room; k++) {
fprintf(stdout, " %hd", people[i][j][k]);
}
putchar('\n');
}
if (i < house - 1) {
fprintf(stdout, "####################\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236408/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 [4 x i8] c"%hd\00", align 1
@.str.1 = private unnamed_addr constant [16 x i8] c"%hd %hd %hd %hd\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [5 x i8] c" %hd\00", align 1
@.str.3 = private unnamed_addr constant [22 x i8] c"####################\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%people = alloca [4 x [3 x [10 x i16]]], align 16
%n = alloca i16, align 2
%b = alloca i16, align 2
%f = alloca i16, align 2
%r = alloca i16, align 2
%v = alloca i16, align 2
call void @llvm.lifetime.start.p0(i64 240, ptr nonnull %people) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240) %people, i8 0, i64 240, i1 false)
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %n) #6
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %f) #6
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %v) #6
%1 = load i16, ptr %n, align 2, !tbaa !9
%cmp62 = icmp sgt i16 %1, 0
br i1 %cmp62, label %for.body, label %for.cond21.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.063 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call3 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v) #6
%3 = load i16, ptr %v, align 2, !tbaa !9
%4 = load i16, ptr %b, align 2, !tbaa !9
%conv5 = sext i16 %4 to i64
%sub = add nsw i64 %conv5, -1
%5 = load i16, ptr %f, align 2, !tbaa !9
%conv6 = sext i16 %5 to i64
%sub7 = add nsw i64 %conv6, -1
%6 = load i16, ptr %r, align 2, !tbaa !9
%conv10 = sext i16 %6 to i64
%sub11 = add nsw i64 %conv10, -1
%arrayidx13 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %sub, i64 %sub7, i64 %sub11
%7 = load i16, ptr %arrayidx13, align 2, !tbaa !9
%add = add i16 %7, %3
store i16 %add, ptr %arrayidx13, align 2, !tbaa !9
%inc = add nuw nsw i16 %i.063, 1
%8 = load i16, ptr %n, align 2, !tbaa !9
%cmp = icmp slt i16 %inc, %8
br i1 %cmp, label %for.body, label %for.cond21.preheader.preheader, !llvm.loop !11
for.cond21.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.cond21.preheader.preheader, %for.inc50
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc50 ], [ 0, %for.cond21.preheader.preheader ]
%9 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 0
%10 = load i16, ptr %arrayidx36, align 4, !tbaa !9
%conv37 = sext i16 %10 to i32
%call38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.2, i32 noundef %conv37)
%11 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 1
%12 = load i16, ptr %arrayidx36.1, align 2, !tbaa !9
%conv37.1 = sext i16 %12 to i32
%call38.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.2, i32 noundef %conv37.1)
%13 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 2
%14 = load i16, ptr %arrayidx36.2, align 4, !tbaa !9
%conv37.2 = sext i16 %14 to i32
%call38.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.2, i32 noundef %conv37.2)
%15 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.3 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 3
%16 = load i16, ptr %arrayidx36.3, align 2, !tbaa !9
%conv37.3 = sext i16 %16 to i32
%call38.3 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.2, i32 noundef %conv37.3)
%17 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.4 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 4
%18 = load i16, ptr %arrayidx36.4, align 4, !tbaa !9
%conv37.4 = sext i16 %18 to i32
%call38.4 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.2, i32 noundef %conv37.4)
%19 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.5 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 5
%20 = load i16, ptr %arrayidx36.5, align 2, !tbaa !9
%conv37.5 = sext i16 %20 to i32
%call38.5 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.2, i32 noundef %conv37.5)
%21 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.6 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 6
%22 = load i16, ptr %arrayidx36.6, align 4, !tbaa !9
%conv37.6 = sext i16 %22 to i32
%call38.6 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.2, i32 noundef %conv37.6)
%23 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.7 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 7
%24 = load i16, ptr %arrayidx36.7, align 2, !tbaa !9
%conv37.7 = sext i16 %24 to i32
%call38.7 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.2, i32 noundef %conv37.7)
%25 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.8 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 8
%26 = load i16, ptr %arrayidx36.8, align 4, !tbaa !9
%conv37.8 = sext i16 %26 to i32
%call38.8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.2, i32 noundef %conv37.8)
%27 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.9 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 0, i64 9
%28 = load i16, ptr %arrayidx36.9, align 2, !tbaa !9
%conv37.9 = sext i16 %28 to i32
%call38.9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.2, i32 noundef %conv37.9)
%29 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %29)
%30 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.169 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 0
%31 = load i16, ptr %arrayidx36.169, align 4, !tbaa !9
%conv37.170 = sext i16 %31 to i32
%call38.171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.2, i32 noundef %conv37.170)
%32 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.1.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 1
%33 = load i16, ptr %arrayidx36.1.1, align 2, !tbaa !9
%conv37.1.1 = sext i16 %33 to i32
%call38.1.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.2, i32 noundef %conv37.1.1)
%34 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.2.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 2
%35 = load i16, ptr %arrayidx36.2.1, align 4, !tbaa !9
%conv37.2.1 = sext i16 %35 to i32
%call38.2.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.2, i32 noundef %conv37.2.1)
%36 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.3.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 3
%37 = load i16, ptr %arrayidx36.3.1, align 2, !tbaa !9
%conv37.3.1 = sext i16 %37 to i32
%call38.3.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.2, i32 noundef %conv37.3.1)
%38 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.4.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 4
%39 = load i16, ptr %arrayidx36.4.1, align 4, !tbaa !9
%conv37.4.1 = sext i16 %39 to i32
%call38.4.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.2, i32 noundef %conv37.4.1)
%40 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.5.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 5
%41 = load i16, ptr %arrayidx36.5.1, align 2, !tbaa !9
%conv37.5.1 = sext i16 %41 to i32
%call38.5.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.2, i32 noundef %conv37.5.1)
%42 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.6.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 6
%43 = load i16, ptr %arrayidx36.6.1, align 4, !tbaa !9
%conv37.6.1 = sext i16 %43 to i32
%call38.6.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.2, i32 noundef %conv37.6.1)
%44 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.7.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 7
%45 = load i16, ptr %arrayidx36.7.1, align 2, !tbaa !9
%conv37.7.1 = sext i16 %45 to i32
%call38.7.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.2, i32 noundef %conv37.7.1)
%46 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.8.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 8
%47 = load i16, ptr %arrayidx36.8.1, align 4, !tbaa !9
%conv37.8.1 = sext i16 %47 to i32
%call38.8.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.2, i32 noundef %conv37.8.1)
%48 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.9.1 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 1, i64 9
%49 = load i16, ptr %arrayidx36.9.1, align 2, !tbaa !9
%conv37.9.1 = sext i16 %49 to i32
%call38.9.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.2, i32 noundef %conv37.9.1)
%50 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i.1 = call i32 @putc(i32 noundef 10, ptr noundef %50)
%51 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.272 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 0
%52 = load i16, ptr %arrayidx36.272, align 4, !tbaa !9
%conv37.273 = sext i16 %52 to i32
%call38.274 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef nonnull @.str.2, i32 noundef %conv37.273)
%53 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.1.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 1
%54 = load i16, ptr %arrayidx36.1.2, align 2, !tbaa !9
%conv37.1.2 = sext i16 %54 to i32
%call38.1.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.2, i32 noundef %conv37.1.2)
%55 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.2.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 2
%56 = load i16, ptr %arrayidx36.2.2, align 4, !tbaa !9
%conv37.2.2 = sext i16 %56 to i32
%call38.2.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.2, i32 noundef %conv37.2.2)
%57 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.3.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 3
%58 = load i16, ptr %arrayidx36.3.2, align 2, !tbaa !9
%conv37.3.2 = sext i16 %58 to i32
%call38.3.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.2, i32 noundef %conv37.3.2)
%59 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.4.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 4
%60 = load i16, ptr %arrayidx36.4.2, align 4, !tbaa !9
%conv37.4.2 = sext i16 %60 to i32
%call38.4.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.2, i32 noundef %conv37.4.2)
%61 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.5.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 5
%62 = load i16, ptr %arrayidx36.5.2, align 2, !tbaa !9
%conv37.5.2 = sext i16 %62 to i32
%call38.5.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.2, i32 noundef %conv37.5.2)
%63 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.6.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 6
%64 = load i16, ptr %arrayidx36.6.2, align 4, !tbaa !9
%conv37.6.2 = sext i16 %64 to i32
%call38.6.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.2, i32 noundef %conv37.6.2)
%65 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.7.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 7
%66 = load i16, ptr %arrayidx36.7.2, align 2, !tbaa !9
%conv37.7.2 = sext i16 %66 to i32
%call38.7.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef nonnull @.str.2, i32 noundef %conv37.7.2)
%67 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.8.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 8
%68 = load i16, ptr %arrayidx36.8.2, align 4, !tbaa !9
%conv37.8.2 = sext i16 %68 to i32
%call38.8.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.2, i32 noundef %conv37.8.2)
%69 = load ptr, ptr @stdout, align 8, !tbaa !5
%arrayidx36.9.2 = getelementptr inbounds [4 x [3 x [10 x i16]]], ptr %people, i64 0, i64 %indvars.iv, i64 2, i64 9
%70 = load i16, ptr %arrayidx36.9.2, align 2, !tbaa !9
%conv37.9.2 = sext i16 %70 to i32
%call38.9.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef nonnull @.str.2, i32 noundef %conv37.9.2)
%71 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i.2 = call i32 @putc(i32 noundef 10, ptr noundef %71)
%cmp47 = icmp ult i64 %indvars.iv, 3
br i1 %cmp47, label %if.then, label %for.inc50
if.then: ; preds = %for.cond21.preheader
%72 = load ptr, ptr @stdout, align 8, !tbaa !5
%73 = call i64 @fwrite(ptr nonnull @.str.3, i64 21, i64 1, ptr %72)
br label %for.inc50
for.inc50: ; preds = %for.cond21.preheader, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 4
br i1 %exitcond.not, label %for.end52, label %for.cond21.preheader, !llvm.loop !13
for.end52: ; preds = %for.inc50
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %v) #6
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %f) #6
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 240, ptr nonnull %people) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { 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 = !{!"short", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main(void){
int mem[4][3][10]={0};
int b,f,r,v,n,i,j,k;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
mem[b-1][f-1][r-1]+=v;
}
for(i=0;i<4;i++){
for(j=0;j<3;j++){
for(k=0;k<10;k++)
printf(" %d",mem[i][j][k]);
putchar('\n');
}
if(i<3)
puts("####################");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236451/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236451/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.3 = private unnamed_addr constant [21 x i8] c"####################\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%mem = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %mem) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %mem, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #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
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.cond11.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.046 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.046, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond11.preheader.preheader, !llvm.loop !9
for.cond11.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.cond11.preheader.preheader, %for.inc33
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc33 ], [ 0, %for.cond11.preheader.preheader ]
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx22, align 8, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx22.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%call23.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx22.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx22.2, align 8, !tbaa !5
%call23.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx22.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%call23.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx22.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx22.4, align 8, !tbaa !5
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx22.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx22.5, align 4, !tbaa !5
%call23.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx22.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx22.6, align 8, !tbaa !5
%call23.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx22.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx22.7, align 4, !tbaa !5
%call23.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx22.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx22.8, align 8, !tbaa !5
%call23.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx22.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx22.9, align 4, !tbaa !5
%call23.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%17 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %17)
%arrayidx22.152 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 0
%18 = load i32, ptr %arrayidx22.152, align 8, !tbaa !5
%call23.153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx22.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 1
%19 = load i32, ptr %arrayidx22.1.1, align 4, !tbaa !5
%call23.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx22.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 2
%20 = load i32, ptr %arrayidx22.2.1, align 8, !tbaa !5
%call23.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx22.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 3
%21 = load i32, ptr %arrayidx22.3.1, align 4, !tbaa !5
%call23.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx22.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 4
%22 = load i32, ptr %arrayidx22.4.1, align 8, !tbaa !5
%call23.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx22.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 5
%23 = load i32, ptr %arrayidx22.5.1, align 4, !tbaa !5
%call23.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx22.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 6
%24 = load i32, ptr %arrayidx22.6.1, align 8, !tbaa !5
%call23.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx22.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 7
%25 = load i32, ptr %arrayidx22.7.1, align 4, !tbaa !5
%call23.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx22.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 8
%26 = load i32, ptr %arrayidx22.8.1, align 8, !tbaa !5
%call23.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%arrayidx22.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 1, i64 9
%27 = load i32, ptr %arrayidx22.9.1, align 4, !tbaa !5
%call23.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%28 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i.1 = call i32 @putc(i32 noundef 10, ptr noundef %28)
%arrayidx22.254 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 0
%29 = load i32, ptr %arrayidx22.254, align 8, !tbaa !5
%call23.255 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx22.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 1
%30 = load i32, ptr %arrayidx22.1.2, align 4, !tbaa !5
%call23.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx22.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 2
%31 = load i32, ptr %arrayidx22.2.2, align 8, !tbaa !5
%call23.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx22.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 3
%32 = load i32, ptr %arrayidx22.3.2, align 4, !tbaa !5
%call23.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx22.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 4
%33 = load i32, ptr %arrayidx22.4.2, align 8, !tbaa !5
%call23.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx22.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 5
%34 = load i32, ptr %arrayidx22.5.2, align 4, !tbaa !5
%call23.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx22.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 6
%35 = load i32, ptr %arrayidx22.6.2, align 8, !tbaa !5
%call23.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx22.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 7
%36 = load i32, ptr %arrayidx22.7.2, align 4, !tbaa !5
%call23.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%arrayidx22.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 8
%37 = load i32, ptr %arrayidx22.8.2, align 8, !tbaa !5
%call23.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %37)
%arrayidx22.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %mem, i64 0, i64 %indvars.iv, i64 2, i64 9
%38 = load i32, ptr %arrayidx22.9.2, align 4, !tbaa !5
%call23.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38)
%39 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i.2 = call i32 @putc(i32 noundef 10, ptr noundef %39)
%cmp31 = icmp ult i64 %indvars.iv, 3
br i1 %cmp31, label %if.then, label %for.inc33
if.then: ; preds = %for.cond11.preheader
%call32 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %for.inc33
for.inc33: ; preds = %for.cond11.preheader, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 4
br i1 %exitcond.not, label %for.end35, label %for.cond11.preheader, !llvm.loop !13
for.end35: ; preds = %for.inc33
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %mem) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 @putc(i32 noundef, ptr nocapture 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void) {
int a,i,j;
int b,f,r,v,n;
int house[4][3][10];
scanf("%d",&n);
for(i=0;i<4;i++){
for(j=0;j<3;j++){
for(a=0;a<10;a++){
house[i][j][a] = 0;
}
}
}
for(i = 0;i < n; i++){
scanf("%d",&b);
scanf("%d",&f);
scanf("%d",&r);
scanf("%d",&v);
house[b-1][f-1][r-1] += v;
}
for(i=0;i<4;i++){
for(j=0;j<3;j++){
for(a=0;a<10;a++){
printf(" %d",house[i][j][a]);
}
printf("\n");
}
if(i != 3)
printf("####################\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236495/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236495/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 = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
%house = alloca [4 x [3 x [10 x i32]]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %house) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %house, i8 0, i64 480, i1 false), !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1884 = icmp sgt i32 %0, 0
br i1 %cmp1884, label %for.body19, label %for.cond38.preheader.preheader
for.body19: ; preds = %entry, %for.body19
%i.185 = phi i32 [ %inc33, %for.body19 ], [ 0, %entry ]
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %f)
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r)
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom24 = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub26 = add nsw i32 %3, -1
%idxprom27 = sext i32 %sub26 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub29 = add nsw i32 %4, -1
%idxprom30 = sext i32 %sub29 to i64
%arrayidx31 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %idxprom24, i64 %idxprom27, i64 %idxprom30
%5 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx31, align 4, !tbaa !5
%inc33 = add nuw nsw i32 %i.185, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc33, %6
br i1 %cmp18, label %for.body19, label %for.cond38.preheader.preheader, !llvm.loop !9
for.cond38.preheader.preheader: ; preds = %for.body19, %entry
br label %for.cond38.preheader
for.cond38.preheader: ; preds = %for.cond38.preheader.preheader, %for.inc60
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc60 ], [ 0, %for.cond38.preheader.preheader ]
%arrayidx49 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx49, align 8, !tbaa !5
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%arrayidx49.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx49.1, align 4, !tbaa !5
%call50.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%arrayidx49.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx49.2, align 8, !tbaa !5
%call50.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%arrayidx49.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx49.3, align 4, !tbaa !5
%call50.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%arrayidx49.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx49.4, align 8, !tbaa !5
%call50.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
%arrayidx49.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx49.5, align 4, !tbaa !5
%call50.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
%arrayidx49.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx49.6, align 8, !tbaa !5
%call50.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%arrayidx49.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx49.7, align 4, !tbaa !5
%call50.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%arrayidx49.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx49.8, align 8, !tbaa !5
%call50.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%arrayidx49.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx49.9, align 4, !tbaa !5
%call50.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx49.197 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx49.197, align 8, !tbaa !5
%call50.198 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17)
%arrayidx49.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx49.1.1, align 4, !tbaa !5
%call50.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%arrayidx49.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx49.2.1, align 8, !tbaa !5
%call50.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
%arrayidx49.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx49.3.1, align 4, !tbaa !5
%call50.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %20)
%arrayidx49.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx49.4.1, align 8, !tbaa !5
%call50.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
%arrayidx49.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx49.5.1, align 4, !tbaa !5
%call50.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
%arrayidx49.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx49.6.1, align 8, !tbaa !5
%call50.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %23)
%arrayidx49.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx49.7.1, align 4, !tbaa !5
%call50.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24)
%arrayidx49.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx49.8.1, align 8, !tbaa !5
%call50.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %25)
%arrayidx49.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx49.9.1, align 4, !tbaa !5
%call50.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx49.299 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx49.299, align 8, !tbaa !5
%call50.2100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %27)
%arrayidx49.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx49.1.2, align 4, !tbaa !5
%call50.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %28)
%arrayidx49.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx49.2.2, align 8, !tbaa !5
%call50.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %29)
%arrayidx49.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx49.3.2, align 4, !tbaa !5
%call50.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %30)
%arrayidx49.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx49.4.2, align 8, !tbaa !5
%call50.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %31)
%arrayidx49.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx49.5.2, align 4, !tbaa !5
%call50.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %32)
%arrayidx49.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx49.6.2, align 8, !tbaa !5
%call50.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %33)
%arrayidx49.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx49.7.2, align 4, !tbaa !5
%call50.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34)
%arrayidx49.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx49.8.2, align 8, !tbaa !5
%call50.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %35)
%arrayidx49.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx49.9.2, align 4, !tbaa !5
%call50.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp58.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp58.not, label %for.end62, label %for.inc60
for.inc60: ; preds = %for.cond38.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond38.preheader
for.end62: ; preds = %for.cond38.preheader
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %house) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: 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"}
|
#include<stdio.h>
int main(void)
{
int house[4][3][10],b,f,r,v,n,i,j,k;
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<10;k++)
{
house[i][j][k] = 0;
}
}
}
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d %d %d",&b,&f,&r,&v);
house[b-1][f-1][r-1]+=v;
}
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<10;k++)
{
printf(" %d",house[i][j][k]);
}
printf("\n");
}
if(i<3)
{
printf("####################\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236538/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236538/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%house = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %house) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %house, i8 0, i64 480, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1881 = icmp sgt i32 %0, 0
br i1 %cmp1881, label %for.body19, label %for.cond35.preheader.preheader
for.body19: ; preds = %entry, %for.body19
%i.182 = phi i32 [ %inc30, %for.body19 ], [ 0, %entry ]
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom21 = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub23 = add nsw i32 %3, -1
%idxprom24 = sext i32 %sub23 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub26 = add nsw i32 %4, -1
%idxprom27 = sext i32 %sub26 to i64
%arrayidx28 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %idxprom21, i64 %idxprom24, i64 %idxprom27
%5 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx28, align 4, !tbaa !5
%inc30 = add nuw nsw i32 %i.182, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc30, %6
br i1 %cmp18, label %for.body19, label %for.cond35.preheader.preheader, !llvm.loop !9
for.cond35.preheader.preheader: ; preds = %for.body19, %entry
br label %for.cond35.preheader
for.cond35.preheader: ; preds = %for.cond35.preheader.preheader, %for.inc57
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc57 ], [ 0, %for.cond35.preheader.preheader ]
%arrayidx46 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx46, align 8, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx46.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
%call47.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx46.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx46.2, align 8, !tbaa !5
%call47.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx46.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx46.3, align 4, !tbaa !5
%call47.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx46.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx46.4, align 8, !tbaa !5
%call47.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx46.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx46.5, align 4, !tbaa !5
%call47.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx46.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx46.6, align 8, !tbaa !5
%call47.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx46.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx46.7, align 4, !tbaa !5
%call47.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx46.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx46.8, align 8, !tbaa !5
%call47.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx46.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx46.9, align 4, !tbaa !5
%call47.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx46.194 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx46.194, align 8, !tbaa !5
%call47.195 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx46.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx46.1.1, align 4, !tbaa !5
%call47.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx46.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx46.2.1, align 8, !tbaa !5
%call47.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx46.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx46.3.1, align 4, !tbaa !5
%call47.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx46.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx46.4.1, align 8, !tbaa !5
%call47.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx46.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx46.5.1, align 4, !tbaa !5
%call47.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx46.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx46.6.1, align 8, !tbaa !5
%call47.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx46.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx46.7.1, align 4, !tbaa !5
%call47.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx46.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx46.8.1, align 8, !tbaa !5
%call47.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx46.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx46.9.1, align 4, !tbaa !5
%call47.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx46.296 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx46.296, align 8, !tbaa !5
%call47.297 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx46.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx46.1.2, align 4, !tbaa !5
%call47.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx46.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx46.2.2, align 8, !tbaa !5
%call47.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx46.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx46.3.2, align 4, !tbaa !5
%call47.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx46.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx46.4.2, align 8, !tbaa !5
%call47.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx46.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx46.5.2, align 4, !tbaa !5
%call47.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx46.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx46.6.2, align 8, !tbaa !5
%call47.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx46.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx46.7.2, align 4, !tbaa !5
%call47.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx46.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx46.8.2, align 8, !tbaa !5
%call47.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx46.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx46.9.2, align 4, !tbaa !5
%call47.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp55 = icmp ult i64 %indvars.iv, 3
br i1 %cmp55, label %if.then, label %for.inc57
if.then: ; preds = %for.cond35.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc57
for.inc57: ; preds = %for.cond35.preheader, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 4
br i1 %exitcond.not, label %for.end59, label %for.cond35.preheader, !llvm.loop !11
for.end59: ; preds = %for.inc57
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %house) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: 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}
|
#include<stdio.h>
int main(){
int n,i,j,k,l,m;
int peo[4][3][10]={0};
int b[1000],f[1000],r[1000],v[1000];
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d %d %d %d",&b[i],&f[i],&r[i],&v[i]);
peo[b[i]-1][f[i]-1][r[i]-1]+=v[i];
}
for(j=0;j<4;j++){
for(k=0;k<3;k++){
for(l=0;l<=9;l++){
printf(" %d",peo[j][k][l]);
}
printf("\n");
}
if(j!=3){
for(m=1;m<=19;m++){
printf("#");
}
printf("#\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236581/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236581/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%peo = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca [1000 x i32], align 16
%f = alloca [1000 x i32], align 16
%r = alloca [1000 x i32], align 16
%v = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %peo) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %peo, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not77 = icmp slt i32 %0, 1
br i1 %cmp.not77, label %for.cond27.preheader.preheader, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %b, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %f, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [1000 x i32], ptr %r, i64 0, i64 %indvars.iv
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %v, i64 0, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx6)
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom12 = sext i32 %sub to i64
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%sub16 = add nsw i32 %3, -1
%idxprom17 = sext i32 %sub16 to i64
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%sub21 = add nsw i32 %4, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %idxprom12, i64 %idxprom17, i64 %idxprom22
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx23, 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.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond27.preheader.preheader, !llvm.loop !9
for.cond27.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond27.preheader
for.cond27.preheader: ; preds = %for.cond27.preheader.preheader, %for.inc56
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.inc56 ], [ 0, %for.cond27.preheader.preheader ]
%arrayidx38 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 0
%8 = load i32, ptr %arrayidx38, align 8, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx38.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 1
%9 = load i32, ptr %arrayidx38.1, align 4, !tbaa !5
%call39.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx38.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 2
%10 = load i32, ptr %arrayidx38.2, align 8, !tbaa !5
%call39.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx38.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 3
%11 = load i32, ptr %arrayidx38.3, align 4, !tbaa !5
%call39.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx38.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 4
%12 = load i32, ptr %arrayidx38.4, align 8, !tbaa !5
%call39.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx38.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 5
%13 = load i32, ptr %arrayidx38.5, align 4, !tbaa !5
%call39.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx38.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 6
%14 = load i32, ptr %arrayidx38.6, align 8, !tbaa !5
%call39.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx38.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 7
%15 = load i32, ptr %arrayidx38.7, align 4, !tbaa !5
%call39.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx38.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 8
%16 = load i32, ptr %arrayidx38.8, align 8, !tbaa !5
%call39.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%arrayidx38.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 0, i64 9
%17 = load i32, ptr %arrayidx38.9, align 4, !tbaa !5
%call39.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%putchar76 = call i32 @putchar(i32 10)
%arrayidx38.190 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 0
%18 = load i32, ptr %arrayidx38.190, align 8, !tbaa !5
%call39.191 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx38.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 1
%19 = load i32, ptr %arrayidx38.1.1, align 4, !tbaa !5
%call39.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx38.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 2
%20 = load i32, ptr %arrayidx38.2.1, align 8, !tbaa !5
%call39.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx38.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 3
%21 = load i32, ptr %arrayidx38.3.1, align 4, !tbaa !5
%call39.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx38.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 4
%22 = load i32, ptr %arrayidx38.4.1, align 8, !tbaa !5
%call39.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx38.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 5
%23 = load i32, ptr %arrayidx38.5.1, align 4, !tbaa !5
%call39.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx38.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 6
%24 = load i32, ptr %arrayidx38.6.1, align 8, !tbaa !5
%call39.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx38.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 7
%25 = load i32, ptr %arrayidx38.7.1, align 4, !tbaa !5
%call39.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx38.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 8
%26 = load i32, ptr %arrayidx38.8.1, align 8, !tbaa !5
%call39.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%arrayidx38.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 1, i64 9
%27 = load i32, ptr %arrayidx38.9.1, align 4, !tbaa !5
%call39.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%putchar76.1 = call i32 @putchar(i32 10)
%arrayidx38.292 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 0
%28 = load i32, ptr %arrayidx38.292, align 8, !tbaa !5
%call39.293 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx38.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 1
%29 = load i32, ptr %arrayidx38.1.2, align 4, !tbaa !5
%call39.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx38.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 2
%30 = load i32, ptr %arrayidx38.2.2, align 8, !tbaa !5
%call39.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx38.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 3
%31 = load i32, ptr %arrayidx38.3.2, align 4, !tbaa !5
%call39.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx38.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 4
%32 = load i32, ptr %arrayidx38.4.2, align 8, !tbaa !5
%call39.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx38.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 5
%33 = load i32, ptr %arrayidx38.5.2, align 4, !tbaa !5
%call39.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx38.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 6
%34 = load i32, ptr %arrayidx38.6.2, align 8, !tbaa !5
%call39.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx38.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 7
%35 = load i32, ptr %arrayidx38.7.2, align 4, !tbaa !5
%call39.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx38.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 8
%36 = load i32, ptr %arrayidx38.8.2, align 8, !tbaa !5
%call39.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%arrayidx38.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %peo, i64 0, i64 %indvars.iv94, i64 2, i64 9
%37 = load i32, ptr %arrayidx38.9.2, align 4, !tbaa !5
%call39.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %37)
%putchar76.2 = call i32 @putchar(i32 10)
%cmp47.not = icmp eq i64 %indvars.iv94, 3
br i1 %cmp47.not, label %for.end58, label %for.inc56
for.inc56: ; preds = %for.cond27.preheader
%putchar = call i32 @putchar(i32 35)
%putchar.1 = call i32 @putchar(i32 35)
%putchar.2 = call i32 @putchar(i32 35)
%putchar.3 = call i32 @putchar(i32 35)
%putchar.4 = call i32 @putchar(i32 35)
%putchar.5 = call i32 @putchar(i32 35)
%putchar.6 = call i32 @putchar(i32 35)
%putchar.7 = call i32 @putchar(i32 35)
%putchar.8 = call i32 @putchar(i32 35)
%putchar.9 = call i32 @putchar(i32 35)
%putchar.10 = call i32 @putchar(i32 35)
%putchar.11 = call i32 @putchar(i32 35)
%putchar.12 = call i32 @putchar(i32 35)
%putchar.13 = call i32 @putchar(i32 35)
%putchar.14 = call i32 @putchar(i32 35)
%putchar.15 = call i32 @putchar(i32 35)
%putchar.16 = call i32 @putchar(i32 35)
%putchar.17 = call i32 @putchar(i32 35)
%putchar.18 = call i32 @putchar(i32 35)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
br label %for.cond27.preheader
for.end58: ; preds = %for.cond27.preheader
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %peo) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 p[4][3][10],i,j,k,n,b,f,r,v;
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 10; k++) {
p[i][j][k] = 0;
}
}
}
scanf("%d", &n);
for (i = 0; i < n;i++) {
scanf("%d%d%d%d", &b, &f, &r, &v);
p[b-1][f-1][r-1] += v;
}
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 10; k++) {
printf(" %d",p[i][j][k]);
}
printf("\n");
}
if (i == 3)
break;
printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236631/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236631/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%p = alloca [4 x [3 x [10 x i32]]], align 16
%n = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %p, i8 0, i64 480, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1881 = icmp sgt i32 %0, 0
br i1 %cmp1881, label %for.body19, label %for.cond35.preheader.preheader
for.body19: ; preds = %entry, %for.body19
%i.182 = phi i32 [ %inc30, %for.body19 ], [ 0, %entry ]
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom21 = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub23 = add nsw i32 %3, -1
%idxprom24 = sext i32 %sub23 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub26 = add nsw i32 %4, -1
%idxprom27 = sext i32 %sub26 to i64
%arrayidx28 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %idxprom21, i64 %idxprom24, i64 %idxprom27
%5 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx28, align 4, !tbaa !5
%inc30 = add nuw nsw i32 %i.182, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc30, %6
br i1 %cmp18, label %for.body19, label %for.cond35.preheader.preheader, !llvm.loop !9
for.cond35.preheader.preheader: ; preds = %for.body19, %entry
br label %for.cond35.preheader
for.cond35.preheader: ; preds = %for.cond35.preheader.preheader, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %for.cond35.preheader.preheader ]
%arrayidx46 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx46, align 8, !tbaa !5
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx46.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
%call47.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx46.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx46.2, align 8, !tbaa !5
%call47.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx46.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx46.3, align 4, !tbaa !5
%call47.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx46.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx46.4, align 8, !tbaa !5
%call47.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx46.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx46.5, align 4, !tbaa !5
%call47.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx46.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx46.6, align 8, !tbaa !5
%call47.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx46.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx46.7, align 4, !tbaa !5
%call47.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx46.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx46.8, align 8, !tbaa !5
%call47.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx46.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx46.9, align 4, !tbaa !5
%call47.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx46.194 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx46.194, align 8, !tbaa !5
%call47.195 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx46.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx46.1.1, align 4, !tbaa !5
%call47.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx46.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx46.2.1, align 8, !tbaa !5
%call47.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx46.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx46.3.1, align 4, !tbaa !5
%call47.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx46.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx46.4.1, align 8, !tbaa !5
%call47.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx46.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx46.5.1, align 4, !tbaa !5
%call47.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx46.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx46.6.1, align 8, !tbaa !5
%call47.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx46.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx46.7.1, align 4, !tbaa !5
%call47.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx46.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx46.8.1, align 8, !tbaa !5
%call47.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx46.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx46.9.1, align 4, !tbaa !5
%call47.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx46.296 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx46.296, align 8, !tbaa !5
%call47.297 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx46.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx46.1.2, align 4, !tbaa !5
%call47.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx46.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx46.2.2, align 8, !tbaa !5
%call47.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx46.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx46.3.2, align 4, !tbaa !5
%call47.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx46.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx46.4.2, align 8, !tbaa !5
%call47.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx46.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx46.5.2, align 4, !tbaa !5
%call47.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx46.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx46.6.2, align 8, !tbaa !5
%call47.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx46.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx46.7.2, align 4, !tbaa !5
%call47.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx46.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx46.8.2, align 8, !tbaa !5
%call47.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx46.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %p, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx46.9.2, align 4, !tbaa !5
%call47.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp55 = icmp eq i64 %indvars.iv, 3
br i1 %cmp55, label %for.end59, label %if.end
if.end: ; preds = %for.cond35.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond35.preheader
for.end59: ; preds = %for.cond35.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %p) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: 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"}
|
#include <stdio.h>
int main(void){
int house[4][3][10]={},n,i,b,f,r,v;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
house[b-1][f-1][r-1] += v;
}
for(b=0;b<4;b++){
for(f=0;f<3;f++){
for(r=0;r<10;r++){
printf(" %d",house[b][f][r]);
}
printf("\n");
}
if (b != 3) printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236682/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236682/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%house = alloca [4 x [3 x [10 x i32]]], align 16
%n = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %house) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %house, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body, %entry
store i32 0, ptr %b, align 4, !tbaa !5
br label %for.cond11.preheader
for.body: ; preds = %entry, %for.body
%i.040 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.040, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.cond8.preheader, %for.inc33
store i32 0, ptr %f, align 4, !tbaa !5
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond11.preheader, %for.end26
store i32 0, ptr %r, align 4, !tbaa !5
br label %for.body16
for.body16: ; preds = %for.cond14.preheader, %for.body16
%storemerge3841 = phi i32 [ 0, %for.cond14.preheader ], [ %inc25, %for.body16 ]
%7 = load i32, ptr %b, align 4, !tbaa !5
%idxprom17 = sext i32 %7 to i64
%8 = load i32, ptr %f, align 4, !tbaa !5
%idxprom19 = sext i32 %8 to i64
%idxprom21 = sext i32 %storemerge3841 to i64
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %idxprom17, i64 %idxprom19, i64 %idxprom21
%9 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%10 = load i32, ptr %r, align 4, !tbaa !5
%inc25 = add nsw i32 %10, 1
store i32 %inc25, ptr %r, align 4, !tbaa !5
%cmp15 = icmp slt i32 %10, 9
br i1 %cmp15, label %for.body16, label %for.end26, !llvm.loop !11
for.end26: ; preds = %for.body16
%putchar = call i32 @putchar(i32 10)
%11 = load i32, ptr %f, align 4, !tbaa !5
%inc29 = add nsw i32 %11, 1
store i32 %inc29, ptr %f, align 4, !tbaa !5
%cmp12 = icmp slt i32 %11, 2
br i1 %cmp12, label %for.cond14.preheader, label %for.end30, !llvm.loop !12
for.end30: ; preds = %for.end26
%12 = load i32, ptr %b, align 4, !tbaa !5
%cmp31.not = icmp eq i32 %12, 3
br i1 %cmp31.not, label %for.end35, label %for.inc33
for.inc33: ; preds = %for.end30
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %b, align 4, !tbaa !5
%inc34 = add nsw i32 %.pre, 1
store i32 %inc34, ptr %b, align 4, !tbaa !5
%cmp9 = icmp slt i32 %.pre, 3
br i1 %cmp9, label %for.cond11.preheader, label %for.end35, !llvm.loop !13
for.end35: ; preds = %for.inc33, %for.end30
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %house) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int n, b, f, r, v;
int i, j;
int info[12][10];
for(i = 0; i < 12;i++)
for(j = 0; j < 10;j++)
info[i][j] = 0;
scanf("%d", &n);
for(i = 0;i < n;i++){
scanf("%d%d%d%d", &b, &f, &r, &v);
info[(b-1)*3+(f-1)][r-1] = info[(b-1)*3+(f-1)][r-1] + v;
}
for(i = 0;i < 12;i++){
for(j = 0; j < 10; j++){
printf(" %d", info[i][j]);
}
if((i+1) % 3 == 0 && i != 11) printf("\n####################");
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236725/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236725/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.3 = private unnamed_addr constant [22 x i8] c"\0A####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%info = alloca [12 x [10 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 %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %info) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %info, i8 0, i64 480, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1070 = icmp sgt i32 %0, 0
br i1 %cmp1070, label %for.body11, label %for.cond35.preheader.preheader
for.body11: ; preds = %entry, %for.body11
%i.171 = phi i32 [ %inc30, %for.body11 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = mul i32 %1, 3
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub13 = add i32 %3, -4
%add = add i32 %sub13, %2
%idxprom14 = sext i32 %add to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub16 = add nsw i32 %4, -1
%idxprom17 = sext i32 %sub16 to i64
%arrayidx18 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %idxprom14, i64 %idxprom17
%5 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%6 = load i32, ptr %v, align 4, !tbaa !5
%add19 = add nsw i32 %6, %5
store i32 %add19, ptr %arrayidx18, align 4, !tbaa !5
%inc30 = add nuw nsw i32 %i.171, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc30, %7
br i1 %cmp10, label %for.body11, label %for.cond35.preheader.preheader, !llvm.loop !9
for.cond35.preheader.preheader: ; preds = %for.body11, %entry
br label %for.cond35.preheader
for.cond35.preheader: ; preds = %for.cond35.preheader.preheader, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %for.cond35.preheader.preheader ]
%arrayidx41 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 0
%8 = load i32, ptr %arrayidx41, align 8, !tbaa !5
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx41.1 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 1
%9 = load i32, ptr %arrayidx41.1, align 4, !tbaa !5
%call42.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx41.2 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 2
%10 = load i32, ptr %arrayidx41.2, align 8, !tbaa !5
%call42.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx41.3 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 3
%11 = load i32, ptr %arrayidx41.3, align 4, !tbaa !5
%call42.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx41.4 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 4
%12 = load i32, ptr %arrayidx41.4, align 8, !tbaa !5
%call42.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx41.5 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 5
%13 = load i32, ptr %arrayidx41.5, align 4, !tbaa !5
%call42.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx41.6 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 6
%14 = load i32, ptr %arrayidx41.6, align 8, !tbaa !5
%call42.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx41.7 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 7
%15 = load i32, ptr %arrayidx41.7, align 4, !tbaa !5
%call42.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx41.8 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 8
%16 = load i32, ptr %arrayidx41.8, align 8, !tbaa !5
%call42.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%arrayidx41.9 = getelementptr inbounds [12 x [10 x i32]], ptr %info, i64 0, i64 %indvars.iv, i64 9
%17 = load i32, ptr %arrayidx41.9, align 4, !tbaa !5
%call42.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%18 = trunc i64 %indvars.iv.next to i32
%rem = urem i32 %18, 3
%cmp47 = icmp eq i32 %rem, 0
%cmp48 = icmp ne i64 %indvars.iv, 11
%or.cond = and i1 %cmp48, %cmp47
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %for.cond35.preheader
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end
if.end: ; preds = %if.then, %for.cond35.preheader
%putchar = call i32 @putchar(i32 10)
%exitcond.not = icmp eq i64 %indvars.iv.next, 12
br i1 %exitcond.not, label %for.end53, label %for.cond35.preheader, !llvm.loop !11
for.end53: ; preds = %if.end
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %info) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #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: 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: 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}
|
#include <stdio.h>
int main(void){
int i,j,k,n;
int data[4][3][10] = {{{0}}};
scanf("%d",&n);
for(i = 0; i < n; i++) {
int b, f, r, v;
scanf("%d %d %d %d", &b, &f, &r, &v);
data[b-1][f-1][r-1] += v;
}
for(i=0;i<4;i++){
for(j=0;j<3;j++){
for(k=0;k<10;k++){
printf(" %d",data[i][j][k]);
}
printf("\n");}
if(i!=3)
printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236769/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236769/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%data = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %data) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %data, i8 0, i64 480, 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
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.cond11.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.046 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
%inc = add nuw nsw i32 %i.046, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond11.preheader.preheader, !llvm.loop !9
for.cond11.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.cond11.preheader.preheader, %for.inc33
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc33 ], [ 0, %for.cond11.preheader.preheader ]
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx22, align 8, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx22.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%call23.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx22.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx22.2, align 8, !tbaa !5
%call23.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx22.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%call23.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx22.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx22.4, align 8, !tbaa !5
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx22.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx22.5, align 4, !tbaa !5
%call23.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx22.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx22.6, align 8, !tbaa !5
%call23.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx22.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx22.7, align 4, !tbaa !5
%call23.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx22.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx22.8, align 8, !tbaa !5
%call23.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx22.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx22.9, align 4, !tbaa !5
%call23.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx22.152 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx22.152, align 8, !tbaa !5
%call23.153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx22.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx22.1.1, align 4, !tbaa !5
%call23.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx22.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx22.2.1, align 8, !tbaa !5
%call23.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx22.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx22.3.1, align 4, !tbaa !5
%call23.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx22.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx22.4.1, align 8, !tbaa !5
%call23.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx22.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx22.5.1, align 4, !tbaa !5
%call23.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx22.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx22.6.1, align 8, !tbaa !5
%call23.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx22.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx22.7.1, align 4, !tbaa !5
%call23.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx22.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx22.8.1, align 8, !tbaa !5
%call23.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx22.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx22.9.1, align 4, !tbaa !5
%call23.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx22.254 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx22.254, align 8, !tbaa !5
%call23.255 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx22.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx22.1.2, align 4, !tbaa !5
%call23.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx22.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx22.2.2, align 8, !tbaa !5
%call23.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx22.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx22.3.2, align 4, !tbaa !5
%call23.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx22.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx22.4.2, align 8, !tbaa !5
%call23.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx22.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx22.5.2, align 4, !tbaa !5
%call23.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx22.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx22.6.2, align 8, !tbaa !5
%call23.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx22.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx22.7.2, align 4, !tbaa !5
%call23.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx22.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx22.8.2, align 8, !tbaa !5
%call23.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx22.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx22.9.2, align 4, !tbaa !5
%call23.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp31.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp31.not, label %for.end35, label %for.inc33
for.inc33: ; preds = %for.cond11.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond11.preheader
for.end35: ; preds = %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %data) #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: 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: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
////////////////////////////////////////////////////////////////////////
//ファイル名:ITP_1_6_C_Official House.c
//内容;4つの建物を管理します。それぞれの建物には3つのフロアがあり、
// それぞれが10の部屋で構成されています。
// テナント通知を読み取り、各部屋のテナント数を報告するプログラム
//
//入力:通知の数 n, 建物bのf階の部屋rにv人が入室したことを表す
// 4つの整数b、f、r、およびv
//
//出力:建物ごとに1階、2階、3階の情報を表示する。
// 建物の間に "####################"(20 '#')を出力する。
//
//制約:n ≧ 0
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#define BULDING_NUM_MIN 1
#define BULDING_NUM_MAX 4
#define FLOOR_NUM_MIN 1
#define FLOOR_NUM_MAX 3
#define ROOM_NUM_MIN 1
#define ROOM_NUM_MAX 10
#define PEOPLE_NUM_MIN -9
#define PEOPLE_NUM_MAX 9
int main()
{
int t[BULDING_NUM_MAX][FLOOR_NUM_MAX][ROOM_NUM_MAX] = {0}; //建物情報用の配列
int b,f,r,v; //b:建物 f:階層 r:部屋 v:人数
int i,j,k; //for文用
int n; //通知数
//通知数を入力
scanf("%d", &n);
//制約の範囲外ならエラーメッセージを出力
if(n <= 0 )
{
printf("Invalid Input\n");
return 0;
}
//通知情報を入力
for(i=0; i<n; i++)
{
scanf("%d%d%d%d", &b,&f,&r,&v);
//制約の範囲外ならエラーメッセージを出力
if( b < BULDING_NUM_MIN || b > BULDING_NUM_MAX ||
f < FLOOR_NUM_MIN || f > FLOOR_NUM_MAX ||
r < ROOM_NUM_MIN || r > ROOM_NUM_MAX ||
v < PEOPLE_NUM_MIN || v > PEOPLE_NUM_MAX)
{
printf("Invalid Input\n");
return 0;
}
t[b-1][f-1][r-1] = t[b-1][f-1][r-1] + v;
}
//各建物の情報を順に出力
for(i=0; i<BULDING_NUM_MAX; i++)
{
for(j=0; j<FLOOR_NUM_MAX; j++)
{
for(k=0; k<ROOM_NUM_MAX; k++)
{
printf(" %d", t[i][j][k]);
}
printf("\n");
}
if(i != 3)
{
printf("####################\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236840/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
@str.7 = private unnamed_addr constant [14 x i8] c"Invalid Input\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %t) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %t, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
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
%cmp = icmp slt i32 %0, 1
br i1 %cmp, label %cleanup.sink.split, label %for.body
for.body: ; preds = %entry, %if.end20
%i.092 = phi i32 [ %inc, %if.end20 ], [ 0, %entry ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %b, align 4
%2 = add i32 %1, -5
%or.cond = icmp ult i32 %2, -4
%3 = load i32, ptr %f, align 4
%cmp7 = icmp slt i32 %3, 1
%or.cond74 = select i1 %or.cond, i1 true, i1 %cmp7
%cmp9 = icmp sgt i32 %3, 3
%or.cond75 = select i1 %or.cond74, i1 true, i1 %cmp9
%4 = load i32, ptr %r, align 4
%cmp11 = icmp slt i32 %4, 1
%or.cond76 = select i1 %or.cond75, i1 true, i1 %cmp11
%cmp13 = icmp sgt i32 %4, 10
%or.cond77 = select i1 %or.cond76, i1 true, i1 %cmp13
%5 = load i32, ptr %v, align 4
%cmp15 = icmp slt i32 %5, -9
%or.cond78 = select i1 %or.cond77, i1 true, i1 %cmp15
%cmp17 = icmp sgt i32 %5, 9
%or.cond79 = select i1 %or.cond78, i1 true, i1 %cmp17
br i1 %or.cond79, label %cleanup.sink.split, label %if.end20
if.end20: ; preds = %for.body
%sub = add nsw i32 %1, -1
%idxprom = zext i32 %sub to i64
%sub21 = add nsw i32 %3, -1
%idxprom22 = zext i32 %sub21 to i64
%sub24 = add nsw i32 %4, -1
%idxprom25 = zext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %idxprom, i64 %idxprom22, i64 %idxprom25
%6 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%add = add nsw i32 %6, %5
store i32 %add, ptr %arrayidx26, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.092, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc, %7
br i1 %cmp2, label %for.body, label %for.cond39.preheader, !llvm.loop !9
for.cond39.preheader: ; preds = %if.end20, %for.inc63
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc63 ], [ 0, %if.end20 ]
%arrayidx50 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 0
%8 = load i32, ptr %arrayidx50, align 8, !tbaa !5
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
%arrayidx50.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 1
%9 = load i32, ptr %arrayidx50.1, align 4, !tbaa !5
%call51.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
%arrayidx50.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 2
%10 = load i32, ptr %arrayidx50.2, align 8, !tbaa !5
%call51.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
%arrayidx50.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 3
%11 = load i32, ptr %arrayidx50.3, align 4, !tbaa !5
%call51.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %11)
%arrayidx50.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 4
%12 = load i32, ptr %arrayidx50.4, align 8, !tbaa !5
%call51.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
%arrayidx50.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 5
%13 = load i32, ptr %arrayidx50.5, align 4, !tbaa !5
%call51.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %13)
%arrayidx50.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 6
%14 = load i32, ptr %arrayidx50.6, align 8, !tbaa !5
%call51.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %14)
%arrayidx50.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 7
%15 = load i32, ptr %arrayidx50.7, align 4, !tbaa !5
%call51.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %15)
%arrayidx50.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 8
%16 = load i32, ptr %arrayidx50.8, align 8, !tbaa !5
%call51.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %16)
%arrayidx50.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 0, i64 9
%17 = load i32, ptr %arrayidx50.9, align 4, !tbaa !5
%call51.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %17)
%putchar = call i32 @putchar(i32 10)
%arrayidx50.198 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 0
%18 = load i32, ptr %arrayidx50.198, align 8, !tbaa !5
%call51.199 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18)
%arrayidx50.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 1
%19 = load i32, ptr %arrayidx50.1.1, align 4, !tbaa !5
%call51.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %19)
%arrayidx50.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 2
%20 = load i32, ptr %arrayidx50.2.1, align 8, !tbaa !5
%call51.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %20)
%arrayidx50.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 3
%21 = load i32, ptr %arrayidx50.3.1, align 4, !tbaa !5
%call51.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %21)
%arrayidx50.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 4
%22 = load i32, ptr %arrayidx50.4.1, align 8, !tbaa !5
%call51.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
%arrayidx50.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 5
%23 = load i32, ptr %arrayidx50.5.1, align 4, !tbaa !5
%call51.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %23)
%arrayidx50.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 6
%24 = load i32, ptr %arrayidx50.6.1, align 8, !tbaa !5
%call51.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %24)
%arrayidx50.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 7
%25 = load i32, ptr %arrayidx50.7.1, align 4, !tbaa !5
%call51.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %25)
%arrayidx50.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 8
%26 = load i32, ptr %arrayidx50.8.1, align 8, !tbaa !5
%call51.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %26)
%arrayidx50.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 1, i64 9
%27 = load i32, ptr %arrayidx50.9.1, align 4, !tbaa !5
%call51.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %27)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx50.2100 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 0
%28 = load i32, ptr %arrayidx50.2100, align 8, !tbaa !5
%call51.2101 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %28)
%arrayidx50.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 1
%29 = load i32, ptr %arrayidx50.1.2, align 4, !tbaa !5
%call51.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %29)
%arrayidx50.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 2
%30 = load i32, ptr %arrayidx50.2.2, align 8, !tbaa !5
%call51.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %30)
%arrayidx50.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 3
%31 = load i32, ptr %arrayidx50.3.2, align 4, !tbaa !5
%call51.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %31)
%arrayidx50.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 4
%32 = load i32, ptr %arrayidx50.4.2, align 8, !tbaa !5
%call51.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %32)
%arrayidx50.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 5
%33 = load i32, ptr %arrayidx50.5.2, align 4, !tbaa !5
%call51.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %33)
%arrayidx50.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 6
%34 = load i32, ptr %arrayidx50.6.2, align 8, !tbaa !5
%call51.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %34)
%arrayidx50.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 7
%35 = load i32, ptr %arrayidx50.7.2, align 4, !tbaa !5
%call51.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %35)
%arrayidx50.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 8
%36 = load i32, ptr %arrayidx50.8.2, align 8, !tbaa !5
%call51.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %36)
%arrayidx50.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %t, i64 0, i64 %indvars.iv, i64 2, i64 9
%37 = load i32, ptr %arrayidx50.9.2, align 4, !tbaa !5
%call51.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %37)
%putchar.2 = call i32 @putchar(i32 10)
%cmp59.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp59.not, label %cleanup, label %for.inc63
for.inc63: ; preds = %for.cond39.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond39.preheader
cleanup.sink.split: ; preds = %for.body, %entry
%str.6.sink = phi ptr [ @str.7, %entry ], [ @str.7, %for.body ]
%puts89 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
br label %cleanup
cleanup: ; preds = %for.cond39.preheader, %cleanup.sink.split
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 i, j, k, n, b, f, r, v, house[4][3][10]={0};
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d %d %d %d", &b, &f, &r, &v);
house[b-1][f-1][r-1]+=v;
}
for(i=0; i<4; i++){
for(j=0; j<3; j++){
for(k=0; k<10; k++){
printf(" %d", house[i][j][k]);
}
putchar('\n');
}
if(i!=3){
printf("####################\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236884/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236884/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%house = alloca [4 x [3 x [10 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 %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %house) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %house, i8 0, i64 480, 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
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.cond11.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.046 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.046, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond11.preheader.preheader, !llvm.loop !9
for.cond11.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.cond11.preheader.preheader, %for.inc33
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc33 ], [ 0, %for.cond11.preheader.preheader ]
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx22, align 8, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx22.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%call23.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx22.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx22.2, align 8, !tbaa !5
%call23.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx22.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%call23.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx22.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx22.4, align 8, !tbaa !5
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx22.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx22.5, align 4, !tbaa !5
%call23.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx22.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx22.6, align 8, !tbaa !5
%call23.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx22.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx22.7, align 4, !tbaa !5
%call23.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx22.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx22.8, align 8, !tbaa !5
%call23.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx22.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx22.9, align 4, !tbaa !5
%call23.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%17 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %17)
%arrayidx22.152 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 0
%18 = load i32, ptr %arrayidx22.152, align 8, !tbaa !5
%call23.153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx22.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 1
%19 = load i32, ptr %arrayidx22.1.1, align 4, !tbaa !5
%call23.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx22.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 2
%20 = load i32, ptr %arrayidx22.2.1, align 8, !tbaa !5
%call23.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx22.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 3
%21 = load i32, ptr %arrayidx22.3.1, align 4, !tbaa !5
%call23.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx22.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 4
%22 = load i32, ptr %arrayidx22.4.1, align 8, !tbaa !5
%call23.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx22.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 5
%23 = load i32, ptr %arrayidx22.5.1, align 4, !tbaa !5
%call23.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx22.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 6
%24 = load i32, ptr %arrayidx22.6.1, align 8, !tbaa !5
%call23.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx22.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 7
%25 = load i32, ptr %arrayidx22.7.1, align 4, !tbaa !5
%call23.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx22.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 8
%26 = load i32, ptr %arrayidx22.8.1, align 8, !tbaa !5
%call23.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%arrayidx22.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 9
%27 = load i32, ptr %arrayidx22.9.1, align 4, !tbaa !5
%call23.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%28 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i.1 = call i32 @putc(i32 noundef 10, ptr noundef %28)
%arrayidx22.254 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 0
%29 = load i32, ptr %arrayidx22.254, align 8, !tbaa !5
%call23.255 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx22.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 1
%30 = load i32, ptr %arrayidx22.1.2, align 4, !tbaa !5
%call23.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx22.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 2
%31 = load i32, ptr %arrayidx22.2.2, align 8, !tbaa !5
%call23.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx22.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 3
%32 = load i32, ptr %arrayidx22.3.2, align 4, !tbaa !5
%call23.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx22.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 4
%33 = load i32, ptr %arrayidx22.4.2, align 8, !tbaa !5
%call23.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx22.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 5
%34 = load i32, ptr %arrayidx22.5.2, align 4, !tbaa !5
%call23.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx22.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 6
%35 = load i32, ptr %arrayidx22.6.2, align 8, !tbaa !5
%call23.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx22.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 7
%36 = load i32, ptr %arrayidx22.7.2, align 4, !tbaa !5
%call23.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%arrayidx22.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 8
%37 = load i32, ptr %arrayidx22.8.2, align 8, !tbaa !5
%call23.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %37)
%arrayidx22.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 9
%38 = load i32, ptr %arrayidx22.9.2, align 4, !tbaa !5
%call23.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38)
%39 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i.2 = call i32 @putc(i32 noundef 10, ptr noundef %39)
%cmp31.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp31.not, label %for.end35, label %for.inc33
for.inc33: ; preds = %for.cond11.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond11.preheader
for.end35: ; preds = %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %house) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
int b = 0;
int f = 0;
int r = 0;
int v = 0;
int roomMem[4][3][10] = { 0 };
char sh[21] ="####################";
// 0 = スペードが'S'、 1 = ハートが'H'、2 =クラブが'C'、3 = ダイヤが'D'
int n;
scanf("%d", &n);
int i = 0;
for (; i < n; i++) {
scanf("%d %d %d %d", &b, &f, &r, &v);
roomMem[b - 1][f - 1][r - 1] += v;
}
int b_i = 0;
for (; b_i < 4; b_i++) {
int f_i = 0;
for (f_i = 0; f_i < 3; f_i++) {
int r_i = 0;
for (r_i = 0; r_i < 10; r_i++) {
printf(" %d", roomMem[b_i][f_i][r_i]);
//if (r_i != 9) {
// printf(" ");
//}
}
//if (b_i == 3 && f_i == 2) {
//}else {
printf("\n");
//}
}
if (b_i != 3) {
printf("%s\n", sh);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236927/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.sh = private unnamed_addr constant [21 x i8] c"####################\00", align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%roomMem = alloca [4 x [3 x [10 x i32]]], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
store i32 0, ptr %b, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
store i32 0, ptr %f, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
store i32 0, ptr %r, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
store i32 0, ptr %v, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %roomMem) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %roomMem, i8 0, i64 480, i1 false)
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
%cmp44 = icmp sgt i32 %0, 0
br i1 %cmp44, label %for.body, label %for.cond11.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.045 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %3, -1
%idxprom3 = sext i32 %sub2 to i64
%4 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %4, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.045, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond11.preheader.preheader, !llvm.loop !9
for.cond11.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.cond11.preheader.preheader, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %for.cond11.preheader.preheader ]
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx22, align 8, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx22.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%call23.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx22.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx22.2, align 8, !tbaa !5
%call23.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx22.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%call23.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx22.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx22.4, align 8, !tbaa !5
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx22.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx22.5, align 4, !tbaa !5
%call23.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx22.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx22.6, align 8, !tbaa !5
%call23.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx22.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx22.7, align 4, !tbaa !5
%call23.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx22.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx22.8, align 8, !tbaa !5
%call23.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx22.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx22.9, align 4, !tbaa !5
%call23.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx22.151 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx22.151, align 8, !tbaa !5
%call23.152 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx22.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx22.1.1, align 4, !tbaa !5
%call23.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx22.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx22.2.1, align 8, !tbaa !5
%call23.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx22.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx22.3.1, align 4, !tbaa !5
%call23.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx22.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx22.4.1, align 8, !tbaa !5
%call23.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx22.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx22.5.1, align 4, !tbaa !5
%call23.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx22.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx22.6.1, align 8, !tbaa !5
%call23.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx22.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx22.7.1, align 4, !tbaa !5
%call23.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx22.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx22.8.1, align 8, !tbaa !5
%call23.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx22.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx22.9.1, align 4, !tbaa !5
%call23.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx22.253 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx22.253, align 8, !tbaa !5
%call23.254 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx22.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx22.1.2, align 4, !tbaa !5
%call23.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx22.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx22.2.2, align 8, !tbaa !5
%call23.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx22.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx22.3.2, align 4, !tbaa !5
%call23.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx22.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx22.4.2, align 8, !tbaa !5
%call23.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx22.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx22.5.2, align 4, !tbaa !5
%call23.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx22.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx22.6.2, align 8, !tbaa !5
%call23.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx22.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx22.7.2, align 4, !tbaa !5
%call23.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx22.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx22.8.2, align 8, !tbaa !5
%call23.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx22.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %roomMem, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx22.9.2, align 4, !tbaa !5
%call23.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp31.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp31.not, label %for.end35, label %if.end
if.end: ; preds = %for.cond11.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @__const.main.sh)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond11.preheader
for.end35: ; preds = %for.cond11.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %roomMem) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 room[10][3][4] = {0};
int n,b,f,r,v;
/*入力部*/
scanf("%d",&n);
for (int i = 0; i < n; ++i)
{
scanf("%d %d %d %d",&b,&f,&r,&v);
room[--r][--f][--b] += v;
}
/*出力部*/
for (int i = 0; i < 4; ++i)
{
for (int j= 0; j < 3; ++j)
{
for (int k= 0; k < 10; ++k)
{
printf(" %d", room[k][j][i]);
}
printf("\n");
}
if (i == 3)break;
printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236970/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236970/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%room = alloca [10 x [3 x [4 x i32]]], align 16
%n = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %room) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %room, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body, label %for.cond13.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.055 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %r, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %r, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%3 = load i32, ptr %f, align 4, !tbaa !5
%dec2 = add nsw i32 %3, -1
store i32 %dec2, ptr %f, align 4, !tbaa !5
%idxprom3 = sext i32 %dec2 to i64
%4 = load i32, ptr %b, align 4, !tbaa !5
%dec5 = add nsw i32 %4, -1
store i32 %dec5, ptr %b, align 4, !tbaa !5
%idxprom6 = sext i32 %dec5 to i64
%arrayidx7 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %5, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.055, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond13.preheader.preheader, !llvm.loop !9
for.cond13.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %for.cond13.preheader.preheader ]
%arrayidx26 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 0, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx26.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 1, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%call27.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx26.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 2, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx26.2, align 4, !tbaa !5
%call27.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx26.3 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 3, i64 0, i64 %indvars.iv
%10 = load i32, ptr %arrayidx26.3, align 4, !tbaa !5
%call27.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx26.4 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 4, i64 0, i64 %indvars.iv
%11 = load i32, ptr %arrayidx26.4, align 4, !tbaa !5
%call27.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx26.5 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 5, i64 0, i64 %indvars.iv
%12 = load i32, ptr %arrayidx26.5, align 4, !tbaa !5
%call27.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx26.6 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 6, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx26.6, align 4, !tbaa !5
%call27.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx26.7 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 7, i64 0, i64 %indvars.iv
%14 = load i32, ptr %arrayidx26.7, align 4, !tbaa !5
%call27.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx26.8 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 8, i64 0, i64 %indvars.iv
%15 = load i32, ptr %arrayidx26.8, align 4, !tbaa !5
%call27.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx26.9 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 9, i64 0, i64 %indvars.iv
%16 = load i32, ptr %arrayidx26.9, align 4, !tbaa !5
%call27.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx26.161 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 0, i64 1, i64 %indvars.iv
%17 = load i32, ptr %arrayidx26.161, align 4, !tbaa !5
%call27.162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx26.1.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 1, i64 1, i64 %indvars.iv
%18 = load i32, ptr %arrayidx26.1.1, align 4, !tbaa !5
%call27.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx26.2.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 2, i64 1, i64 %indvars.iv
%19 = load i32, ptr %arrayidx26.2.1, align 4, !tbaa !5
%call27.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx26.3.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 3, i64 1, i64 %indvars.iv
%20 = load i32, ptr %arrayidx26.3.1, align 4, !tbaa !5
%call27.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx26.4.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 4, i64 1, i64 %indvars.iv
%21 = load i32, ptr %arrayidx26.4.1, align 4, !tbaa !5
%call27.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx26.5.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 5, i64 1, i64 %indvars.iv
%22 = load i32, ptr %arrayidx26.5.1, align 4, !tbaa !5
%call27.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx26.6.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 6, i64 1, i64 %indvars.iv
%23 = load i32, ptr %arrayidx26.6.1, align 4, !tbaa !5
%call27.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx26.7.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 7, i64 1, i64 %indvars.iv
%24 = load i32, ptr %arrayidx26.7.1, align 4, !tbaa !5
%call27.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx26.8.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 8, i64 1, i64 %indvars.iv
%25 = load i32, ptr %arrayidx26.8.1, align 4, !tbaa !5
%call27.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx26.9.1 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 9, i64 1, i64 %indvars.iv
%26 = load i32, ptr %arrayidx26.9.1, align 4, !tbaa !5
%call27.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx26.263 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 0, i64 2, i64 %indvars.iv
%27 = load i32, ptr %arrayidx26.263, align 4, !tbaa !5
%call27.264 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx26.1.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 1, i64 2, i64 %indvars.iv
%28 = load i32, ptr %arrayidx26.1.2, align 4, !tbaa !5
%call27.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx26.2.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 2, i64 2, i64 %indvars.iv
%29 = load i32, ptr %arrayidx26.2.2, align 4, !tbaa !5
%call27.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx26.3.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 3, i64 2, i64 %indvars.iv
%30 = load i32, ptr %arrayidx26.3.2, align 4, !tbaa !5
%call27.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx26.4.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 4, i64 2, i64 %indvars.iv
%31 = load i32, ptr %arrayidx26.4.2, align 4, !tbaa !5
%call27.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx26.5.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 5, i64 2, i64 %indvars.iv
%32 = load i32, ptr %arrayidx26.5.2, align 4, !tbaa !5
%call27.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx26.6.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 6, i64 2, i64 %indvars.iv
%33 = load i32, ptr %arrayidx26.6.2, align 4, !tbaa !5
%call27.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx26.7.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 7, i64 2, i64 %indvars.iv
%34 = load i32, ptr %arrayidx26.7.2, align 4, !tbaa !5
%call27.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx26.8.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 8, i64 2, i64 %indvars.iv
%35 = load i32, ptr %arrayidx26.8.2, align 4, !tbaa !5
%call27.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx26.9.2 = getelementptr inbounds [10 x [3 x [4 x i32]]], ptr %room, i64 0, i64 9, i64 2, i64 %indvars.iv
%36 = load i32, ptr %arrayidx26.9.2, align 4, !tbaa !5
%call27.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp35 = icmp eq i64 %indvars.iv, 3
br i1 %cmp35, label %cleanup, label %if.end
if.end: ; preds = %for.cond13.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond13.preheader
cleanup: ; preds = %for.cond13.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %room) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 house[4][3][10] = {0};
int b,f,r,v,i,n,j,k,l;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d %d %d %d", &b, &f, &r, &v);
house[b-1][f-1][r-1] = house[b - 1][f - 1][r - 1] + v;
}
for (j = 0; j < 4; j++)
{
for (k = 0; k < 3; k++)
{
for (l = 0; l < 10; l++)
{
printf(" %d", house[j][k][l]);
}
printf("\n");
}
if(j!=3)
{
printf("####################\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237012/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 [12 x i8] c"%d %d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [21 x i8] c"####################\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%house = alloca [4 x [3 x [10 x i32]]], align 16
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 480, ptr nonnull %house) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %house, i8 0, i64 480, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
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
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.cond20.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.054 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %f, ptr noundef nonnull %r, ptr noundef nonnull %v)
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%idxprom = sext i32 %sub to i64
%2 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %2, -1
%idxprom3 = sext i32 %sub2 to i64
%3 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %3, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr %v, align 4, !tbaa !5
%add = add nsw i32 %5, %4
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.054, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond20.preheader.preheader, !llvm.loop !9
for.cond20.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.inc42
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc42 ], [ 0, %for.cond20.preheader.preheader ]
%arrayidx31 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx31, align 8, !tbaa !5
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx31.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 1
%8 = load i32, ptr %arrayidx31.1, align 4, !tbaa !5
%call32.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx31.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 2
%9 = load i32, ptr %arrayidx31.2, align 8, !tbaa !5
%call32.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx31.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 3
%10 = load i32, ptr %arrayidx31.3, align 4, !tbaa !5
%call32.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx31.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx31.4, align 8, !tbaa !5
%call32.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx31.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 5
%12 = load i32, ptr %arrayidx31.5, align 4, !tbaa !5
%call32.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx31.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 6
%13 = load i32, ptr %arrayidx31.6, align 8, !tbaa !5
%call32.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx31.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 7
%14 = load i32, ptr %arrayidx31.7, align 4, !tbaa !5
%call32.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx31.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx31.8, align 8, !tbaa !5
%call32.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx31.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 0, i64 9
%16 = load i32, ptr %arrayidx31.9, align 4, !tbaa !5
%call32.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%putchar = call i32 @putchar(i32 10)
%arrayidx31.160 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx31.160, align 8, !tbaa !5
%call32.161 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx31.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 1
%18 = load i32, ptr %arrayidx31.1.1, align 4, !tbaa !5
%call32.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx31.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 2
%19 = load i32, ptr %arrayidx31.2.1, align 8, !tbaa !5
%call32.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%arrayidx31.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 3
%20 = load i32, ptr %arrayidx31.3.1, align 4, !tbaa !5
%call32.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx31.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx31.4.1, align 8, !tbaa !5
%call32.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx31.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 5
%22 = load i32, ptr %arrayidx31.5.1, align 4, !tbaa !5
%call32.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx31.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 6
%23 = load i32, ptr %arrayidx31.6.1, align 8, !tbaa !5
%call32.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx31.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 7
%24 = load i32, ptr %arrayidx31.7.1, align 4, !tbaa !5
%call32.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx31.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx31.8.1, align 8, !tbaa !5
%call32.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx31.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 1, i64 9
%26 = load i32, ptr %arrayidx31.9.1, align 4, !tbaa !5
%call32.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx31.262 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx31.262, align 8, !tbaa !5
%call32.263 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx31.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 1
%28 = load i32, ptr %arrayidx31.1.2, align 4, !tbaa !5
%call32.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx31.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 2
%29 = load i32, ptr %arrayidx31.2.2, align 8, !tbaa !5
%call32.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%arrayidx31.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 3
%30 = load i32, ptr %arrayidx31.3.2, align 4, !tbaa !5
%call32.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%arrayidx31.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx31.4.2, align 8, !tbaa !5
%call32.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx31.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 5
%32 = load i32, ptr %arrayidx31.5.2, align 4, !tbaa !5
%call32.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%arrayidx31.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 6
%33 = load i32, ptr %arrayidx31.6.2, align 8, !tbaa !5
%call32.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%arrayidx31.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 7
%34 = load i32, ptr %arrayidx31.7.2, align 4, !tbaa !5
%call32.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx31.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx31.8.2, align 8, !tbaa !5
%call32.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx31.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, i64 0, i64 %indvars.iv, i64 2, i64 9
%36 = load i32, ptr %arrayidx31.9.2, align 4, !tbaa !5
%call32.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%putchar.2 = call i32 @putchar(i32 10)
%cmp40.not = icmp eq i64 %indvars.iv, 3
br i1 %cmp40.not, label %for.end44, label %for.inc42
for.inc42: ; preds = %for.cond20.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond20.preheader
for.end44: ; preds = %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %house) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
void meibo(int arr[][10], int cn); // print 関数
int main(void){
int i, no;
int bui, flo, a, num;
int buildA[3][10] = {0}; // 4 棟の配列初期化
int buildB[3][10] = {0};
int buildC[3][10] = {0};
int buildD[3][10] = {0};
scanf("%d", &no);
while(i<no){
scanf("%d %d %d %d", &bui, &flo, &a, &num);
if(bui == 1)
buildA[flo-1][a-1] += num;
if(bui == 2)
buildB[flo-1][a-1] += num;
if(bui == 3)
buildC[flo-1][a-1] += num;
if(bui == 4)
buildD[flo-1][a-1] += num;
i++;
}
meibo(buildA,1);
meibo(buildB,1);
meibo(buildC,1);
meibo(buildD,0);
return 0;
}
void meibo(int arr[][10], int cn){
int i, j, k;
for(i=0;i<3; i++){
for(j=0; j<10; j++){
printf(" %d", arr[i][j]);
}
printf("\n");
}
if(cn != 0){
for(k=0; k<20;k++){
printf("#");
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%no = alloca i32, align 4
%buildA = alloca [3 x [10 x i32]], align 16
%buildB = alloca [3 x [10 x i32]], align 16
%buildC = alloca [3 x [10 x i32]], align 16
%buildD = alloca [3 x [10 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %no) #5
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %buildA) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %buildA, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %buildB) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %buildB, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %buildC) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %buildC, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %buildD) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %buildD, i8 0, i64 120, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %no)
call void @meibo(ptr noundef nonnull %buildA, i32 noundef 1)
call void @meibo(ptr noundef nonnull %buildB, i32 noundef 1)
call void @meibo(ptr noundef nonnull %buildC, i32 noundef 1)
call void @meibo(ptr noundef nonnull %buildD, i32 noundef 0)
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %buildD) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %buildC) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %buildB) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %buildA) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %no) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @meibo(ptr nocapture noundef readonly %arr, i32 noundef %cn) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %arr, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %0)
%arrayidx5.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 1
%1 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%call.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1)
%arrayidx5.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 2
%2 = load i32, ptr %arrayidx5.2, align 4, !tbaa !5
%call.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %2)
%arrayidx5.3 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 3
%3 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5
%call.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3)
%arrayidx5.4 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 4
%4 = load i32, ptr %arrayidx5.4, align 4, !tbaa !5
%call.4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
%arrayidx5.5 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 5
%5 = load i32, ptr %arrayidx5.5, align 4, !tbaa !5
%call.5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
%arrayidx5.6 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 6
%6 = load i32, ptr %arrayidx5.6, align 4, !tbaa !5
%call.6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %6)
%arrayidx5.7 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 7
%7 = load i32, ptr %arrayidx5.7, align 4, !tbaa !5
%call.7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx5.8 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 8
%8 = load i32, ptr %arrayidx5.8, align 4, !tbaa !5
%call.8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx5.9 = getelementptr inbounds [10 x i32], ptr %arr, i64 0, i64 9
%9 = load i32, ptr %arrayidx5.9, align 4, !tbaa !5
%call.9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%putchar25 = tail call i32 @putchar(i32 10)
%arrayidx5.131 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 0
%10 = load i32, ptr %arrayidx5.131, align 4, !tbaa !5
%call.132 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx5.1.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 1
%11 = load i32, ptr %arrayidx5.1.1, align 4, !tbaa !5
%call.1.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx5.2.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 2
%12 = load i32, ptr %arrayidx5.2.1, align 4, !tbaa !5
%call.2.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%arrayidx5.3.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 3
%13 = load i32, ptr %arrayidx5.3.1, align 4, !tbaa !5
%call.3.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%arrayidx5.4.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 4
%14 = load i32, ptr %arrayidx5.4.1, align 4, !tbaa !5
%call.4.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%arrayidx5.5.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 5
%15 = load i32, ptr %arrayidx5.5.1, align 4, !tbaa !5
%call.5.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx5.6.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 6
%16 = load i32, ptr %arrayidx5.6.1, align 4, !tbaa !5
%call.6.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%arrayidx5.7.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 7
%17 = load i32, ptr %arrayidx5.7.1, align 4, !tbaa !5
%call.7.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx5.8.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 8
%18 = load i32, ptr %arrayidx5.8.1, align 4, !tbaa !5
%call.8.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx5.9.1 = getelementptr inbounds [10 x i32], ptr %arr, i64 1, i64 9
%19 = load i32, ptr %arrayidx5.9.1, align 4, !tbaa !5
%call.9.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%putchar25.1 = tail call i32 @putchar(i32 10)
%arrayidx5.233 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 0
%20 = load i32, ptr %arrayidx5.233, align 4, !tbaa !5
%call.234 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%arrayidx5.1.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 1
%21 = load i32, ptr %arrayidx5.1.2, align 4, !tbaa !5
%call.1.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx5.2.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 2
%22 = load i32, ptr %arrayidx5.2.2, align 4, !tbaa !5
%call.2.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%arrayidx5.3.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 3
%23 = load i32, ptr %arrayidx5.3.2, align 4, !tbaa !5
%call.3.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%arrayidx5.4.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 4
%24 = load i32, ptr %arrayidx5.4.2, align 4, !tbaa !5
%call.4.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%arrayidx5.5.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 5
%25 = load i32, ptr %arrayidx5.5.2, align 4, !tbaa !5
%call.5.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx5.6.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 6
%26 = load i32, ptr %arrayidx5.6.2, align 4, !tbaa !5
%call.6.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%arrayidx5.7.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 7
%27 = load i32, ptr %arrayidx5.7.2, align 4, !tbaa !5
%call.7.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx5.8.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 8
%28 = load i32, ptr %arrayidx5.8.2, align 4, !tbaa !5
%call.8.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%arrayidx5.9.2 = getelementptr inbounds [10 x i32], ptr %arr, i64 2, i64 9
%29 = load i32, ptr %arrayidx5.9.2, align 4, !tbaa !5
%call.9.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%putchar25.2 = tail call i32 @putchar(i32 10)
%cmp10.not = icmp eq i32 %cn, 0
br i1 %cmp10.not, label %if.end, label %for.body13.preheader
for.body13.preheader: ; preds = %entry
%putchar24 = tail call i32 @putchar(i32 35)
%putchar24.1 = tail call i32 @putchar(i32 35)
%putchar24.2 = tail call i32 @putchar(i32 35)
%putchar24.3 = tail call i32 @putchar(i32 35)
%putchar24.4 = tail call i32 @putchar(i32 35)
%putchar24.5 = tail call i32 @putchar(i32 35)
%putchar24.6 = tail call i32 @putchar(i32 35)
%putchar24.7 = tail call i32 @putchar(i32 35)
%putchar24.8 = tail call i32 @putchar(i32 35)
%putchar24.9 = tail call i32 @putchar(i32 35)
%putchar24.10 = tail call i32 @putchar(i32 35)
%putchar24.11 = tail call i32 @putchar(i32 35)
%putchar24.12 = tail call i32 @putchar(i32 35)
%putchar24.13 = tail call i32 @putchar(i32 35)
%putchar24.14 = tail call i32 @putchar(i32 35)
%putchar24.15 = tail call i32 @putchar(i32 35)
%putchar24.16 = tail call i32 @putchar(i32 35)
%putchar24.17 = tail call i32 @putchar(i32 35)
%putchar24.18 = tail call i32 @putchar(i32 35)
%putchar24.19 = tail call i32 @putchar(i32 35)
%putchar = tail call i32 @putchar(i32 10)
br label %if.end
if.end: ; preds = %for.body13.preheader, %entry
ret void
}
; 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main()
{
int n,p,i;
long long price = 0;
double prev = 0.5;
scanf("%d%d",&n,&p);
int is[n];
char S[n][10];
for (i=0;i<n;i++)
{
scanf("%s",&S);
// printf("%s",S);
if (strlen(S)==4)
is[i]=0;
else
is[i]=1;
}
for (i=n-2;i>=0;i--)
{
if (is[i]==1)
{
price += ((prev*2)*p)+(p/2);
prev = (prev*2)+0.5;
// printf("(%lld)\n",price);
}
else
{
price += ((prev*2)*p);
prev = (prev*2);
//printf("(%lld)\n",price);
}
}
price += p/2;
printf("%lld",price);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2371/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2371/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = 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 %p) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %p)
%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
%4 = zext i32 %3 to i64
%vla1 = alloca [10 x i8], i64 %4, align 16
%cmp45 = icmp sgt i32 %3, 0
br i1 %cmp45, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%.pre60 = load i32, ptr %p, align 4
br label %for.end.for.end28_crit_edge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla1)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %vla1) #7
%cmp4 = icmp ne i64 %call3, 4
%spec.select = zext i1 %cmp4 to i32
%5 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
store i32 %spec.select, 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.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp847 = icmp sgt i32 %6, 1
%.pre = load i32, ptr %p, align 4
br i1 %cmp847, label %for.body9.lr.ph, label %for.end.for.end28_crit_edge
for.end.for.end28_crit_edge: ; preds = %for.end.thread, %for.end
%.pre61 = phi i32 [ %.pre60, %for.end.thread ], [ %.pre, %for.end ]
%.pre57 = sdiv i32 %.pre61, 2
br label %for.end28
for.body9.lr.ph: ; preds = %for.end
%sub = add nsw i32 %6, -2
%conv21 = sitofp i32 %.pre to double
%div = sdiv i32 %.pre, 2
%conv15 = sitofp i32 %div to double
%8 = zext i32 %sub to i64
br label %for.body9
for.body9: ; preds = %for.body9.lr.ph, %for.inc27
%indvars.iv54 = phi i64 [ %8, %for.body9.lr.ph ], [ %indvars.iv.next55, %for.inc27 ]
%price.049 = phi i64 [ 0, %for.body9.lr.ph ], [ %price.1, %for.inc27 ]
%prev.048 = phi double [ 5.000000e-01, %for.body9.lr.ph ], [ %prev.1, %for.inc27 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv54
%9 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %9, 1
%mul = fmul double %prev.048, 2.000000e+00
br i1 %cmp12, label %if.then13, label %if.else19
if.then13: ; preds = %for.body9
%10 = call double @llvm.fmuladd.f64(double %mul, double %conv21, double %conv15)
%conv16 = sitofp i64 %price.049 to double
%add = fadd double %10, %conv16
%11 = call double @llvm.fmuladd.f64(double %prev.048, double 2.000000e+00, double 5.000000e-01)
br label %for.inc27
if.else19: ; preds = %for.body9
%conv23 = sitofp i64 %price.049 to double
%12 = call double @llvm.fmuladd.f64(double %mul, double %conv21, double %conv23)
br label %for.inc27
for.inc27: ; preds = %if.then13, %if.else19
%prev.1 = phi double [ %11, %if.then13 ], [ %mul, %if.else19 ]
%price.1.in = phi double [ %add, %if.then13 ], [ %12, %if.else19 ]
%price.1 = fptosi double %price.1.in to i64
%indvars.iv.next55 = add nsw i64 %indvars.iv54, -1
%cmp8 = icmp sgt i64 %indvars.iv54, 0
br i1 %cmp8, label %for.body9, label %for.end28, !llvm.loop !11
for.end28: ; preds = %for.inc27, %for.end.for.end28_crit_edge
%div29.pre-phi = phi i32 [ %.pre57, %for.end.for.end28_crit_edge ], [ %div, %for.inc27 ]
%price.0.lcssa = phi i64 [ 0, %for.end.for.end28_crit_edge ], [ %price.1, %for.inc27 ]
%conv30 = sext i32 %div29.pre-phi to i64
%add31 = add nsw i64 %price.0.lcssa, %conv30
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add31)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5
; 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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.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 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;}
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 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;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
typedef struct{
int par;
int dep;
}node;
node uft[524288];
void resuf(){
int i;
for(i=0;i<524288;i++){
uft[i].par=i;uft[i].dep=i;
}
return;
}
int find(int x){
if(uft[x].par==x){return x;}
else{uft[x].par=find(uft[x].par);return uft[x].par;}
}
void uni(int x,int y){
int xp,yp;
xp=find(x);yp=find(y);
if(xp==yp){return;}
if(uft[xp].dep>uft[yp].dep){
uft[yp].par=xp;
}
else{
uft[xp].par=yp;
if(uft[xp].dep==uft[yp].dep){uft[yp].dep++;}
}
return;
}
typedef struct{
long long st;
long long fi;
long long kr;
}rs;
typedef struct{
long long st;
long long kz;
}mkj;
int sortfnc(const void *a,const void *b){
if(((rs*)a)->st > ((rs*)b)->st){return 1;}
if(((rs*)a)->st < ((rs*)b)->st){return -1;}
if(((rs*)a)->fi > ((rs*)b)->fi){return 1;}
if(((rs*)a)->fi < ((rs*)b)->fi){return -1;}
return 0;
}
void makemkj(rs g[],mkj x[],long long n){
long long i,ms=0,nst=g[0].st;
for(i=1;i<n;i++){
if(g[i].st!=g[i-1].st){
x[nst].kz=i-ms;
x[nst].st=ms;
nst=g[i].st;ms=i;
}
}
x[nst].kz=n-ms;
x[nst].st=ms;
}
int main(void){
resuf();
long long fl[262144]={0},zs=0;
long long ar[262144]={0},arp=0;
long long nv,r=0;
long long nc,i,j,n,m,k,a[262144],b,c,w,l,t,ux,uy;
rs g[262144];
mkj x[262144];
double d;
char s[262144];
scanf("%lld%lld",&n,&m);
//l=strlen(s);
for(i=0;i<n;i++){scanf("%lld",&a[i]);}
for(i=0;i<m;i++){scanf("%lld%lld",&ux,&uy);
uni(ux,uy);
}
for(i=0;i<n;i++){
g[i].st=find(i);
fl[g[i].st]=1;
g[i].fi=a[i];
}
for(i=0;i<n;i++){
zs+=fl[i];
}
nv=(zs-1)*2;
if(nv==0){printf("0\n");return 0;}
qsort(g,n,sizeof(rs),sortfnc);
makemkj(g,x,n);
for(nc=0;nc<n;nc++){
for(i=x[nc].st;i<x[nc].st+x[nc].kz;i++){
if(i==x[nc].st){nv--;r+=g[i].fi;}
else{ar[arp]=g[i].fi;arp++;}
}
}
qsort(ar,arp,sizeof(long long),llsortfncsj);
for(i=0;i<nv;i++){
//printf("<%d>\n",ar[i]);
if(i>=arp){printf("Impossible\n");return 0;}
r+=ar[i];
}
printf("%lld\n",r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237142/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237142/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.node = type { i32, i32 }
%struct.rs = type { i64, i64, i64 }
%struct.mkj = type { i64, i64 }
@uft = dso_local local_unnamed_addr global [524288 x %struct.node] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Impossible\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"0\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 @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: 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 !14
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 !14
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 !15
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 @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 !16
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 !17
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 !19
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 !20
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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !21
%1 = load i32, ptr %b, align 4, !tbaa !21
%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) #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !25
%1 = load i64, ptr %b, align 8, !tbaa !25
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !25
%1 = load i64, ptr %b, align 8, !tbaa !25
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !27
%1 = load double, ptr %b, align 8, !tbaa !27
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !27
%1 = load double, ptr %b, align 8, !tbaa !27
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #17
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #17
ret i32 %call
}
; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @resuf() local_unnamed_addr #7 {
entry:
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %entry ], [ %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 [524288 x %struct.node], ptr @uft, i64 0, i64 %index
%2 = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %0
%3 = shufflevector <2 x i32> %vec.ind, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%interleaved.vec = shufflevector <4 x i32> %3, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %1, align 16, !tbaa !21
%4 = shufflevector <2 x i32> %step.add, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%interleaved.vec11 = shufflevector <4 x i32> %4, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec11, ptr %2, align 16, !tbaa !21
%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, 524288
br i1 %5, label %for.end, label %vector.body, !llvm.loop !29
for.end: ; preds = %vector.body
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @find(i32 noundef %x) local_unnamed_addr #8 {
entry:
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 8, !tbaa !30
%cmp = icmp eq i32 %0, %x
br i1 %cmp, label %common.ret15, label %if.else
common.ret15: ; preds = %entry, %if.else
%common.ret15.op = phi i32 [ %call, %if.else ], [ %x, %entry ]
ret i32 %common.ret15.op
if.else: ; preds = %entry
%call = tail call i32 @find(i32 noundef %0)
store i32 %call, ptr %arrayidx, align 8, !tbaa !30
br label %common.ret15
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @uni(i32 noundef %x, i32 noundef %y) local_unnamed_addr #9 {
entry:
%call = tail call i32 @find(i32 noundef %x)
%call1 = tail call i32 @find(i32 noundef %y)
%cmp = icmp eq i32 %call, %call1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %call to i64
%dep = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %dep, align 4, !tbaa !32
%idxprom2 = sext i32 %call1 to i64
%dep4 = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom2, i32 1
%1 = load i32, ptr %dep4, align 4, !tbaa !32
%cmp5 = icmp sgt i32 %0, %1
br i1 %cmp5, label %if.then6, label %if.else
if.then6: ; preds = %if.end
%arrayidx3 = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom2
store i32 %call, ptr %arrayidx3, align 8, !tbaa !30
br label %cleanup
if.else: ; preds = %if.end
%arrayidx = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom
store i32 %call1, ptr %arrayidx, align 8, !tbaa !30
%cmp18 = icmp eq i32 %0, %1
br i1 %cmp18, label %if.then19, label %cleanup
if.then19: ; preds = %if.else
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %dep4, align 4, !tbaa !32
br label %cleanup
cleanup: ; preds = %if.then6, %if.then19, %if.else, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !33
%1 = load i64, ptr %b, align 8, !tbaa !33
%cmp = icmp sgt i64 %0, %1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp slt i64 %0, %1
br i1 %cmp4, label %return, label %if.end6
if.end6: ; preds = %if.end
%fi = getelementptr inbounds %struct.rs, ptr %a, i64 0, i32 1
%2 = load i64, ptr %fi, align 8, !tbaa !35
%fi7 = getelementptr inbounds %struct.rs, ptr %b, i64 0, i32 1
%3 = load i64, ptr %fi7, align 8, !tbaa !35
%cmp8 = icmp sgt i64 %2, %3
br i1 %cmp8, label %return, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp slt i64 %2, %3
%. = sext i1 %cmp13 to i32
br label %return
return: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ -1, %if.end ], [ 1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @makemkj(ptr nocapture noundef readonly %g, ptr nocapture noundef writeonly %x, i64 noundef %n) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr %g, align 8, !tbaa !33
%cmp36 = icmp sgt i64 %n, 1
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%nst.039 = phi i64 [ %nst.1, %for.inc ], [ %0, %entry ]
%ms.038 = phi i64 [ %ms.1, %for.inc ], [ 0, %entry ]
%i.037 = phi i64 [ %inc, %for.inc ], [ 1, %entry ]
%arrayidx1 = getelementptr inbounds %struct.rs, ptr %g, i64 %i.037
%1 = load i64, ptr %arrayidx1, align 8, !tbaa !33
%arrayidx3 = getelementptr %struct.rs, ptr %arrayidx1, i64 -1
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !33
%cmp5.not = icmp eq i64 %1, %2
br i1 %cmp5.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%sub6 = sub nsw i64 %i.037, %ms.038
%arrayidx7 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039
%kz = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039, i32 1
store i64 %sub6, ptr %kz, align 8, !tbaa !36
store i64 %ms.038, ptr %arrayidx7, align 8, !tbaa !38
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%ms.1 = phi i64 [ %i.037, %if.then ], [ %ms.038, %for.body ]
%nst.1 = phi i64 [ %1, %if.then ], [ %nst.039, %for.body ]
%inc = add nuw nsw i64 %i.037, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !39
for.end: ; preds = %for.inc, %entry
%ms.0.lcssa = phi i64 [ 0, %entry ], [ %ms.1, %for.inc ]
%nst.0.lcssa = phi i64 [ %0, %entry ], [ %nst.1, %for.inc ]
%sub12 = sub nsw i64 %n, %ms.0.lcssa
%arrayidx13 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa
%kz14 = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa, i32 1
store i64 %sub12, ptr %kz14, align 8, !tbaa !36
store i64 %ms.0.lcssa, ptr %arrayidx13, align 8, !tbaa !38
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #11 {
entry:
%fl = alloca [262144 x i64], align 16
%ar = alloca [262144 x i64], align 16
%n = alloca i64, align 8
%m = alloca i64, align 8
%a = alloca [262144 x i64], align 16
%ux = alloca i64, align 8
%uy = alloca i64, align 8
%g = alloca [262144 x %struct.rs], align 16
%x = alloca [262144 x %struct.mkj], align 16
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %entry ], [ %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 [524288 x %struct.node], ptr @uft, i64 0, i64 %index
%2 = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %0
%3 = shufflevector <2 x i32> %vec.ind, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%interleaved.vec = shufflevector <4 x i32> %3, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %1, align 16, !tbaa !21
%4 = shufflevector <2 x i32> %step.add, <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%interleaved.vec200 = shufflevector <4 x i32> %4, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec200, ptr %2, align 16, !tbaa !21
%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, 524288
br i1 %5, label %resuf.exit, label %vector.body, !llvm.loop !40
resuf.exit: ; preds = %vector.body
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %fl) #18
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2097152) %fl, i8 0, i64 2097152, i1 false)
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %ar) #18
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2097152) %ar, i8 0, i64 2097152, i1 false)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #18
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #18
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %a) #18
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ux) #18
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %uy) #18
call void @llvm.lifetime.start.p0(i64 6291456, ptr nonnull %g) #18
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %x) #18
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%6 = load i64, ptr %n, align 8, !tbaa !25
%cmp155 = icmp sgt i64 %6, 0
br i1 %cmp155, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %resuf.exit
%7 = phi i64 [ %6, %resuf.exit ], [ %9, %for.body ]
%8 = load i64, ptr %m, align 8, !tbaa !25
%cmp3157 = icmp sgt i64 %8, 0
br i1 %cmp3157, label %for.body4, label %for.cond10.preheader
for.body: ; preds = %resuf.exit, %for.body
%i.0156 = phi i64 [ %inc, %for.body ], [ 0, %resuf.exit ]
%arrayidx = getelementptr inbounds [262144 x i64], ptr %a, i64 0, i64 %i.0156
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.0156, 1
%9 = load i64, ptr %n, align 8, !tbaa !25
%cmp = icmp slt i64 %inc, %9
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !41
for.cond10.preheader.loopexit: ; preds = %uni.exit
%.pre = load i64, ptr %n, align 8, !tbaa !25
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.loopexit, %for.cond2.preheader
%10 = phi i64 [ %.pre, %for.cond10.preheader.loopexit ], [ %7, %for.cond2.preheader ]
%cmp11159 = icmp sgt i64 %10, 0
br i1 %cmp11159, label %for.body13, label %if.end
for.body4: ; preds = %for.cond2.preheader, %uni.exit
%i.1158 = phi i64 [ %inc8, %uni.exit ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ux, ptr noundef nonnull %uy)
%11 = load i64, ptr %ux, align 8, !tbaa !25
%conv = trunc i64 %11 to i32
%12 = load i64, ptr %uy, align 8, !tbaa !25
%conv6 = trunc i64 %12 to i32
%call.i = call i32 @find(i32 noundef %conv)
%call1.i = call i32 @find(i32 noundef %conv6)
%cmp.i = icmp eq i32 %call.i, %call1.i
br i1 %cmp.i, label %uni.exit, label %if.end.i
if.end.i: ; preds = %for.body4
%idxprom.i = sext i32 %call.i to i64
%dep.i148 = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom.i, i32 1
%13 = load i32, ptr %dep.i148, align 4, !tbaa !32
%idxprom2.i = sext i32 %call1.i to i64
%dep4.i = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom2.i, i32 1
%14 = load i32, ptr %dep4.i, align 4, !tbaa !32
%cmp5.i = icmp sgt i32 %13, %14
br i1 %cmp5.i, label %if.then6.i, label %if.else.i
if.then6.i: ; preds = %if.end.i
%arrayidx3.i = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom2.i
store i32 %call.i, ptr %arrayidx3.i, align 8, !tbaa !30
br label %uni.exit
if.else.i: ; preds = %if.end.i
%arrayidx.i149 = getelementptr inbounds [524288 x %struct.node], ptr @uft, i64 0, i64 %idxprom.i
store i32 %call1.i, ptr %arrayidx.i149, align 8, !tbaa !30
%cmp18.i = icmp eq i32 %13, %14
br i1 %cmp18.i, label %if.then19.i, label %uni.exit
if.then19.i: ; preds = %if.else.i
%inc.i = add nsw i32 %13, 1
store i32 %inc.i, ptr %dep4.i, align 4, !tbaa !32
br label %uni.exit
uni.exit: ; preds = %for.body4, %if.then6.i, %if.else.i, %if.then19.i
%inc8 = add nuw nsw i64 %i.1158, 1
%15 = load i64, ptr %m, align 8, !tbaa !25
%cmp3 = icmp slt i64 %inc8, %15
br i1 %cmp3, label %for.body4, label %for.cond10.preheader.loopexit, !llvm.loop !42
for.cond26.preheader: ; preds = %for.body13
%cmp27161 = icmp sgt i64 %23, 0
br i1 %cmp27161, label %for.body29.preheader, label %if.end
for.body29.preheader: ; preds = %for.cond26.preheader
%min.iters.check = icmp ult i64 %23, 4
br i1 %min.iters.check, label %for.body29.preheader210, label %vector.ph203
vector.ph203: ; preds = %for.body29.preheader
%n.vec = and i64 %23, -4
br label %vector.body205
vector.body205: ; preds = %vector.body205, %vector.ph203
%index206 = phi i64 [ 0, %vector.ph203 ], [ %index.next209, %vector.body205 ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph203 ], [ %18, %vector.body205 ]
%vec.phi207 = phi <2 x i64> [ zeroinitializer, %vector.ph203 ], [ %19, %vector.body205 ]
%16 = getelementptr inbounds [262144 x i64], ptr %fl, i64 0, i64 %index206
%wide.load = load <2 x i64>, ptr %16, align 16, !tbaa !25
%17 = getelementptr inbounds i64, ptr %16, i64 2
%wide.load208 = load <2 x i64>, ptr %17, align 16, !tbaa !25
%18 = add <2 x i64> %wide.load, %vec.phi
%19 = add <2 x i64> %wide.load208, %vec.phi207
%index.next209 = add nuw i64 %index206, 4
%20 = icmp eq i64 %index.next209, %n.vec
br i1 %20, label %middle.block201, label %vector.body205, !llvm.loop !43
middle.block201: ; preds = %vector.body205
%bin.rdx = add <2 x i64> %19, %18
%21 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %23, %n.vec
br i1 %cmp.n, label %for.end33, label %for.body29.preheader210
for.body29.preheader210: ; preds = %for.body29.preheader, %middle.block201
%zs.0163.ph = phi i64 [ 0, %for.body29.preheader ], [ %21, %middle.block201 ]
%i.3162.ph = phi i64 [ 0, %for.body29.preheader ], [ %n.vec, %middle.block201 ]
br label %for.body29
for.body13: ; preds = %for.cond10.preheader, %for.body13
%i.2160 = phi i64 [ %inc24, %for.body13 ], [ 0, %for.cond10.preheader ]
%conv14 = trunc i64 %i.2160 to i32
%call15 = call i32 @find(i32 noundef %conv14)
%conv16 = sext i32 %call15 to i64
%arrayidx17 = getelementptr inbounds [262144 x %struct.rs], ptr %g, i64 0, i64 %i.2160
store i64 %conv16, ptr %arrayidx17, align 8, !tbaa !33
%arrayidx20 = getelementptr inbounds [262144 x i64], ptr %fl, i64 0, i64 %conv16
store i64 1, ptr %arrayidx20, align 8, !tbaa !25
%arrayidx21 = getelementptr inbounds [262144 x i64], ptr %a, i64 0, i64 %i.2160
%22 = load i64, ptr %arrayidx21, align 8, !tbaa !25
%fi = getelementptr inbounds [262144 x %struct.rs], ptr %g, i64 0, i64 %i.2160, i32 1
store i64 %22, ptr %fi, align 8, !tbaa !35
%inc24 = add nuw nsw i64 %i.2160, 1
%23 = load i64, ptr %n, align 8, !tbaa !25
%cmp11 = icmp slt i64 %inc24, %23
br i1 %cmp11, label %for.body13, label %for.cond26.preheader, !llvm.loop !44
for.body29: ; preds = %for.body29.preheader210, %for.body29
%zs.0163 = phi i64 [ %add, %for.body29 ], [ %zs.0163.ph, %for.body29.preheader210 ]
%i.3162 = phi i64 [ %inc32, %for.body29 ], [ %i.3162.ph, %for.body29.preheader210 ]
%arrayidx30 = getelementptr inbounds [262144 x i64], ptr %fl, i64 0, i64 %i.3162
%24 = load i64, ptr %arrayidx30, align 8, !tbaa !25
%add = add nsw i64 %24, %zs.0163
%inc32 = add nuw nsw i64 %i.3162, 1
%exitcond.not = icmp eq i64 %inc32, %23
br i1 %exitcond.not, label %for.end33, label %for.body29, !llvm.loop !45
for.end33: ; preds = %for.body29, %middle.block201
%add.lcssa = phi i64 [ %21, %middle.block201 ], [ %add, %for.body29 ]
%25 = shl i64 %add.lcssa, 1
%26 = add i64 %25, -2
%cmp34 = icmp eq i64 %26, 0
br i1 %cmp34, label %if.then, label %if.end
if.then: ; preds = %for.end33
%puts147 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %cleanup
if.end: ; preds = %for.cond10.preheader, %for.cond26.preheader, %for.end33
%zs.0.lcssa196 = phi i64 [ %26, %for.end33 ], [ -2, %for.cond26.preheader ], [ -2, %for.cond10.preheader ]
%.lcssa191195 = phi i64 [ %23, %for.end33 ], [ %23, %for.cond26.preheader ], [ %10, %for.cond10.preheader ]
call void @qsort(ptr noundef nonnull %g, i64 noundef %.lcssa191195, i64 noundef 24, ptr noundef nonnull @sortfnc) #18
%27 = load i64, ptr %n, align 8, !tbaa !25
%28 = load i64, ptr %g, align 16, !tbaa !33
%cmp36.i = icmp sgt i64 %27, 1
br i1 %cmp36.i, label %for.body.i150, label %makemkj.exit
for.body.i150: ; preds = %if.end, %for.inc.i
%nst.039.i = phi i64 [ %nst.1.i, %for.inc.i ], [ %28, %if.end ]
%ms.038.i = phi i64 [ %ms.1.i, %for.inc.i ], [ 0, %if.end ]
%i.037.i = phi i64 [ %inc.i152, %for.inc.i ], [ 1, %if.end ]
%arrayidx1.i = getelementptr inbounds %struct.rs, ptr %g, i64 %i.037.i
%29 = load i64, ptr %arrayidx1.i, align 8, !tbaa !33
%arrayidx3.i151 = getelementptr %struct.rs, ptr %arrayidx1.i, i64 -1
%30 = load i64, ptr %arrayidx3.i151, align 8, !tbaa !33
%cmp5.not.i = icmp eq i64 %29, %30
br i1 %cmp5.not.i, label %for.inc.i, label %if.then.i
if.then.i: ; preds = %for.body.i150
%sub6.i = sub nsw i64 %i.037.i, %ms.038.i
%arrayidx7.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039.i
%kz.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.039.i, i32 1
store i64 %sub6.i, ptr %kz.i, align 8, !tbaa !36
store i64 %ms.038.i, ptr %arrayidx7.i, align 16, !tbaa !38
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i150
%ms.1.i = phi i64 [ %i.037.i, %if.then.i ], [ %ms.038.i, %for.body.i150 ]
%nst.1.i = phi i64 [ %29, %if.then.i ], [ %nst.039.i, %for.body.i150 ]
%inc.i152 = add nuw nsw i64 %i.037.i, 1
%exitcond.not.i153 = icmp eq i64 %inc.i152, %27
br i1 %exitcond.not.i153, label %makemkj.exit, label %for.body.i150, !llvm.loop !39
makemkj.exit: ; preds = %for.inc.i, %if.end
%ms.0.lcssa.i = phi i64 [ 0, %if.end ], [ %ms.1.i, %for.inc.i ]
%nst.0.lcssa.i = phi i64 [ %28, %if.end ], [ %nst.1.i, %for.inc.i ]
%sub12.i = sub nsw i64 %27, %ms.0.lcssa.i
%arrayidx13.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa.i
%kz14.i = getelementptr inbounds %struct.mkj, ptr %x, i64 %nst.0.lcssa.i, i32 1
store i64 %sub12.i, ptr %kz14.i, align 8, !tbaa !36
store i64 %ms.0.lcssa.i, ptr %arrayidx13.i, align 16, !tbaa !38
%cmp40173 = icmp sgt i64 %27, 0
br i1 %cmp40173, label %for.body42, label %for.end71
for.body42: ; preds = %makemkj.exit, %for.inc69
%arp.0177 = phi i64 [ %arp.1.lcssa, %for.inc69 ], [ 0, %makemkj.exit ]
%nv.0176 = phi i64 [ %nv.1.lcssa, %for.inc69 ], [ %zs.0.lcssa196, %makemkj.exit ]
%r.0175 = phi i64 [ %r.1.lcssa, %for.inc69 ], [ 0, %makemkj.exit ]
%nc.0174 = phi i64 [ %inc70, %for.inc69 ], [ 0, %makemkj.exit ]
%arrayidx43 = getelementptr inbounds [262144 x %struct.mkj], ptr %x, i64 0, i64 %nc.0174
%31 = load i64, ptr %arrayidx43, align 16, !tbaa !38
%kz = getelementptr inbounds [262144 x %struct.mkj], ptr %x, i64 0, i64 %nc.0174, i32 1
%32 = load i64, ptr %kz, align 8, !tbaa !36
%add49 = add nsw i64 %32, %31
%cmp50165 = icmp sgt i64 %32, 0
br i1 %cmp50165, label %for.inc66.peel, label %for.inc69
for.inc66.peel: ; preds = %for.body42
%dec.peel = add nsw i64 %nv.0176, -1
%fi59.peel = getelementptr inbounds [262144 x %struct.rs], ptr %g, i64 0, i64 %31, i32 1
%33 = load i64, ptr %fi59.peel, align 8, !tbaa !35
%add60.peel = add nsw i64 %33, %r.0175
%cmp50.peel.not = icmp eq i64 %32, 1
br i1 %cmp50.peel.not, label %for.inc69, label %for.body52.peel.next
for.body52.peel.next: ; preds = %for.inc66.peel
%inc67.peel = add nsw i64 %31, 1
br label %for.body52
for.body52: ; preds = %for.body52.peel.next, %for.inc66
%arp.1169 = phi i64 [ %arp.2, %for.inc66 ], [ %arp.0177, %for.body52.peel.next ]
%nv.1168 = phi i64 [ %nv.2, %for.inc66 ], [ %dec.peel, %for.body52.peel.next ]
%r.1167 = phi i64 [ %r.2, %for.inc66 ], [ %add60.peel, %for.body52.peel.next ]
%i.4166 = phi i64 [ %inc67, %for.inc66 ], [ %inc67.peel, %for.body52.peel.next ]
%cmp55 = icmp eq i64 %i.4166, %31
br i1 %cmp55, label %if.then57, label %if.else
if.then57: ; preds = %for.body52
%dec = add nsw i64 %nv.1168, -1
%add60 = add nsw i64 %33, %r.1167
br label %for.inc66
if.else: ; preds = %for.body52
%fi62 = getelementptr inbounds [262144 x %struct.rs], ptr %g, i64 0, i64 %i.4166, i32 1
%34 = load i64, ptr %fi62, align 8, !tbaa !35
%arrayidx63 = getelementptr inbounds [262144 x i64], ptr %ar, i64 0, i64 %arp.1169
store i64 %34, ptr %arrayidx63, align 8, !tbaa !25
%inc64 = add nsw i64 %arp.1169, 1
br label %for.inc66
for.inc66: ; preds = %if.then57, %if.else
%r.2 = phi i64 [ %add60, %if.then57 ], [ %r.1167, %if.else ]
%nv.2 = phi i64 [ %dec, %if.then57 ], [ %nv.1168, %if.else ]
%arp.2 = phi i64 [ %arp.1169, %if.then57 ], [ %inc64, %if.else ]
%inc67 = add nsw i64 %i.4166, 1
%cmp50 = icmp slt i64 %inc67, %add49
br i1 %cmp50, label %for.body52, label %for.inc69, !llvm.loop !46
for.inc69: ; preds = %for.inc66, %for.inc66.peel, %for.body42
%r.1.lcssa = phi i64 [ %r.0175, %for.body42 ], [ %add60.peel, %for.inc66.peel ], [ %r.2, %for.inc66 ]
%nv.1.lcssa = phi i64 [ %nv.0176, %for.body42 ], [ %dec.peel, %for.inc66.peel ], [ %nv.2, %for.inc66 ]
%arp.1.lcssa = phi i64 [ %arp.0177, %for.body42 ], [ %arp.0177, %for.inc66.peel ], [ %arp.2, %for.inc66 ]
%inc70 = add nuw nsw i64 %nc.0174, 1
%exitcond187.not = icmp eq i64 %inc70, %27
br i1 %exitcond187.not, label %for.end71, label %for.body42, !llvm.loop !48
for.end71: ; preds = %for.inc69, %makemkj.exit
%r.0.lcssa = phi i64 [ 0, %makemkj.exit ], [ %r.1.lcssa, %for.inc69 ]
%nv.0.lcssa = phi i64 [ %zs.0.lcssa196, %makemkj.exit ], [ %nv.1.lcssa, %for.inc69 ]
%arp.0.lcssa = phi i64 [ 0, %makemkj.exit ], [ %arp.1.lcssa, %for.inc69 ]
%nv.0.lcssa.fr = freeze i64 %nv.0.lcssa
call void @qsort(ptr noundef nonnull %ar, i64 noundef %arp.0.lcssa, i64 noundef 8, ptr noundef nonnull @llsortfncsj) #18
%cmp74181 = icmp sgt i64 %nv.0.lcssa.fr, 0
br i1 %cmp74181, label %for.body76.preheader, label %for.end86
for.body76.preheader: ; preds = %for.end71
%smax = call i64 @llvm.smax.i64(i64 %arp.0.lcssa, i64 0)
%35 = add nsw i64 %nv.0.lcssa.fr, -1
%.not.not = icmp ugt i64 %smax, %35
br label %for.body76
for.body76: ; preds = %for.body76.preheader, %if.end81
%r.3183 = phi i64 [ %add83, %if.end81 ], [ %r.0.lcssa, %for.body76.preheader ]
%i.5182 = phi i64 [ %inc85, %if.end81 ], [ 0, %for.body76.preheader ]
br i1 %.not.not, label %if.end81, label %if.then79
if.then79: ; preds = %for.body76
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end81: ; preds = %for.body76
%arrayidx82 = getelementptr inbounds [262144 x i64], ptr %ar, i64 0, i64 %i.5182
%36 = load i64, ptr %arrayidx82, align 8, !tbaa !25
%add83 = add nsw i64 %36, %r.3183
%inc85 = add nuw nsw i64 %i.5182, 1
%exitcond188.not = icmp eq i64 %inc85, %nv.0.lcssa.fr
br i1 %exitcond188.not, label %for.end86, label %for.body76, !llvm.loop !49
for.end86: ; preds = %if.end81, %for.end71
%r.3.lcssa = phi i64 [ %r.0.lcssa, %for.end71 ], [ %add83, %if.end81 ]
%call87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %r.3.lcssa)
br label %cleanup
cleanup: ; preds = %for.end86, %if.then79, %if.then
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %x) #18
call void @llvm.lifetime.end.p0(i64 6291456, ptr nonnull %g) #18
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %uy) #18
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ux) #18
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %a) #18
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #18
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #18
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %ar) #18
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %fl) #18
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) #12
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #13
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #13
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #14
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #16
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree norecurse nosync nounwind memory(write, 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 #8 = { 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 #9 = { nofree nosync nounwind memory(readwrite, 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 #10 = { 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 #11 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #13 = { 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 #14 = { 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 #15 = { nofree nounwind }
attributes #16 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #17 = { nounwind willreturn memory(read) }
attributes #18 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !18}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !23, i64 0}
!23 = !{!"omnipotent char", !24, i64 0}
!24 = !{!"Simple C/C++ TBAA"}
!25 = !{!26, !26, i64 0}
!26 = !{!"long long", !23, i64 0}
!27 = !{!28, !28, i64 0}
!28 = !{!"double", !23, i64 0}
!29 = distinct !{!29, !6, !9, !10}
!30 = !{!31, !22, i64 0}
!31 = !{!"", !22, i64 0, !22, i64 4}
!32 = !{!31, !22, i64 4}
!33 = !{!34, !26, i64 0}
!34 = !{!"", !26, i64 0, !26, i64 8, !26, i64 16}
!35 = !{!34, !26, i64 8}
!36 = !{!37, !26, i64 8}
!37 = !{!"", !26, i64 0, !26, i64 8}
!38 = !{!37, !26, i64 0}
!39 = distinct !{!39, !6}
!40 = distinct !{!40, !6, !9, !10}
!41 = distinct !{!41, !6}
!42 = distinct !{!42, !6}
!43 = distinct !{!43, !6, !9, !10}
!44 = distinct !{!44, !6}
!45 = distinct !{!45, !6, !10, !9}
!46 = distinct !{!46, !6, !47}
!47 = !{!"llvm.loop.peeled.count", i32 1}
!48 = distinct !{!48, !6}
!49 = distinct !{!49, !6}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define MAX 1000005
int main()
{
long int n,i,j,flag =0;scanf("%ld",&n);
for(i=0;i<n;i++)
{
char name[15];
scanf("%s",name);
long int a,b;
scanf("%ld%ld",&a,&b);
if(a>=2400 && b>a)
{
flag =1;
}
}
if(flag ==0)
{
printf("NO");
}
else if(flag==1)
{
printf("YES");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23720/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23720/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"%s\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%ld%ld\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%name = alloca [15 x i8], align 1
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp15 = icmp sgt i64 %0, 0
br i1 %cmp15, label %for.body, label %if.end12
for.body: ; preds = %entry, %for.body
%flag.017 = phi i64 [ %flag.1, %for.body ], [ 0, %entry ]
%i.016 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %name) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %name)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i64, ptr %a, align 8, !tbaa !5
%cmp3 = icmp sgt i64 %1, 2399
%2 = load i64, ptr %b, align 8
%cmp4 = icmp sgt i64 %2, %1
%or.cond = select i1 %cmp3, i1 %cmp4, i1 false
%flag.1 = select i1 %or.cond, i64 1, i64 %flag.017
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %name) #3
%inc = add nuw nsw i64 %i.016, 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
%4 = icmp eq i64 %flag.1, 0
%spec.select = select i1 %4, ptr @.str.3, ptr @.str.4
br label %if.end12
if.end12: ; preds = %for.end, %entry
%.str.4.sink = phi ptr [ @.str.3, %entry ], [ %spec.select, %for.end ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
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: 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
//Twelvefold way[syazou 12-sou]
//https://onlinejudge.u-aizu.ac.jp/problems/DPL_5_A
//https://qiita.com/drken/items/f2ea4b58b0d21621bd51
//https://mathtrain.jp/twelveway
#include<stdio.h>
#define mod 1000000007
#define faclim 1048576
#define partition_nlim 1024
#define partition_klim 1024
long long power(long long a,long long b){
long long x=1,y=a;
while(b>0){
if(b&1ll){
x=(x*y)%mod;
}
y=(y*y)%mod;
b>>=1;
}
return x%mod;
}
long long modular_inverse(long long n){
return power(n,mod-2);
}
long long factorial[faclim];
long long invfact[faclim];
long long bce[faclim];
void cfact(){
long long i;
factorial[0]=1;
factorial[1]=1;
for(i=2;i<faclim;i++){
factorial[i]=factorial[i-1]*i;
factorial[i]%=mod;
}
invfact[faclim-1]=modular_inverse(factorial[faclim-1]);
for(i=faclim-2;i>=0;i--){
invfact[i]=invfact[i+1]*(i+1);
invfact[i]%=mod;
}
for(i=0;i<faclim;i++){
if(i%2==1){bce[i]=mod-1;}
else{bce[i]=1;}
bce[i]*=invfact[i];
bce[i]%=mod;
if(i!=0){
bce[i]+=bce[i-1];
if(bce[i]>=mod){bce[i]-=mod;}
}
}
}
long long calcnCr(long long n,long long k){
if(k<0 || n<k){return 0;}
return (factorial[n]*((invfact[k]*invfact[n-k])%mod))%mod;
}
long long partition[partition_nlim][partition_klim];
long long partition_isinit=0;
void partition_init(){
if(partition_isinit==1){return;}
partition_isinit=1;
long long i,j;
for(i=0;i<partition_nlim;i++){
for(j=0;j<partition_klim;j++){
partition[i][j]=-1;
}
}
}
long long partition_rep(long long n,long long k){
if(n<0 || k<0){return 0;}
if(n==0){return 1;}
if(k==0){
if(n==0){return 1;}
else{return 0;}
}
if(partition[n][k]!=-1){return partition[n][k];}
partition[n][k]=(partition_rep(n,k-1)+partition_rep(n-k,k))%mod;
return partition[n][k];
}
// packing n balls using k boxes
// | distinguish | each boxes contains the balls limited |
// | balls | boxes | no limits | at most 1 | at least 1 |
// | can | can | 1 | 2 | 3 |
// | can't | can | 4 | 5 | 6 |
// | can | can't | 7 | 8 | 9 |
// | can't | can't | 10 | 11 | 12 |
long long twelvefold_way(long long n,long long k,long long type){
long long i,r=0,dt;
switch(type){
case 1:
return power(k,n);
break;
case 2:
if(k<n){return 0;}
return (factorial[k]*invfact[k-n])%mod;
break;
case 3:
if(n<k){return 0;}
for(i=0;i<=k;i++){
dt=(calcnCr(k,i)*power(i,n))%mod;
if((k-i)%2==1){r+=(mod-dt);}
else{r+=dt;}
if(r>=mod){r-=mod;}
}
return r;
break;
case 4:
return calcnCr(n+k-1,n);
break;
case 5:
if(k<n){return 0;}
return calcnCr(k,n);
break;
case 6:
if(n<k){return 0;}
return calcnCr(n-1,k-1);
break;
case 7:
for(i=0;i<=k;i++){
dt=(power(i,n)*invfact[i])%mod;
r+=dt*bce[k-i];
r%=mod;
}
return r;
case 8:
if(k<n){return 0;}
return 1;
break;
case 9:
if(n<k){return 0;}
for(i=0;i<=k;i++){
dt=(calcnCr(k,i)*power(i,n))%mod;
if((k-i)%2==1){r+=(mod-dt);}
else{r+=dt;}
if(r>=mod){r-=mod;}
}
r*=invfact[k];r%=mod;
return r;
break;
case 10:
partition_init();
return partition_rep(n,k);
break;
case 11:
if(k<n){return 0;}
return 1;
break;
case 12:
if(n<k){return 0;}
partition_init();
return partition_rep(n-k,k);
break;
}
}
int main(){
cfact();
long long n,k;
scanf("%lld%lld",&n,&k);
printf("%lld\n",twelvefold_way(n,k,2));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237258/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"
@factorial = dso_local local_unnamed_addr global [1048576 x i64] zeroinitializer, align 16
@invfact = dso_local local_unnamed_addr global [1048576 x i64] zeroinitializer, align 16
@bce = dso_local local_unnamed_addr global [1048576 x i64] zeroinitializer, align 16
@partition_isinit = dso_local local_unnamed_addr global i64 0, align 8
@partition = dso_local local_unnamed_addr global [1024 x [1024 x i64]] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @power(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp9 = icmp sgt i64 %b, 0
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%y.012 = phi i64 [ %rem2, %if.end ], [ %a, %entry ]
%x.011 = phi i64 [ %x.1, %if.end ], [ 1, %entry ]
%b.addr.010 = phi i64 [ %shr, %if.end ], [ %b, %entry ]
%and = and i64 %b.addr.010, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %y.012, %x.011
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%x.1 = phi i64 [ %rem, %if.then ], [ %x.011, %while.body ]
%mul1 = mul nsw i64 %y.012, %y.012
%rem2 = urem i64 %mul1, 1000000007
%shr = lshr i64 %b.addr.010, 1
%cmp.not = icmp ult i64 %b.addr.010, 2
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !5
while.end.loopexit: ; preds = %if.end
%0 = srem i64 %x.1, 1000000007
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%x.0.lcssa = phi i64 [ 1, %entry ], [ %0, %while.end.loopexit ]
ret i64 %x.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @modular_inverse(i64 noundef %n) local_unnamed_addr #0 {
entry:
br label %while.body.i
while.body.i: ; preds = %if.end.i, %entry
%y.012.i = phi i64 [ %rem2.i, %if.end.i ], [ %n, %entry ]
%x.011.i = phi i64 [ %x.1.i, %if.end.i ], [ 1, %entry ]
%b.addr.010.i = phi i64 [ %shr.i, %if.end.i ], [ 1000000005, %entry ]
%and.i = and i64 %b.addr.010.i, 1
%tobool.not.i = icmp eq i64 %and.i, 0
br i1 %tobool.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul nsw i64 %x.011.i, %y.012.i
%rem.i = srem i64 %mul.i, 1000000007
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%x.1.i = phi i64 [ %rem.i, %if.then.i ], [ %x.011.i, %while.body.i ]
%mul1.i = mul nsw i64 %y.012.i, %y.012.i
%rem2.i = urem i64 %mul1.i, 1000000007
%shr.i = lshr i64 %b.addr.010.i, 1
%cmp.not.i = icmp ult i64 %b.addr.010.i, 2
br i1 %cmp.not.i, label %power.exit, label %while.body.i, !llvm.loop !5
power.exit: ; preds = %if.end.i
%0 = srem i64 %x.1.i, 1000000007
ret i64 %0
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @cfact() local_unnamed_addr #2 {
entry:
store i64 1, ptr @factorial, align 16, !tbaa !7
store i64 1, ptr getelementptr inbounds ([1048576 x i64], ptr @factorial, i64 0, i64 1), align 8, !tbaa !7
br label %for.body
for.body: ; preds = %for.body, %entry
%0 = phi i64 [ 1, %entry ], [ %rem.1, %for.body ]
%i.066 = phi i64 [ 2, %entry ], [ %inc.1, %for.body ]
%mul = mul nsw i64 %0, %i.066
%arrayidx1 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %i.066
%rem = srem i64 %mul, 1000000007
store i64 %rem, ptr %arrayidx1, align 16, !tbaa !7
%inc = or i64 %i.066, 1
%mul.1 = mul nsw i64 %rem, %inc
%arrayidx1.1 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %inc
%rem.1 = srem i64 %mul.1, 1000000007
store i64 %rem.1, ptr %arrayidx1.1, align 8, !tbaa !7
%inc.1 = add nuw nsw i64 %i.066, 2
%exitcond.not.1 = icmp eq i64 %inc.1, 1048576
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body
%1 = load i64, ptr getelementptr inbounds ([1048576 x i64], ptr @factorial, i64 0, i64 1048575), align 8, !tbaa !7
br label %while.body.i.i
while.body.i.i: ; preds = %if.end.i.i, %for.end
%y.012.i.i = phi i64 [ %rem2.i.i, %if.end.i.i ], [ %1, %for.end ]
%x.011.i.i = phi i64 [ %x.1.i.i, %if.end.i.i ], [ 1, %for.end ]
%b.addr.010.i.i = phi i64 [ %shr.i.i, %if.end.i.i ], [ 1000000005, %for.end ]
%and.i.i = and i64 %b.addr.010.i.i, 1
%tobool.not.i.i = icmp eq i64 %and.i.i, 0
br i1 %tobool.not.i.i, label %if.end.i.i, label %if.then.i.i
if.then.i.i: ; preds = %while.body.i.i
%mul.i.i = mul nsw i64 %x.011.i.i, %y.012.i.i
%rem.i.i = srem i64 %mul.i.i, 1000000007
br label %if.end.i.i
if.end.i.i: ; preds = %if.then.i.i, %while.body.i.i
%x.1.i.i = phi i64 [ %rem.i.i, %if.then.i.i ], [ %x.011.i.i, %while.body.i.i ]
%mul1.i.i = mul nsw i64 %y.012.i.i, %y.012.i.i
%rem2.i.i = urem i64 %mul1.i.i, 1000000007
%shr.i.i = lshr i64 %b.addr.010.i.i, 1
%cmp.not.i.i = icmp ult i64 %b.addr.010.i.i, 2
br i1 %cmp.not.i.i, label %modular_inverse.exit, label %while.body.i.i, !llvm.loop !5
modular_inverse.exit: ; preds = %if.end.i.i
%2 = srem i64 %x.1.i.i, 1000000007
store i64 %2, ptr getelementptr inbounds ([1048576 x i64], ptr @invfact, i64 0, i64 1048575), align 8, !tbaa !7
br label %for.body5
for.body5: ; preds = %for.body5.1, %modular_inverse.exit
%3 = phi i64 [ %2, %modular_inverse.exit ], [ %rem11.1, %for.body5.1 ]
%i.167 = phi i64 [ 1048574, %modular_inverse.exit ], [ %dec.1, %for.body5.1 ]
%add = or i64 %i.167, 1
%mul8 = mul nsw i64 %3, %add
%arrayidx9 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.167
%rem11 = srem i64 %mul8, 1000000007
store i64 %rem11, ptr %arrayidx9, align 16, !tbaa !7
%cmp4.not = icmp eq i64 %i.167, 0
br i1 %cmp4.not, label %for.body16.peel.next, label %for.body5.1, !llvm.loop !12
for.body5.1: ; preds = %for.body5
%dec = add nsw i64 %i.167, -1
%mul8.1 = mul nsw i64 %rem11, %i.167
%arrayidx9.1 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %dec
%rem11.1 = srem i64 %mul8.1, 1000000007
store i64 %rem11.1, ptr %arrayidx9.1, align 8, !tbaa !7
%dec.1 = add nsw i64 %i.167, -2
br label %for.body5
for.body16.peel.next: ; preds = %for.body5
%4 = load i64, ptr @invfact, align 16, !tbaa !7
%rem25.peel = srem i64 %4, 1000000007
store i64 %rem25.peel, ptr @bce, align 16, !tbaa !7
br label %for.body16
for.body16: ; preds = %for.body16.peel.next, %for.body16
%5 = phi i64 [ %8, %for.body16 ], [ %rem25.peel, %for.body16.peel.next ]
%i.268 = phi i64 [ %inc40, %for.body16 ], [ 1, %for.body16.peel.next ]
%rem17 = and i64 %i.268, 1
%cmp18.not = icmp eq i64 %rem17, 0
%spec.select = select i1 %cmp18.not, i64 1, i64 1000000006
%6 = getelementptr inbounds [1048576 x i64], ptr @bce, i64 0, i64 %i.268
%arrayidx21 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.268
%7 = load i64, ptr %arrayidx21, align 8, !tbaa !7
%mul23 = mul nsw i64 %spec.select, %7
%rem25 = srem i64 %mul23, 1000000007
%add31 = add nsw i64 %5, %rem25
%cmp33 = icmp sgt i64 %add31, 1000000006
%sub36 = add nsw i64 %add31, -1000000007
%8 = select i1 %cmp33, i64 %sub36, i64 %add31
store i64 %8, ptr %6, align 8, !tbaa !7
%inc40 = add nuw nsw i64 %i.268, 1
%exitcond69.not = icmp eq i64 %inc40, 1048576
br i1 %exitcond69.not, label %for.end41, label %for.body16, !llvm.loop !13
for.end41: ; preds = %for.body16
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @calcnCr(i64 noundef %n, i64 noundef %k) local_unnamed_addr #3 {
entry:
%cmp = icmp slt i64 %k, 0
%cmp1 = icmp slt i64 %n, %k
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %return, label %if.end
if.end: ; preds = %entry
%arrayidx = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %n
%0 = load i64, ptr %arrayidx, align 8, !tbaa !7
%arrayidx2 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %k
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !7
%sub = sub nsw i64 %n, %k
%arrayidx3 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub
%2 = load i64, ptr %arrayidx3, align 8, !tbaa !7
%mul = mul nsw i64 %2, %1
%rem = srem i64 %mul, 1000000007
%mul4 = mul nsw i64 %rem, %0
%rem5 = srem i64 %mul4, 1000000007
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i64 [ %rem5, %if.end ], [ 0, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @partition_init() local_unnamed_addr #4 {
entry:
%0 = load i64, ptr @partition_isinit, align 8, !tbaa !7
%cmp = icmp eq i64 %0, 1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
store i64 1, ptr @partition_isinit, align 8, !tbaa !7
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8388608) @partition, i8 -1, i64 8388608, i1 false), !tbaa !7
br label %return
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @partition_rep(i64 noundef %n, i64 noundef %k) local_unnamed_addr #5 {
entry:
%0 = or i64 %k, %n
%or.cond.not = icmp sgt i64 %0, -1
br i1 %or.cond.not, label %if.end, label %common.ret38
if.end: ; preds = %entry
%cmp2 = icmp eq i64 %n, 0
br i1 %cmp2, label %common.ret38, label %if.end4
if.end4: ; preds = %if.end
%cmp5 = icmp eq i64 %k, 0
br i1 %cmp5, label %common.ret38, label %if.end9
if.end9: ; preds = %if.end4
%arrayidx10 = getelementptr inbounds [1024 x [1024 x i64]], ptr @partition, i64 0, i64 %n, i64 %k
%1 = load i64, ptr %arrayidx10, align 8, !tbaa !7
%cmp11.not = icmp eq i64 %1, -1
br i1 %cmp11.not, label %if.end15, label %common.ret38
common.ret38: ; preds = %if.end9, %if.end4, %if.end, %entry, %if.end15
%common.ret38.op = phi i64 [ %rem, %if.end15 ], [ 0, %entry ], [ 1, %if.end ], [ 0, %if.end4 ], [ %1, %if.end9 ]
ret i64 %common.ret38.op
if.end15: ; preds = %if.end9
%sub = add nsw i64 %k, -1
%call = tail call i64 @partition_rep(i64 noundef %n, i64 noundef %sub)
%sub16 = sub nsw i64 %n, %k
%call17 = tail call i64 @partition_rep(i64 noundef %sub16, i64 noundef %k)
%add = add nsw i64 %call17, %call
%rem = srem i64 %add, 1000000007
store i64 %rem, ptr %arrayidx10, align 8, !tbaa !7
br label %common.ret38
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @twelvefold_way(i64 noundef %n, i64 noundef %k, i64 noundef %type) local_unnamed_addr #6 {
entry:
switch i64 %type, label %cleanup [
i64 1, label %sw.bb
i64 2, label %sw.bb1
i64 3, label %sw.bb3
i64 4, label %sw.bb23
i64 5, label %sw.bb27
i64 6, label %sw.bb32
i64 7, label %for.cond40.preheader
i64 8, label %sw.bb55
i64 9, label %sw.bb59
i64 10, label %sw.bb89
i64 11, label %sw.bb91
i64 12, label %sw.bb95
]
for.cond40.preheader: ; preds = %entry
%cmp41.not302 = icmp slt i64 %k, 0
br i1 %cmp41.not302, label %cleanup, label %for.body42.lr.ph
for.body42.lr.ph: ; preds = %for.cond40.preheader
%cmp9.i242 = icmp sgt i64 %n, 0
br i1 %cmp9.i242, label %for.body42.us, label %for.body42
for.body42.us: ; preds = %for.body42.lr.ph, %while.end.loopexit.i259.us
%r.3304.us = phi i64 [ %rem51.us, %while.end.loopexit.i259.us ], [ 0, %for.body42.lr.ph ]
%i.1303.us = phi i64 [ %inc53.us, %while.end.loopexit.i259.us ], [ 0, %for.body42.lr.ph ]
br label %while.body.i244.us
while.body.i244.us: ; preds = %for.body42.us, %if.end.i253.us
%y.012.i245.us = phi i64 [ %rem2.i256.us, %if.end.i253.us ], [ %i.1303.us, %for.body42.us ]
%x.011.i246.us = phi i64 [ %x.1.i254.us, %if.end.i253.us ], [ 1, %for.body42.us ]
%b.addr.010.i247.us = phi i64 [ %shr.i257.us, %if.end.i253.us ], [ %n, %for.body42.us ]
%and.i248.us = and i64 %b.addr.010.i247.us, 1
%tobool.not.i249.us = icmp eq i64 %and.i248.us, 0
br i1 %tobool.not.i249.us, label %if.end.i253.us, label %if.then.i250.us
if.then.i250.us: ; preds = %while.body.i244.us
%mul.i251.us = mul nsw i64 %x.011.i246.us, %y.012.i245.us
%rem.i252.us = srem i64 %mul.i251.us, 1000000007
br label %if.end.i253.us
if.end.i253.us: ; preds = %if.then.i250.us, %while.body.i244.us
%x.1.i254.us = phi i64 [ %rem.i252.us, %if.then.i250.us ], [ %x.011.i246.us, %while.body.i244.us ]
%mul1.i255.us = mul nsw i64 %y.012.i245.us, %y.012.i245.us
%rem2.i256.us = urem i64 %mul1.i255.us, 1000000007
%shr.i257.us = lshr i64 %b.addr.010.i247.us, 1
%cmp.not.i258.us = icmp ult i64 %b.addr.010.i247.us, 2
br i1 %cmp.not.i258.us, label %while.end.loopexit.i259.us, label %while.body.i244.us, !llvm.loop !5
while.end.loopexit.i259.us: ; preds = %if.end.i253.us
%0 = srem i64 %x.1.i254.us, 1000000007
%arrayidx44.us = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.1303.us
%1 = load i64, ptr %arrayidx44.us, align 8, !tbaa !7
%mul45.us = mul nsw i64 %1, %0
%rem46.us = srem i64 %mul45.us, 1000000007
%sub47.us = sub nsw i64 %k, %i.1303.us
%arrayidx48.us = getelementptr inbounds [1048576 x i64], ptr @bce, i64 0, i64 %sub47.us
%2 = load i64, ptr %arrayidx48.us, align 8, !tbaa !7
%mul49.us = mul nsw i64 %rem46.us, %2
%add50.us = add nsw i64 %mul49.us, %r.3304.us
%rem51.us = srem i64 %add50.us, 1000000007
%inc53.us = add nuw i64 %i.1303.us, 1
%exitcond314.not = icmp eq i64 %i.1303.us, %k
br i1 %exitcond314.not, label %cleanup, label %for.body42.us, !llvm.loop !15
sw.bb: ; preds = %entry
%cmp9.i = icmp sgt i64 %n, 0
br i1 %cmp9.i, label %while.body.i, label %cleanup
while.body.i: ; preds = %sw.bb, %if.end.i
%y.012.i = phi i64 [ %rem2.i, %if.end.i ], [ %k, %sw.bb ]
%x.011.i = phi i64 [ %x.1.i, %if.end.i ], [ 1, %sw.bb ]
%b.addr.010.i = phi i64 [ %shr.i, %if.end.i ], [ %n, %sw.bb ]
%and.i = and i64 %b.addr.010.i, 1
%tobool.not.i = icmp eq i64 %and.i, 0
br i1 %tobool.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul nsw i64 %x.011.i, %y.012.i
%rem.i = srem i64 %mul.i, 1000000007
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%x.1.i = phi i64 [ %rem.i, %if.then.i ], [ %x.011.i, %while.body.i ]
%mul1.i = mul nsw i64 %y.012.i, %y.012.i
%rem2.i = urem i64 %mul1.i, 1000000007
%shr.i = lshr i64 %b.addr.010.i, 1
%cmp.not.i = icmp ult i64 %b.addr.010.i, 2
br i1 %cmp.not.i, label %while.end.loopexit.i, label %while.body.i, !llvm.loop !5
while.end.loopexit.i: ; preds = %if.end.i
%3 = srem i64 %x.1.i, 1000000007
br label %cleanup
sw.bb1: ; preds = %entry
%cmp = icmp slt i64 %k, %n
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %sw.bb1
%arrayidx = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %k
%4 = load i64, ptr %arrayidx, align 8, !tbaa !7
%sub = sub nsw i64 %k, %n
%arrayidx2 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub
%5 = load i64, ptr %arrayidx2, align 8, !tbaa !7
%mul = mul nsw i64 %5, %4
%rem = srem i64 %mul, 1000000007
br label %cleanup
sw.bb3: ; preds = %entry
%cmp4 = icmp slt i64 %n, %k
%cmp7.not306 = icmp slt i64 %k, 0
%or.cond310 = or i1 %cmp4, %cmp7.not306
br i1 %or.cond310, label %cleanup, label %calcnCr.exit.lr.ph
calcnCr.exit.lr.ph: ; preds = %sw.bb3
%arrayidx.i = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %k
%6 = load i64, ptr %arrayidx.i, align 8, !tbaa !7
%cmp9.i183 = icmp sgt i64 %n, 0
br label %calcnCr.exit
calcnCr.exit: ; preds = %calcnCr.exit.lr.ph, %power.exit201
%r.0308 = phi i64 [ 0, %calcnCr.exit.lr.ph ], [ %r.2, %power.exit201 ]
%i.0307 = phi i64 [ 0, %calcnCr.exit.lr.ph ], [ %inc, %power.exit201 ]
%arrayidx2.i = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.0307
%7 = load i64, ptr %arrayidx2.i, align 8, !tbaa !7
%sub.i = sub nsw i64 %k, %i.0307
%arrayidx3.i = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub.i
%8 = load i64, ptr %arrayidx3.i, align 8, !tbaa !7
%mul.i181 = mul nsw i64 %8, %7
%rem.i182 = srem i64 %mul.i181, 1000000007
%mul4.i = mul nsw i64 %rem.i182, %6
%rem5.i = srem i64 %mul4.i, 1000000007
br i1 %cmp9.i183, label %while.body.i185, label %power.exit201
while.body.i185: ; preds = %calcnCr.exit, %if.end.i194
%y.012.i186 = phi i64 [ %rem2.i197, %if.end.i194 ], [ %i.0307, %calcnCr.exit ]
%x.011.i187 = phi i64 [ %x.1.i195, %if.end.i194 ], [ 1, %calcnCr.exit ]
%b.addr.010.i188 = phi i64 [ %shr.i198, %if.end.i194 ], [ %n, %calcnCr.exit ]
%and.i189 = and i64 %b.addr.010.i188, 1
%tobool.not.i190 = icmp eq i64 %and.i189, 0
br i1 %tobool.not.i190, label %if.end.i194, label %if.then.i191
if.then.i191: ; preds = %while.body.i185
%mul.i192 = mul nsw i64 %x.011.i187, %y.012.i186
%rem.i193 = srem i64 %mul.i192, 1000000007
br label %if.end.i194
if.end.i194: ; preds = %if.then.i191, %while.body.i185
%x.1.i195 = phi i64 [ %rem.i193, %if.then.i191 ], [ %x.011.i187, %while.body.i185 ]
%mul1.i196 = mul nsw i64 %y.012.i186, %y.012.i186
%rem2.i197 = urem i64 %mul1.i196, 1000000007
%shr.i198 = lshr i64 %b.addr.010.i188, 1
%cmp.not.i199 = icmp ult i64 %b.addr.010.i188, 2
br i1 %cmp.not.i199, label %while.end.loopexit.i200, label %while.body.i185, !llvm.loop !5
while.end.loopexit.i200: ; preds = %if.end.i194
%9 = srem i64 %x.1.i195, 1000000007
br label %power.exit201
power.exit201: ; preds = %calcnCr.exit, %while.end.loopexit.i200
%x.0.lcssa.i184 = phi i64 [ 1, %calcnCr.exit ], [ %9, %while.end.loopexit.i200 ]
%mul10 = mul nsw i64 %x.0.lcssa.i184, %rem5.i
%rem11 = srem i64 %mul10, 1000000007
%10 = and i64 %sub.i, -9223372036854775807
%cmp14 = icmp eq i64 %10, 1
%reass.sub178 = add i64 %r.0308, 1000000007
%add = sub i64 %reass.sub178, %rem11
%add17 = add nsw i64 %rem11, %r.0308
%r.1 = select i1 %cmp14, i64 %add, i64 %add17
%cmp19 = icmp sgt i64 %r.1, 1000000006
%sub21 = add nsw i64 %r.1, -1000000007
%r.2 = select i1 %cmp19, i64 %sub21, i64 %r.1
%inc = add nuw i64 %i.0307, 1
%exitcond315.not = icmp eq i64 %i.0307, %k
br i1 %exitcond315.not, label %cleanup, label %calcnCr.exit, !llvm.loop !16
sw.bb23: ; preds = %entry
%cmp.i = icmp slt i64 %n, 0
%cmp1.i202 = icmp slt i64 %k, 1
%or.cond.i = or i1 %cmp.i, %cmp1.i202
br i1 %or.cond.i, label %cleanup, label %if.end.i203
if.end.i203: ; preds = %sw.bb23
%add24 = add nsw i64 %n, -1
%sub25 = add i64 %add24, %k
%arrayidx.i204 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %sub25
%11 = load i64, ptr %arrayidx.i204, align 8, !tbaa !7
%arrayidx2.i205 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %n
%12 = load i64, ptr %arrayidx2.i205, align 8, !tbaa !7
%sub.i206 = sub nsw i64 %sub25, %n
%arrayidx3.i207 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub.i206
%13 = load i64, ptr %arrayidx3.i207, align 8, !tbaa !7
%mul.i208 = mul nsw i64 %13, %12
%rem.i209 = srem i64 %mul.i208, 1000000007
%mul4.i210 = mul nsw i64 %rem.i209, %11
%rem5.i211 = srem i64 %mul4.i210, 1000000007
br label %cleanup
sw.bb27: ; preds = %entry
%cmp28 = icmp slt i64 %k, %n
%cmp.i214 = icmp slt i64 %n, 0
%or.cond = or i1 %cmp.i214, %cmp28
br i1 %or.cond, label %cleanup, label %if.end.i217
if.end.i217: ; preds = %sw.bb27
%arrayidx.i218 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %k
%14 = load i64, ptr %arrayidx.i218, align 8, !tbaa !7
%arrayidx2.i219 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %n
%15 = load i64, ptr %arrayidx2.i219, align 8, !tbaa !7
%sub.i220 = sub nsw i64 %k, %n
%arrayidx3.i221 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub.i220
%16 = load i64, ptr %arrayidx3.i221, align 8, !tbaa !7
%mul.i222 = mul nsw i64 %16, %15
%rem.i223 = srem i64 %mul.i222, 1000000007
%mul4.i224 = mul nsw i64 %rem.i223, %14
%rem5.i225 = srem i64 %mul4.i224, 1000000007
br label %cleanup
sw.bb32: ; preds = %entry
%cmp33 = icmp slt i64 %n, %k
%cmp.i228 = icmp slt i64 %k, 1
%or.cond297 = or i1 %cmp33, %cmp.i228
br i1 %or.cond297, label %cleanup, label %if.end.i231
if.end.i231: ; preds = %sw.bb32
%sub37 = add nsw i64 %k, -1
%sub36 = add nsw i64 %n, -1
%arrayidx.i232 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %sub36
%17 = load i64, ptr %arrayidx.i232, align 8, !tbaa !7
%arrayidx2.i233 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub37
%18 = load i64, ptr %arrayidx2.i233, align 8, !tbaa !7
%sub.i234 = sub nsw i64 %sub36, %sub37
%arrayidx3.i235 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub.i234
%19 = load i64, ptr %arrayidx3.i235, align 8, !tbaa !7
%mul.i236 = mul nsw i64 %19, %18
%rem.i237 = srem i64 %mul.i236, 1000000007
%mul4.i238 = mul nsw i64 %rem.i237, %17
%rem5.i239 = srem i64 %mul4.i238, 1000000007
br label %cleanup
for.body42: ; preds = %for.body42.lr.ph, %for.body42
%r.3304 = phi i64 [ %rem51, %for.body42 ], [ 0, %for.body42.lr.ph ]
%i.1303 = phi i64 [ %inc53, %for.body42 ], [ 0, %for.body42.lr.ph ]
%arrayidx44 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.1303
%20 = load i64, ptr %arrayidx44, align 8, !tbaa !7
%rem46 = srem i64 %20, 1000000007
%sub47 = sub nsw i64 %k, %i.1303
%arrayidx48 = getelementptr inbounds [1048576 x i64], ptr @bce, i64 0, i64 %sub47
%21 = load i64, ptr %arrayidx48, align 8, !tbaa !7
%mul49 = mul nsw i64 %rem46, %21
%add50 = add nsw i64 %mul49, %r.3304
%rem51 = srem i64 %add50, 1000000007
%inc53 = add nuw i64 %i.1303, 1
%exitcond313.not = icmp eq i64 %i.1303, %k
br i1 %exitcond313.not, label %cleanup, label %for.body42, !llvm.loop !15
sw.bb55: ; preds = %entry
%cmp56 = icmp sge i64 %k, %n
%. = zext i1 %cmp56 to i64
br label %cleanup
sw.bb59: ; preds = %entry
%cmp60 = icmp slt i64 %n, %k
br i1 %cmp60, label %cleanup, label %for.cond63.preheader
for.cond63.preheader: ; preds = %sw.bb59
%cmp64.not299 = icmp slt i64 %k, 0
br i1 %cmp64.not299, label %for.end85, label %calcnCr.exit272.lr.ph
calcnCr.exit272.lr.ph: ; preds = %for.cond63.preheader
%arrayidx.i263 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %k
%22 = load i64, ptr %arrayidx.i263, align 8, !tbaa !7
%cmp9.i273 = icmp sgt i64 %n, 0
br label %calcnCr.exit272
calcnCr.exit272: ; preds = %calcnCr.exit272.lr.ph, %power.exit291
%r.4301 = phi i64 [ 0, %calcnCr.exit272.lr.ph ], [ %r.6, %power.exit291 ]
%i.2300 = phi i64 [ 0, %calcnCr.exit272.lr.ph ], [ %inc84, %power.exit291 ]
%arrayidx2.i264 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.2300
%23 = load i64, ptr %arrayidx2.i264, align 8, !tbaa !7
%sub.i265 = sub nsw i64 %k, %i.2300
%arrayidx3.i266 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub.i265
%24 = load i64, ptr %arrayidx3.i266, align 8, !tbaa !7
%mul.i267 = mul nsw i64 %24, %23
%rem.i268 = srem i64 %mul.i267, 1000000007
%mul4.i269 = mul nsw i64 %rem.i268, %22
%rem5.i270 = srem i64 %mul4.i269, 1000000007
br i1 %cmp9.i273, label %while.body.i275, label %power.exit291
while.body.i275: ; preds = %calcnCr.exit272, %if.end.i284
%y.012.i276 = phi i64 [ %rem2.i287, %if.end.i284 ], [ %i.2300, %calcnCr.exit272 ]
%x.011.i277 = phi i64 [ %x.1.i285, %if.end.i284 ], [ 1, %calcnCr.exit272 ]
%b.addr.010.i278 = phi i64 [ %shr.i288, %if.end.i284 ], [ %n, %calcnCr.exit272 ]
%and.i279 = and i64 %b.addr.010.i278, 1
%tobool.not.i280 = icmp eq i64 %and.i279, 0
br i1 %tobool.not.i280, label %if.end.i284, label %if.then.i281
if.then.i281: ; preds = %while.body.i275
%mul.i282 = mul nsw i64 %x.011.i277, %y.012.i276
%rem.i283 = srem i64 %mul.i282, 1000000007
br label %if.end.i284
if.end.i284: ; preds = %if.then.i281, %while.body.i275
%x.1.i285 = phi i64 [ %rem.i283, %if.then.i281 ], [ %x.011.i277, %while.body.i275 ]
%mul1.i286 = mul nsw i64 %y.012.i276, %y.012.i276
%rem2.i287 = urem i64 %mul1.i286, 1000000007
%shr.i288 = lshr i64 %b.addr.010.i278, 1
%cmp.not.i289 = icmp ult i64 %b.addr.010.i278, 2
br i1 %cmp.not.i289, label %while.end.loopexit.i290, label %while.body.i275, !llvm.loop !5
while.end.loopexit.i290: ; preds = %if.end.i284
%25 = srem i64 %x.1.i285, 1000000007
br label %power.exit291
power.exit291: ; preds = %calcnCr.exit272, %while.end.loopexit.i290
%x.0.lcssa.i274 = phi i64 [ 1, %calcnCr.exit272 ], [ %25, %while.end.loopexit.i290 ]
%mul68 = mul nsw i64 %x.0.lcssa.i274, %rem5.i270
%rem69 = srem i64 %mul68, 1000000007
%26 = and i64 %sub.i265, -9223372036854775807
%cmp72 = icmp eq i64 %26, 1
%reass.sub = add i64 %r.4301, 1000000007
%add75 = sub i64 %reass.sub, %rem69
%add77 = add nsw i64 %rem69, %r.4301
%r.5 = select i1 %cmp72, i64 %add75, i64 %add77
%cmp79 = icmp sgt i64 %r.5, 1000000006
%sub81 = add nsw i64 %r.5, -1000000007
%r.6 = select i1 %cmp79, i64 %sub81, i64 %r.5
%inc84 = add nuw i64 %i.2300, 1
%exitcond.not = icmp eq i64 %i.2300, %k
br i1 %exitcond.not, label %for.end85, label %calcnCr.exit272, !llvm.loop !17
for.end85: ; preds = %power.exit291, %for.cond63.preheader
%r.4.lcssa = phi i64 [ 0, %for.cond63.preheader ], [ %r.6, %power.exit291 ]
%arrayidx86 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %k
%27 = load i64, ptr %arrayidx86, align 8, !tbaa !7
%mul87 = mul nsw i64 %27, %r.4.lcssa
%rem88 = srem i64 %mul87, 1000000007
br label %cleanup
sw.bb89: ; preds = %entry
%28 = load i64, ptr @partition_isinit, align 8, !tbaa !7
%cmp.i292 = icmp eq i64 %28, 1
br i1 %cmp.i292, label %partition_init.exit, label %if.end.i293
if.end.i293: ; preds = %sw.bb89
store i64 1, ptr @partition_isinit, align 8, !tbaa !7
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8388608) @partition, i8 -1, i64 8388608, i1 false), !tbaa !7
br label %partition_init.exit
partition_init.exit: ; preds = %sw.bb89, %if.end.i293
%call90 = tail call i64 @partition_rep(i64 noundef %n, i64 noundef %k)
br label %cleanup
sw.bb91: ; preds = %entry
%cmp92 = icmp sge i64 %k, %n
%.179 = zext i1 %cmp92 to i64
br label %cleanup
sw.bb95: ; preds = %entry
%cmp96 = icmp slt i64 %n, %k
br i1 %cmp96, label %cleanup, label %if.end98
if.end98: ; preds = %sw.bb95
%29 = load i64, ptr @partition_isinit, align 8, !tbaa !7
%cmp.i294 = icmp eq i64 %29, 1
br i1 %cmp.i294, label %partition_init.exit296, label %if.end.i295
if.end.i295: ; preds = %if.end98
store i64 1, ptr @partition_isinit, align 8, !tbaa !7
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8388608) @partition, i8 -1, i64 8388608, i1 false), !tbaa !7
br label %partition_init.exit296
partition_init.exit296: ; preds = %if.end98, %if.end.i295
%sub99 = sub nsw i64 %n, %k
%call100 = tail call i64 @partition_rep(i64 noundef %sub99, i64 noundef %k)
br label %cleanup
cleanup: ; preds = %for.body42, %while.end.loopexit.i259.us, %power.exit201, %for.cond40.preheader, %if.end.i231, %if.end.i217, %if.end.i203, %sw.bb23, %while.end.loopexit.i, %sw.bb, %entry, %sw.bb95, %sw.bb91, %sw.bb59, %sw.bb55, %sw.bb32, %sw.bb27, %sw.bb3, %sw.bb1, %partition_init.exit296, %partition_init.exit, %for.end85, %if.end
%retval.0 = phi i64 [ %call100, %partition_init.exit296 ], [ %call90, %partition_init.exit ], [ %rem88, %for.end85 ], [ %rem, %if.end ], [ 0, %sw.bb1 ], [ 0, %sw.bb3 ], [ 0, %sw.bb27 ], [ 0, %sw.bb32 ], [ %., %sw.bb55 ], [ 0, %sw.bb59 ], [ %.179, %sw.bb91 ], [ 0, %sw.bb95 ], [ undef, %entry ], [ 1, %sw.bb ], [ %3, %while.end.loopexit.i ], [ %rem5.i211, %if.end.i203 ], [ 0, %sw.bb23 ], [ %rem5.i225, %if.end.i217 ], [ %rem5.i239, %if.end.i231 ], [ 0, %for.cond40.preheader ], [ %r.2, %power.exit201 ], [ %rem51.us, %while.end.loopexit.i259.us ], [ %rem51, %for.body42 ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
store i64 1, ptr @factorial, align 16, !tbaa !7
store i64 1, ptr getelementptr inbounds ([1048576 x i64], ptr @factorial, i64 0, i64 1), align 8, !tbaa !7
br label %for.body.i
for.body.i: ; preds = %for.body.i, %entry
%0 = phi i64 [ 1, %entry ], [ %rem.i.1, %for.body.i ]
%i.066.i = phi i64 [ 2, %entry ], [ %inc.i.1, %for.body.i ]
%mul.i = mul nsw i64 %i.066.i, %0
%arrayidx1.i = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %i.066.i
%rem.i = srem i64 %mul.i, 1000000007
store i64 %rem.i, ptr %arrayidx1.i, align 16, !tbaa !7
%inc.i = or i64 %i.066.i, 1
%mul.i.1 = mul nsw i64 %inc.i, %rem.i
%arrayidx1.i.1 = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %inc.i
%rem.i.1 = srem i64 %mul.i.1, 1000000007
store i64 %rem.i.1, ptr %arrayidx1.i.1, align 8, !tbaa !7
%inc.i.1 = add nuw nsw i64 %i.066.i, 2
%exitcond.not.i.1 = icmp eq i64 %inc.i.1, 1048576
br i1 %exitcond.not.i.1, label %for.end.i, label %for.body.i, !llvm.loop !11
for.end.i: ; preds = %for.body.i
%1 = load i64, ptr getelementptr inbounds ([1048576 x i64], ptr @factorial, i64 0, i64 1048575), align 8, !tbaa !7
br label %while.body.i.i.i
while.body.i.i.i: ; preds = %if.end.i.i.i, %for.end.i
%y.012.i.i.i = phi i64 [ %rem2.i.i.i, %if.end.i.i.i ], [ %1, %for.end.i ]
%x.011.i.i.i = phi i64 [ %x.1.i.i.i, %if.end.i.i.i ], [ 1, %for.end.i ]
%b.addr.010.i.i.i = phi i64 [ %shr.i.i.i, %if.end.i.i.i ], [ 1000000005, %for.end.i ]
%and.i.i.i = and i64 %b.addr.010.i.i.i, 1
%tobool.not.i.i.i = icmp eq i64 %and.i.i.i, 0
br i1 %tobool.not.i.i.i, label %if.end.i.i.i, label %if.then.i.i.i
if.then.i.i.i: ; preds = %while.body.i.i.i
%mul.i.i.i = mul nsw i64 %x.011.i.i.i, %y.012.i.i.i
%rem.i.i.i = srem i64 %mul.i.i.i, 1000000007
br label %if.end.i.i.i
if.end.i.i.i: ; preds = %if.then.i.i.i, %while.body.i.i.i
%x.1.i.i.i = phi i64 [ %rem.i.i.i, %if.then.i.i.i ], [ %x.011.i.i.i, %while.body.i.i.i ]
%mul1.i.i.i = mul nsw i64 %y.012.i.i.i, %y.012.i.i.i
%rem2.i.i.i = urem i64 %mul1.i.i.i, 1000000007
%shr.i.i.i = lshr i64 %b.addr.010.i.i.i, 1
%cmp.not.i.i.i = icmp ult i64 %b.addr.010.i.i.i, 2
br i1 %cmp.not.i.i.i, label %modular_inverse.exit.i, label %while.body.i.i.i, !llvm.loop !5
modular_inverse.exit.i: ; preds = %if.end.i.i.i
%2 = srem i64 %x.1.i.i.i, 1000000007
store i64 %2, ptr getelementptr inbounds ([1048576 x i64], ptr @invfact, i64 0, i64 1048575), align 8, !tbaa !7
br label %for.body5.i
for.body5.i: ; preds = %for.body5.i.1, %modular_inverse.exit.i
%3 = phi i64 [ %2, %modular_inverse.exit.i ], [ %rem11.i.1, %for.body5.i.1 ]
%i.167.i = phi i64 [ 1048574, %modular_inverse.exit.i ], [ %dec.i.1, %for.body5.i.1 ]
%add.i = or i64 %i.167.i, 1
%mul8.i = mul nsw i64 %add.i, %3
%arrayidx9.i = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.167.i
%rem11.i = srem i64 %mul8.i, 1000000007
store i64 %rem11.i, ptr %arrayidx9.i, align 16, !tbaa !7
%cmp4.not.i = icmp eq i64 %i.167.i, 0
br i1 %cmp4.not.i, label %for.body16.peel.next.i, label %for.body5.i.1, !llvm.loop !12
for.body5.i.1: ; preds = %for.body5.i
%dec.i = add nsw i64 %i.167.i, -1
%mul8.i.1 = mul nsw i64 %i.167.i, %rem11.i
%arrayidx9.i.1 = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %dec.i
%rem11.i.1 = srem i64 %mul8.i.1, 1000000007
store i64 %rem11.i.1, ptr %arrayidx9.i.1, align 8, !tbaa !7
%dec.i.1 = add nsw i64 %i.167.i, -2
br label %for.body5.i
for.body16.peel.next.i: ; preds = %for.body5.i
%4 = load i64, ptr @invfact, align 16, !tbaa !7
%rem25.peel.i = srem i64 %4, 1000000007
store i64 %rem25.peel.i, ptr @bce, align 16, !tbaa !7
br label %for.body16.i
for.body16.i: ; preds = %for.body16.i, %for.body16.peel.next.i
%5 = phi i64 [ %8, %for.body16.i ], [ %rem25.peel.i, %for.body16.peel.next.i ]
%i.268.i = phi i64 [ %inc40.i, %for.body16.i ], [ 1, %for.body16.peel.next.i ]
%rem17.i = and i64 %i.268.i, 1
%cmp18.not.i = icmp eq i64 %rem17.i, 0
%spec.select.i = select i1 %cmp18.not.i, i64 1, i64 1000000006
%6 = getelementptr inbounds [1048576 x i64], ptr @bce, i64 0, i64 %i.268.i
%arrayidx21.i = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %i.268.i
%7 = load i64, ptr %arrayidx21.i, align 8, !tbaa !7
%mul23.i = mul nsw i64 %spec.select.i, %7
%rem25.i = srem i64 %mul23.i, 1000000007
%add31.i = add nsw i64 %rem25.i, %5
%cmp33.i = icmp sgt i64 %add31.i, 1000000006
%sub36.i = add nsw i64 %add31.i, -1000000007
%8 = select i1 %cmp33.i, i64 %sub36.i, i64 %add31.i
store i64 %8, ptr %6, align 8, !tbaa !7
%inc40.i = add nuw nsw i64 %i.268.i, 1
%exitcond69.not.i = icmp eq i64 %inc40.i, 1048576
br i1 %exitcond69.not.i, label %cfact.exit, label %for.body16.i, !llvm.loop !13
cfact.exit: ; preds = %for.body16.i
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%9 = load i64, ptr %n, align 8, !tbaa !7
%10 = load i64, ptr %k, align 8, !tbaa !7
%cmp.i = icmp slt i64 %10, %9
br i1 %cmp.i, label %twelvefold_way.exit, label %if.end.i
if.end.i: ; preds = %cfact.exit
%arrayidx.i = getelementptr inbounds [1048576 x i64], ptr @factorial, i64 0, i64 %10
%11 = load i64, ptr %arrayidx.i, align 8, !tbaa !7
%sub.i = sub nsw i64 %10, %9
%arrayidx2.i = getelementptr inbounds [1048576 x i64], ptr @invfact, i64 0, i64 %sub.i
%12 = load i64, ptr %arrayidx2.i, align 8, !tbaa !7
%mul.i3 = mul nsw i64 %12, %11
%rem.i4 = srem i64 %mul.i3, 1000000007
br label %twelvefold_way.exit
twelvefold_way.exit: ; preds = %cfact.exit, %if.end.i
%retval.0.i = phi i64 [ %rem.i4, %if.end.i ], [ 0, %cfact.exit ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %retval.0.i)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
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 norecurse 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 #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, 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 #4 = { mustprogress nofree 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 #5 = { 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 #6 = { nofree nosync nounwind memory(readwrite, 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 #7 = { 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 #8 = { 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 #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { 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 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
|
#include<stdio.h>
#define MAX 100005
#define NIL -1
typedef struct{
int parent, left, right;
}Node;
Node Tree[MAX];
int Depth[MAX];
int Height[MAX];
int degree[MAX];
int h;
int getDepth(int);
int getHeight(int);
void print(int);
int main(void){
int i, n;
int vertex;
int child[2];
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
Tree[i].parent = NIL;
Tree[i].left = NIL;
Tree[i].right = NIL;
}
for ( i = 0; i < n; i++ ){
scanf("%d %d %d", &vertex, &child[0], &child[1]);
//子どもがいない場合はdegreeは0である。
if(child[0] == NIL && child[1] == NIL)
degree[vertex] = 0;
//子どもがどちらかにいればdegreeは1である。
else if(child[0] == NIL && child[1] != NIL){
degree[vertex] = 1;
Tree[child[1]].parent = vertex;
Tree[vertex].right = child[1];
}
else if(child[0] != NIL && child[1] == NIL){
degree[vertex] = 1;
Tree[child[0]].parent = vertex;
Tree[vertex].left = child[0];
}
//子どもが両方存在するという事はdegreeは2という事
else{
degree[vertex] = 2;
Tree[child[0]].parent = vertex;
Tree[child[1]].parent = vertex;
Tree[vertex].left = child[0];
Tree[vertex].right = child[1];
}
}
for(i = 0;i < n; i++){
Height[i] = getHeight(i);
}
for ( i = 0; i < n; i++ )
Depth[i] = getDepth(i);
for ( i = 0; i < n; i++ )
print(i);
return 0;
}
int getHeight(int u){
int l = Tree[u].left;
int r = Tree[u].right;
int heightL = 0;
int heightR = 0;
if(l == NIL && r == NIL){
return 0;
}
if(l != NIL){
heightL = getHeight(l) + 1;
}
if (r != NIL){
heightR = getHeight(r) + 1;
}
if(heightL < heightR){
return heightR;
}
else{
return heightL;
}
}
int getDepth(int u){
int d = 0;
while(Tree[u].parent >= 0){
u = Tree[u].parent;
d++;
}
return d;
}
void print(int u){
int index = Tree[u].parent;
printf("node %d: parent = %d, ",u, Tree[u].parent);
if(index == NIL){
printf("sibling = %d, ",NIL);
}
else if(Tree[index].right != u){
printf("sibling = %d, ",Tree[index].right);
}
else if(Tree[index].left != u){
printf("sibling = %d, ",Tree[index].left);
}
printf("degree = %d, depth = %d, height = %d, ",degree[u], Depth[u], Height[u]);
if(Tree[u].parent == NIL)
printf("root\n");
else if(degree[u] == 0)
printf("leaf\n");
else if(2 >= degree[u] && degree[u] >= 1)
printf("internal node\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237308/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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@Tree = dso_local local_unnamed_addr global [100005 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@degree = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16
@Height = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16
@Depth = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [23 x i8] c"node %d: parent = %d, \00", align 1
@.str.3 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.4 = private unnamed_addr constant [39 x i8] c"degree = %d, depth = %d, height = %d, \00", align 1
@h = dso_local local_unnamed_addr global i32 0, align 4
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.8 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.9 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%vertex = alloca i32, align 4
%child = alloca [2 x i32], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %vertex) #8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %child) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp117 = icmp sgt i32 %0, 0
br i1 %cmp117, label %for.body7.lr.ph, label %for.end97
for.body7.lr.ph: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
call void @llvm.memset.p0.i64(ptr nonnull align 16 @Tree, i8 -1, i64 %2, i1 false), !tbaa !5
%arrayidx9 = getelementptr inbounds [2 x i32], ptr %child, i64 0, i64 1
br label %for.body7
for.cond74.preheader: ; preds = %for.inc71
%cmp75121 = icmp sgt i32 %8, 0
br i1 %cmp75121, label %for.body76.preheader, label %for.end97
for.body76.preheader: ; preds = %for.cond74.preheader
%wide.trip.count = zext i32 %8 to i64
br label %for.body76
for.body7: ; preds = %for.body7.lr.ph, %for.inc71
%i.1120 = phi i32 [ 0, %for.body7.lr.ph ], [ %inc72, %for.inc71 ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vertex, ptr noundef nonnull %child, ptr noundef nonnull %arrayidx9)
%3 = load i32, ptr %child, align 4, !tbaa !5
%cmp12 = icmp eq i32 %3, -1
%4 = load i32, ptr %arrayidx9, align 4
%cmp14 = icmp eq i32 %4, -1
%or.cond = select i1 %cmp12, i1 %cmp14, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %for.body7
%5 = load i32, ptr %vertex, align 4, !tbaa !5
%idxprom15 = sext i32 %5 to i64
%arrayidx16 = getelementptr inbounds [100005 x i32], ptr @degree, i64 0, i64 %idxprom15
store i32 0, ptr %arrayidx16, align 4, !tbaa !5
br label %for.inc71
if.else: ; preds = %for.body7
%cmp21 = icmp ne i32 %4, -1
%or.cond98 = select i1 %cmp12, i1 %cmp21, i1 false
br i1 %or.cond98, label %if.then22, label %if.else33
if.then22: ; preds = %if.else
%6 = load i32, ptr %vertex, align 4, !tbaa !5
%idxprom23 = sext i32 %6 to i64
%arrayidx24 = getelementptr inbounds [100005 x i32], ptr @degree, i64 0, i64 %idxprom23
store i32 1, ptr %arrayidx24, align 4, !tbaa !5
%idxprom26 = sext i32 %4 to i64
%arrayidx27 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom26
store i32 %6, ptr %arrayidx27, align 4, !tbaa !9
%right32 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom23, i32 2
store i32 %4, ptr %right32, align 4, !tbaa !11
br label %for.inc71
if.else33: ; preds = %if.else
%cmp35 = icmp ne i32 %3, -1
%or.cond99 = select i1 %cmp35, i1 %cmp14, i1 false
%7 = load i32, ptr %vertex, align 4, !tbaa !5
%idxprom40 = sext i32 %7 to i64
%arrayidx41 = getelementptr inbounds [100005 x i32], ptr @degree, i64 0, i64 %idxprom40
%idxprom43 = sext i32 %3 to i64
%arrayidx44 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom43
br i1 %or.cond99, label %if.then39, label %if.else50
if.then39: ; preds = %if.else33
store i32 1, ptr %arrayidx41, align 4, !tbaa !5
store i32 %7, ptr %arrayidx44, align 4, !tbaa !9
%left49 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom40, i32 1
store i32 %3, ptr %left49, align 4, !tbaa !12
br label %for.inc71
if.else50: ; preds = %if.else33
store i32 2, ptr %arrayidx41, align 4, !tbaa !5
store i32 %7, ptr %arrayidx44, align 4, !tbaa !9
%idxprom58 = sext i32 %4 to i64
%arrayidx59 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom58
store i32 %7, ptr %arrayidx59, align 4, !tbaa !9
%left64 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom40, i32 1
store i32 %3, ptr %left64, align 4, !tbaa !12
%right68 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom40, i32 2
store i32 %4, ptr %right68, align 4, !tbaa !11
br label %for.inc71
for.inc71: ; preds = %if.then, %if.then39, %if.else50, %if.then22
%inc72 = add nuw nsw i32 %i.1120, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc72, %8
br i1 %cmp6, label %for.body7, label %for.cond74.preheader, !llvm.loop !13
for.cond83.preheader: ; preds = %for.body76
br i1 %cmp75121, label %while.cond.i.preheader.preheader, label %for.end97
while.cond.i.preheader.preheader: ; preds = %for.cond83.preheader
%xtraiter = and i64 %wide.trip.count, 1
%9 = icmp eq i32 %8, 1
br i1 %9, label %for.cond92.preheader.unr-lcssa, label %while.cond.i.preheader.preheader.new
while.cond.i.preheader.preheader.new: ; preds = %while.cond.i.preheader.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %while.cond.i.preheader
for.body76: ; preds = %for.body76.preheader, %for.body76
%indvars.iv = phi i64 [ 0, %for.body76.preheader ], [ %indvars.iv.next, %for.body76 ]
%10 = trunc i64 %indvars.iv to i32
%call77 = call i32 @getHeight(i32 noundef %10)
%arrayidx79 = getelementptr inbounds [100005 x i32], ptr @Height, i64 0, i64 %indvars.iv
store i32 %call77, ptr %arrayidx79, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond83.preheader, label %for.body76, !llvm.loop !15
while.cond.i.preheader: ; preds = %getDepth.exit.1, %while.cond.i.preheader.preheader.new
%indvars.iv130 = phi i64 [ 0, %while.cond.i.preheader.preheader.new ], [ %indvars.iv.next131.1, %getDepth.exit.1 ]
%niter = phi i64 [ 0, %while.cond.i.preheader.preheader.new ], [ %niter.next.1, %getDepth.exit.1 ]
%11 = trunc i64 %indvars.iv130 to i32
br label %while.cond.i
for.cond92.preheader.unr-lcssa: ; preds = %getDepth.exit.1, %while.cond.i.preheader.preheader
%indvars.iv130.unr = phi i64 [ 0, %while.cond.i.preheader.preheader ], [ %indvars.iv.next131.1, %getDepth.exit.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond92.preheader, label %while.cond.i.preheader.epil
while.cond.i.preheader.epil: ; preds = %for.cond92.preheader.unr-lcssa
%12 = trunc i64 %indvars.iv130.unr to i32
br label %while.cond.i.epil
while.cond.i.epil: ; preds = %while.cond.i.epil, %while.cond.i.preheader.epil
%u.addr.0.i.epil = phi i32 [ %13, %while.cond.i.epil ], [ %12, %while.cond.i.preheader.epil ]
%d.0.i.epil = phi i32 [ %inc.i.epil, %while.cond.i.epil ], [ 0, %while.cond.i.preheader.epil ]
%idxprom.i.epil = zext i32 %u.addr.0.i.epil to i64
%arrayidx.i.epil = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom.i.epil
%13 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !9
%cmp.i.epil = icmp sgt i32 %13, -1
%inc.i.epil = add nuw nsw i32 %d.0.i.epil, 1
br i1 %cmp.i.epil, label %while.cond.i.epil, label %getDepth.exit.epil, !llvm.loop !16
getDepth.exit.epil: ; preds = %while.cond.i.epil
%arrayidx88.epil = getelementptr inbounds [100005 x i32], ptr @Depth, i64 0, i64 %indvars.iv130.unr
store i32 %d.0.i.epil, ptr %arrayidx88.epil, align 4, !tbaa !5
br label %for.cond92.preheader
for.cond92.preheader: ; preds = %for.cond92.preheader.unr-lcssa, %getDepth.exit.epil
br i1 %cmp75121, label %for.body94, label %for.end97
while.cond.i: ; preds = %while.cond.i.preheader, %while.cond.i
%u.addr.0.i = phi i32 [ %14, %while.cond.i ], [ %11, %while.cond.i.preheader ]
%d.0.i = phi i32 [ %inc.i, %while.cond.i ], [ 0, %while.cond.i.preheader ]
%idxprom.i = zext i32 %u.addr.0.i to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom.i
%14 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp.i = icmp sgt i32 %14, -1
%inc.i = add nuw nsw i32 %d.0.i, 1
br i1 %cmp.i, label %while.cond.i, label %getDepth.exit, !llvm.loop !16
getDepth.exit: ; preds = %while.cond.i
%arrayidx88 = getelementptr inbounds [100005 x i32], ptr @Depth, i64 0, i64 %indvars.iv130
store i32 %d.0.i, ptr %arrayidx88, align 8, !tbaa !5
%indvars.iv.next131 = or i64 %indvars.iv130, 1
%15 = trunc i64 %indvars.iv.next131 to i32
br label %while.cond.i.1
while.cond.i.1: ; preds = %while.cond.i.1, %getDepth.exit
%u.addr.0.i.1 = phi i32 [ %16, %while.cond.i.1 ], [ %15, %getDepth.exit ]
%d.0.i.1 = phi i32 [ %inc.i.1, %while.cond.i.1 ], [ 0, %getDepth.exit ]
%idxprom.i.1 = zext i32 %u.addr.0.i.1 to i64
%arrayidx.i.1 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom.i.1
%16 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !9
%cmp.i.1 = icmp sgt i32 %16, -1
%inc.i.1 = add nuw nsw i32 %d.0.i.1, 1
br i1 %cmp.i.1, label %while.cond.i.1, label %getDepth.exit.1, !llvm.loop !16
getDepth.exit.1: ; preds = %while.cond.i.1
%arrayidx88.1 = getelementptr inbounds [100005 x i32], ptr @Depth, i64 0, i64 %indvars.iv.next131
store i32 %d.0.i.1, ptr %arrayidx88.1, align 4, !tbaa !5
%indvars.iv.next131.1 = add nuw nsw i64 %indvars.iv130, 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.cond92.preheader.unr-lcssa, label %while.cond.i.preheader, !llvm.loop !17
for.body94: ; preds = %for.cond92.preheader, %for.body94
%i.4126 = phi i32 [ %inc96, %for.body94 ], [ 0, %for.cond92.preheader ]
call void @print(i32 noundef %i.4126)
%inc96 = add nuw nsw i32 %i.4126, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp93 = icmp slt i32 %inc96, %17
br i1 %cmp93, label %for.body94, label %for.end97, !llvm.loop !18
for.end97: ; preds = %for.body94, %entry, %for.cond74.preheader, %for.cond83.preheader, %for.cond92.preheader
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %child) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vertex) #8
call void @llvm.lifetime.end.p0(i64 4, 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getHeight(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !12
%right = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %0, -1
%cmp3 = icmp eq i32 %1, -1
%or.cond = select i1 %cmp, i1 %cmp3, i1 false
br i1 %or.cond, label %cleanup, label %if.end
if.end: ; preds = %entry
br i1 %cmp, label %if.end6, label %if.then5
if.then5: ; preds = %if.end
%call = tail call i32 @getHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end6
if.end6: ; preds = %if.then5, %if.end
%heightL.0 = phi i32 [ %add, %if.then5 ], [ 0, %if.end ]
br i1 %cmp3, label %if.end11, label %if.then8
if.then8: ; preds = %if.end6
%call9 = tail call i32 @getHeight(i32 noundef %1)
%add10 = add nsw i32 %call9, 1
br label %if.end11
if.end11: ; preds = %if.then8, %if.end6
%heightR.0 = phi i32 [ %add10, %if.then8 ], [ 0, %if.end6 ]
%heightR.0.heightL.0 = tail call i32 @llvm.smax.i32(i32 %heightL.0, i32 %heightR.0)
br label %cleanup
cleanup: ; preds = %if.end11, %entry
%retval.0 = phi i32 [ 0, %entry ], [ %heightR.0.heightL.0, %if.end11 ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getDepth(i32 noundef %u) local_unnamed_addr #4 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%u.addr.0 = phi i32 [ %u, %entry ], [ %0, %while.cond ]
%d.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%idxprom = sext i32 %u.addr.0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp sgt i32 %0, -1
%inc = add nuw nsw i32 %d.0, 1
br i1 %cmp, label %while.cond, label %while.end, !llvm.loop !16
while.end: ; preds = %while.cond
ret i32 %d.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %u, i32 noundef %0)
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.end23.sink.split, label %if.else
if.else: ; preds = %entry
%idxprom5 = sext i32 %0 to i64
%right = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp7.not = icmp eq i32 %1, %u
br i1 %cmp7.not, label %if.else13, label %if.end23.sink.split
if.else13: ; preds = %if.else
%left = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 1
%2 = load i32, ptr %left, align 4, !tbaa !12
%cmp16.not = icmp eq i32 %2, %u
br i1 %cmp16.not, label %if.end23, label %if.end23.sink.split
if.end23.sink.split: ; preds = %if.else13, %if.else, %entry
%.sink = phi i32 [ -1, %entry ], [ %1, %if.else ], [ %2, %if.else13 ]
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.sink)
br label %if.end23
if.end23: ; preds = %if.end23.sink.split, %if.else13
%arrayidx25 = getelementptr inbounds [100005 x i32], ptr @degree, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%arrayidx27 = getelementptr inbounds [100005 x i32], ptr @Depth, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx29 = getelementptr inbounds [100005 x i32], ptr @Height, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%call30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %3, i32 noundef %4, i32 noundef %5)
%6 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp34 = icmp eq i32 %6, -1
br i1 %cmp34, label %if.end54.sink.split, label %if.else37
if.else37: ; preds = %if.end23
%7 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp40 = icmp eq i32 %7, 0
br i1 %cmp40, label %if.end54.sink.split, label %if.else43
if.else43: ; preds = %if.else37
%or.cond = icmp ult i32 %7, 3
br i1 %or.cond, label %if.end54.sink.split, label %if.end54
if.end54.sink.split: ; preds = %if.else43, %if.else37, %if.end23
%str.8.sink = phi ptr [ @str.9, %if.end23 ], [ @str.8, %if.else37 ], [ @str, %if.else43 ]
%puts73 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
br label %if.end54
if.end54: ; preds = %if.end54.sink.split, %if.else43
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
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(read, 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 #4 = { nofree norecurse nosync nounwind memory(read, 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
|
#include<stdio.h>
struct Node{
int a,b,c;
};
struct Node N[10000];
int depth(int);
int sibling(int);
int n;
int D[10000],S[10000];
int main(){
int i,j,k,l,m,q,r,s;
scanf("%d",&n);
for(i=0;i<n;i++){
N[i].a=-1;
}
for(i=0;i<n;i++){
scanf("%d %d %d",&q,&r,&s);
N[q].b=r;
N[q].c=s;
if(r!=-1){
N[r].a=q;
}
if(s!=-1){
N[s].a=q;
}
}
for(i=0;i<n;i++){
D[i]=depth(i);
S[i]=0;
}
for(i=0;i<n;i++){
if(N[i].b==-1 && N[i].c==-1){
S[i]=0;
k=N[i].a;
l=1;
while(1){
if(k==-1){
break;
}
if(S[k]<l){
S[k]=l;
}
l++;
k=N[k].a;
}
}
}
for(i=0;i<n;i++){
j=0;
printf("node %d: ",i);
printf("parent = %d, ",N[i].a);
printf("sibling = %d, ",sibling(i));
if(N[i].b!=-1){
j++;
}
if(N[i].c!=-1){
j++;
}
printf("degree = %d, ",j);
printf("depth = %d, ",D[i]);
printf("height = %d, ",S[i]);
if(N[i].a==-1){
printf("root\n");
}
else if(N[i].b==-1 && N[i].c==-1){
printf("leaf\n");
}
else{
printf("internal node\n");
}
}
return 0;
}
int depth(int r){
int c=0;
while(1){
r=N[r].a;
if(r==-1){
break;
}
c++;
}
return c;
}
int sibling(int s){
if(N[s].a==-1){
return -1;
}
if(N[N[s].a].b!=s && N[N[s].a].b!=-1){
return N[N[s].a].b;
}
if(N[N[s].a].c!=s && N[N[s].a].c!=-1){
return N[N[s].a].c;
}
return -1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237351/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237351/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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@N = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@D = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@S = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.4 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.6 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.12 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%r = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp163 = icmp sgt i32 %0, 0
br i1 %cmp163, label %for.body.preheader, label %for.end122
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !9
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond1.preheader, label %for.body.epil, !llvm.loop !11
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp163, label %for.body3, label %for.end122
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !9
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !9
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !9
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !13
for.cond22.preheader: ; preds = %for.inc19
%cmp23167 = icmp sgt i32 %8, 0
br i1 %cmp23167, label %while.cond.i.preheader.preheader, label %for.end122
while.cond.i.preheader.preheader: ; preds = %for.cond22.preheader
%2 = zext i32 %8 to i64
%3 = shl nuw nsw i64 %2, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @S, i8 0, i64 %3, i1 false), !tbaa !5
%xtraiter199 = and i64 %2, 1
%4 = icmp eq i32 %8, 1
br i1 %4, label %for.cond33.preheader.unr-lcssa, label %while.cond.i.preheader.preheader.new
while.cond.i.preheader.preheader.new: ; preds = %while.cond.i.preheader.preheader
%unroll_iter202 = and i64 %2, 4294967294
br label %while.cond.i.preheader
for.body3: ; preds = %for.cond1.preheader, %for.inc19
%i.1166 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q, ptr noundef nonnull %r, ptr noundef nonnull %s)
%5 = load i32, ptr %r, align 4, !tbaa !5
%6 = load i32, ptr %q, align 4, !tbaa !5
%idxprom5 = sext i32 %6 to i64
%b = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom5, i32 1
store i32 %5, ptr %b, align 4, !tbaa !15
%7 = load i32, ptr %s, align 4, !tbaa !5
%c = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom5, i32 2
store i32 %7, ptr %c, align 4, !tbaa !16
%cmp9.not = icmp eq i32 %5, -1
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom10 = sext i32 %5 to i64
%arrayidx11 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom10
store i32 %6, ptr %arrayidx11, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp13.not = icmp eq i32 %7, -1
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%idxprom15 = sext i32 %7 to i64
%arrayidx16 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom15
store i32 %6, ptr %arrayidx16, align 4, !tbaa !9
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14
%inc20 = add nuw nsw i32 %i.1166, 1
%8 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %8
br i1 %cmp2, label %for.body3, label %for.cond22.preheader, !llvm.loop !17
while.cond.i.preheader: ; preds = %depth.exit.1, %while.cond.i.preheader.preheader.new
%indvars.iv180 = phi i64 [ 0, %while.cond.i.preheader.preheader.new ], [ %indvars.iv.next181.1, %depth.exit.1 ]
%niter203 = phi i64 [ 0, %while.cond.i.preheader.preheader.new ], [ %niter203.next.1, %depth.exit.1 ]
%9 = trunc i64 %indvars.iv180 to i32
br label %while.cond.i
for.cond33.preheader.unr-lcssa: ; preds = %depth.exit.1, %while.cond.i.preheader.preheader
%indvars.iv180.unr = phi i64 [ 0, %while.cond.i.preheader.preheader ], [ %indvars.iv.next181.1, %depth.exit.1 ]
%lcmp.mod201.not = icmp eq i64 %xtraiter199, 0
br i1 %lcmp.mod201.not, label %for.cond33.preheader, label %while.cond.i.preheader.epil
while.cond.i.preheader.epil: ; preds = %for.cond33.preheader.unr-lcssa
%10 = trunc i64 %indvars.iv180.unr to i32
br label %while.cond.i.epil
while.cond.i.epil: ; preds = %while.cond.i.epil, %while.cond.i.preheader.epil
%r.addr.0.i.epil = phi i32 [ %11, %while.cond.i.epil ], [ %10, %while.cond.i.preheader.epil ]
%c.0.i.epil = phi i32 [ %inc.i.epil, %while.cond.i.epil ], [ 0, %while.cond.i.preheader.epil ]
%idxprom.i.epil = sext i32 %r.addr.0.i.epil to i64
%arrayidx.i.epil = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom.i.epil
%11 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !9
%cmp.i.epil = icmp eq i32 %11, -1
%inc.i.epil = add nuw nsw i32 %c.0.i.epil, 1
br i1 %cmp.i.epil, label %depth.exit.epil, label %while.cond.i.epil
depth.exit.epil: ; preds = %while.cond.i.epil
%arrayidx27.epil = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %indvars.iv180.unr
store i32 %c.0.i.epil, ptr %arrayidx27.epil, align 4, !tbaa !5
br label %for.cond33.preheader
for.cond33.preheader: ; preds = %for.cond33.preheader.unr-lcssa, %depth.exit.epil
br i1 %cmp23167, label %for.body35.preheader, label %for.end122
for.body35.preheader: ; preds = %for.cond33.preheader
%wide.trip.count188 = zext i32 %8 to i64
br label %for.body35
while.cond.i: ; preds = %while.cond.i.preheader, %while.cond.i
%r.addr.0.i = phi i32 [ %12, %while.cond.i ], [ %9, %while.cond.i.preheader ]
%c.0.i = phi i32 [ %inc.i, %while.cond.i ], [ 0, %while.cond.i.preheader ]
%idxprom.i = sext i32 %r.addr.0.i to i64
%arrayidx.i = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp.i = icmp eq i32 %12, -1
%inc.i = add nuw nsw i32 %c.0.i, 1
br i1 %cmp.i, label %depth.exit, label %while.cond.i
depth.exit: ; preds = %while.cond.i
%arrayidx27 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %indvars.iv180
store i32 %c.0.i, ptr %arrayidx27, align 8, !tbaa !5
%indvars.iv.next181 = or i64 %indvars.iv180, 1
%13 = trunc i64 %indvars.iv.next181 to i32
br label %while.cond.i.1
while.cond.i.1: ; preds = %while.cond.i.1, %depth.exit
%r.addr.0.i.1 = phi i32 [ %14, %while.cond.i.1 ], [ %13, %depth.exit ]
%c.0.i.1 = phi i32 [ %inc.i.1, %while.cond.i.1 ], [ 0, %depth.exit ]
%idxprom.i.1 = sext i32 %r.addr.0.i.1 to i64
%arrayidx.i.1 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom.i.1
%14 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !9
%cmp.i.1 = icmp eq i32 %14, -1
%inc.i.1 = add nuw nsw i32 %c.0.i.1, 1
br i1 %cmp.i.1, label %depth.exit.1, label %while.cond.i.1
depth.exit.1: ; preds = %while.cond.i.1
%arrayidx27.1 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %indvars.iv.next181
store i32 %c.0.i.1, ptr %arrayidx27.1, align 4, !tbaa !5
%indvars.iv.next181.1 = add nuw nsw i64 %indvars.iv180, 2
%niter203.next.1 = add i64 %niter203, 2
%niter203.ncmp.1 = icmp eq i64 %niter203.next.1, %unroll_iter202
br i1 %niter203.ncmp.1, label %for.cond33.preheader.unr-lcssa, label %while.cond.i.preheader, !llvm.loop !18
for.cond68.preheader: ; preds = %for.inc65
br i1 %cmp23167, label %for.body70, label %for.end122
for.body35: ; preds = %for.body35.preheader, %for.inc65
%indvars.iv185 = phi i64 [ 0, %for.body35.preheader ], [ %indvars.iv.next186, %for.inc65 ]
%b38 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv185, i32 1
%15 = load i32, ptr %b38, align 4, !tbaa !15
%cmp39 = icmp eq i32 %15, -1
br i1 %cmp39, label %land.lhs.true, label %for.inc65
land.lhs.true: ; preds = %for.body35
%c42 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv185, i32 2
%16 = load i32, ptr %c42, align 4, !tbaa !16
%cmp43 = icmp eq i32 %16, -1
br i1 %cmp43, label %if.then44, label %for.inc65
if.then44: ; preds = %land.lhs.true
%arrayidx46 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv185
store i32 0, ptr %arrayidx46, align 4, !tbaa !5
%k.0.in169 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv185
%k.0170 = load i32, ptr %k.0.in169, align 4, !tbaa !9
%cmp50171 = icmp eq i32 %k.0170, -1
br i1 %cmp50171, label %for.inc65, label %if.end52
if.end52: ; preds = %if.then44, %if.end59
%k.0173 = phi i32 [ %k.0, %if.end59 ], [ %k.0170, %if.then44 ]
%l.0172 = phi i32 [ %inc60, %if.end59 ], [ 1, %if.then44 ]
%idxprom53 = sext i32 %k.0173 to i64
%arrayidx54 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %idxprom53
%17 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%cmp55 = icmp slt i32 %17, %l.0172
br i1 %cmp55, label %if.then56, label %if.end59
if.then56: ; preds = %if.end52
store i32 %l.0172, ptr %arrayidx54, align 4, !tbaa !5
br label %if.end59
if.end59: ; preds = %if.then56, %if.end52
%inc60 = add nuw nsw i32 %l.0172, 1
%k.0.in = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom53
%k.0 = load i32, ptr %k.0.in, align 4, !tbaa !9
%cmp50 = icmp eq i32 %k.0, -1
br i1 %cmp50, label %for.inc65, label %if.end52
for.inc65: ; preds = %if.end59, %if.then44, %for.body35, %land.lhs.true
%indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1
%exitcond189.not = icmp eq i64 %indvars.iv.next186, %wide.trip.count188
br i1 %exitcond189.not, label %for.cond68.preheader, label %for.body35, !llvm.loop !19
for.body70: ; preds = %for.cond68.preheader, %for.inc120
%indvars.iv190 = phi i64 [ %indvars.iv.next191, %for.inc120 ], [ 0, %for.cond68.preheader ]
%18 = trunc i64 %indvars.iv190 to i32
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx73 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv190
%19 = load i32, ptr %arrayidx73, align 4, !tbaa !9
%call75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %19)
%20 = load i32, ptr %arrayidx73, align 4, !tbaa !9
%cmp.i162 = icmp eq i32 %20, -1
br i1 %cmp.i162, label %sibling.exit, label %if.end.i
if.end.i: ; preds = %for.body70
%idxprom4.i = sext i32 %20 to i64
%b.i = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4.i, i32 1
%21 = load i32, ptr %b.i, align 4, !tbaa !15
%22 = zext i32 %21 to i64
%cmp6.not.i = icmp eq i64 %indvars.iv190, %22
%cmp13.not.i = icmp eq i32 %21, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %sibling.exit
if.end21.i: ; preds = %if.end.i
%c.i = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4.i, i32 2
%23 = load i32, ptr %c.i, align 4, !tbaa !16
%24 = zext i32 %23 to i64
%cmp27.not.i = icmp eq i64 %indvars.iv190, %24
%cmp35.not.i = icmp eq i32 %23, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %23
br label %sibling.exit
sibling.exit: ; preds = %for.body70, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %for.body70 ], [ %21, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %retval.0.i)
%b80 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv190, i32 1
%25 = load i32, ptr %b80, align 4, !tbaa !15
%cmp81.not = icmp ne i32 %25, -1
%spec.select = zext i1 %cmp81.not to i32
%c87 = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %indvars.iv190, i32 2
%26 = load i32, ptr %c87, align 4, !tbaa !16
%cmp88.not = icmp eq i32 %26, -1
%inc90 = select i1 %cmp81.not, i32 2, i32 1
%j.1 = select i1 %cmp88.not, i32 %spec.select, i32 %inc90
%call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %j.1)
%arrayidx94 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %indvars.iv190
%27 = load i32, ptr %arrayidx94, align 4, !tbaa !5
%call95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %27)
%arrayidx97 = getelementptr inbounds [10000 x i32], ptr @S, i64 0, i64 %indvars.iv190
%28 = load i32, ptr %arrayidx97, align 4, !tbaa !5
%call98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %28)
%29 = load i32, ptr %arrayidx73, align 4, !tbaa !9
%cmp102 = icmp eq i32 %29, -1
br i1 %cmp102, label %for.inc120, label %if.else
if.else: ; preds = %sibling.exit
%30 = load i32, ptr %b80, align 4, !tbaa !15
%cmp108 = icmp eq i32 %30, -1
br i1 %cmp108, label %land.lhs.true109, label %if.else116
land.lhs.true109: ; preds = %if.else
%31 = load i32, ptr %c87, align 4, !tbaa !16
%cmp113 = icmp eq i32 %31, -1
br i1 %cmp113, label %for.inc120, label %if.else116
if.else116: ; preds = %land.lhs.true109, %if.else
br label %for.inc120
for.inc120: ; preds = %land.lhs.true109, %sibling.exit, %if.else116
%str.12.sink = phi ptr [ @str, %if.else116 ], [ @str.12, %sibling.exit ], [ @str.11, %land.lhs.true109 ]
%puts159 = call i32 @puts(ptr nonnull dereferenceable(1) %str.12.sink)
%indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1
%32 = load i32, ptr @n, align 4, !tbaa !5
%33 = sext i32 %32 to i64
%cmp69 = icmp slt i64 %indvars.iv.next191, %33
br i1 %cmp69, label %for.body70, label %for.end122, !llvm.loop !20
for.end122: ; preds = %for.inc120, %for.cond22.preheader, %entry, %for.cond1.preheader, %for.cond33.preheader, %for.cond68.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @depth(i32 noundef %r) local_unnamed_addr #3 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%r.addr.0 = phi i32 [ %r, %entry ], [ %0, %while.cond ]
%c.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%idxprom = sext i32 %r.addr.0 to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %0, -1
%inc = add nuw nsw i32 %c.0, 1
br i1 %cmp, label %while.end, label %while.cond
while.end: ; preds = %while.cond
ret i32 %c.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @sibling(i32 noundef %s) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %s to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%b = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %b, align 4, !tbaa !15
%cmp6.not = icmp eq i32 %1, %s
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%c = getelementptr inbounds [10000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %c, align 4, !tbaa !16
%cmp27.not = icmp eq i32 %2, %s
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { nofree norecurse nosync nounwind memory(read, 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 #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 4}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
|
/*二分木*/
#include <stdio.h>
#define N 25
typedef struct node{
int No;
int depth;
int height;
int nchild;
int sibling;
int parent;
struct node *left;
struct node *right;
} Node;
void depth(Node *);
void height(Node *, Node *);
void depth(Node *temp){
if(temp->left !=NULL && temp->right == NULL){
temp->left->depth = temp->depth + 1;
depth(temp->left);
}
else if(temp->right !=NULL && temp->left == NULL){
temp->right->depth = temp->depth + 1;
depth(temp->right);
}
else if(temp->left !=NULL && temp->right != NULL){
temp->left->depth = temp->depth + 1;
temp->right->depth = temp->depth + 1;
depth(temp->left);
depth(temp->right);
}
}
void height(Node *a, Node *temp){
if(a[temp->parent].height <= temp->height+1){
a[temp->parent].height = temp->height+1;
}
if (temp->parent != -1){
temp = &a[temp->parent];
height(a,temp);
}
else return;
}
int main(){
Node a[N];
int i, j, n, l, r, num;
scanf("%d", &n);
for (i=0; i<n; i++){
a[i].No = i;
a[i].parent = -1;
a[i].sibling = -1;
a[i].depth = -2;
a[i].height = -1;
}
/*以下のループによりsibling, degreeを決定*/
for (i=0; i<n; i++){
scanf("%d%d%d", &num, &l, &r);
if(l != -1 && r != -1){
a[num].nchild = 2;
a[num].left = &a[l];
a[num].right = &a[r];
a[l].sibling = r;
a[r].sibling = l;
a[l].parent = a[num].No;
a[r].parent = a[num].No;
}
else if (l != -1 && r == -1){
a[num].nchild = 1;
a[num].left = &a[l];
a[num].right = NULL;
a[l].sibling = -1;
a[l].parent = a[num].No;
}
else if (l == -1 && r != -1){
a[num].nchild = 1;
a[num].right = &a[r];
a[num].left = NULL;
a[r].sibling = -1;
a[r].parent = a[num].No;
}
else if (l == -1 && r == -1){
a[num].nchild = 0;
a[num].left = NULL;
a[num].right = NULL;
a[num].height = 0;
}
}
/*rootのdepthを決定するループ*/
for (i=0; i<n; i++){
if(a[i].parent == -1){
a[i].depth = 0;
break;
}
}
depth(&a[i]);/*depthを決定する関数*/
/*heightを決定するループ*/
for (i=0; i<n; i++){
if (a[i].left == NULL && a[i].right == NULL){
height(a, &a[i]);/*heightを決定する関数*/
}
}
for (i=0; i<n; i++){
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", a[i].No, a[i].parent, a[i].sibling, a[i].nchild, a[i].depth, a[i].height);
if (a[i].parent == -1) printf("root\n");
else if (a[i].height == 0) printf("leaf\n");
else printf("internal node\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237401/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237401/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.node = type { i32, i32, i32, i32, i32, i32, ptr, ptr }
@.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%d\00", align 1
@.str.2 = private unnamed_addr constant [75 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, \00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.6 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @depth(ptr nocapture noundef readonly %temp) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%temp.tr = phi ptr [ %temp, %entry ], [ %temp.tr.be, %tailrecurse.backedge ]
%left = getelementptr inbounds %struct.node, ptr %temp.tr, i64 0, i32 6
%0 = load ptr, ptr %left, align 8, !tbaa !5
%cmp.not = icmp eq ptr %0, null
%right5 = getelementptr inbounds %struct.node, ptr %temp.tr, i64 0, i32 7
%1 = load ptr, ptr %right5, align 8, !tbaa !11
%cmp6.not = icmp eq ptr %1, null
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %tailrecurse
%depth = getelementptr inbounds %struct.node, ptr %temp.tr, i64 0, i32 1
%2 = load i32, ptr %depth, align 4, !tbaa !12
%add = add nsw i32 %2, 1
%depth3 = getelementptr inbounds %struct.node, ptr %0, i64 0, i32 1
store i32 %add, ptr %depth3, align 4, !tbaa !12
br i1 %cmp6.not, label %tailrecurse.backedge, label %if.then22
tailrecurse.backedge: ; preds = %land.lhs.true, %if.then10, %if.then22
%temp.tr.be = phi ptr [ %1, %if.then10 ], [ %5, %if.then22 ], [ %0, %land.lhs.true ]
br label %tailrecurse
if.else: ; preds = %tailrecurse
br i1 %cmp6.not, label %if.end34, label %if.then10
if.then10: ; preds = %if.else
%depth11 = getelementptr inbounds %struct.node, ptr %temp.tr, i64 0, i32 1
%3 = load i32, ptr %depth11, align 4, !tbaa !12
%add12 = add nsw i32 %3, 1
%depth14 = getelementptr inbounds %struct.node, ptr %1, i64 0, i32 1
store i32 %add12, ptr %depth14, align 4, !tbaa !12
br label %tailrecurse.backedge
if.then22: ; preds = %land.lhs.true
%4 = load i32, ptr %depth, align 4, !tbaa !12
%add28 = add nsw i32 %4, 1
%depth30 = getelementptr inbounds %struct.node, ptr %1, i64 0, i32 1
store i32 %add28, ptr %depth30, align 4, !tbaa !12
tail call void @depth(ptr noundef nonnull %0)
%5 = load ptr, ptr %right5, align 8, !tbaa !11
br label %tailrecurse.backedge
if.end34: ; preds = %if.else
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @height(ptr nocapture noundef %a, ptr nocapture noundef readonly %temp) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then10, %entry
%temp.tr = phi ptr [ %temp, %entry ], [ %arrayidx13, %if.then10 ]
%parent = getelementptr inbounds %struct.node, ptr %temp.tr, i64 0, i32 5
%0 = load i32, ptr %parent, align 4, !tbaa !13
%idxprom = sext i32 %0 to i64
%height = getelementptr inbounds %struct.node, ptr %a, i64 %idxprom, i32 2
%1 = load i32, ptr %height, align 8, !tbaa !14
%height1 = getelementptr inbounds %struct.node, ptr %temp.tr, i64 0, i32 2
%2 = load i32, ptr %height1, align 8, !tbaa !14
%add = add nsw i32 %2, 1
%cmp.not = icmp sgt i32 %1, %add
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
store i32 %add, ptr %height, align 8, !tbaa !14
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%cmp9.not = icmp eq i32 %0, -1
br i1 %cmp9.not, label %if.end14, label %if.then10
if.then10: ; preds = %if.end
%arrayidx13 = getelementptr inbounds %struct.node, ptr %a, i64 %idxprom
br label %tailrecurse
if.end14: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca [25 x %struct.node], align 16
%n = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !15
%cmp229 = icmp sgt i32 %0, 0
br i1 %cmp229, label %for.body.preheader, label %for.end129
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond9.preheader: ; preds = %for.body
br i1 %cmp229, label %for.body11, label %for.end129
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr %arrayidx, align 8, !tbaa !16
%parent = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv, i32 5
store i32 -1, ptr %parent, align 4, !tbaa !13
%sibling = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv, i32 4
store i32 -1, ptr %sibling, align 8, !tbaa !17
%depth = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv, i32 1
store i32 -2, ptr %depth, align 4, !tbaa !12
%height = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv, i32 2
store i32 -1, ptr %height, align 8, !tbaa !14
%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.cond9.preheader, label %for.body, !llvm.loop !18
for.cond115.preheader: ; preds = %for.inc112
%cmp116233 = icmp sgt i32 %11, 0
br i1 %cmp116233, label %for.body117.preheader, label %for.end129
for.body117.preheader: ; preds = %for.cond115.preheader
%wide.trip.count247 = zext i32 %11 to i64
br label %for.body117
for.body11: ; preds = %for.cond9.preheader, %for.inc112
%i.1232 = phi i32 [ %inc113, %for.inc112 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num, ptr noundef nonnull %l, ptr noundef nonnull %r)
%2 = load i32, ptr %l, align 4, !tbaa !15
%cmp13 = icmp ne i32 %2, -1
%3 = load i32, ptr %r, align 4
%cmp14 = icmp ne i32 %3, -1
%or.cond = select i1 %cmp13, i1 %cmp14, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %for.body11
%4 = load i32, ptr %num, align 4, !tbaa !15
%idxprom15 = sext i32 %4 to i64
%nchild = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom15, i32 3
store i32 2, ptr %nchild, align 4, !tbaa !20
%idxprom17 = sext i32 %2 to i64
%arrayidx18 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom17
%left = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom15, i32 6
store ptr %arrayidx18, ptr %left, align 8, !tbaa !5
%idxprom21 = sext i32 %3 to i64
%arrayidx22 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom21
%right = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom15, i32 7
store ptr %arrayidx22, ptr %right, align 8, !tbaa !11
%sibling27 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom17, i32 4
store i32 %3, ptr %sibling27, align 8, !tbaa !17
%sibling30 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom21, i32 4
store i32 %2, ptr %sibling30, align 8, !tbaa !17
%arrayidx32 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom15
%5 = load i32, ptr %arrayidx32, align 8, !tbaa !16
%parent36 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom17, i32 5
store i32 %5, ptr %parent36, align 4, !tbaa !13
%parent42 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom21, i32 5
store i32 %5, ptr %parent42, align 4, !tbaa !13
br label %for.inc112
if.else: ; preds = %for.body11
%cmp45 = icmp eq i32 %3, -1
%or.cond193 = select i1 %cmp13, i1 %cmp45, i1 false
br i1 %or.cond193, label %if.then46, label %if.else67
if.then46: ; preds = %if.else
%6 = load i32, ptr %num, align 4, !tbaa !15
%idxprom47 = sext i32 %6 to i64
%nchild49 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom47, i32 3
store i32 1, ptr %nchild49, align 4, !tbaa !20
%idxprom50 = sext i32 %2 to i64
%arrayidx51 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom50
%left54 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom47, i32 6
store ptr %arrayidx51, ptr %left54, align 8, !tbaa !5
%right57 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom47, i32 7
store ptr null, ptr %right57, align 8, !tbaa !11
%sibling60 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom50, i32 4
store i32 -1, ptr %sibling60, align 8, !tbaa !17
%arrayidx62 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom47
%7 = load i32, ptr %arrayidx62, align 8, !tbaa !16
%parent66 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom50, i32 5
store i32 %7, ptr %parent66, align 4, !tbaa !13
br label %for.inc112
if.else67: ; preds = %if.else
%cmp68 = icmp eq i32 %2, -1
%or.cond194 = select i1 %cmp68, i1 %cmp14, i1 false
br i1 %or.cond194, label %if.then71, label %if.else92
if.then71: ; preds = %if.else67
%8 = load i32, ptr %num, align 4, !tbaa !15
%idxprom72 = sext i32 %8 to i64
%nchild74 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom72, i32 3
store i32 1, ptr %nchild74, align 4, !tbaa !20
%idxprom75 = sext i32 %3 to i64
%arrayidx76 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom75
%right79 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom72, i32 7
store ptr %arrayidx76, ptr %right79, align 8, !tbaa !11
%left82 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom72, i32 6
store ptr null, ptr %left82, align 8, !tbaa !5
%sibling85 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom75, i32 4
store i32 -1, ptr %sibling85, align 8, !tbaa !17
%arrayidx87 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom72
%9 = load i32, ptr %arrayidx87, align 8, !tbaa !16
%parent91 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom75, i32 5
store i32 %9, ptr %parent91, align 4, !tbaa !13
br label %for.inc112
if.else92: ; preds = %if.else67
%or.cond195 = select i1 %cmp68, i1 %cmp45, i1 false
br i1 %or.cond195, label %if.then96, label %for.inc112
if.then96: ; preds = %if.else92
%10 = load i32, ptr %num, align 4, !tbaa !15
%idxprom97 = sext i32 %10 to i64
%nchild99 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom97, i32 3
store i32 0, ptr %nchild99, align 4, !tbaa !20
%left102 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom97, i32 6
%height108 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom97, i32 2
store i32 0, ptr %height108, align 8, !tbaa !14
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left102, i8 0, i64 16, i1 false)
br label %for.inc112
for.inc112: ; preds = %if.then, %if.then71, %if.then96, %if.else92, %if.then46
%inc113 = add nuw nsw i32 %i.1232, 1
%11 = load i32, ptr %n, align 4, !tbaa !15
%cmp10 = icmp slt i32 %inc113, %11
br i1 %cmp10, label %for.body11, label %for.cond115.preheader, !llvm.loop !21
for.body117: ; preds = %for.body117.preheader, %for.inc127
%indvars.iv244 = phi i64 [ 0, %for.body117.preheader ], [ %indvars.iv.next245, %for.inc127 ]
%parent120 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv244, i32 5
%12 = load i32, ptr %parent120, align 4, !tbaa !13
%cmp121 = icmp eq i32 %12, -1
br i1 %cmp121, label %if.then122, label %for.inc127
if.then122: ; preds = %for.body117
%13 = trunc i64 %indvars.iv244 to i32
%depth125 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv244, i32 1
store i32 0, ptr %depth125, align 4, !tbaa !12
br label %for.end129
for.inc127: ; preds = %for.body117
%indvars.iv.next245 = add nuw nsw i64 %indvars.iv244, 1
%exitcond248.not = icmp eq i64 %indvars.iv.next245, %wide.trip.count247
br i1 %exitcond248.not, label %for.end129, label %for.body117, !llvm.loop !22
for.end129: ; preds = %for.inc127, %entry, %for.cond9.preheader, %for.cond115.preheader, %if.then122
%i.2228 = phi i32 [ %13, %if.then122 ], [ 0, %for.cond115.preheader ], [ 0, %for.cond9.preheader ], [ 0, %entry ], [ %11, %for.inc127 ]
%idxprom130 = zext i32 %i.2228 to i64
%arrayidx131 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %idxprom130
call void @depth(ptr noundef nonnull %arrayidx131)
%14 = load i32, ptr %n, align 4, !tbaa !15
%cmp133236 = icmp sgt i32 %14, 0
br i1 %cmp133236, label %for.body134.preheader, label %for.end192
for.body134.preheader: ; preds = %for.end129
%wide.trip.count252 = zext i32 %14 to i64
br label %for.body134
for.cond151.preheader: ; preds = %for.inc148
br i1 %cmp133236, label %for.body153, label %for.end192
for.body134: ; preds = %for.body134.preheader, %for.inc148
%indvars.iv249 = phi i64 [ 0, %for.body134.preheader ], [ %indvars.iv.next250, %for.inc148 ]
%left137 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv249, i32 6
%15 = load ptr, ptr %left137, align 8, !tbaa !5
%cmp138 = icmp eq ptr %15, null
br i1 %cmp138, label %land.lhs.true139, label %for.inc148
land.lhs.true139: ; preds = %for.body134
%right142 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv249, i32 7
%16 = load ptr, ptr %right142, align 8, !tbaa !11
%cmp143 = icmp eq ptr %16, null
br i1 %cmp143, label %tailrecurse.i.preheader, label %for.inc148
tailrecurse.i.preheader: ; preds = %land.lhs.true139
%arrayidx136 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv249
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i.preheader, %if.then10.i
%temp.tr.i = phi ptr [ %arrayidx13.i, %if.then10.i ], [ %arrayidx136, %tailrecurse.i.preheader ]
%parent.i = getelementptr inbounds %struct.node, ptr %temp.tr.i, i64 0, i32 5
%17 = load i32, ptr %parent.i, align 4, !tbaa !13
%idxprom.i = sext i32 %17 to i64
%height.i = getelementptr inbounds %struct.node, ptr %a, i64 %idxprom.i, i32 2
%18 = load i32, ptr %height.i, align 8, !tbaa !14
%height1.i = getelementptr inbounds %struct.node, ptr %temp.tr.i, i64 0, i32 2
%19 = load i32, ptr %height1.i, align 8, !tbaa !14
%add.i = add nsw i32 %19, 1
%cmp.not.i = icmp sgt i32 %18, %add.i
br i1 %cmp.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %tailrecurse.i
store i32 %add.i, ptr %height.i, align 8, !tbaa !14
br label %if.end.i
if.end.i: ; preds = %if.then.i, %tailrecurse.i
%cmp9.not.i = icmp eq i32 %17, -1
br i1 %cmp9.not.i, label %for.inc148, label %if.then10.i
if.then10.i: ; preds = %if.end.i
%arrayidx13.i = getelementptr inbounds %struct.node, ptr %a, i64 %idxprom.i
br label %tailrecurse.i
for.inc148: ; preds = %if.end.i, %for.body134, %land.lhs.true139
%indvars.iv.next250 = add nuw nsw i64 %indvars.iv249, 1
%exitcond253.not = icmp eq i64 %indvars.iv.next250, %wide.trip.count252
br i1 %exitcond253.not, label %for.cond151.preheader, label %for.body134, !llvm.loop !23
for.body153: ; preds = %for.cond151.preheader, %for.inc190
%indvars.iv254 = phi i64 [ %indvars.iv.next255, %for.inc190 ], [ 0, %for.cond151.preheader ]
%arrayidx155 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv254
%20 = load i32, ptr %arrayidx155, align 8, !tbaa !16
%parent159 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv254, i32 5
%21 = load i32, ptr %parent159, align 4, !tbaa !13
%sibling162 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv254, i32 4
%22 = load i32, ptr %sibling162, align 8, !tbaa !17
%nchild165 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv254, i32 3
%23 = load i32, ptr %nchild165, align 4, !tbaa !20
%depth168 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv254, i32 1
%24 = load i32, ptr %depth168, align 4, !tbaa !12
%height171 = getelementptr inbounds [25 x %struct.node], ptr %a, i64 0, i64 %indvars.iv254, i32 2
%25 = load i32, ptr %height171, align 8, !tbaa !14
%call172 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20, i32 noundef %21, i32 noundef %22, i32 noundef %23, i32 noundef %24, i32 noundef %25)
%26 = load i32, ptr %parent159, align 4, !tbaa !13
%cmp176 = icmp eq i32 %26, -1
br i1 %cmp176, label %for.inc190, label %if.else179
if.else179: ; preds = %for.body153
%27 = load i32, ptr %height171, align 8, !tbaa !14
%cmp183 = icmp eq i32 %27, 0
%str.6.str = select i1 %cmp183, ptr @str.6, ptr @str
br label %for.inc190
for.inc190: ; preds = %if.else179, %for.body153
%str.7.sink = phi ptr [ @str.7, %for.body153 ], [ %str.6.str, %if.else179 ]
%puts226 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
%indvars.iv.next255 = add nuw nsw i64 %indvars.iv254, 1
%28 = load i32, ptr %n, align 4, !tbaa !15
%29 = sext i32 %28 to i64
%cmp152 = icmp slt i64 %indvars.iv.next255, %29
br i1 %cmp152, label %for.body153, label %for.end192, !llvm.loop !24
for.end192: ; preds = %for.inc190, %for.end129, %for.cond151.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %a) #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) #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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, 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 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 #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 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !10, i64 24}
!6 = !{!"node", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 32}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 20}
!14 = !{!6, !7, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !7, i64 16}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !7, i64 12}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}
|
#include <stdio.h>
#define MAX 10000
#define NIL -1
typedef struct { int parent, left, right;} Node;
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u,int d) {
if(u == NIL) return;
D[u] = d;
setDepth(T[u].left, d+1);
setDepth(T[u].right,d+1);
}
int setHeight(int u) {
int h1 = 0, h2 = 0;
if(T[u].left != NIL)
h1 = setHeight(T[u].left) + 1;
if(T[u].right != NIL)
h2 = setHeight(T[u].right) + 1;
return H[u] = (h1 > h2 ? h1 : h2);
}
// 接点 u の兄弟を返す
int getSibling(int u) {
if(T[u].parent == NIL) return NIL;
if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
return T[T[u].parent].left;
if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
return T[T[u].parent].right;
return NIL;
}
void print(int u) {
int deg = 0;
printf("node %d: ",u);
printf("parent = %d, ",T[u].parent);
printf("sibling = %d, ",getSibling(u));
if(T[u].left != NIL) deg++;
if(T[u].right != NIL) deg++;
printf("degree = %d, ",deg);
printf("depth = %d, ",D[u]);
printf("height = %d, ",H[u]);
if(T[u].parent == NIL) {
printf("root\n");
} else if(T[u].left == NIL && T[u].right == NIL) {
printf("leaf\n");
} else {
printf("internal node\n");
}
}
int main(void) {
int i, v, l, r, root = 0;
scanf("%d",&n);
for(i=0;i<n;i++) T[i].parent = NIL;
for(i=0;i<n;i++) {
scanf("%d %d %d",&v,&l,&r);
T[v].left = l;
T[v].right = r;
if(l != NIL) T[l].parent = v;
if(r != NIL) T[r].parent = v;
}
for(i=0; i<n; i++)
if(T[i].parent == NIL) root = i;
setDepth(root,0);
setHeight(root);
for(i=0;i<n;i++) print(i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237445/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237445/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.Node = type { i32, i32, i32 }
@D = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@.str.9 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.10 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.12 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setDepth(i32 noundef %u, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%d.tr13 = phi i32 [ %add, %if.end ], [ %d, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %idxprom
store i32 %d.tr13, ptr %arrayidx, align 4, !tbaa !5
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%add = add nsw i32 %d.tr13, 1
tail call void @setDepth(i32 noundef %0, i32 noundef %add)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @setHeight(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @setHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @setHeight(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !5
ret i32 %cond
}
; 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getSibling(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %1, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %1 to i64
%left.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%2 = load i32, ptr %left.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %2, %u
%cmp13.not.i = icmp eq i32 %2, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %getSibling.exit
if.end21.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%3 = load i32, ptr %right.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %3, %u
%cmp35.not.i = icmp eq i32 %3, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %3
br label %getSibling.exit
getSibling.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %2, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp ne i32 %4, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%5 = load i32, ptr %right, align 4, !tbaa !11
%cmp8.not = icmp eq i32 %5, -1
%inc10 = select i1 %cmp.not, i32 2, i32 1
%deg.1 = select i1 %cmp8.not, i32 %spec.select, i32 %inc10
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %deg.1)
%arrayidx14 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %6)
%arrayidx17 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %idxprom
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %7)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp22 = icmp eq i32 %8, -1
br i1 %cmp22, label %if.end38, label %if.else
if.else: ; preds = %getSibling.exit
%9 = load i32, ptr %left, align 4, !tbaa !9
%cmp28 = icmp eq i32 %9, -1
br i1 %cmp28, label %land.lhs.true, label %if.else35
land.lhs.true: ; preds = %if.else
%10 = load i32, ptr %right, align 4, !tbaa !11
%cmp32 = icmp eq i32 %10, -1
br i1 %cmp32, label %if.end38, label %if.else35
if.else35: ; preds = %land.lhs.true, %if.else
br label %if.end38
if.end38: ; preds = %land.lhs.true, %getSibling.exit, %if.else35
%str.11.sink = phi ptr [ @str, %if.else35 ], [ @str.12, %getSibling.exit ], [ @str.11, %land.lhs.true ]
%puts50 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.11.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body.preheader, label %for.end33
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp54, label %for.body3, label %for.end33
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond22.preheader: ; preds = %for.inc19
%cmp2358 = icmp sgt i32 %6, 0
br i1 %cmp2358, label %for.body24.preheader, label %for.end33
for.body24.preheader: ; preds = %for.cond22.preheader
%wide.trip.count69 = zext i32 %6 to i64
%xtraiter73 = and i64 %wide.trip.count69, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end33.loopexit.unr-lcssa, label %for.body24.preheader.new
for.body24.preheader.new: ; preds = %for.body24.preheader
%unroll_iter77 = and i64 %wide.trip.count69, 4294967292
br label %for.body24
for.body3: ; preds = %for.cond1.preheader, %for.inc19
%i.157 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %left, align 4, !tbaa !9
%5 = load i32, ptr %r, align 4, !tbaa !5
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %right, align 4, !tbaa !11
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom10 = sext i32 %3 to i64
%arrayidx11 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom10
store i32 %4, ptr %arrayidx11, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp13.not = icmp eq i32 %5, -1
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%idxprom15 = sext i32 %5 to i64
%arrayidx16 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom15
store i32 %4, ptr %arrayidx16, align 4, !tbaa !12
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14
%inc20 = add nuw nsw i32 %i.157, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %6
br i1 %cmp2, label %for.body3, label %for.cond22.preheader, !llvm.loop !17
for.body24: ; preds = %for.body24, %for.body24.preheader.new
%indvars.iv66 = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next67.3, %for.body24 ]
%root.060 = phi i32 [ 0, %for.body24.preheader.new ], [ %spec.select.3, %for.body24 ]
%niter78 = phi i64 [ 0, %for.body24.preheader.new ], [ %niter78.next.3, %for.body24 ]
%arrayidx26 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv66
%7 = load i32, ptr %arrayidx26, align 16, !tbaa !12
%cmp28 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv66 to i32
%spec.select = select i1 %cmp28, i32 %8, i32 %root.060
%indvars.iv.next67 = or i64 %indvars.iv66, 1
%arrayidx26.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next67
%9 = load i32, ptr %arrayidx26.1, align 4, !tbaa !12
%cmp28.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next67 to i32
%spec.select.1 = select i1 %cmp28.1, i32 %10, i32 %spec.select
%indvars.iv.next67.1 = or i64 %indvars.iv66, 2
%arrayidx26.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next67.1
%11 = load i32, ptr %arrayidx26.2, align 8, !tbaa !12
%cmp28.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next67.1 to i32
%spec.select.2 = select i1 %cmp28.2, i32 %12, i32 %spec.select.1
%indvars.iv.next67.2 = or i64 %indvars.iv66, 3
%arrayidx26.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next67.2
%13 = load i32, ptr %arrayidx26.3, align 4, !tbaa !12
%cmp28.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next67.2 to i32
%spec.select.3 = select i1 %cmp28.3, i32 %14, i32 %spec.select.2
%indvars.iv.next67.3 = add nuw nsw i64 %indvars.iv66, 4
%niter78.next.3 = add i64 %niter78, 4
%niter78.ncmp.3 = icmp eq i64 %niter78.next.3, %unroll_iter77
br i1 %niter78.ncmp.3, label %for.end33.loopexit.unr-lcssa, label %for.body24, !llvm.loop !18
for.end33.loopexit.unr-lcssa: ; preds = %for.body24, %for.body24.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body24.preheader ], [ %spec.select.3, %for.body24 ]
%indvars.iv66.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next67.3, %for.body24 ]
%root.060.unr = phi i32 [ 0, %for.body24.preheader ], [ %spec.select.3, %for.body24 ]
%lcmp.mod75.not = icmp eq i64 %xtraiter73, 0
br i1 %lcmp.mod75.not, label %for.end33, label %for.body24.epil
for.body24.epil: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil
%indvars.iv66.epil = phi i64 [ %indvars.iv.next67.epil, %for.body24.epil ], [ %indvars.iv66.unr, %for.end33.loopexit.unr-lcssa ]
%root.060.epil = phi i32 [ %spec.select.epil, %for.body24.epil ], [ %root.060.unr, %for.end33.loopexit.unr-lcssa ]
%epil.iter74 = phi i64 [ %epil.iter74.next, %for.body24.epil ], [ 0, %for.end33.loopexit.unr-lcssa ]
%arrayidx26.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv66.epil
%15 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !12
%cmp28.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv66.epil to i32
%spec.select.epil = select i1 %cmp28.epil, i32 %16, i32 %root.060.epil
%indvars.iv.next67.epil = add nuw nsw i64 %indvars.iv66.epil, 1
%epil.iter74.next = add i64 %epil.iter74, 1
%epil.iter74.cmp.not = icmp eq i64 %epil.iter74.next, %xtraiter73
br i1 %epil.iter74.cmp.not, label %for.end33, label %for.body24.epil, !llvm.loop !19
for.end33: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil, %entry, %for.cond1.preheader, %for.cond22.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ 0, %for.cond1.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end33.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body24.epil ]
call void @setDepth(i32 noundef %root.0.lcssa, i32 noundef 0)
%call34 = call i32 @setHeight(i32 noundef %root.0.lcssa)
%17 = load i32, ptr @n, align 4, !tbaa !5
%cmp3662 = icmp sgt i32 %17, 0
br i1 %cmp3662, label %for.body37, label %for.end40
for.body37: ; preds = %for.end33, %for.body37
%i.363 = phi i32 [ %inc39, %for.body37 ], [ 0, %for.end33 ]
call void @print(i32 noundef %i.363)
%inc39 = add nuw nsw i32 %i.363, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%cmp36 = icmp slt i32 %inc39, %18
br i1 %cmp36, label %for.body37, label %for.end40, !llvm.loop !20
for.end40: ; preds = %for.body37, %for.end33
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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(read, 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !16}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int parent;
int left;
int right;
}Node;
Node T[25];
int n;
void maigoCenter(void);
int findSibling(int);
int countDegree(int);
int findDepth(int);
int findHeight(int);
void printType(int);
int main(){
int i, id;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &id);
scanf("%d%d", &T[id].left, &T[id].right);
T[id].parent = -1;
}
maigoCenter();
for(i=0; i<n; i++){
printf("node %d: parent = %d, sibling = %d, ", i, T[i].parent, findSibling(i));
printf("degree = %d, ", countDegree(i));
printf("depth = %d, ", findDepth(i));
printf("height = %d, ", findHeight(i));
printType(i);
}
return 0;
}
void maigoCenter(void){
int i;
for(i=0; i<n; i++){
if(T[i].left != -1){
T[T[i].left].parent = i;
}
if(T[i].right != -1){
T[T[i].right].parent = i;
}
}
}
int findSibling(int n){
if(T[n].parent != -1){
if(T[T[n].parent].left == n){
return T[T[n].parent].right;
}else {
return T[T[n].parent].left;
}
}
return -1;
}
int countDegree(int n){
int count = 0 ;
if(T[n].left != -1) count++;
if(T[n].right != -1) count++;
return count;
}
int findDepth(int n){
int depth, parent;
if(T[n].parent == -1) return 0;
parent = T[n].parent;
for( depth = 1; T[parent].parent != -1; depth++){
parent = T[parent].parent;
}
return depth;
}
int findHeight(int n){
int left=0, right=0;
if(T[n].right != -1){
right = findHeight(T[n].right) + 1;
}
if(T[n].left != -1){
left = findHeight(T[n].left) + 1;
}
return (left>right)? left : right;
}
void printType(int n){
if(T[n].parent == -1) printf("root\n");
else if(T[n].left == -1 && T[n].right == -1) printf("leaf\n");
else printf("internal node\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237502/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.Node = type { i32, i32, i32 }
@.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 [5 x i8] c"%d%d\00", align 1
@T = dso_local global [25 x %struct.Node] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [37 x i8] c"node %d: parent = %d, sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.9 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.10 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%id = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #9
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.end23
for.body: ; preds = %entry, %for.body
%i.053 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%1 = load i32, ptr %id, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%2 = load i32, ptr %id, align 4, !tbaa !5
%idxprom5 = sext i32 %2 to i64
%arrayidx6 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5
store i32 -1, ptr %arrayidx6, align 4, !tbaa !9
%inc = add nuw nsw i32 %i.053, 1
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
%cmp26.i = icmp sgt i32 %3, 0
br i1 %cmp26.i, label %for.body.preheader.i, label %for.end23
for.body.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %3 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%left.i = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.i, i32 1
%4 = load i32, ptr %left.i, align 4, !tbaa !13
%cmp1.not.i = icmp eq i32 %4, -1
br i1 %cmp1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %for.body.i
%idxprom5.i = sext i32 %4 to i64
%arrayidx6.i = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5.i
%5 = trunc i64 %indvars.iv.i to i32
store i32 %5, ptr %arrayidx6.i, align 4, !tbaa !9
br label %if.end.i
if.end.i: ; preds = %if.then.i, %for.body.i
%right.i = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.i, i32 2
%6 = load i32, ptr %right.i, align 4, !tbaa !14
%cmp9.not.i = icmp eq i32 %6, -1
br i1 %cmp9.not.i, label %for.inc.i, label %if.then10.i
if.then10.i: ; preds = %if.end.i
%idxprom14.i = sext i32 %6 to i64
%arrayidx15.i = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom14.i
%7 = trunc i64 %indvars.iv.i to i32
store i32 %7, ptr %arrayidx15.i, align 4, !tbaa !9
br label %for.inc.i
for.inc.i: ; preds = %if.then10.i, %if.end.i
%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 %maigoCenter.exit, label %for.body.i, !llvm.loop !15
maigoCenter.exit: ; preds = %for.inc.i
br i1 %cmp26.i, label %for.body9, label %for.end23
for.body9: ; preds = %maigoCenter.exit, %printType.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %printType.exit ], [ 0, %maigoCenter.exit ]
%arrayidx11 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx11, align 4, !tbaa !9
%cmp.not.i = icmp eq i32 %8, -1
br i1 %cmp.not.i, label %findSibling.exit, label %if.then.i34
if.then.i34: ; preds = %for.body9
%idxprom4.i = sext i32 %8 to i64
%left.i35 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%9 = load i32, ptr %left.i35, align 4, !tbaa !13
%10 = zext i32 %9 to i64
%cmp6.i = icmp eq i64 %indvars.iv, %10
br i1 %cmp6.i, label %if.then7.i, label %findSibling.exit
if.then7.i: ; preds = %if.then.i34
%right.i36 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%11 = load i32, ptr %right.i36, align 4, !tbaa !14
br label %findSibling.exit
findSibling.exit: ; preds = %for.body9, %if.then.i34, %if.then7.i
%retval.0.i = phi i32 [ %11, %if.then7.i ], [ %9, %if.then.i34 ], [ -1, %for.body9 ]
%12 = trunc i64 %indvars.iv to i32
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12, i32 noundef %8, i32 noundef %retval.0.i)
%left.i38 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv, i32 1
%13 = load i32, ptr %left.i38, align 4, !tbaa !13
%cmp.not.i39 = icmp ne i32 %13, -1
%spec.select.i = zext i1 %cmp.not.i39 to i32
%right.i40 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv, i32 2
%14 = load i32, ptr %right.i40, align 4, !tbaa !14
%cmp3.not.i = icmp eq i32 %14, -1
%inc5.i = select i1 %cmp.not.i39, i32 2, i32 1
%count.1.i = select i1 %cmp3.not.i, i32 %spec.select.i, i32 %inc5.i
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.1.i)
%15 = load i32, ptr %arrayidx11, align 4, !tbaa !9
%cmp.i = icmp eq i32 %15, -1
br i1 %cmp.i, label %findDepth.exit, label %for.cond.i
for.cond.i: ; preds = %findSibling.exit, %for.cond.i
%depth.0.i = phi i32 [ %inc.i, %for.cond.i ], [ 1, %findSibling.exit ]
%parent.0.i = phi i32 [ %16, %for.cond.i ], [ %15, %findSibling.exit ]
%idxprom5.i43 = sext i32 %parent.0.i to i64
%arrayidx6.i44 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5.i43
%16 = load i32, ptr %arrayidx6.i44, align 4, !tbaa !9
%cmp8.not.i = icmp eq i32 %16, -1
%inc.i = add nuw nsw i32 %depth.0.i, 1
br i1 %cmp8.not.i, label %findDepth.exit, label %for.cond.i, !llvm.loop !16
findDepth.exit: ; preds = %for.cond.i, %findSibling.exit
%retval.0.i45 = phi i32 [ 0, %findSibling.exit ], [ %depth.0.i, %for.cond.i ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %retval.0.i45)
%call19 = call i32 @findHeight(i32 noundef %12)
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %call19)
%17 = load i32, ptr %arrayidx11, align 4, !tbaa !9
%cmp.i48 = icmp eq i32 %17, -1
br i1 %cmp.i48, label %printType.exit, label %if.else.i
if.else.i: ; preds = %findDepth.exit
%18 = load i32, ptr %left.i38, align 4, !tbaa !13
%cmp3.i = icmp eq i32 %18, -1
br i1 %cmp3.i, label %land.lhs.true.i, label %if.else9.i
land.lhs.true.i: ; preds = %if.else.i
%19 = load i32, ptr %right.i40, align 4, !tbaa !14
%cmp6.i51 = icmp eq i32 %19, -1
br i1 %cmp6.i51, label %printType.exit, label %if.else9.i
if.else9.i: ; preds = %land.lhs.true.i, %if.else.i
br label %printType.exit
printType.exit: ; preds = %findDepth.exit, %land.lhs.true.i, %if.else9.i
%str.9.sink.i = phi ptr [ @str, %if.else9.i ], [ @str.10, %findDepth.exit ], [ @str.9, %land.lhs.true.i ]
%puts14.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.9.sink.i)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = load i32, ptr @n, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp8 = icmp slt i64 %indvars.iv.next, %21
br i1 %cmp8, label %for.body9, label %for.end23, !llvm.loop !17
for.end23: ; preds = %printType.exit, %entry, %for.end, %maigoCenter.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @maigoCenter() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !13
%cmp1.not = icmp eq i32 %1, -1
br i1 %cmp1.not, label %if.end, label %if.then
if.then: ; preds = %for.body
%idxprom5 = sext i32 %1 to i64
%arrayidx6 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5
%2 = trunc i64 %indvars.iv to i32
store i32 %2, ptr %arrayidx6, align 4, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv, i32 2
%3 = load i32, ptr %right, align 4, !tbaa !14
%cmp9.not = icmp eq i32 %3, -1
br i1 %cmp9.not, label %for.inc, label %if.then10
if.then10: ; preds = %if.end
%idxprom14 = sext i32 %3 to i64
%arrayidx15 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom14
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx15, align 4, !tbaa !9
br label %for.inc
for.inc: ; preds = %if.end, %if.then10
%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 !15
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @findSibling(i32 noundef %n) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %return, label %if.then
if.then: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !13
%cmp6 = icmp eq i32 %1, %n
br i1 %cmp6, label %if.then7, label %return
if.then7: ; preds = %if.then
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !14
br label %return
return: ; preds = %entry, %if.then, %if.then7
%retval.0 = phi i32 [ %2, %if.then7 ], [ %1, %if.then ], [ -1, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @countDegree(i32 noundef %n) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %n to i64
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !13
%cmp.not = icmp ne i32 %0, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !14
%cmp3.not = icmp eq i32 %1, -1
%inc5 = select i1 %cmp.not, i32 2, i32 1
%count.1 = select i1 %cmp3.not, i32 %spec.select, i32 %inc5
ret i32 %count.1
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @findDepth(i32 noundef %n) local_unnamed_addr #5 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %cleanup, label %for.cond
for.cond: ; preds = %entry, %for.cond
%depth.0 = phi i32 [ %inc, %for.cond ], [ 1, %entry ]
%parent.0 = phi i32 [ %1, %for.cond ], [ %0, %entry ]
%idxprom5 = sext i32 %parent.0 to i64
%arrayidx6 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom5
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !9
%cmp8.not = icmp eq i32 %1, -1
%inc = add nuw nsw i32 %depth.0, 1
br i1 %cmp8.not, label %cleanup, label %for.cond, !llvm.loop !16
cleanup: ; preds = %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ %depth.0, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @findHeight(i32 noundef %n) local_unnamed_addr #6 {
entry:
%idxprom = sext i32 %n to i64
%right1 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %right1, align 4, !tbaa !14
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @findHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%right.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%left7 = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %left7, align 4, !tbaa !13
%cmp8.not = icmp eq i32 %1, -1
br i1 %cmp8.not, label %if.end15, label %if.then9
if.then9: ; preds = %if.end
%call13 = tail call i32 @findHeight(i32 noundef %1)
%add14 = add nsw i32 %call13, 1
br label %if.end15
if.end15: ; preds = %if.then9, %if.end
%left.0 = phi i32 [ %add14, %if.then9 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %left.0, i32 %right.0)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printType(i32 noundef %n) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.end11, label %if.else
if.else: ; preds = %entry
%left = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !13
%cmp3 = icmp eq i32 %1, -1
br i1 %cmp3, label %land.lhs.true, label %if.else9
land.lhs.true: ; preds = %if.else
%right = getelementptr inbounds [25 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !14
%cmp6 = icmp eq i32 %2, -1
br i1 %cmp6, label %if.end11, label %if.else9
if.else9: ; preds = %land.lhs.true, %if.else
br label %if.end11
if.end11: ; preds = %land.lhs.true, %entry, %if.else9
%str.9.sink = phi ptr [ @str, %if.else9 ], [ @str.10, %entry ], [ @str.9, %land.lhs.true ]
%puts14 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.9.sink)
ret void
}
; 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) #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 = { nofree norecurse 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 #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, 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 #5 = { nofree norecurse nosync nounwind memory(read, 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 #6 = { nofree nosync nounwind memory(read, 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nofree nounwind }
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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 4}
!14 = !{!10, !6, i64 8}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
int depth(int);
int get_height(int, int);
void retheight(int, int, int, int);
typedef struct {
int parent, sibling, left, right, degree;
} Node;
Node tree[100001];
int n;
int count = 0, count_b = 0;
int count_c[100001];
int main(){
int nownode, deg, left, right, i, j;
scanf("%d", &n);
for (i = 0; i < n; i++){
tree[i].parent = tree[i].degree = tree[i].sibling = tree[i].left = tree[i].right = -1;
}
for (i = 0; i < n; i++){
scanf("%d%d%d", &nownode, &left, &right);
count = 0;
if (left != -1){
tree[left].parent = nownode;
tree[left].sibling = right;
tree[nownode].left = left;
count++;
}
if (right != -1){
tree[right].parent = nownode;
tree[right].sibling = left;
tree[nownode].right = right;
count++;
}
tree[nownode].degree = count;
}
for(i = 0; i < n; i++){
count = count_b = 0;
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", i,tree[i].parent, tree[i].sibling, tree[i].degree, depth(i), get_height(i, depth(i)));
if(tree[i].parent == -1){
printf("root\n");
} else if(tree[i].left == -1 && tree[i].right == -1){
printf("leaf\n");
} else {
printf("internal node\n");
}
}
return 0;
}
int depth(int id) {
if (tree[id].parent == -1) {
return count / 2;
} else {
count++;
return depth(tree[id].parent);
}
}
int get_height(int id, int depth) {
int i, ret = 0;
for(i = 0; i < n; i++){
count_c[i] = 0;
}
retheight(id, 0, depth, depth);
for(i = 0; i < count_b + 1; i++){
if(ret < count_c[i]){
ret = count_c[i];
}
}
return ret;
}
void retheight(int id, int count_id, int startdepth, int depth) {
int i, c;
for (i = 1; i < n; i++) {
if (count_c[i] == 0) {
c = i;
break;
}
}
if (tree[id].left != -1 && tree[id].right != -1) {
count_c[count_id]++;
count_c[c] = depth - startdepth + 1;
retheight(tree[id].left, count_id, startdepth, depth + 1);
retheight(tree[id].right, c, startdepth, depth + 1);
} else if (tree[id].left != -1) {
count_c[count_id]++;
retheight(tree[id].left, count_id, startdepth, depth + 1);
} else if (tree[id].right != -1) {
count_c[count_id]++;
retheight(tree[id].right, count_id, startdepth, depth + 1);
} else {
count_b = count_id;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237560/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237560/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.Node = type { i32, i32, i32, i32, i32 }
@count = dso_local local_unnamed_addr global i32 0, align 4
@count_b = 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
@tree = dso_local local_unnamed_addr global [100001 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [75 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, \00", align 1
@count_c = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.6 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%nownode = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nownode) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #9
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp124 = icmp sgt i32 %0, 0
br i1 %cmp124, label %for.body13.preheader, label %for.end83
for.body13.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 20
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @tree, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body13
for.cond45.preheader: ; preds = %if.end38
%cmp46128 = icmp sgt i32 %6, 0
br i1 %cmp46128, label %for.body47, label %for.end83
for.body13: ; preds = %for.body13.preheader, %if.end38
%i.1127 = phi i32 [ %inc43, %if.end38 ], [ 0, %for.body13.preheader ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %nownode, ptr noundef nonnull %left, ptr noundef nonnull %right)
store i32 0, ptr @count, align 4, !tbaa !5
%3 = load i32, ptr %left, align 4, !tbaa !5
%cmp15.not = icmp eq i32 %3, -1
%.pre = load i32, ptr %right, align 4, !tbaa !5
%.pre133.pre = load i32, ptr %nownode, align 4, !tbaa !5
br i1 %cmp15.not, label %if.end, label %if.then
if.then: ; preds = %for.body13
%idxprom16 = sext i32 %3 to i64
%arrayidx17 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom16
store i32 %.pre133.pre, ptr %arrayidx17, align 4, !tbaa !9
%sibling21 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom16, i32 1
store i32 %.pre, ptr %sibling21, align 4, !tbaa !11
%idxprom22 = sext i32 %.pre133.pre to i64
%left24 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom22, i32 2
store i32 %3, ptr %left24, align 4, !tbaa !12
store i32 1, ptr @count, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body13
%4 = phi i32 [ 1, %if.then ], [ 0, %for.body13 ]
%cmp26.not = icmp eq i32 %.pre, -1
br i1 %cmp26.not, label %if.end.if.end38_crit_edge, label %if.then27
if.end.if.end38_crit_edge: ; preds = %if.end
%.pre134 = sext i32 %.pre133.pre to i64
br label %if.end38
if.then27: ; preds = %if.end
%idxprom28 = sext i32 %.pre to i64
%arrayidx29 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom28
store i32 %.pre133.pre, ptr %arrayidx29, align 4, !tbaa !9
%sibling33 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom28, i32 1
store i32 %3, ptr %sibling33, align 4, !tbaa !11
%idxprom34 = sext i32 %.pre133.pre to i64
%right36 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom34, i32 3
store i32 %.pre, ptr %right36, align 4, !tbaa !13
%inc37 = add nuw nsw i32 %4, 1
store i32 %inc37, ptr @count, align 4, !tbaa !5
br label %if.end38
if.end38: ; preds = %if.end.if.end38_crit_edge, %if.then27
%idxprom39.pre-phi = phi i64 [ %.pre134, %if.end.if.end38_crit_edge ], [ %idxprom34, %if.then27 ]
%5 = phi i32 [ %4, %if.end.if.end38_crit_edge ], [ %inc37, %if.then27 ]
%degree41 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom39.pre-phi, i32 4
store i32 %5, ptr %degree41, align 4, !tbaa !14
%inc43 = add nuw nsw i32 %i.1127, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc43, %6
br i1 %cmp12, label %for.body13, label %for.cond45.preheader, !llvm.loop !15
for.body47: ; preds = %for.cond45.preheader, %for.inc81
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc81 ], [ 0, %for.cond45.preheader ]
%7 = phi i32 [ %.pr, %for.inc81 ], [ %6, %for.cond45.preheader ]
store i32 0, ptr @count_b, align 4, !tbaa !5
store i32 0, ptr @count, align 4, !tbaa !5
%arrayidx49 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx49, align 4, !tbaa !9
%sibling53 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 1
%9 = load i32, ptr %sibling53, align 4, !tbaa !11
%degree56 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 4
%10 = load i32, ptr %degree56, align 4, !tbaa !14
%cmp8.i = icmp eq i32 %8, -1
br i1 %cmp8.i, label %depth.exit119, label %if.else.i
if.else.i: ; preds = %for.body47, %if.else.i
%11 = phi i32 [ %12, %if.else.i ], [ %8, %for.body47 ]
%inc59.i = phi i32 [ %inc.i, %if.else.i ], [ 0, %for.body47 ]
%inc.i = add nuw nsw i32 %inc59.i, 1
%idxprom.i = sext i32 %11 to i64
%arrayidx.i = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp.i = icmp eq i32 %12, -1
br i1 %cmp.i, label %if.else.i111.preheader, label %if.else.i
if.else.i111.preheader: ; preds = %if.else.i
%div.i123 = lshr i32 %inc.i, 1
br label %if.else.i111
tailrecurse.if.then_crit_edge.i117: ; preds = %if.else.i111
store i32 %inc.i113, ptr @count, align 4, !tbaa !5
br label %depth.exit119
if.else.i111: ; preds = %if.else.i111.preheader, %if.else.i111
%13 = phi i32 [ %14, %if.else.i111 ], [ %8, %if.else.i111.preheader ]
%inc59.i112 = phi i32 [ %inc.i113, %if.else.i111 ], [ %inc.i, %if.else.i111.preheader ]
%inc.i113 = add nuw nsw i32 %inc59.i112, 1
%idxprom.i114 = sext i32 %13 to i64
%arrayidx.i115 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom.i114
%14 = load i32, ptr %arrayidx.i115, align 4, !tbaa !9
%cmp.i116 = icmp eq i32 %14, -1
br i1 %cmp.i116, label %tailrecurse.if.then_crit_edge.i117, label %if.else.i111
depth.exit119: ; preds = %for.body47, %tailrecurse.if.then_crit_edge.i117
%div.i122 = phi i32 [ %div.i123, %tailrecurse.if.then_crit_edge.i117 ], [ 0, %for.body47 ]
%15 = phi i32 [ %inc.i113, %tailrecurse.if.then_crit_edge.i117 ], [ 0, %for.body47 ]
%div.i118 = sdiv i32 %15, 2
%cmp20.i = icmp sgt i32 %7, 0
br i1 %cmp20.i, label %for.body.preheader.i, label %for.end.i
for.body.preheader.i: ; preds = %depth.exit119
%16 = zext i32 %7 to i64
%17 = shl nuw nsw i64 %16, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @count_c, i8 0, i64 %17, i1 false), !tbaa !5
br label %for.end.i
for.end.i: ; preds = %for.body.preheader.i, %depth.exit119
%18 = trunc i64 %indvars.iv to i32
call void @retheight(i32 noundef %18, i32 noundef 0, i32 noundef %div.i118, i32 noundef %div.i118)
%19 = load i32, ptr @count_b, align 4, !tbaa !5
%cmp2.not22.i = icmp slt i32 %19, 0
br i1 %cmp2.not22.i, label %get_height.exit, label %for.body3.preheader.i
for.body3.preheader.i: ; preds = %for.end.i
%20 = add nuw i32 %19, 1
%wide.trip.count.i = zext i32 %20 to i64
%min.iters.check = icmp ult i32 %19, 7
br i1 %min.iters.check, label %for.body3.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body3.preheader.i
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ]
%vec.phi137 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
%21 = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = getelementptr inbounds i32, ptr %21, i64 4
%wide.load138 = load <4 x i32>, ptr %22, align 16, !tbaa !5
%23 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%24 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi137, <4 x i32> %wide.load138)
%index.next = add nuw i64 %index, 8
%25 = icmp eq i64 %index.next, %n.vec
br i1 %25, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %23, <4 x i32> %24)
%26 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %get_height.exit, label %for.body3.i.preheader
for.body3.i.preheader: ; preds = %for.body3.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body3.preheader.i ], [ %n.vec, %middle.block ]
%ret.024.i.ph = phi i32 [ 0, %for.body3.preheader.i ], [ %26, %middle.block ]
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i.preheader, %for.body3.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body3.i ], [ %indvars.iv.i.ph, %for.body3.i.preheader ]
%ret.024.i = phi i32 [ %spec.select.i, %for.body3.i ], [ %ret.024.i.ph, %for.body3.i.preheader ]
%arrayidx5.i = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %indvars.iv.i
%27 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%spec.select.i = call i32 @llvm.smax.i32(i32 %ret.024.i, i32 %27)
%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 %get_height.exit, label %for.body3.i, !llvm.loop !20
get_height.exit: ; preds = %for.body3.i, %middle.block, %for.end.i
%ret.0.lcssa.i = phi i32 [ 0, %for.end.i ], [ %26, %middle.block ], [ %spec.select.i, %for.body3.i ]
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18, i32 noundef %8, i32 noundef %9, i32 noundef %10, i32 noundef %div.i122, i32 noundef %ret.0.lcssa.i)
%28 = load i32, ptr %arrayidx49, align 4, !tbaa !9
%cmp64 = icmp eq i32 %28, -1
br i1 %cmp64, label %for.inc81, label %if.else
if.else: ; preds = %get_height.exit
%left69 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 2
%29 = load i32, ptr %left69, align 4, !tbaa !12
%cmp70 = icmp eq i32 %29, -1
br i1 %cmp70, label %land.lhs.true, label %if.else77
land.lhs.true: ; preds = %if.else
%right73 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 3
%30 = load i32, ptr %right73, align 4, !tbaa !13
%cmp74 = icmp eq i32 %30, -1
br i1 %cmp74, label %for.inc81, label %if.else77
if.else77: ; preds = %land.lhs.true, %if.else
br label %for.inc81
for.inc81: ; preds = %land.lhs.true, %get_height.exit, %if.else77
%str.7.sink = phi ptr [ @str, %if.else77 ], [ @str.7, %get_height.exit ], [ @str.6, %land.lhs.true ]
%puts106 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%31 = sext i32 %.pr to i64
%cmp46 = icmp slt i64 %indvars.iv.next, %31
br i1 %cmp46, label %for.body47, label %for.end83, !llvm.loop !21
for.end83: ; preds = %for.inc81, %entry, %for.cond45.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nownode) #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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @depth(i32 noundef %id) local_unnamed_addr #3 {
entry:
%count.promoted = load i32, ptr @count, align 4, !tbaa !5
%idxprom6 = sext i32 %id to i64
%arrayidx7 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom6
%0 = load i32, ptr %arrayidx7, align 4, !tbaa !9
%cmp8 = icmp eq i32 %0, -1
br i1 %cmp8, label %if.then, label %if.else
tailrecurse.if.then_crit_edge: ; preds = %if.else
store i32 %inc, ptr @count, align 4, !tbaa !5
br label %if.then
if.then: ; preds = %tailrecurse.if.then_crit_edge, %entry
%1 = phi i32 [ %inc, %tailrecurse.if.then_crit_edge ], [ %count.promoted, %entry ]
%div = sdiv i32 %1, 2
ret i32 %div
if.else: ; preds = %entry, %if.else
%2 = phi i32 [ %3, %if.else ], [ %0, %entry ]
%inc59 = phi i32 [ %inc, %if.else ], [ %count.promoted, %entry ]
%inc = add nsw i32 %inc59, 1
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %3, -1
br i1 %cmp, label %tailrecurse.if.then_crit_edge, label %if.else
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @get_height(i32 noundef %id, i32 noundef %depth) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @count_c, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
tail call void @retheight(i32 noundef %id, i32 noundef 0, i32 noundef %depth, i32 noundef %depth)
%3 = load i32, ptr @count_b, align 4, !tbaa !5
%cmp2.not22 = icmp slt i32 %3, 0
br i1 %cmp2.not22, label %for.end11, label %for.body3.preheader
for.body3.preheader: ; preds = %for.end
%4 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %3, 7
br i1 %min.iters.check, label %for.body3.preheader29, label %vector.ph
vector.ph: ; preds = %for.body3.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi27 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%5 = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load28 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%8 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi27, <4 x i32> %wide.load28)
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %7, <4 x i32> %8)
%10 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end11, label %for.body3.preheader29
for.body3.preheader29: ; preds = %for.body3.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body3.preheader ], [ %n.vec, %middle.block ]
%ret.024.ph = phi i32 [ 0, %for.body3.preheader ], [ %10, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader29, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ %indvars.iv.ph, %for.body3.preheader29 ]
%ret.024 = phi i32 [ %spec.select, %for.body3 ], [ %ret.024.ph, %for.body3.preheader29 ]
%arrayidx5 = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %indvars.iv
%11 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%spec.select = tail call i32 @llvm.smax.i32(i32 %ret.024, i32 %11)
%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.end11, label %for.body3, !llvm.loop !23
for.end11: ; preds = %for.body3, %middle.block, %for.end
%ret.0.lcssa = phi i32 [ 0, %for.end ], [ %10, %middle.block ], [ %spec.select, %for.body3 ]
ret i32 %ret.0.lcssa
}
; 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @retheight(i32 noundef %id, i32 noundef %count_id, i32 noundef %startdepth, i32 noundef %depth) local_unnamed_addr #5 {
entry:
br label %tailrecurse.outer
tailrecurse.outer: ; preds = %if.then8, %entry
%id.tr.ph = phi i32 [ %8, %if.then8 ], [ %id, %entry ]
%count_id.tr.ph = phi i32 [ %.us-phi84, %if.then8 ], [ %count_id, %entry ]
%depth.tr.ph = phi i32 [ %add17, %if.then8 ], [ %depth, %entry ]
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %0, 1
%idxprom27 = sext i32 %count_id.tr.ph to i64
%arrayidx28 = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %idxprom27
br i1 %cmp79, label %tailrecurse.us.preheader, label %tailrecurse
tailrecurse.us.preheader: ; preds = %tailrecurse.outer
%wide.trip.count = zext i32 %0 to i64
br label %tailrecurse.us
tailrecurse.us: ; preds = %tailrecurse.us.preheader, %tailrecurse.backedge.us
%id.tr.us = phi i32 [ %id.tr.be.us, %tailrecurse.backedge.us ], [ %id.tr.ph, %tailrecurse.us.preheader ]
%depth.tr.us = phi i32 [ %depth.tr.be.us, %tailrecurse.backedge.us ], [ %depth.tr.ph, %tailrecurse.us.preheader ]
br label %for.body.us
for.body.us: ; preds = %tailrecurse.us, %for.inc.us
%indvars.iv = phi i64 [ 1, %tailrecurse.us ], [ %indvars.iv.next, %for.inc.us ]
%arrayidx.us = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%cmp1.us = icmp eq i32 %1, 0
br i1 %cmp1.us, label %for.end.us.split.loop.exit108, label %for.inc.us
for.inc.us: ; preds = %for.body.us
%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.us, label %for.body.us, !llvm.loop !24
for.end.us.split.loop.exit108: ; preds = %for.body.us
%2 = trunc i64 %indvars.iv to i32
br label %for.end.us
for.end.us: ; preds = %for.inc.us, %for.end.us.split.loop.exit108
%i.0.lcssa.us = phi i32 [ %2, %for.end.us.split.loop.exit108 ], [ %0, %for.inc.us ]
%idxprom2.us = sext i32 %id.tr.us to i64
%left.us = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2.us, i32 2
%3 = load i32, ptr %left.us, align 4, !tbaa !12
%cmp4.not.us = icmp eq i32 %3, -1
%right37.us = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2.us, i32 3
%4 = load i32, ptr %right37.us, align 4, !tbaa !13
%cmp38.not.us = icmp eq i32 %4, -1
br i1 %cmp4.not.us, label %if.else34.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.end.us
br i1 %cmp38.not.us, label %tailrecurse.backedge.us, label %if.then8
if.else34.us: ; preds = %for.end.us
br i1 %cmp38.not.us, label %if.else47, label %tailrecurse.backedge.us
tailrecurse.backedge.us: ; preds = %if.else34.us, %land.lhs.true.us
%id.tr.be.us = phi i32 [ %3, %land.lhs.true.us ], [ %4, %if.else34.us ]
%storemerge97.in = load i32, ptr %arrayidx28, align 4, !tbaa !5
%storemerge97 = add nsw i32 %storemerge97.in, 1
store i32 %storemerge97, ptr %arrayidx28, align 4, !tbaa !5
%depth.tr.be.us = add nsw i32 %depth.tr.us, 1
br label %tailrecurse.us
tailrecurse: ; preds = %tailrecurse.outer, %tailrecurse.backedge
%id.tr = phi i32 [ %id.tr.be, %tailrecurse.backedge ], [ %id.tr.ph, %tailrecurse.outer ]
%depth.tr = phi i32 [ %depth.tr.be, %tailrecurse.backedge ], [ %depth.tr.ph, %tailrecurse.outer ]
%idxprom2 = sext i32 %id.tr to i64
%left = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2, i32 2
%5 = load i32, ptr %left, align 4, !tbaa !12
%cmp4.not = icmp eq i32 %5, -1
%right37 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2, i32 3
%6 = load i32, ptr %right37, align 4, !tbaa !13
%cmp38.not = icmp eq i32 %6, -1
br i1 %cmp4.not, label %if.else34, label %land.lhs.true
land.lhs.true: ; preds = %tailrecurse
br i1 %cmp38.not, label %tailrecurse.backedge, label %if.then8
if.then8: ; preds = %land.lhs.true, %land.lhs.true.us
%.us-phi = phi i32 [ %3, %land.lhs.true.us ], [ %5, %land.lhs.true ]
%.us-phi82 = phi i32 [ %depth.tr.us, %land.lhs.true.us ], [ %depth.tr, %land.lhs.true ]
%.us-phi83 = phi ptr [ %right37.us, %land.lhs.true.us ], [ %right37, %land.lhs.true ]
%.us-phi84 = phi i32 [ %i.0.lcssa.us, %land.lhs.true.us ], [ 1, %land.lhs.true ]
%7 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%inc11 = add nsw i32 %7, 1
store i32 %inc11, ptr %arrayidx28, align 4, !tbaa !5
%reass.sub = sub i32 %.us-phi82, %startdepth
%add = add i32 %reass.sub, 1
%idxprom12 = zext i32 %.us-phi84 to i64
%arrayidx13 = getelementptr inbounds [100001 x i32], ptr @count_c, i64 0, i64 %idxprom12
store i32 %add, ptr %arrayidx13, align 4, !tbaa !5
%add17 = add nsw i32 %.us-phi82, 1
tail call void @retheight(i32 noundef %.us-phi, i32 noundef %count_id.tr.ph, i32 noundef %startdepth, i32 noundef %add17)
%8 = load i32, ptr %.us-phi83, align 4, !tbaa !13
br label %tailrecurse.outer
tailrecurse.backedge: ; preds = %if.else34, %land.lhs.true
%id.tr.be = phi i32 [ %5, %land.lhs.true ], [ %6, %if.else34 ]
%storemerge.in = load i32, ptr %arrayidx28, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr %arrayidx28, align 4, !tbaa !5
%depth.tr.be = add nsw i32 %depth.tr, 1
br label %tailrecurse
if.else34: ; preds = %tailrecurse
br i1 %cmp38.not, label %if.else47, label %tailrecurse.backedge
if.else47: ; preds = %if.else34, %if.else34.us
store i32 %count_id.tr.ph, ptr @count_b, align 4, !tbaa !5
ret void
}
; 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
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #7
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(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 #4 = { nofree nosync nounwind memory(readwrite, 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 #5 = { 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 #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 12}
!14 = !{!10, !6, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !16, !19, !18}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16, !18, !19}
!23 = distinct !{!23, !16, !19, !18}
!24 = distinct !{!24, !16}
|
#include <stdio.h> // printf(), scanf()
#define MAX_N 25
typedef struct node_tbl
{
int parent;
int left;
int right;
} node;
const int nil = -1;
node t[MAX_N];
int d[MAX_N];
int h[MAX_N];
void
set_depth(int u, int v)
{
if (u == nil)
return;
d[u] = v;
set_depth(t[u].left, v + 1);
set_depth(t[u].right, v + 1);
}
int
set_height(int u)
{
int h1 = 0, h2 = 0;
if (t[u].left != nil)
h1 = set_height(t[u].left) + 1;
if (t[u].right != nil)
h2 = set_height(t[u].right) + 1;
return h[u] = (h1 > h2) ? h1 : h2;
}
int
get_sibling(int u)
{
if (t[u].parent == nil)
return nil;
if (t[t[u].parent].left != u && t[t[u].parent].left != nil)
return t[t[u].parent].left;
if (t[t[u].parent].right != u && t[t[u].parent].right != nil)
return t[t[u].parent].right;
return nil;
}
void
print(int u)
{
printf("node %d: ", u);
printf("parent = %d, ", t[u].parent);
printf("sibling = %d, ", get_sibling(u));
int deg = 0;
if (t[u].left != nil)
deg++;
if (t[u].right != nil)
deg++;
printf("degree = %d, ", deg);
printf("depth = %d, ", d[u]);
printf("height = %d, ", h[u]);
if (t[u].parent == nil)
printf("root\n");
else if (t[u].left == nil && t[u].right == nil)
printf("leaf\n");
else
printf("internal node\n");
}
int
main(int argc, char** argv)
{
int n;
int root;
int v;
int l, r;
int i;
scanf("%d", &n);
for (i = 0; i < n; ++i)
t[i].parent = nil;
for (i = 0; i < n; ++i)
{
scanf("%d %d %d", &v, &l, &r);
t[v].left = l;
t[v].right = r;
if (l != nil)
t[l].parent = v;
if (r != nil)
t[r].parent = v;
}
for (i = 0; i < n; ++i)
{
if (t[i].parent == nil)
{
root = i;
break;
}
}
set_depth(root, 0);
set_height(root);
for (i = 0; i < n; ++i)
print(i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237603/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237603/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.node_tbl = type { i32, i32, i32 }
@nil = dso_local local_unnamed_addr constant i32 -1, align 4
@d = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [25 x %struct.node_tbl] zeroinitializer, align 16
@h = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@.str.9 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.10 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.12 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @set_depth(i32 noundef %u, i32 noundef %v) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%v.tr13 = phi i32 [ %add, %if.end ], [ %v, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [25 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %v.tr13, ptr %arrayidx, align 4, !tbaa !5
%left = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%add = add nsw i32 %v.tr13, 1
tail call void @set_depth(i32 noundef %0, i32 noundef %add)
%right = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @set_height(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @set_height(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @set_height(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [25 x i32], ptr @h, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !5
ret i32 %cond
}
; 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @get_sibling(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%right = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %1, -1
br i1 %cmp.i, label %get_sibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %1 to i64
%left.i = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom4.i, i32 1
%2 = load i32, ptr %left.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %2, %u
%cmp13.not.i = icmp eq i32 %2, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %get_sibling.exit
if.end21.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom4.i, i32 2
%3 = load i32, ptr %right.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %3, %u
%cmp35.not.i = icmp eq i32 %3, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %3
br label %get_sibling.exit
get_sibling.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %2, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
%left = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp ne i32 %4, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom, i32 2
%5 = load i32, ptr %right, align 4, !tbaa !11
%cmp8.not = icmp eq i32 %5, -1
%inc10 = select i1 %cmp.not, i32 2, i32 1
%deg.1 = select i1 %cmp8.not, i32 %spec.select, i32 %inc10
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %deg.1)
%arrayidx14 = getelementptr inbounds [25 x i32], ptr @d, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %6)
%arrayidx17 = getelementptr inbounds [25 x i32], ptr @h, i64 0, i64 %idxprom
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %7)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp22 = icmp eq i32 %8, -1
br i1 %cmp22, label %if.end38, label %if.else
if.else: ; preds = %get_sibling.exit
%9 = load i32, ptr %left, align 4, !tbaa !9
%cmp28 = icmp eq i32 %9, -1
br i1 %cmp28, label %land.lhs.true, label %if.else35
land.lhs.true: ; preds = %if.else
%10 = load i32, ptr %right, align 4, !tbaa !11
%cmp32 = icmp eq i32 %10, -1
br i1 %cmp32, label %if.end38, label %if.else35
if.else35: ; preds = %land.lhs.true, %if.else
br label %if.end38
if.end38: ; preds = %land.lhs.true, %get_sibling.exit, %if.else35
%str.11.sink = phi ptr [ @str, %if.else35 ], [ @str.12, %get_sibling.exit ], [ @str.11, %land.lhs.true ]
%puts50 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.11.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%v = 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) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp54 = icmp sgt i32 %0, 0
br i1 %cmp54, label %for.body.preheader, label %for.end33
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp54, label %for.body3, label %for.end33
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond22.preheader: ; preds = %for.inc19
%cmp2358 = icmp sgt i32 %5, 0
br i1 %cmp2358, label %for.body24.preheader, label %for.end33
for.body24.preheader: ; preds = %for.cond22.preheader
%wide.trip.count69 = zext i32 %5 to i64
br label %for.body24
for.body3: ; preds = %for.cond1.preheader, %for.inc19
%i.157 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%2 = load i32, ptr %l, align 4, !tbaa !5
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %3 to i64
%left = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom5, i32 1
store i32 %2, ptr %left, align 4, !tbaa !9
%4 = load i32, ptr %r, align 4, !tbaa !5
%right = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom5, i32 2
store i32 %4, ptr %right, align 4, !tbaa !11
%cmp9.not = icmp eq i32 %2, -1
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom10 = sext i32 %2 to i64
%arrayidx11 = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom10
store i32 %3, ptr %arrayidx11, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp13.not = icmp eq i32 %4, -1
br i1 %cmp13.not, label %for.inc19, label %if.then14
if.then14: ; preds = %if.end
%idxprom15 = sext i32 %4 to i64
%arrayidx16 = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %idxprom15
store i32 %3, ptr %arrayidx16, align 4, !tbaa !12
br label %for.inc19
for.inc19: ; preds = %if.end, %if.then14
%inc20 = add nuw nsw i32 %i.157, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc20, %5
br i1 %cmp2, label %for.body3, label %for.cond22.preheader, !llvm.loop !17
for.body24: ; preds = %for.body24.preheader, %for.inc31
%indvars.iv66 = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next67, %for.inc31 ]
%arrayidx26 = getelementptr inbounds [25 x %struct.node_tbl], ptr @t, i64 0, i64 %indvars.iv66
%6 = load i32, ptr %arrayidx26, align 4, !tbaa !12
%cmp28 = icmp eq i32 %6, -1
br i1 %cmp28, label %for.end33.loopexit.split.loop.exit, label %for.inc31
for.inc31: ; preds = %for.body24
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.end33, label %for.body24, !llvm.loop !18
for.end33.loopexit.split.loop.exit: ; preds = %for.body24
%7 = trunc i64 %indvars.iv66 to i32
br label %for.end33
for.end33: ; preds = %for.inc31, %for.end33.loopexit.split.loop.exit, %entry, %for.cond1.preheader, %for.cond22.preheader
%i.2.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ 0, %for.cond1.preheader ], [ 0, %entry ], [ %7, %for.end33.loopexit.split.loop.exit ], [ %5, %for.inc31 ]
call void @set_depth(i32 noundef %i.2.lcssa, i32 noundef 0)
%call34 = call i32 @set_height(i32 noundef %i.2.lcssa)
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp3662 = icmp sgt i32 %8, 0
br i1 %cmp3662, label %for.body37, label %for.end40
for.body37: ; preds = %for.end33, %for.body37
%i.363 = phi i32 [ %inc39, %for.body37 ], [ 0, %for.end33 ]
call void @print(i32 noundef %i.363)
%inc39 = add nuw nsw i32 %i.363, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp36 = icmp slt i32 %inc39, %9
br i1 %cmp36, label %for.body37, label %for.end40, !llvm.loop !19
for.end40: ; preds = %for.body37, %for.end33
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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(read, 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"node_tbl", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int p;
int left;
int right;
} Node;
int searchHight(int);
Node *trees;
int main(){
int n,i,id,depth,tmpP,deg,nowNode,sibling;
scanf("%d", &n);
trees = malloc(sizeof(Node)*n);
for (i = 0; i < n; ++i){
trees[i].p = -1;
}
for (i = 0; i < n; ++i){
scanf("%d",&id);
scanf("%d%d",&trees[id].left,&trees[id].right);
trees[trees[id].left].p = id;
trees[trees[id].right].p = id;
}
nowNode = 0;
while(1){
if (trees[nowNode].left != -1 && trees[nowNode].right != -1)
{
break;
} else if (trees[nowNode].left == -1)
{
nowNode = trees[nowNode].right;
} else {
nowNode = trees[nowNode].left;
}
}
for (i = 0; i < n; ++i){
tmpP = trees[i].p;
if (tmpP == -1) sibling = -1;
else if(trees[tmpP].left == i) sibling = trees[tmpP].right;
else sibling = trees[tmpP].left;
depth = 0;
while(tmpP != -1){
tmpP = trees[tmpP].p;
depth++;
}
deg = 0;
if (trees[i].left != -1) deg++;
if (trees[i].right != -1) deg++;
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, "
,i,trees[i].p,sibling,deg,depth,searchHight(i));
if(trees[i].p == -1) printf("root\n");
else if(trees[i].left == -1 && trees[i].right == -1) printf("leaf\n");
else printf("internal node\n");
}
return 0;
}
int searchHight(int index){
int hLeft = 0;
int hRight = 0;
if (trees[index].left != -1){
hLeft = searchHight(trees[index].left) +1;
}
if (trees[index].right != -1){
hRight = searchHight(trees[index].right) +1;
}
if (hLeft < hRight) return hRight;
else return hLeft;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237654/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.node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@trees = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [75 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, \00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.6 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = mul nsw i64 %conv, 12
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
store ptr %call1, ptr @trees, align 8, !tbaa !9
%cmp168 = icmp sgt i32 %0, 0
br i1 %cmp168, label %for.body.preheader, label %while.cond.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !11
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond3.preheader, label %for.body.epil, !llvm.loop !13
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
br i1 %cmp168, label %for.body6, label %while.cond.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 4, !tbaa !11
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !11
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 4, !tbaa !11
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !11
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !15
while.cond.preheader.loopexit: ; preds = %for.body6
%2 = icmp sgt i32 %11, 0
br label %while.cond.preheader
while.cond.preheader: ; preds = %entry, %while.cond.preheader.loopexit, %for.cond3.preheader
%cmp53175 = phi i1 [ %2, %while.cond.preheader.loopexit ], [ false, %for.cond3.preheader ], [ false, %entry ]
%3 = phi ptr [ %7, %while.cond.preheader.loopexit ], [ %call1, %for.cond3.preheader ], [ %call1, %entry ]
br label %while.cond
for.body6: ; preds = %for.cond3.preheader, %for.body6
%i.1171 = phi i32 [ %inc26, %for.body6 ], [ 0, %for.cond3.preheader ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%4 = load ptr, ptr @trees, align 8, !tbaa !9
%5 = load i32, ptr %id, align 4, !tbaa !5
%idxprom8 = sext i32 %5 to i64
%left = getelementptr inbounds %struct.node, ptr %4, i64 %idxprom8, i32 1
%right = getelementptr inbounds %struct.node, ptr %4, i64 %idxprom8, i32 2
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%6 = load i32, ptr %id, align 4, !tbaa !5
%7 = load ptr, ptr @trees, align 8, !tbaa !9
%idxprom13 = sext i32 %6 to i64
%left15 = getelementptr inbounds %struct.node, ptr %7, i64 %idxprom13, i32 1
%8 = load i32, ptr %left15, align 4, !tbaa !17
%idxprom16 = sext i32 %8 to i64
%arrayidx17 = getelementptr inbounds %struct.node, ptr %7, i64 %idxprom16
store i32 %6, ptr %arrayidx17, align 4, !tbaa !11
%9 = load i32, ptr %id, align 4, !tbaa !5
%idxprom19 = sext i32 %9 to i64
%right21 = getelementptr inbounds %struct.node, ptr %7, i64 %idxprom19, i32 2
%10 = load i32, ptr %right21, align 4, !tbaa !18
%idxprom22 = sext i32 %10 to i64
%arrayidx23 = getelementptr inbounds %struct.node, ptr %7, i64 %idxprom22
store i32 %9, ptr %arrayidx23, align 4, !tbaa !11
%inc26 = add nuw nsw i32 %i.1171, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc26, %11
br i1 %cmp4, label %for.body6, label %while.cond.preheader.loopexit, !llvm.loop !19
while.cond: ; preds = %while.cond.backedge, %while.cond.preheader
%nowNode.0 = phi i32 [ 0, %while.cond.preheader ], [ %nowNode.0.be, %while.cond.backedge ]
%idxprom28 = sext i32 %nowNode.0 to i64
%left30 = getelementptr inbounds %struct.node, ptr %3, i64 %idxprom28, i32 1
%12 = load i32, ptr %left30, align 4, !tbaa !17
%cmp31.not = icmp eq i32 %12, -1
%right46 = getelementptr inbounds %struct.node, ptr %3, i64 %idxprom28, i32 2
%13 = load i32, ptr %right46, align 4, !tbaa !18
br i1 %cmp31.not, label %while.cond.backedge, label %land.lhs.true
while.cond.backedge: ; preds = %while.cond, %land.lhs.true
%nowNode.0.be = phi i32 [ %12, %land.lhs.true ], [ %13, %while.cond ]
br label %while.cond
land.lhs.true: ; preds = %while.cond
%cmp36.not = icmp eq i32 %13, -1
br i1 %cmp36.not, label %while.cond.backedge, label %for.cond52.preheader
for.cond52.preheader: ; preds = %land.lhs.true
br i1 %cmp53175, label %for.body55, label %for.end135
for.body55: ; preds = %for.cond52.preheader, %for.inc133
%indvars.iv178 = phi i64 [ %indvars.iv.next179, %for.inc133 ], [ 0, %for.cond52.preheader ]
%14 = load ptr, ptr @trees, align 8, !tbaa !9
%arrayidx57 = getelementptr inbounds %struct.node, ptr %14, i64 %indvars.iv178
%15 = load i32, ptr %arrayidx57, align 4, !tbaa !11
%cmp59 = icmp eq i32 %15, -1
br i1 %cmp59, label %while.end86, label %if.else62
if.else62: ; preds = %for.body55
%idxprom63 = sext i32 %15 to i64
%left65 = getelementptr inbounds %struct.node, ptr %14, i64 %idxprom63, i32 1
%16 = load i32, ptr %left65, align 4, !tbaa !17
%17 = zext i32 %16 to i64
%cmp66 = icmp eq i64 %indvars.iv178, %17
br i1 %cmp66, label %if.then68, label %while.body81.preheader
if.then68: ; preds = %if.else62
%right71 = getelementptr inbounds %struct.node, ptr %14, i64 %idxprom63, i32 2
%18 = load i32, ptr %right71, align 4, !tbaa !18
br label %while.body81.preheader
while.body81.preheader: ; preds = %if.else62, %if.then68
%sibling.0.ph = phi i32 [ %16, %if.else62 ], [ %18, %if.then68 ]
br label %while.body81
while.body81: ; preds = %while.body81.preheader, %while.body81
%tmpP.0174 = phi i32 [ %19, %while.body81 ], [ %15, %while.body81.preheader ]
%depth.0173 = phi i32 [ %inc85, %while.body81 ], [ 0, %while.body81.preheader ]
%idxprom82 = sext i32 %tmpP.0174 to i64
%arrayidx83 = getelementptr inbounds %struct.node, ptr %14, i64 %idxprom82
%19 = load i32, ptr %arrayidx83, align 4, !tbaa !11
%inc85 = add nuw nsw i32 %depth.0173, 1
%cmp79.not = icmp eq i32 %19, -1
br i1 %cmp79.not, label %while.end86, label %while.body81, !llvm.loop !20
while.end86: ; preds = %while.body81, %for.body55
%sibling.0183 = phi i32 [ -1, %for.body55 ], [ %sibling.0.ph, %while.body81 ]
%depth.0.lcssa = phi i32 [ 0, %for.body55 ], [ %inc85, %while.body81 ]
%left89 = getelementptr inbounds %struct.node, ptr %14, i64 %indvars.iv178, i32 1
%20 = load i32, ptr %left89, align 4, !tbaa !17
%cmp90.not = icmp ne i32 %20, -1
%spec.select = zext i1 %cmp90.not to i32
%right97 = getelementptr inbounds %struct.node, ptr %14, i64 %indvars.iv178, i32 2
%21 = load i32, ptr %right97, align 4, !tbaa !18
%cmp98.not = icmp eq i32 %21, -1
%inc101 = select i1 %cmp90.not, i32 2, i32 1
%deg.1 = select i1 %cmp98.not, i32 %spec.select, i32 %inc101
%22 = trunc i64 %indvars.iv178 to i32
%call106 = call i32 @searchHight(i32 noundef %22)
%call107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22, i32 noundef %15, i32 noundef %sibling.0183, i32 noundef %deg.1, i32 noundef %depth.0.lcssa, i32 noundef %call106)
%23 = load ptr, ptr @trees, align 8, !tbaa !9
%arrayidx109 = getelementptr inbounds %struct.node, ptr %23, i64 %indvars.iv178
%24 = load i32, ptr %arrayidx109, align 4, !tbaa !11
%cmp111 = icmp eq i32 %24, -1
br i1 %cmp111, label %for.inc133, label %if.else115
if.else115: ; preds = %while.end86
%left118 = getelementptr inbounds %struct.node, ptr %23, i64 %indvars.iv178, i32 1
%25 = load i32, ptr %left118, align 4, !tbaa !17
%cmp119 = icmp eq i32 %25, -1
br i1 %cmp119, label %land.lhs.true121, label %if.else129
land.lhs.true121: ; preds = %if.else115
%right124 = getelementptr inbounds %struct.node, ptr %23, i64 %indvars.iv178, i32 2
%26 = load i32, ptr %right124, align 4, !tbaa !18
%cmp125 = icmp eq i32 %26, -1
br i1 %cmp125, label %for.inc133, label %if.else129
if.else129: ; preds = %land.lhs.true121, %if.else115
br label %for.inc133
for.inc133: ; preds = %land.lhs.true121, %while.end86, %if.else129
%str.7.sink = phi ptr [ @str, %if.else129 ], [ @str.7, %while.end86 ], [ @str.6, %land.lhs.true121 ]
%puts167 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
%indvars.iv.next179 = add nuw nsw i64 %indvars.iv178, 1
%27 = load i32, ptr %n, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp53 = icmp slt i64 %indvars.iv.next179, %28
br i1 %cmp53, label %for.body55, label %for.end135, !llvm.loop !21
for.end135: ; preds = %for.inc133, %for.cond52.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @searchHight(i32 noundef %index) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr @trees, align 8, !tbaa !9
%idxprom = sext i32 %index to i64
%left = getelementptr inbounds %struct.node, ptr %0, i64 %idxprom, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !17
%cmp.not = icmp eq i32 %1, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @searchHight(i32 noundef %1)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%hLeft.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds %struct.node, ptr %0, i64 %idxprom, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !18
%cmp6.not = icmp eq i32 %2, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @searchHight(i32 noundef %2)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%hRight.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%hRight.0.hLeft.0 = tail call i32 @llvm.smax.i32(i32 %hLeft.0, i32 %hRight.0)
ret i32 %hRight.0.hLeft.0
}
; 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"node", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !6, i64 4}
!18 = !{!12, !6, i64 8}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}
|
#include <stdio.h>
typedef struct{
int parent;
int left;
int right;
}Tree;
Tree t[100000];
int num,depth[100000],height[100000];
void print(int);
void setDep(int,int);
int setHei(int);
int getSib(int);
int main(){
int v,k,l,r,c,i,root = 0;
scanf("%d",&num);
for(i = 0; i< num; i++){
t[i].parent = -1;
t[i].left = -1;
t[i].right = -1;
}
for(i = 0; i< num; i++){
scanf("%d %d %d",&v,&l,&r);
t[v].left = l;
t[v].right = r;
if(l != -1)t[l].parent = v;
if(r != -1)t[r].parent = v;
}
for(i = 0; i < num; i++){
if(t[i].parent == -1)root = i;
}
setDep(root,0);
setHei(root);
for(i = 0; i< num; i++)print(i);
return 0;
}
void print(int u){
int i,c;
printf("node %d: parent = %d, sibling = %d, ",u,t[u].parent,getSib(u));
int degree = 0;
if(t[u].left != -1) degree++;
if(t[u].right != -1) degree++;
printf("degree = %d, depth = %d, height = %d, ",degree,depth[u],height[u]);
if(t[u].parent == -1) printf("root\n");
else if(t[u].left == -1 && t[u].right == -1) printf("leaf\n");
else printf("internal node\n");
}
void setDep(int u,int p){
if(u == -1) return;
depth[u] = p;
setDep(t[u].right,p+1);
setDep(t[u].left,p+1);
}
int setHei(int u){
int h1 = 0,h2 = 0,h;
if(t[u].left != -1){
h1 = setHei(t[u].left)+1;
}
if(t[u].right != -1){
h2 = setHei(t[u].right)+1;
}
if(h1 > h2) height[u] =h1;
else height[u] = h2;
return height[u];
}
int getSib(int u){
if(t[u].parent == -1) return -1;
if(t[t[u].parent].left != u && t[t[u].parent].left != -1) return t[t[u].parent].left;
if(t[t[u].parent].right != u && t[t[u].parent].right != -1) return t[t[u].parent].right;
return -1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237698/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237698/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.Tree = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@num = dso_local global i32 0, align 4
@t = dso_local local_unnamed_addr global [100000 x %struct.Tree] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [37 x i8] c"node %d: parent = %d, sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [39 x i8] c"degree = %d, depth = %d, height = %d, \00", align 1
@depth = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@height = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.8 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @num)
%0 = load i32, ptr @num, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %0, 0
br i1 %cmp62, label %for.body7.preheader, label %for.end39
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @t, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond28.preheader: ; preds = %for.inc25
%cmp2966 = icmp sgt i32 %7, 0
br i1 %cmp2966, label %for.body30.preheader, label %for.end39
for.body30.preheader: ; preds = %for.cond28.preheader
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %7, 4
br i1 %3, label %for.end39.loopexit.unr-lcssa, label %for.body30.preheader.new
for.body30.preheader.new: ; preds = %for.body30.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body30
for.body7: ; preds = %for.body7.preheader, %for.inc25
%i.165 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%4 = load i32, ptr %l, align 4, !tbaa !5
%5 = load i32, ptr %v, align 4, !tbaa !5
%idxprom9 = sext i32 %5 to i64
%left11 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom9, i32 1
store i32 %4, ptr %left11, align 4, !tbaa !9
%6 = load i32, ptr %r, align 4, !tbaa !5
%right14 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom9, i32 2
store i32 %6, ptr %right14, align 4, !tbaa !11
%cmp15.not = icmp eq i32 %4, -1
br i1 %cmp15.not, label %if.end, label %if.then
if.then: ; preds = %for.body7
%idxprom16 = sext i32 %4 to i64
%arrayidx17 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom16
store i32 %5, ptr %arrayidx17, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body7
%cmp19.not = icmp eq i32 %6, -1
br i1 %cmp19.not, label %for.inc25, label %if.then20
if.then20: ; preds = %if.end
%idxprom21 = sext i32 %6 to i64
%arrayidx22 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom21
store i32 %5, ptr %arrayidx22, align 4, !tbaa !12
br label %for.inc25
for.inc25: ; preds = %if.end, %if.then20
%inc26 = add nuw nsw i32 %i.165, 1
%7 = load i32, ptr @num, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc26, %7
br i1 %cmp6, label %for.body7, label %for.cond28.preheader, !llvm.loop !13
for.body30: ; preds = %for.body30, %for.body30.preheader.new
%indvars.iv = phi i64 [ 0, %for.body30.preheader.new ], [ %indvars.iv.next.3, %for.body30 ]
%root.068 = phi i32 [ 0, %for.body30.preheader.new ], [ %spec.select.3, %for.body30 ]
%niter = phi i64 [ 0, %for.body30.preheader.new ], [ %niter.next.3, %for.body30 ]
%arrayidx32 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx32, align 16, !tbaa !12
%cmp34 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp34, i32 %9, i32 %root.068
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx32.1 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next
%10 = load i32, ptr %arrayidx32.1, align 4, !tbaa !12
%cmp34.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp34.1, i32 %11, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx32.2 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx32.2, align 8, !tbaa !12
%cmp34.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp34.2, i32 %13, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx32.3 = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.next.2
%14 = load i32, ptr %arrayidx32.3, align 4, !tbaa !12
%cmp34.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp34.3, i32 %15, i32 %spec.select.2
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.end39.loopexit.unr-lcssa, label %for.body30, !llvm.loop !15
for.end39.loopexit.unr-lcssa: ; preds = %for.body30, %for.body30.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body30.preheader ], [ %spec.select.3, %for.body30 ]
%indvars.iv.unr = phi i64 [ 0, %for.body30.preheader ], [ %indvars.iv.next.3, %for.body30 ]
%root.068.unr = phi i32 [ 0, %for.body30.preheader ], [ %spec.select.3, %for.body30 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end39, label %for.body30.epil
for.body30.epil: ; preds = %for.end39.loopexit.unr-lcssa, %for.body30.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body30.epil ], [ %indvars.iv.unr, %for.end39.loopexit.unr-lcssa ]
%root.068.epil = phi i32 [ %spec.select.epil, %for.body30.epil ], [ %root.068.unr, %for.end39.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body30.epil ], [ 0, %for.end39.loopexit.unr-lcssa ]
%arrayidx32.epil = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %indvars.iv.epil
%16 = load i32, ptr %arrayidx32.epil, align 4, !tbaa !12
%cmp34.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp34.epil, i32 %17, i32 %root.068.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.end39, label %for.body30.epil, !llvm.loop !16
for.end39: ; preds = %for.end39.loopexit.unr-lcssa, %for.body30.epil, %entry, %for.cond28.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond28.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end39.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body30.epil ]
call void @setDep(i32 noundef %root.0.lcssa, i32 noundef 0)
%call40 = call i32 @setHei(i32 noundef %root.0.lcssa)
%18 = load i32, ptr @num, align 4, !tbaa !5
%cmp4270 = icmp sgt i32 %18, 0
br i1 %cmp4270, label %for.body43, label %for.end46
for.body43: ; preds = %for.end39, %for.body43
%i.371 = phi i32 [ %inc45, %for.body43 ], [ 0, %for.end39 ]
call void @print(i32 noundef %i.371)
%inc45 = add nuw nsw i32 %i.371, 1
%19 = load i32, ptr @num, align 4, !tbaa !5
%cmp42 = icmp slt i32 %inc45, %19
br i1 %cmp42, label %for.body43, label %for.end46, !llvm.loop !18
for.end46: ; preds = %for.body43, %for.end39
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setDep(i32 noundef %u, i32 noundef %p) local_unnamed_addr #3 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%p.tr13 = phi i32 [ %add, %if.end ], [ %p, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @depth, i64 0, i64 %idxprom
store i32 %p.tr13, ptr %arrayidx, align 4, !tbaa !5
%right = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %right, align 4, !tbaa !11
%add = add nsw i32 %p.tr13, 1
tail call void @setDep(i32 noundef %0, i32 noundef %add)
%left = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @setHei(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @setHei(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @setHei(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%2 = getelementptr inbounds [100000 x i32], ptr @height, i64 0, i64 %idxprom
store i32 %spec.select, ptr %2, align 4
ret i32 %spec.select
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %0, -1
br i1 %cmp.i, label %getSib.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %0 to i64
%left.i = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom4.i, i32 1
%1 = load i32, ptr %left.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %1, %u
%cmp13.not.i = icmp eq i32 %1, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %getSib.exit
if.end21.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom4.i, i32 2
%2 = load i32, ptr %right.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %2, %u
%cmp35.not.i = icmp eq i32 %2, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %2
br label %getSib.exit
getSib.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %1, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %u, i32 noundef %0, i32 noundef %retval.0.i)
%left = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 1
%3 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp ne i32 %3, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom, i32 2
%4 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %4, -1
%inc8 = select i1 %cmp.not, i32 2, i32 1
%degree.1 = select i1 %cmp6.not, i32 %spec.select, i32 %inc8
%arrayidx11 = getelementptr inbounds [100000 x i32], ptr @depth, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [100000 x i32], ptr @height, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %degree.1, i32 noundef %5, i32 noundef %6)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp18 = icmp eq i32 %7, -1
br i1 %cmp18, label %if.end34, label %if.else
if.else: ; preds = %getSib.exit
%8 = load i32, ptr %left, align 4, !tbaa !9
%cmp24 = icmp eq i32 %8, -1
br i1 %cmp24, label %land.lhs.true, label %if.else31
land.lhs.true: ; preds = %if.else
%9 = load i32, ptr %right, align 4, !tbaa !11
%cmp28 = icmp eq i32 %9, -1
br i1 %cmp28, label %if.end34, label %if.else31
if.else31: ; preds = %land.lhs.true, %if.else
br label %if.end34
if.end34: ; preds = %land.lhs.true, %getSib.exit, %if.else31
%str.7.sink = phi ptr [ @str, %if.else31 ], [ @str.8, %getSib.exit ], [ @str.7, %land.lhs.true ]
%puts46 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
ret void
}
; 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 nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getSib(i32 noundef %u) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%right = getelementptr inbounds [100000 x %struct.Tree], ptr @t, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
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(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 #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !14}
|
#include<stdio.h>
#include<stdlib.h>
#define MAX 100001
typedef struct{
int parent;
int left;
int right;
} Node;
Node T[MAX];
int getDepth(int);
int getHeight(int);
int Degree(int);
int Sibling(int,int);
void PrintState(int);
int main(){
int n,i,id,r,l;
scanf("%d",&n);
for(i = 0; i < n; i++){
T[i].parent = -1;
T[i].left = -1;
T[i].right = -1;
}
for(i = 0; i < n; i++){
scanf("%d%d%d",&id ,&r ,&l);
T[r].parent = id;
T[l].parent = id;
T[id].left = r;
T[id].right = l;
}
for(i=0; i<n; i++) PrintState(i);
return 0;
}
int getDepth(int x){
if(T[x].parent == -1) return 0;
else return 1+getDepth(T[x].parent);
}
int getHeight(int x){
int lefth = 0, righth = 0;
if(x == -1) return 0;
if(T[x].left != -1) lefth = getHeight(T[x].left)+1;
if(T[x].right != -1) righth = getHeight(T[x].right)+1;
if(lefth > righth) return lefth;
else return righth;
}
int Degree(int x){
if(T[x].left != -1 && T[x].right != -1) return 2;
else if(T[x].left != -1 || T[x].right != -1) return 1;
else return 0;
}
int Sibling(int parent,int x){
if(parent == -1) return -1;
else if(T[parent].left == x)return T[parent].right;
else return T[parent].left;
}
void PrintState(int u){
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, " ,u ,T[u].parent ,Sibling(T[u].parent,u) ,Degree(u) ,getDepth(u) ,getHeight(u));
if(T[u].parent == -1) printf("root\n");
else if(T[u].left == -1 && T[u].right == -1) printf("leaf\n");
else printf("internal node\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237740/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.Node = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@T = dso_local local_unnamed_addr global [100001 x %struct.Node] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [75 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, \00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.6 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
%r = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body7.preheader, label %for.end29
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond24.preheader: ; preds = %for.body7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body26, label %for.end29
for.body7: ; preds = %for.body7.preheader, %for.body7
%i.142 = phi i32 [ %inc22, %for.body7 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %r, ptr noundef nonnull %l)
%4 = load i32, ptr %id, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !5
%idxprom9 = sext i32 %5 to i64
%arrayidx10 = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom9
store i32 %4, ptr %arrayidx10, align 4, !tbaa !9
%6 = load i32, ptr %l, align 4, !tbaa !5
%idxprom12 = sext i32 %6 to i64
%arrayidx13 = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !9
%idxprom15 = sext i32 %4 to i64
%left17 = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom15, i32 1
store i32 %5, ptr %left17, align 4, !tbaa !11
%right20 = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom15, i32 2
store i32 %6, ptr %right20, align 4, !tbaa !12
%inc22 = add nuw nsw i32 %i.142, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc22, %7
br i1 %cmp6, label %for.body7, label %for.cond24.preheader, !llvm.loop !13
for.body26: ; preds = %for.cond24.preheader, %for.body26
%i.244 = phi i32 [ %inc28, %for.body26 ], [ 0, %for.cond24.preheader ]
call void @PrintState(i32 noundef %i.244)
%inc28 = add nuw nsw i32 %i.244, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp slt i32 %inc28, %8
br i1 %cmp25, label %for.body26, label %for.end29, !llvm.loop !15
for.end29: ; preds = %for.body26, %entry, %for.cond24.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind uwtable
define dso_local void @PrintState(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp.i = icmp eq i32 %0, -1
br i1 %cmp.i, label %Sibling.exit, label %if.else.i
if.else.i: ; preds = %entry
%idxprom.i = sext i32 %0 to i64
%left.i = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom.i, i32 1
%1 = load i32, ptr %left.i, align 4, !tbaa !11
%cmp1.i = icmp eq i32 %1, %u
br i1 %cmp1.i, label %if.then2.i, label %Sibling.exit
if.then2.i: ; preds = %if.else.i
%right.i = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom.i, i32 2
%2 = load i32, ptr %right.i, align 4, !tbaa !12
br label %Sibling.exit
Sibling.exit: ; preds = %entry, %if.else.i, %if.then2.i
%retval.0.i = phi i32 [ %2, %if.then2.i ], [ -1, %entry ], [ %1, %if.else.i ]
%left.i35 = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%3 = load i32, ptr %left.i35, align 4, !tbaa !11
%right10.i = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%4 = load i32, ptr %right10.i, align 4, !tbaa !12
%cmp11.not.i = icmp ne i32 %4, -1
%cmp3.not.i = icmp eq i32 %4, -1
%spec.select17.i = select i1 %cmp3.not.i, i32 1, i32 2
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %Sibling.exit
%accumulator.tr.i = phi i32 [ 0, %Sibling.exit ], [ %add.i, %tailrecurse.i ]
%x.tr.i = phi i32 [ %u, %Sibling.exit ], [ %5, %tailrecurse.i ]
%idxprom.i37 = sext i32 %x.tr.i to i64
%arrayidx.i = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom.i37
%5 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp.i38 = icmp eq i32 %5, -1
%add.i = add nuw nsw i32 %accumulator.tr.i, 1
br i1 %cmp.i38, label %getDepth.exit, label %tailrecurse.i
getDepth.exit: ; preds = %tailrecurse.i
%cmp.not.i = icmp eq i32 %3, -1
%spec.select.i = zext i1 %cmp11.not.i to i32
%retval.0.i36 = select i1 %cmp.not.i, i32 %spec.select.i, i32 %spec.select17.i
%call6 = tail call i32 @getHeight(i32 noundef %u)
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %u, i32 noundef %0, i32 noundef %retval.0.i, i32 noundef %retval.0.i36, i32 noundef %accumulator.tr.i, i32 noundef %call6)
%6 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %6, -1
br i1 %cmp, label %if.end22, label %if.else
if.else: ; preds = %getDepth.exit
%7 = load i32, ptr %left.i35, align 4, !tbaa !11
%cmp14 = icmp eq i32 %7, -1
br i1 %cmp14, label %land.lhs.true, label %if.else20
land.lhs.true: ; preds = %if.else
%8 = load i32, ptr %right10.i, align 4, !tbaa !12
%cmp17 = icmp eq i32 %8, -1
br i1 %cmp17, label %if.end22, label %if.else20
if.else20: ; preds = %land.lhs.true, %if.else
br label %if.end22
if.end22: ; preds = %land.lhs.true, %getDepth.exit, %if.else20
%str.6.sink = phi ptr [ @str, %if.else20 ], [ @str.7, %getDepth.exit ], [ @str.6, %land.lhs.true ]
%puts32 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
ret void
}
; 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, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getDepth(i32 noundef %x) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%accumulator.tr = phi i32 [ 0, %entry ], [ %add, %tailrecurse ]
%x.tr = phi i32 [ %x, %entry ], [ %0, %tailrecurse ]
%idxprom = sext i32 %x.tr to i64
%arrayidx = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp eq i32 %0, -1
%add = add nuw nsw i32 %accumulator.tr, 1
br i1 %cmp, label %return, label %tailrecurse
return: ; preds = %tailrecurse
ret i32 %accumulator.tr
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getHeight(i32 noundef %x) local_unnamed_addr #4 {
entry:
%cmp = icmp eq i32 %x, -1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %x to i64
%left = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !11
%cmp1.not = icmp eq i32 %0, -1
br i1 %cmp1.not, label %if.end6, label %if.then2
if.then2: ; preds = %if.end
%call = tail call i32 @getHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end6
if.end6: ; preds = %if.then2, %if.end
%lefth.0 = phi i32 [ %add, %if.then2 ], [ 0, %if.end ]
%right = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !12
%cmp9.not = icmp eq i32 %1, -1
br i1 %cmp9.not, label %if.end16, label %if.then10
if.then10: ; preds = %if.end6
%call14 = tail call i32 @getHeight(i32 noundef %1)
%add15 = add nsw i32 %call14, 1
br label %if.end16
if.end16: ; preds = %if.then10, %if.end6
%righth.0 = phi i32 [ %add15, %if.then10 ], [ 0, %if.end6 ]
%lefth.0.righth.0 = tail call i32 @llvm.smax.i32(i32 %lefth.0, i32 %righth.0)
br label %cleanup
cleanup: ; preds = %if.end16, %entry
%retval.0 = phi i32 [ 0, %entry ], [ %lefth.0.righth.0, %if.end16 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Degree(i32 noundef %x) local_unnamed_addr #5 {
entry:
%idxprom = sext i32 %x to i64
%left = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !11
%cmp.not = icmp eq i32 %0, -1
%right10 = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right10, align 4, !tbaa !12
%cmp11.not = icmp ne i32 %1, -1
%spec.select = zext i1 %cmp11.not to i32
%cmp3.not = icmp eq i32 %1, -1
%spec.select17 = select i1 %cmp3.not, i32 1, i32 2
%retval.0 = select i1 %cmp.not, i32 %spec.select, i32 %spec.select17
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Sibling(i32 noundef %parent, i32 noundef %x) local_unnamed_addr #5 {
entry:
%cmp = icmp eq i32 %parent, -1
br i1 %cmp, label %return, label %if.else
if.else: ; preds = %entry
%idxprom = sext i32 %parent to i64
%left = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !11
%cmp1 = icmp eq i32 %0, %x
br i1 %cmp1, label %if.then2, label %return
if.then2: ; preds = %if.else
%right = getelementptr inbounds [100001 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !12
br label %return
return: ; preds = %if.else, %entry, %if.then2
%retval.0 = phi i32 [ %1, %if.then2 ], [ -1, %entry ], [ %0, %if.else ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { nofree norecurse nosync nounwind memory(read, 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 #4 = { nofree nosync nounwind memory(read, 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 #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, 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 #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 4}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include<stdio.h>
#define MAX 100005
#define NIL -1
/*
p: parent
l: left-child
r: right sibling
*/
struct Node{
int p, l, r;
};
struct Node T[MAX]; // Tree
int n;
int depth(int u){
int d = 0, i;
for(i=u; T[i].p!=NIL; i=T[i].p, d++);
return d;
}
int height(int u){
int l = 0, r = 0,h=0;
if (T[u].l != -1){
l += height(T[u].l);
l++;
}
if (T[u].r != -1){
r += height(T[u].r);
r++;
}
if(r>=l) h=r;
else h=l;
return h;
}
void print(int u){
int sibling,degree;
printf("node %d: parent = %d, ",u,T[u].p);
if(T[u].p==NIL){
sibling=-1;
}else if(T[T[u].p].l==u){
sibling=T[T[u].p].r;
}else{
sibling=T[T[u].p].l;
}
printf("sibling = %d, ",sibling);
if(T[u].l == NIL && T[u].r == NIL){
degree=0;
}else if(T[u].l == NIL || T[u].r == NIL){
degree=1;
}else{
degree=2;
}
printf("degree = %d, ",degree);
printf("depth = %d, height = %d, ",depth(u),height(u));
if(T[u].p==NIL){
printf("root\n");
}else if(height(u)==0){
printf("leaf\n");
}else{
printf("internal node\n");
}
}
int main(){
int i, j, d, v, c, l,tmp;
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
T[i].p = T[i].l = T[i].r = NIL;
}
for ( i = 0; i < n; i++ ){
scanf("%d %d %d", &v, &d, &c);
T[v].l = d;
T[v].r = c;
T[d].p = T[c].p = v;
}
for ( i = 0; i < n; i++ ) print(i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237791/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.Node = type { i32, i32, i32 }
@T = dso_local local_unnamed_addr global [100005 x %struct.Node] zeroinitializer, align 16
@.str = private unnamed_addr constant [23 x i8] c"node %d: parent = %d, \00", align 1
@.str.1 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.2 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.3 = private unnamed_addr constant [26 x i8] c"depth = %d, height = %d, \00", align 1
@.str.7 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.8 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.9 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.10 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @depth(i32 noundef %u) local_unnamed_addr #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%d.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ]
%i.0 = phi i32 [ %u, %entry ], [ %0, %for.cond ]
%idxprom = sext i32 %i.0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, -1
%inc = add nuw nsw i32 %d.0, 1
br i1 %cmp.not, label %for.end, label %for.cond, !llvm.loop !10
for.end: ; preds = %for.cond
ret i32 %d.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 nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @height(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%l1 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l1, align 4, !tbaa !12
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @height(i32 noundef %0)
%inc = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%l.0 = phi i32 [ %inc, %if.then ], [ 0, %entry ]
%r7 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r7, align 4, !tbaa !13
%cmp8.not = icmp eq i32 %1, -1
br i1 %cmp8.not, label %if.end16, label %if.then9
if.then9: ; preds = %if.end
%call13 = tail call i32 @height(i32 noundef %1)
%inc15 = add nsw i32 %call13, 1
br label %if.end16
if.end16: ; preds = %if.then9, %if.end
%r.0 = phi i32 [ %inc15, %if.then9 ], [ 0, %if.end ]
%l.0.r.0 = tail call i32 @llvm.smax.i32(i32 %r.0, i32 %l.0)
ret i32 %l.0.r.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %if.end23, label %if.else
if.else: ; preds = %entry
%idxprom7 = sext i32 %1 to i64
%l = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom7, i32 1
%2 = load i32, ptr %l, align 4, !tbaa !12
%cmp9 = icmp eq i32 %2, %u
br i1 %cmp9, label %if.then10, label %if.end23
if.then10: ; preds = %if.else
%r = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom7, i32 2
%3 = load i32, ptr %r, align 4, !tbaa !13
br label %if.end23
if.end23: ; preds = %if.else, %entry, %if.then10
%sibling.0 = phi i32 [ %3, %if.then10 ], [ -1, %entry ], [ %2, %if.else ]
%call24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sibling.0)
%l27 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %l27, align 4, !tbaa !12
%cmp28 = icmp eq i32 %4, -1
%r31 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%5 = load i32, ptr %r31, align 4, !tbaa !13
%cmp42 = icmp eq i32 %5, -1
%spec.select = select i1 %cmp42, i32 1, i32 2
%cmp32 = icmp ne i32 %5, -1
%spec.select83 = zext i1 %cmp32 to i32
%degree.0 = select i1 %cmp28, i32 %spec.select83, i32 %spec.select
%call47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %degree.0)
br label %for.cond.i
for.cond.i: ; preds = %for.cond.i, %if.end23
%d.0.i = phi i32 [ 0, %if.end23 ], [ %inc.i, %for.cond.i ]
%i.0.i = phi i32 [ %u, %if.end23 ], [ %6, %for.cond.i ]
%idxprom.i = sext i32 %i.0.i to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp.not.i = icmp eq i32 %6, -1
%inc.i = add nuw nsw i32 %d.0.i, 1
br i1 %cmp.not.i, label %depth.exit, label %for.cond.i, !llvm.loop !10
depth.exit: ; preds = %for.cond.i
%call49 = tail call i32 @height(i32 noundef %u)
%call50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %d.0.i, i32 noundef %call49)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp54 = icmp eq i32 %7, -1
br i1 %cmp54, label %if.end65, label %if.else57
if.else57: ; preds = %depth.exit
%call58 = tail call i32 @height(i32 noundef %u)
%cmp59 = icmp eq i32 %call58, 0
%str.9.str = select i1 %cmp59, ptr @str.9, ptr @str
br label %if.end65
if.end65: ; preds = %if.else57, %depth.exit
%str.9.sink = phi ptr [ @str.10, %depth.exit ], [ %str.9.str, %if.else57 ]
%puts81 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.9.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%d = alloca i32, align 4
%v = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !14
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body8.preheader, label %for.end30
for.body8.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !14
br label %for.body8
for.cond25.preheader: ; preds = %for.body8
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body27, label %for.end30
for.body8: ; preds = %for.body8.preheader, %for.body8
%i.143 = phi i32 [ %inc23, %for.body8 ], [ 0, %for.body8.preheader ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.8, ptr noundef nonnull %v, ptr noundef nonnull %d, ptr noundef nonnull %c)
%4 = load i32, ptr %d, align 4, !tbaa !14
%5 = load i32, ptr %v, align 4, !tbaa !14
%idxprom10 = sext i32 %5 to i64
%l12 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom10, i32 1
store i32 %4, ptr %l12, align 4, !tbaa !12
%6 = load i32, ptr %c, align 4, !tbaa !14
%r15 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom10, i32 2
store i32 %6, ptr %r15, align 4, !tbaa !13
%idxprom16 = sext i32 %6 to i64
%arrayidx17 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom16
store i32 %5, ptr %arrayidx17, align 4, !tbaa !5
%idxprom19 = sext i32 %4 to i64
%arrayidx20 = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom19
store i32 %5, ptr %arrayidx20, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %i.143, 1
%7 = load i32, ptr @n, align 4, !tbaa !14
%cmp7 = icmp slt i32 %inc23, %7
br i1 %cmp7, label %for.body8, label %for.cond25.preheader, !llvm.loop !15
for.body27: ; preds = %for.cond25.preheader, %for.body27
%i.245 = phi i32 [ %inc29, %for.body27 ], [ 0, %for.cond25.preheader ]
call void @print(i32 noundef %i.245)
%inc29 = add nuw nsw i32 %i.245, 1
%8 = load i32, ptr @n, align 4, !tbaa !14
%cmp26 = icmp slt i32 %inc29, %8
br i1 %cmp26, label %for.body27, label %for.end30, !llvm.loop !16
for.end30: ; preds = %for.body27, %entry, %for.cond25.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #8
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { nofree norecurse nosync nounwind memory(read, 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 = { nofree nosync nounwind memory(read, 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 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 0}
!6 = !{!"Node", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
|
#include <stdio.h>
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
int n = 0, c = gc();
if (c == '-') { c = gc();
do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
return -n;
}
do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
return n;
}
typedef struct { int parent; int sibling; int depth, height; int k; int c[2]; } TREE;
TREE tree[30];
void calc_depth(int node, int d)
{
int i;
tree[node].depth = d;
for (i = 0; i < tree[node].k; i++) calc_depth(tree[node].c[i], d+1);
}
int calc_height(int node)
{
int i, h, t;
h = 0;
for (i = 0; i < tree[node].k; i++) {
if ((t = calc_height(tree[node].c[i])+1) > h) h = t;
}
tree[node].height = h;
return h;
}
int main()
{
int n, i, id;
int root, left, right;
n = in();
for (i = 0; i < n; i++) {
id = in(), left = in(), right = in();
if (left < 0 && right < 0) tree[id].k = 0;
else if (left >= 0 && right >= 0) {
tree[id].k = 2;
tree[id].c[0] = left, tree[id].c[1] = right;
tree[left].parent = id+1;
tree[left].sibling = right+1;
tree[right].parent = id+1;
tree[right].sibling = left+1;
} else {
if (left < 0) left = right;
tree[id].k = 1;
tree[id].c[0] = left;
tree[left].parent = id+1;
}
}
for (root = 0; root < n; root++) {
if (tree[root].parent == 0) break;
}
calc_depth(root, 0);
calc_height(root);
for (i = 0; i < n; i++) {
printf("node %d:", i);
printf(" parent = %d,", tree[i].parent-1);
printf(" sibling = %d,", tree[i].sibling-1);
printf(" degree = %d,", tree[i].k);
printf(" depth = %d,", tree[i].depth);
printf(" height = %d,", tree[i].height);
if (i == root) printf(" root");
else if (tree[i].k == 0) printf(" leaf");
else printf(" internal node");
putchar('\n');
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237856/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237856/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.TREE = type { i32, i32, i32, i32, i32, [2 x i32] }
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@tree = dso_local local_unnamed_addr global [30 x %struct.TREE] zeroinitializer, align 16
@.str = private unnamed_addr constant [9 x i8] c"node %d:\00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c" parent = %d,\00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c" sibling = %d,\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c" degree = %d,\00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c" depth = %d,\00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c" height = %d,\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c" root\00", align 1
@.str.7 = private unnamed_addr constant [6 x i8] c" leaf\00", align 1
@.str.8 = private unnamed_addr constant [15 x i8] c" internal node\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
br label %getchar_unlocked.exit
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%cmp = icmp eq i32 %cond.i, 45
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
br i1 %cmp, label %if.then, label %do.body4
if.then: ; preds = %getchar_unlocked.exit
%_IO_read_ptr.i20 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i20, align 8, !tbaa !9
%_IO_read_end.i21 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i21, align 8, !tbaa !14
%cmp.not.i22 = icmp ult ptr %5, %6
br i1 %cmp.not.i22, label %cond.false.i26, label %cond.true.i23, !prof !15
cond.true.i23: ; preds = %if.then
%call.i24 = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre52.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i26: ; preds = %if.then
%incdec.ptr.i27 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i27, ptr %_IO_read_ptr.i20, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i28 = zext i8 %7 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i23, %cond.false.i26
%.ph = phi ptr [ %4, %cond.false.i26 ], [ %.pre52.pre, %cond.true.i23 ]
%c.0.ph = phi i32 [ %conv3.i28, %cond.false.i26 ], [ %call.i24, %cond.true.i23 ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit39
%8 = phi ptr [ %12, %getchar_unlocked.exit39 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit39 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i35, %getchar_unlocked.exit39 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i30 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i30, align 8, !tbaa !9
%_IO_read_end.i31 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i31, align 8, !tbaa !14
%cmp.not.i32 = icmp ult ptr %9, %10
br i1 %cmp.not.i32, label %cond.false.i36, label %cond.true.i33, !prof !15
cond.true.i33: ; preds = %do.body
%call.i34 = tail call i32 @__uflow(ptr noundef nonnull %8) #4
%.pre51 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit39
cond.false.i36: ; preds = %do.body
%incdec.ptr.i37 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i37, ptr %_IO_read_ptr.i30, align 8, !tbaa !9
%11 = load i8, ptr %9, align 1, !tbaa !16
%conv3.i38 = zext i8 %11 to i32
br label %getchar_unlocked.exit39
getchar_unlocked.exit39: ; preds = %cond.true.i33, %cond.false.i36
%12 = phi ptr [ %.pre51, %cond.true.i33 ], [ %8, %cond.false.i36 ]
%cond.i35 = phi i32 [ %call.i34, %cond.true.i33 ], [ %conv3.i38, %cond.false.i36 ]
%cmp3 = icmp sgt i32 %cond.i35, 47
br i1 %cmp3, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit39
%sub = sub nsw i32 0, %add
br label %cleanup
do.body4: ; preds = %getchar_unlocked.exit, %getchar_unlocked.exit49
%13 = phi ptr [ %17, %getchar_unlocked.exit49 ], [ %4, %getchar_unlocked.exit ]
%n.1 = phi i32 [ %add7, %getchar_unlocked.exit49 ], [ 0, %getchar_unlocked.exit ]
%c.1 = phi i32 [ %cond.i45, %getchar_unlocked.exit49 ], [ %cond.i, %getchar_unlocked.exit ]
%mul5 = mul nsw i32 %n.1, 10
%and6 = and i32 %c.1, 15
%add7 = add nsw i32 %and6, %mul5
%_IO_read_ptr.i40 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i40, align 8, !tbaa !9
%_IO_read_end.i41 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i41, align 8, !tbaa !14
%cmp.not.i42 = icmp ult ptr %14, %15
br i1 %cmp.not.i42, label %cond.false.i46, label %cond.true.i43, !prof !15
cond.true.i43: ; preds = %do.body4
%call.i44 = tail call i32 @__uflow(ptr noundef nonnull %13) #4
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit49
cond.false.i46: ; preds = %do.body4
%incdec.ptr.i47 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i47, ptr %_IO_read_ptr.i40, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i48 = zext i8 %16 to i32
br label %getchar_unlocked.exit49
getchar_unlocked.exit49: ; preds = %cond.true.i43, %cond.false.i46
%17 = phi ptr [ %.pre, %cond.true.i43 ], [ %13, %cond.false.i46 ]
%cond.i45 = phi i32 [ %call.i44, %cond.true.i43 ], [ %conv3.i48, %cond.false.i46 ]
%cmp10 = icmp sgt i32 %cond.i45, 47
br i1 %cmp10, label %do.body4, label %cleanup, !llvm.loop !19
cleanup: ; preds = %getchar_unlocked.exit49, %do.end
%retval.0 = phi i32 [ %sub, %do.end ], [ %add7, %getchar_unlocked.exit49 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @calc_depth(i32 noundef %node, i32 noundef %d) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %node to i64
%depth = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 2
store i32 %d, ptr %depth, align 4, !tbaa !20
%k = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 4
%0 = load i32, ptr %k, align 4, !tbaa !22
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %d, 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%arrayidx6 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 5, i64 %indvars.iv
%1 = load i32, ptr %arrayidx6, align 4, !tbaa !23
tail call void @calc_depth(i32 noundef %1, i32 noundef %add)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %k, align 4, !tbaa !22
%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 !24
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @calc_height(i32 noundef %node) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %node to i64
%k = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 4
%0 = load i32, ptr %k, align 4, !tbaa !22
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%h.015 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%arrayidx4 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 5, i64 %indvars.iv
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !23
%call = tail call i32 @calc_height(i32 noundef %1)
%cmp5.not = icmp slt i32 %call, %h.015
%add = add nsw i32 %call, 1
%spec.select = select i1 %cmp5.not, i32 %h.015, i32 %add
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %k, align 4, !tbaa !22
%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 !25
for.end: ; preds = %for.body, %entry
%h.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%height = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 3
store i32 %h.0.lcssa, ptr %height, align 4, !tbaa !26
ret i32 %h.0.lcssa
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 @in()
%cmp144 = icmp sgt i32 %call, 0
br i1 %cmp144, label %for.body, label %for.end60
for.cond49.preheader: ; preds = %for.inc
br i1 %cmp144, label %for.body51.preheader, label %for.end60
for.body51.preheader: ; preds = %for.cond49.preheader
%wide.trip.count = zext i32 %call to i64
br label %for.body51
for.body: ; preds = %entry, %for.inc
%i.0145 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = tail call i32 @in()
%call2 = tail call i32 @in()
%call3 = tail call i32 @in()
%cmp4 = icmp slt i32 %call2, 0
%cmp5 = icmp slt i32 %call3, 0
%or.cond = select i1 %cmp4, i1 %cmp5, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %for.body
%idxprom = sext i32 %call1 to i64
%k = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom, i32 4
store i32 0, ptr %k, align 4, !tbaa !22
br label %for.inc
if.else: ; preds = %for.body
%cmp6 = icmp sgt i32 %call2, -1
%cmp8 = icmp sgt i32 %call3, -1
%or.cond103 = select i1 %cmp6, i1 %cmp8, i1 false
br i1 %or.cond103, label %if.then9, label %if.else33
if.then9: ; preds = %if.else
%idxprom10 = sext i32 %call1 to i64
%k12 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom10, i32 4
store i32 2, ptr %k12, align 4, !tbaa !22
%c = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom10, i32 5
store i32 %call2, ptr %c, align 4, !tbaa !23
%arrayidx19 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom10, i32 5, i64 1
store i32 %call3, ptr %arrayidx19, align 4, !tbaa !23
%add = add nsw i32 %call1, 1
%idxprom20 = zext i32 %call2 to i64
%arrayidx21 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom20
store i32 %add, ptr %arrayidx21, align 4, !tbaa !27
%add22 = add nuw nsw i32 %call3, 1
%sibling = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom20, i32 1
store i32 %add22, ptr %sibling, align 4, !tbaa !28
%idxprom26 = zext i32 %call3 to i64
%arrayidx27 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom26
store i32 %add, ptr %arrayidx27, align 4, !tbaa !27
%add29 = add nuw nsw i32 %call2, 1
%sibling32 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom26, i32 1
store i32 %add29, ptr %sibling32, align 4, !tbaa !28
br label %for.inc
if.else33: ; preds = %if.else
%spec.select = select i1 %cmp4, i32 %call3, i32 %call2
%idxprom36 = sext i32 %call1 to i64
%k38 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom36, i32 4
store i32 1, ptr %k38, align 4, !tbaa !22
%c41 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom36, i32 5
store i32 %spec.select, ptr %c41, align 4, !tbaa !23
%add43 = add nsw i32 %call1, 1
%idxprom44 = sext i32 %spec.select to i64
%arrayidx45 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %idxprom44
store i32 %add43, ptr %arrayidx45, align 4, !tbaa !27
br label %for.inc
for.inc: ; preds = %if.then, %if.else33, %if.then9
%inc = add nuw nsw i32 %i.0145, 1
%exitcond.not = icmp eq i32 %inc, %call
br i1 %exitcond.not, label %for.cond49.preheader, label %for.body, !llvm.loop !29
for.body51: ; preds = %for.body51.preheader, %for.inc58
%indvars.iv = phi i64 [ 0, %for.body51.preheader ], [ %indvars.iv.next, %for.inc58 ]
%arrayidx53 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %indvars.iv
%0 = load i32, ptr %arrayidx53, align 4, !tbaa !27
%cmp55 = icmp eq i32 %0, 0
br i1 %cmp55, label %for.end60.loopexit.split.loop.exit, label %for.inc58
for.inc58: ; preds = %for.body51
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond152.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond152.not, label %for.end60, label %for.body51, !llvm.loop !30
for.end60.loopexit.split.loop.exit: ; preds = %for.body51
%1 = trunc i64 %indvars.iv to i32
br label %for.end60
for.end60: ; preds = %for.inc58, %for.end60.loopexit.split.loop.exit, %entry, %for.cond49.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond49.preheader ], [ 0, %entry ], [ %1, %for.end60.loopexit.split.loop.exit ], [ %call, %for.inc58 ]
tail call void @calc_depth(i32 noundef %root.0.lcssa, i32 noundef 0)
%call61 = tail call i32 @calc_height(i32 noundef %root.0.lcssa)
br i1 %cmp144, label %for.body64.preheader, label %for.end102
for.body64.preheader: ; preds = %for.end60
%2 = zext i32 %root.0.lcssa to i64
%wide.trip.count156 = zext i32 %call to i64
br label %for.body64
for.body64: ; preds = %for.body64.preheader, %if.end98
%indvars.iv153 = phi i64 [ 0, %for.body64.preheader ], [ %indvars.iv.next154, %if.end98 ]
%3 = trunc i64 %indvars.iv153 to i32
%call65 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%arrayidx67 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %indvars.iv153
%4 = load i32, ptr %arrayidx67, align 4, !tbaa !27
%sub = add nsw i32 %4, -1
%call69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%sibling72 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %indvars.iv153, i32 1
%5 = load i32, ptr %sibling72, align 4, !tbaa !28
%sub73 = add nsw i32 %5, -1
%call74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub73)
%k77 = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %indvars.iv153, i32 4
%6 = load i32, ptr %k77, align 4, !tbaa !22
%call78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %6)
%depth = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %indvars.iv153, i32 2
%7 = load i32, ptr %depth, align 4, !tbaa !20
%call81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %7)
%height = getelementptr inbounds [30 x %struct.TREE], ptr @tree, i64 0, i64 %indvars.iv153, i32 3
%8 = load i32, ptr %height, align 4, !tbaa !26
%call84 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %8)
%cmp85 = icmp eq i64 %indvars.iv153, %2
br i1 %cmp85, label %if.end98, label %if.else88
if.else88: ; preds = %for.body64
%9 = load i32, ptr %k77, align 4, !tbaa !22
%cmp92 = icmp eq i32 %9, 0
%.str.7..str.8 = select i1 %cmp92, ptr @.str.7, ptr @.str.8
br label %if.end98
if.end98: ; preds = %if.else88, %for.body64
%.str.7.sink = phi ptr [ @.str.6, %for.body64 ], [ %.str.7..str.8, %if.else88 ]
%call94 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.7.sink)
%10 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = tail call i32 @putc(i32 noundef 10, ptr noundef %10)
%indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
%exitcond157.not = icmp eq i64 %indvars.iv.next154, %wide.trip.count156
br i1 %exitcond157.not, label %for.end102, label %for.body64, !llvm.loop !31
for.end102: ; preds = %if.end98, %for.end60
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { 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 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!21, !11, i64 8}
!21 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !7, i64 20}
!22 = !{!21, !11, i64 16}
!23 = !{!11, !11, i64 0}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !18}
!26 = !{!21, !11, i64 12}
!27 = !{!21, !11, i64 0}
!28 = !{!21, !11, i64 4}
!29 = distinct !{!29, !18}
!30 = distinct !{!30, !18}
!31 = distinct !{!31, !18}
|
#include <stdio.h>
#include <assert.h>
#ifndef ONLINE_JUDGE
//#define LLD "%lld"
#else
//#define LLD "%I64d"
#endif
#define MAXR 1000000
int rr[MAXR];
int pos;
int A, B, C, D, M;
char s[13];
int g[10];
int e[10];
int get_int (const char *s, int l) {
if (l == 1) {
return s[0];
} else if (l == 2) {
if (s[0] == 0) { return 256; }
return 10 * (int) s[0] + s[1];
} else {
if (s[0] == 0) { return 256; }
return 100 * (int) s[0] + 10 * (int)s[1] + s[2];
}
}
void check (void) {
int a = get_int (s, A);
if (a >= 256) { return; }
int b = get_int (s + A, B);
if (b >= 256) { return; }
int c = get_int (s + A + B, C);
if (c >= 256) { return; }
int d = get_int (s + A + B + C, D);
if (d >= 256) { return; }
int i;
for (i = 0; i < 10; i++) e[i] = 0;
for (i = 0; i < M; i++) {
e[(int)s[i]] = 1;
}
for (i = 0; i < 10; i++) if (g[i] && !e[i]) {
return;
}
rr[pos ++] = (a << 24) + (b << 16) + (c << 8) + d;
}
void cou (int p) {
if (2 * p >= M) {
check ();
return;
}
int i;
for (i = 0; i < 10; i++) if (g[i]) {
s[p] = i;
s[M - 1 - p] = i;
cou (p + 1);
}
}
void poisk (int a, int b, int c, int d) {
A = a; B = b; C = c; D = d; M = a + b + c + d;
cou (0);
}
int main (void) {
#ifndef ONLINE_JUDGE
freopen ("input.txt", "rt", stdin);
freopen ("output.txt", "wt", stdout);
#endif
int k;
scanf ("%d", &k);
int i;
for (i = 0; i < k; i++) {
int n;
scanf ("%d", &n);
g[n] = 1;
}
int a, b, c, d;
int r = 0;
for (a = 1; a <= 3; a++)
for (b = 1; b <= 3; b ++)
for (c = 1; c <= 3; c++)
for (d = 1; d <= 3; d++) {
poisk (a, b, c, d);
}
r = pos;
printf ("%d\n", r);
for (i = 0; i < r; i++) {
unsigned R = rr[i];
printf ("%d.%d.%d.%d\n", (R >> 24) & 0xff, (R >> 16) & 0xff, (R >> 8) & 0xff, R & 0xff);
}
#ifndef ONLINE_JUDGE
fclose (stdout);
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2379/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2379/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@s = dso_local local_unnamed_addr global [13 x i8] zeroinitializer, align 1
@A = dso_local local_unnamed_addr global i32 0, align 4
@B = dso_local local_unnamed_addr global i32 0, align 4
@C = dso_local local_unnamed_addr global i32 0, align 4
@D = dso_local local_unnamed_addr global i32 0, align 4
@e = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16
@M = dso_local local_unnamed_addr global i32 0, align 4
@g = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16
@rr = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16
@pos = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [10 x i8] c"input.txt\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"rt\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [11 x i8] c"output.txt\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"wt\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.6 = private unnamed_addr constant [13 x i8] c"%d.%d.%d.%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @get_int(ptr nocapture noundef readonly %s, i32 noundef %l) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %s, align 1, !tbaa !5
switch i32 %l, label %if.else13 [
i32 1, label %if.then
i32 2, label %if.then3
]
if.then: ; preds = %entry
%conv = sext i8 %0 to i32
br label %return
if.then3: ; preds = %entry
%cmp6 = icmp eq i8 %0, 0
br i1 %cmp6, label %return, label %if.end
if.end: ; preds = %if.then3
%conv5 = sext i8 %0 to i32
%mul = mul nsw i32 %conv5, 10
%arrayidx11 = getelementptr inbounds i8, ptr %s, i64 1
%1 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%conv12 = sext i8 %1 to i32
%add = add nsw i32 %mul, %conv12
br label %return
if.else13: ; preds = %entry
%cmp16 = icmp eq i8 %0, 0
br i1 %cmp16, label %return, label %if.end19
if.end19: ; preds = %if.else13
%conv15 = sext i8 %0 to i32
%mul22 = mul nsw i32 %conv15, 100
%arrayidx23 = getelementptr inbounds i8, ptr %s, i64 1
%2 = load i8, ptr %arrayidx23, align 1, !tbaa !5
%conv24 = sext i8 %2 to i32
%mul25 = mul nsw i32 %conv24, 10
%add26 = add nsw i32 %mul25, %mul22
%arrayidx27 = getelementptr inbounds i8, ptr %s, i64 2
%3 = load i8, ptr %arrayidx27, align 1, !tbaa !5
%conv28 = sext i8 %3 to i32
%add29 = add nsw i32 %add26, %conv28
br label %return
return: ; preds = %if.else13, %if.then3, %if.end19, %if.end, %if.then
%retval.0 = phi i32 [ %conv, %if.then ], [ %add, %if.end ], [ %add29, %if.end19 ], [ 256, %if.then3 ], [ 256, %if.else13 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @check() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @A, align 4, !tbaa !8
%1 = load i8, ptr @s, align 1, !tbaa !5
switch i32 %0, label %if.else13.i [
i32 1, label %get_int.exit.thread143
i32 2, label %if.then3.i
]
get_int.exit.thread143: ; preds = %entry
%conv.i171 = zext i8 %1 to i32
br label %if.end
if.then3.i: ; preds = %entry
%cmp6.i = icmp eq i8 %1, 0
br i1 %cmp6.i, label %cleanup58, label %if.end.i
if.end.i: ; preds = %if.then3.i
%conv5.i = sext i8 %1 to i32
%mul.i = mul nsw i32 %conv5.i, 10
br label %get_int.exit
if.else13.i: ; preds = %entry
%cmp16.i = icmp eq i8 %1, 0
br i1 %cmp16.i, label %cleanup58, label %if.end19.i
if.end19.i: ; preds = %if.else13.i
%conv15.i = sext i8 %1 to i32
%mul22.i = mul nsw i32 %conv15.i, 100
%2 = load i8, ptr getelementptr inbounds ([13 x i8], ptr @s, i64 0, i64 1), align 1, !tbaa !5
%conv24.i = sext i8 %2 to i32
%mul25.i = mul nsw i32 %conv24.i, 10
%add26.i = add nsw i32 %mul25.i, %mul22.i
br label %get_int.exit
get_int.exit: ; preds = %if.end.i, %if.end19.i
%.sink175 = phi ptr [ getelementptr inbounds ([13 x i8], ptr @s, i64 0, i64 1), %if.end.i ], [ getelementptr inbounds ([13 x i8], ptr @s, i64 0, i64 2), %if.end19.i ]
%mul.i.sink = phi i32 [ %mul.i, %if.end.i ], [ %add26.i, %if.end19.i ]
%3 = load i8, ptr %.sink175, align 1, !tbaa !5
%conv12.i = sext i8 %3 to i32
%add.i = add nsw i32 %mul.i.sink, %conv12.i
%cmp = icmp sgt i32 %add.i, 255
br i1 %cmp, label %cleanup58, label %if.end
if.end: ; preds = %get_int.exit.thread143, %get_int.exit
%retval.0.i146 = phi i32 [ %conv.i171, %get_int.exit.thread143 ], [ %add.i, %get_int.exit ]
%idx.ext = sext i32 %0 to i64
%add.ptr = getelementptr inbounds i8, ptr @s, i64 %idx.ext
%4 = load i32, ptr @B, align 4, !tbaa !8
%5 = load i8, ptr %add.ptr, align 1, !tbaa !5
switch i32 %4, label %if.else13.i82 [
i32 1, label %get_int.exit92.thread149
i32 2, label %if.then3.i72
]
get_int.exit92.thread149: ; preds = %if.end
%conv.i81 = sext i8 %5 to i32
br label %if.end4
if.then3.i72: ; preds = %if.end
%cmp6.i73 = icmp eq i8 %5, 0
br i1 %cmp6.i73, label %cleanup58, label %if.end.i74
if.end.i74: ; preds = %if.then3.i72
%conv5.i75 = sext i8 %5 to i32
%mul.i76 = mul nsw i32 %conv5.i75, 10
br label %get_int.exit92
if.else13.i82: ; preds = %if.end
%cmp16.i83 = icmp eq i8 %5, 0
br i1 %cmp16.i83, label %cleanup58, label %if.end19.i84
if.end19.i84: ; preds = %if.else13.i82
%conv15.i85 = sext i8 %5 to i32
%mul22.i86 = mul nsw i32 %conv15.i85, 100
%arrayidx23.i = getelementptr inbounds i8, ptr %add.ptr, i64 1
%6 = load i8, ptr %arrayidx23.i, align 1, !tbaa !5
%conv24.i87 = sext i8 %6 to i32
%mul25.i88 = mul nsw i32 %conv24.i87, 10
%add26.i89 = add nsw i32 %mul25.i88, %mul22.i86
br label %get_int.exit92
get_int.exit92: ; preds = %if.end.i74, %if.end19.i84
%.sink = phi i64 [ 1, %if.end.i74 ], [ 2, %if.end19.i84 ]
%mul.i76.sink = phi i32 [ %mul.i76, %if.end.i74 ], [ %add26.i89, %if.end19.i84 ]
%arrayidx11.i = getelementptr inbounds i8, ptr %add.ptr, i64 %.sink
%7 = load i8, ptr %arrayidx11.i, align 1, !tbaa !5
%conv12.i77 = sext i8 %7 to i32
%add.i78 = add nsw i32 %mul.i76.sink, %conv12.i77
%cmp2 = icmp sgt i32 %add.i78, 255
br i1 %cmp2, label %cleanup58, label %if.end4
if.end4: ; preds = %get_int.exit92.thread149, %get_int.exit92
%retval.0.i79152 = phi i32 [ %conv.i81, %get_int.exit92.thread149 ], [ %add.i78, %get_int.exit92 ]
%idx.ext7 = sext i32 %4 to i64
%add.ptr8 = getelementptr inbounds i8, ptr %add.ptr, i64 %idx.ext7
%8 = load i32, ptr @C, align 4, !tbaa !8
%9 = load i8, ptr %add.ptr8, align 1, !tbaa !5
switch i32 %8, label %if.else13.i104 [
i32 1, label %get_int.exit116.thread155
i32 2, label %if.then3.i93
]
get_int.exit116.thread155: ; preds = %if.end4
%conv.i103 = sext i8 %9 to i32
br label %if.end12
if.then3.i93: ; preds = %if.end4
%cmp6.i94 = icmp eq i8 %9, 0
br i1 %cmp6.i94, label %cleanup58, label %if.end.i95
if.end.i95: ; preds = %if.then3.i93
%conv5.i96 = sext i8 %9 to i32
%mul.i97 = mul nsw i32 %conv5.i96, 10
br label %get_int.exit116
if.else13.i104: ; preds = %if.end4
%cmp16.i105 = icmp eq i8 %9, 0
br i1 %cmp16.i105, label %cleanup58, label %if.end19.i106
if.end19.i106: ; preds = %if.else13.i104
%conv15.i107 = sext i8 %9 to i32
%mul22.i108 = mul nsw i32 %conv15.i107, 100
%arrayidx23.i109 = getelementptr inbounds i8, ptr %add.ptr8, i64 1
%10 = load i8, ptr %arrayidx23.i109, align 1, !tbaa !5
%conv24.i110 = sext i8 %10 to i32
%mul25.i111 = mul nsw i32 %conv24.i110, 10
%add26.i112 = add nsw i32 %mul25.i111, %mul22.i108
br label %get_int.exit116
get_int.exit116: ; preds = %if.end.i95, %if.end19.i106
%.sink177 = phi i64 [ 1, %if.end.i95 ], [ 2, %if.end19.i106 ]
%mul.i97.sink = phi i32 [ %mul.i97, %if.end.i95 ], [ %add26.i112, %if.end19.i106 ]
%arrayidx11.i98 = getelementptr inbounds i8, ptr %add.ptr8, i64 %.sink177
%11 = load i8, ptr %arrayidx11.i98, align 1, !tbaa !5
%conv12.i99 = sext i8 %11 to i32
%add.i100 = add nsw i32 %mul.i97.sink, %conv12.i99
%cmp10 = icmp sgt i32 %add.i100, 255
br i1 %cmp10, label %cleanup58, label %if.end12
if.end12: ; preds = %get_int.exit116.thread155, %get_int.exit116
%retval.0.i101158 = phi i32 [ %conv.i103, %get_int.exit116.thread155 ], [ %add.i100, %get_int.exit116 ]
%idx.ext17 = sext i32 %8 to i64
%add.ptr18 = getelementptr inbounds i8, ptr %add.ptr8, i64 %idx.ext17
%12 = load i32, ptr @D, align 4, !tbaa !8
%13 = load i8, ptr %add.ptr18, align 1, !tbaa !5
switch i32 %12, label %if.else13.i128 [
i32 1, label %get_int.exit140.thread
i32 2, label %if.then3.i117
]
get_int.exit140.thread: ; preds = %if.end12
%conv.i127 = sext i8 %13 to i32
br label %for.body.preheader
if.then3.i117: ; preds = %if.end12
%cmp6.i118 = icmp eq i8 %13, 0
br i1 %cmp6.i118, label %cleanup58, label %if.end.i119
if.end.i119: ; preds = %if.then3.i117
%conv5.i120 = sext i8 %13 to i32
%mul.i121 = mul nsw i32 %conv5.i120, 10
br label %get_int.exit140
if.else13.i128: ; preds = %if.end12
%cmp16.i129 = icmp eq i8 %13, 0
br i1 %cmp16.i129, label %cleanup58, label %if.end19.i130
if.end19.i130: ; preds = %if.else13.i128
%conv15.i131 = sext i8 %13 to i32
%mul22.i132 = mul nsw i32 %conv15.i131, 100
%arrayidx23.i133 = getelementptr inbounds i8, ptr %add.ptr18, i64 1
%14 = load i8, ptr %arrayidx23.i133, align 1, !tbaa !5
%conv24.i134 = sext i8 %14 to i32
%mul25.i135 = mul nsw i32 %conv24.i134, 10
%add26.i136 = add nsw i32 %mul25.i135, %mul22.i132
br label %get_int.exit140
get_int.exit140: ; preds = %if.end.i119, %if.end19.i130
%.sink179 = phi i64 [ 1, %if.end.i119 ], [ 2, %if.end19.i130 ]
%mul.i121.sink = phi i32 [ %mul.i121, %if.end.i119 ], [ %add26.i136, %if.end19.i130 ]
%arrayidx11.i122 = getelementptr inbounds i8, ptr %add.ptr18, i64 %.sink179
%15 = load i8, ptr %arrayidx11.i122, align 1, !tbaa !5
%conv12.i123 = sext i8 %15 to i32
%add.i124 = add nsw i32 %mul.i121.sink, %conv12.i123
%cmp20 = icmp sgt i32 %add.i124, 255
br i1 %cmp20, label %cleanup58, label %for.body.preheader
for.body.preheader: ; preds = %get_int.exit140.thread, %get_int.exit140
%retval.0.i125174 = phi i32 [ %conv.i127, %get_int.exit140.thread ], [ %add.i124, %get_int.exit140 ]
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) @e, i8 0, i64 40, i1 false), !tbaa !8
%16 = load i32, ptr @M, align 4, !tbaa !8
%cmp25162 = icmp sgt i32 %16, 0
br i1 %cmp25162, label %for.body26.preheader, label %for.cond34.preheader
for.body26.preheader: ; preds = %for.body.preheader
%wide.trip.count = zext i32 %16 to i64
%xtraiter = and i64 %wide.trip.count, 3
%17 = icmp ult i32 %16, 4
br i1 %17, label %for.cond34.preheader.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body26
for.cond34.preheader.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next.3, %for.body26 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond34.preheader, label %for.body26.epil
for.body26.epil: ; preds = %for.cond34.preheader.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body26.epil ], [ %indvars.iv.unr, %for.cond34.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body26.epil ], [ 0, %for.cond34.preheader.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %indvars.iv.epil
%18 = load i8, ptr %arrayidx28.epil, align 1, !tbaa !5
%idxprom29.epil = sext i8 %18 to i64
%arrayidx30.epil = getelementptr inbounds [10 x i32], ptr @e, i64 0, i64 %idxprom29.epil
store i32 1, ptr %arrayidx30.epil, align 4, !tbaa !8
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond34.preheader, label %for.body26.epil, !llvm.loop !10
for.cond34.preheader: ; preds = %for.cond34.preheader.loopexit.unr-lcssa, %for.body26.epil, %for.body.preheader
%19 = load i32, ptr @g, align 16, !tbaa !8
%tobool.not = icmp ne i32 %19, 0
%20 = load i32, ptr @e, align 16
%tobool42.not = icmp eq i32 %20, 0
%or.cond = select i1 %tobool.not, i1 %tobool42.not, i1 false
br i1 %or.cond, label %cleanup58, label %for.inc45
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next.3, %for.body26 ]
%niter = phi i64 [ 0, %for.body26.preheader.new ], [ %niter.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %indvars.iv
%21 = load i8, ptr %arrayidx28, align 1, !tbaa !5
%idxprom29 = sext i8 %21 to i64
%arrayidx30 = getelementptr inbounds [10 x i32], ptr @e, i64 0, i64 %idxprom29
store i32 1, ptr %arrayidx30, align 4, !tbaa !8
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx28.1 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %indvars.iv.next
%22 = load i8, ptr %arrayidx28.1, align 1, !tbaa !5
%idxprom29.1 = sext i8 %22 to i64
%arrayidx30.1 = getelementptr inbounds [10 x i32], ptr @e, i64 0, i64 %idxprom29.1
store i32 1, ptr %arrayidx30.1, align 4, !tbaa !8
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx28.2 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %indvars.iv.next.1
%23 = load i8, ptr %arrayidx28.2, align 1, !tbaa !5
%idxprom29.2 = sext i8 %23 to i64
%arrayidx30.2 = getelementptr inbounds [10 x i32], ptr @e, i64 0, i64 %idxprom29.2
store i32 1, ptr %arrayidx30.2, align 4, !tbaa !8
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx28.3 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %indvars.iv.next.2
%24 = load i8, ptr %arrayidx28.3, align 1, !tbaa !5
%idxprom29.3 = sext i8 %24 to i64
%arrayidx30.3 = getelementptr inbounds [10 x i32], ptr @e, i64 0, i64 %idxprom29.3
store i32 1, ptr %arrayidx30.3, align 4, !tbaa !8
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond34.preheader.loopexit.unr-lcssa, label %for.body26, !llvm.loop !12
for.inc45: ; preds = %for.cond34.preheader
%25 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 1), align 4, !tbaa !8
%tobool.not.1 = icmp ne i32 %25, 0
%26 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 1), align 4
%tobool42.not.1 = icmp eq i32 %26, 0
%or.cond180 = select i1 %tobool.not.1, i1 %tobool42.not.1, i1 false
br i1 %or.cond180, label %cleanup58, label %for.inc45.1
for.inc45.1: ; preds = %for.inc45
%27 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 2), align 8, !tbaa !8
%tobool.not.2 = icmp ne i32 %27, 0
%28 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 2), align 8
%tobool42.not.2 = icmp eq i32 %28, 0
%or.cond181 = select i1 %tobool.not.2, i1 %tobool42.not.2, i1 false
br i1 %or.cond181, label %cleanup58, label %for.inc45.2
for.inc45.2: ; preds = %for.inc45.1
%29 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 3), align 4, !tbaa !8
%tobool.not.3 = icmp ne i32 %29, 0
%30 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 3), align 4
%tobool42.not.3 = icmp eq i32 %30, 0
%or.cond182 = select i1 %tobool.not.3, i1 %tobool42.not.3, i1 false
br i1 %or.cond182, label %cleanup58, label %for.inc45.3
for.inc45.3: ; preds = %for.inc45.2
%31 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 4), align 16, !tbaa !8
%tobool.not.4 = icmp ne i32 %31, 0
%32 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 4), align 16
%tobool42.not.4 = icmp eq i32 %32, 0
%or.cond183 = select i1 %tobool.not.4, i1 %tobool42.not.4, i1 false
br i1 %or.cond183, label %cleanup58, label %for.inc45.4
for.inc45.4: ; preds = %for.inc45.3
%33 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 5), align 4, !tbaa !8
%tobool.not.5 = icmp ne i32 %33, 0
%34 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 5), align 4
%tobool42.not.5 = icmp eq i32 %34, 0
%or.cond184 = select i1 %tobool.not.5, i1 %tobool42.not.5, i1 false
br i1 %or.cond184, label %cleanup58, label %for.inc45.5
for.inc45.5: ; preds = %for.inc45.4
%35 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 6), align 8, !tbaa !8
%tobool.not.6 = icmp ne i32 %35, 0
%36 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 6), align 8
%tobool42.not.6 = icmp eq i32 %36, 0
%or.cond185 = select i1 %tobool.not.6, i1 %tobool42.not.6, i1 false
br i1 %or.cond185, label %cleanup58, label %for.inc45.6
for.inc45.6: ; preds = %for.inc45.5
%37 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 7), align 4, !tbaa !8
%tobool.not.7 = icmp ne i32 %37, 0
%38 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 7), align 4
%tobool42.not.7 = icmp eq i32 %38, 0
%or.cond186 = select i1 %tobool.not.7, i1 %tobool42.not.7, i1 false
br i1 %or.cond186, label %cleanup58, label %for.inc45.7
for.inc45.7: ; preds = %for.inc45.6
%39 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 8), align 16, !tbaa !8
%tobool.not.8 = icmp ne i32 %39, 0
%40 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 8), align 16
%tobool42.not.8 = icmp eq i32 %40, 0
%or.cond187 = select i1 %tobool.not.8, i1 %tobool42.not.8, i1 false
br i1 %or.cond187, label %cleanup58, label %for.inc45.8
for.inc45.8: ; preds = %for.inc45.7
%41 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 9), align 4, !tbaa !8
%tobool.not.9 = icmp ne i32 %41, 0
%42 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @e, i64 0, i64 9), align 4
%tobool42.not.9 = icmp eq i32 %42, 0
%or.cond188 = select i1 %tobool.not.9, i1 %tobool42.not.9, i1 false
br i1 %or.cond188, label %cleanup58, label %for.inc45.9
for.inc45.9: ; preds = %for.inc45.8
%shl = shl i32 %retval.0.i146, 24
%shl48 = shl nsw i32 %retval.0.i79152, 16
%add = add nsw i32 %shl48, %shl
%shl49 = shl nsw i32 %retval.0.i101158, 8
%add50 = add nsw i32 %add, %shl49
%add51 = add nsw i32 %add50, %retval.0.i125174
%43 = load i32, ptr @pos, align 4, !tbaa !8
%inc52 = add nsw i32 %43, 1
store i32 %inc52, ptr @pos, align 4, !tbaa !8
%idxprom53 = sext i32 %43 to i64
%arrayidx54 = getelementptr inbounds [1000000 x i32], ptr @rr, i64 0, i64 %idxprom53
store i32 %add51, ptr %arrayidx54, align 4, !tbaa !8
br label %cleanup58
cleanup58: ; preds = %for.inc45.8, %for.inc45.7, %for.inc45.6, %for.inc45.5, %for.inc45.4, %for.inc45.3, %for.inc45.2, %for.inc45.1, %for.inc45, %for.cond34.preheader, %if.else13.i128, %if.then3.i117, %if.else13.i104, %if.then3.i93, %if.else13.i82, %if.then3.i72, %if.else13.i, %if.then3.i, %get_int.exit92, %get_int.exit140, %for.inc45.9, %get_int.exit116, %get_int.exit
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @cou(i32 noundef %p) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then2.9, %entry
%p.tr = phi i32 [ %p, %entry ], [ %add, %if.then2.9 ]
%mul = shl nsw i32 %p.tr, 1
%0 = load i32, ptr @M, align 4, !tbaa !8
%cmp.not = icmp slt i32 %mul, %0
br i1 %cmp.not, label %for.cond.preheader, label %if.then
for.cond.preheader: ; preds = %tailrecurse
%idxprom3 = sext i32 %p.tr to i64
%arrayidx4 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom3
%1 = xor i32 %p.tr, -1
%add = add nsw i32 %p.tr, 1
%2 = load i32, ptr @g, align 16, !tbaa !8
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %for.inc, label %if.then2
if.then: ; preds = %tailrecurse
tail call void @check()
br label %return
if.then2: ; preds = %for.cond.preheader
store i8 0, ptr %arrayidx4, align 1, !tbaa !5
%sub6 = add i32 %0, %1
%idxprom7 = sext i32 %sub6 to i64
%arrayidx8 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7
store i8 0, ptr %arrayidx8, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc
for.inc: ; preds = %for.cond.preheader, %if.then2
%3 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 1), align 4, !tbaa !8
%tobool.not.1 = icmp eq i32 %3, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then2.1
if.then2.1: ; preds = %for.inc
store i8 1, ptr %arrayidx4, align 1, !tbaa !5
%4 = load i32, ptr @M, align 4, !tbaa !8
%sub6.1 = add i32 %4, %1
%idxprom7.1 = sext i32 %sub6.1 to i64
%arrayidx8.1 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.1
store i8 1, ptr %arrayidx8.1, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.1
for.inc.1: ; preds = %if.then2.1, %for.inc
%5 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 2), align 8, !tbaa !8
%tobool.not.2 = icmp eq i32 %5, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then2.2
if.then2.2: ; preds = %for.inc.1
store i8 2, ptr %arrayidx4, align 1, !tbaa !5
%6 = load i32, ptr @M, align 4, !tbaa !8
%sub6.2 = add i32 %6, %1
%idxprom7.2 = sext i32 %sub6.2 to i64
%arrayidx8.2 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.2
store i8 2, ptr %arrayidx8.2, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.2
for.inc.2: ; preds = %if.then2.2, %for.inc.1
%7 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 3), align 4, !tbaa !8
%tobool.not.3 = icmp eq i32 %7, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then2.3
if.then2.3: ; preds = %for.inc.2
store i8 3, ptr %arrayidx4, align 1, !tbaa !5
%8 = load i32, ptr @M, align 4, !tbaa !8
%sub6.3 = add i32 %8, %1
%idxprom7.3 = sext i32 %sub6.3 to i64
%arrayidx8.3 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.3
store i8 3, ptr %arrayidx8.3, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.3
for.inc.3: ; preds = %if.then2.3, %for.inc.2
%9 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 4), align 16, !tbaa !8
%tobool.not.4 = icmp eq i32 %9, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then2.4
if.then2.4: ; preds = %for.inc.3
store i8 4, ptr %arrayidx4, align 1, !tbaa !5
%10 = load i32, ptr @M, align 4, !tbaa !8
%sub6.4 = add i32 %10, %1
%idxprom7.4 = sext i32 %sub6.4 to i64
%arrayidx8.4 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.4
store i8 4, ptr %arrayidx8.4, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.4
for.inc.4: ; preds = %if.then2.4, %for.inc.3
%11 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 5), align 4, !tbaa !8
%tobool.not.5 = icmp eq i32 %11, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then2.5
if.then2.5: ; preds = %for.inc.4
store i8 5, ptr %arrayidx4, align 1, !tbaa !5
%12 = load i32, ptr @M, align 4, !tbaa !8
%sub6.5 = add i32 %12, %1
%idxprom7.5 = sext i32 %sub6.5 to i64
%arrayidx8.5 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.5
store i8 5, ptr %arrayidx8.5, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.5
for.inc.5: ; preds = %if.then2.5, %for.inc.4
%13 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 6), align 8, !tbaa !8
%tobool.not.6 = icmp eq i32 %13, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then2.6
if.then2.6: ; preds = %for.inc.5
store i8 6, ptr %arrayidx4, align 1, !tbaa !5
%14 = load i32, ptr @M, align 4, !tbaa !8
%sub6.6 = add i32 %14, %1
%idxprom7.6 = sext i32 %sub6.6 to i64
%arrayidx8.6 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.6
store i8 6, ptr %arrayidx8.6, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.6
for.inc.6: ; preds = %if.then2.6, %for.inc.5
%15 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 7), align 4, !tbaa !8
%tobool.not.7 = icmp eq i32 %15, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then2.7
if.then2.7: ; preds = %for.inc.6
store i8 7, ptr %arrayidx4, align 1, !tbaa !5
%16 = load i32, ptr @M, align 4, !tbaa !8
%sub6.7 = add i32 %16, %1
%idxprom7.7 = sext i32 %sub6.7 to i64
%arrayidx8.7 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.7
store i8 7, ptr %arrayidx8.7, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.7
for.inc.7: ; preds = %if.then2.7, %for.inc.6
%17 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 8), align 16, !tbaa !8
%tobool.not.8 = icmp eq i32 %17, 0
br i1 %tobool.not.8, label %for.inc.8, label %if.then2.8
if.then2.8: ; preds = %for.inc.7
store i8 8, ptr %arrayidx4, align 1, !tbaa !5
%18 = load i32, ptr @M, align 4, !tbaa !8
%sub6.8 = add i32 %18, %1
%idxprom7.8 = sext i32 %sub6.8 to i64
%arrayidx8.8 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.8
store i8 8, ptr %arrayidx8.8, align 1, !tbaa !5
tail call void @cou(i32 noundef %add)
br label %for.inc.8
for.inc.8: ; preds = %if.then2.8, %for.inc.7
%19 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @g, i64 0, i64 9), align 4, !tbaa !8
%tobool.not.9 = icmp eq i32 %19, 0
br i1 %tobool.not.9, label %return, label %if.then2.9
if.then2.9: ; preds = %for.inc.8
store i8 9, ptr %arrayidx4, align 1, !tbaa !5
%20 = load i32, ptr @M, align 4, !tbaa !8
%sub6.9 = add i32 %20, %1
%idxprom7.9 = sext i32 %sub6.9 to i64
%arrayidx8.9 = getelementptr inbounds [13 x i8], ptr @s, i64 0, i64 %idxprom7.9
store i8 9, ptr %arrayidx8.9, align 1, !tbaa !5
br label %tailrecurse
return: ; preds = %for.inc.8, %if.then
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @poisk(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) local_unnamed_addr #3 {
entry:
store i32 %a, ptr @A, align 4, !tbaa !8
store i32 %b, ptr @B, align 4, !tbaa !8
store i32 %c, ptr @C, align 4, !tbaa !8
store i32 %d, ptr @D, align 4, !tbaa !8
%add = add nsw i32 %b, %a
%add1 = add nsw i32 %add, %c
%add2 = add nsw i32 %add1, %d
store i32 %add2, ptr @M, align 4, !tbaa !8
tail call void @cou(i32 noundef 0)
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%k = alloca i32, align 4
%n = alloca i32, align 4
%0 = load ptr, ptr @stdin, align 8, !tbaa !14
%call = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %0) #8
%1 = load ptr, ptr @stdout, align 8, !tbaa !14
%call1 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %1) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #8
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %k)
%2 = load i32, ptr %k, align 4, !tbaa !8
%cmp60 = icmp sgt i32 %2, 0
br i1 %cmp60, label %for.body, label %for.cond7.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.061 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %n)
%3 = load i32, ptr %n, align 4, !tbaa !8
%idxprom = sext i32 %3 to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr @g, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
%inc = add nuw nsw i32 %i.061, 1
%4 = load i32, ptr %k, align 4, !tbaa !8
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond7.preheader.preheader, !llvm.loop !16
for.cond7.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.cond7.preheader
%a.065 = phi i32 [ %add.i, %for.cond7.preheader ], [ 1, %for.cond7.preheader.preheader ]
%add.i = add nuw nsw i32 %a.065, 1
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
%add2.i = add nuw nsw i32 %a.065, 3
store i32 %add2.i, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
%add2.i.1 = add nuw nsw i32 %a.065, 4
store i32 %add2.i.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2 = add nuw nsw i32 %a.065, 5
store i32 %add2.i.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
store i32 %add2.i.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.1 = add nuw nsw i32 %a.065, 6
store i32 %add2.i.2.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 1, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.2 = add nuw nsw i32 %a.065, 7
store i32 %add2.i.2.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
%add2.i.170 = add nuw nsw i32 %a.065, 4
store i32 %add2.i.170, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
%add2.i.1.171 = add nuw nsw i32 %a.065, 5
store i32 %add2.i.1.171, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.172 = add nuw nsw i32 %a.065, 6
store i32 %add2.i.2.172, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
store i32 %add2.i.1.171, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.172, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.1.1 = add nuw nsw i32 %a.065, 7
store i32 %add2.i.2.1.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.172, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.1.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 2, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.2.1 = add nuw nsw i32 %a.065, 8
store i32 %add2.i.2.2.1, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
%add2.i.274 = add nuw nsw i32 %a.065, 5
store i32 %add2.i.274, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
%add2.i.1.275 = add nuw nsw i32 %a.065, 6
store i32 %add2.i.1.275, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 1, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.276 = add nuw nsw i32 %a.065, 7
store i32 %add2.i.2.276, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
store i32 %add2.i.1.275, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.276, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 2, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.1.2 = add nuw nsw i32 %a.065, 8
store i32 %add2.i.2.1.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 1, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.276, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 2, ptr @D, align 4, !tbaa !8
store i32 %add2.i.2.1.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
store i32 %a.065, ptr @A, align 4, !tbaa !8
store i32 3, ptr @B, align 4, !tbaa !8
store i32 3, ptr @C, align 4, !tbaa !8
store i32 3, ptr @D, align 4, !tbaa !8
%add2.i.2.2.2 = add nuw nsw i32 %a.065, 9
store i32 %add2.i.2.2.2, ptr @M, align 4, !tbaa !8
call void @cou(i32 noundef 0)
%exitcond.not = icmp eq i32 %add.i, 4
br i1 %exitcond.not, label %for.end27, label %for.cond7.preheader, !llvm.loop !17
for.end27: ; preds = %for.cond7.preheader
%5 = load i32, ptr @pos, align 4, !tbaa !8
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %5)
%cmp3066 = icmp sgt i32 %5, 0
br i1 %cmp3066, label %for.body31.preheader, label %for.end42
for.body31.preheader: ; preds = %for.end27
%wide.trip.count = zext i32 %5 to i64
br label %for.body31
for.body31: ; preds = %for.body31.preheader, %for.body31
%indvars.iv = phi i64 [ 0, %for.body31.preheader ], [ %indvars.iv.next, %for.body31 ]
%arrayidx33 = getelementptr inbounds [1000000 x i32], ptr @rr, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx33, align 4, !tbaa !8
%shr = lshr i32 %6, 24
%shr34 = lshr i32 %6, 16
%and35 = and i32 %shr34, 255
%shr36 = lshr i32 %6, 8
%and37 = and i32 %shr36, 255
%and38 = and i32 %6, 255
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %shr, i32 noundef %and35, i32 noundef %and37, i32 noundef %and38)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond79.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond79.not, label %for.end42, label %for.body31, !llvm.loop !18
for.end42: ; preds = %for.body31, %for.end27
%7 = load ptr, ptr @stdout, align 8, !tbaa !14
%call43 = call i32 @fclose(ptr noundef %7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #8
ret i32 0
}
declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nosync nounwind memory(readwrite, 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 #4 = { 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 #5 = { "no-trapping-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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"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.unroll.disable"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !6, i64 0}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
|
#include<stdio.h>
int main()
{
int n,f=0;
scanf("%d",&n);
while(n--)
{
char a[20];
scanf("%s",a);
//printf("%s\n",a);
int c,d;
scanf("%d%d",&c,&d);
//printf("%d %d\n",c,d);
if(c>=2400 && d>c)
{
f++;
}
}
if(f>0)
printf("YES\n");
else
printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23795/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23795/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 [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [20 x i8], align 16
%c = alloca i32, align 4
%d = 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
%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 %if.else, label %while.body
while.body: ; preds = %entry, %while.body
%f.013 = phi i32 [ %f.1, %while.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %c, ptr noundef nonnull %d)
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, 2399
%2 = load i32, ptr %d, align 4
%cmp3 = icmp sgt i32 %2, %1
%or.cond = select i1 %cmp, i1 %cmp3, i1 false
%inc = zext i1 %or.cond to i32
%f.1 = add nuw nsw i32 %f.013, %inc
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %a) #4
%3 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body
%4 = icmp eq i32 %f.1, 0
br i1 %4, label %if.else, label %if.end8
if.else: ; preds = %entry, %while.end
br label %if.end8
if.end8: ; preds = %while.end, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.5, %while.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define N 100000
#define NIL -1
typedef struct {
int p;
int left;
int right;
}Node;
Node T[N];
int depth[N],height[N];
void Depth(int u,int d){
if(u==NIL)return;
depth[u]=d;
Depth(T[u].left,d+1);
Depth(T[u].right,d+1);
}
int Sibling(int u){
if(T[u].p==NIL)return NIL;
if(T[T[u].p].left!=u && T[T[u].p].left!=NIL)
return T[T[u].p].left;
if(T[T[u].p].right!=u && T[T[u].p].right!=NIL)
return T[T[u].p].right;
return NIL;
}
int Height(int u){
int h1,h2;
h1=h2=0;
if(T[u].left!=NIL)
h1=Height(T[u].left)+1;
if(T[u].right!=NIL)
h2=Height(T[u].right)+1;
return height[u]=(h1>h2) ? h1 : h2;
}
void print(int id){
int deg;
printf("node %d: parent = %d, sibling = %d, ",id,T[id].p,Sibling(id));
if(T[id].left!=NIL)deg++;
if(T[id].right!=NIL)deg++;
printf("degree = %d, depth = %d, height = %d, ",deg,depth[id],height[id]);
if(T[id].p==NIL) printf("root\n");
else if(T[id].left==NIL && T[id].right==NIL)
printf("leaf\n");
else printf("internal node\n");
}
int main(){
int left,right,v,n,root=0,i;
scanf("%d",&n);
for(i=0;i<n;i++)
T[i].p=T[i].left=T[i].right=NIL;
for(i=0;i<n;i++){
scanf("%d%d%d",&v,&left,&right);
T[v].left=left;
T[v].right=right;
if(left!=NIL) T[left].p=v;
if(right!=NIL) T[right].p=v;
}
for(i=0;i<n;i++)
if(T[i].p==NIL)
root=i;
Depth(root,0);
Height(root);
for(i=0;i<n;i++)
print(i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237993/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237993/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.Node = type { i32, i32, i32 }
@depth = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [100000 x %struct.Node] zeroinitializer, align 16
@height = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [37 x i8] c"node %d: parent = %d, sibling = %d, \00", align 1
@.str.1 = private unnamed_addr constant [39 x i8] c"degree = %d, depth = %d, height = %d, \00", align 1
@.str.5 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.8 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Depth(i32 noundef %u, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%d.tr13 = phi i32 [ %add, %if.end ], [ %d, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @depth, i64 0, i64 %idxprom
store i32 %d.tr13, ptr %arrayidx, align 4, !tbaa !5
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%add = add nsw i32 %d.tr13, 1
tail call void @Depth(i32 noundef %0, i32 noundef %add)
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Sibling(i32 noundef %u) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Height(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @Height(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @Height(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr @height, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !5
ret i32 %cond
}
; 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 void @print(i32 noundef %id) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %0, -1
br i1 %cmp.i, label %Sibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %0 to i64
%left.i = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%1 = load i32, ptr %left.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %1, %id
%cmp13.not.i = icmp eq i32 %1, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %Sibling.exit
if.end21.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%2 = load i32, ptr %right.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %2, %id
%cmp35.not.i = icmp eq i32 %2, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %2
br label %Sibling.exit
Sibling.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %1, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %id, i32 noundef %0, i32 noundef %retval.0.i)
%right = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%arrayidx11 = getelementptr inbounds [100000 x i32], ptr @depth, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [100000 x i32], ptr @height, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef undef, i32 noundef %3, i32 noundef %4)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp18 = icmp eq i32 %5, -1
br i1 %cmp18, label %if.end34, label %if.else
if.else: ; preds = %Sibling.exit
%left = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%6 = load i32, ptr %left, align 4, !tbaa !9
%cmp24 = icmp eq i32 %6, -1
br i1 %cmp24, label %land.lhs.true, label %if.else31
land.lhs.true: ; preds = %if.else
%7 = load i32, ptr %right, align 4, !tbaa !11
%cmp28 = icmp eq i32 %7, -1
br i1 %cmp28, label %if.end34, label %if.else31
if.else31: ; preds = %land.lhs.true, %if.else
br label %if.end34
if.end34: ; preds = %land.lhs.true, %Sibling.exit, %if.else31
%str.7.sink = phi ptr [ @str, %if.else31 ], [ @str.8, %Sibling.exit ], [ @str.7, %land.lhs.true ]
%puts46 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%left = alloca i32, align 4
%right = alloca i32, align 4
%v = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body9.preheader, label %for.end41
for.body9.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = mul nuw nsw i64 %1, 12
call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body9
for.cond30.preheader: ; preds = %for.inc27
%cmp3168 = icmp sgt i32 %7, 0
br i1 %cmp3168, label %for.body32.preheader, label %for.end41
for.body32.preheader: ; preds = %for.cond30.preheader
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %7, 4
br i1 %3, label %for.end41.loopexit.unr-lcssa, label %for.body32.preheader.new
for.body32.preheader.new: ; preds = %for.body32.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body32
for.body9: ; preds = %for.body9.preheader, %for.inc27
%i.167 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %v, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !5
%5 = load i32, ptr %v, align 4, !tbaa !5
%idxprom11 = sext i32 %5 to i64
%left13 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom11, i32 1
store i32 %4, ptr %left13, align 4, !tbaa !9
%6 = load i32, ptr %right, align 4, !tbaa !5
%right16 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom11, i32 2
store i32 %6, ptr %right16, align 4, !tbaa !11
%cmp17.not = icmp eq i32 %4, -1
br i1 %cmp17.not, label %if.end, label %if.then
if.then: ; preds = %for.body9
%idxprom18 = sext i32 %4 to i64
%arrayidx19 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom18
store i32 %5, ptr %arrayidx19, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body9
%cmp21.not = icmp eq i32 %6, -1
br i1 %cmp21.not, label %for.inc27, label %if.then22
if.then22: ; preds = %if.end
%idxprom23 = sext i32 %6 to i64
%arrayidx24 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom23
store i32 %5, ptr %arrayidx24, align 4, !tbaa !12
br label %for.inc27
for.inc27: ; preds = %if.end, %if.then22
%inc28 = add nuw nsw i32 %i.167, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc28, %7
br i1 %cmp8, label %for.body9, label %for.cond30.preheader, !llvm.loop !13
for.body32: ; preds = %for.body32, %for.body32.preheader.new
%indvars.iv = phi i64 [ 0, %for.body32.preheader.new ], [ %indvars.iv.next.3, %for.body32 ]
%root.069 = phi i32 [ 0, %for.body32.preheader.new ], [ %spec.select.3, %for.body32 ]
%niter = phi i64 [ 0, %for.body32.preheader.new ], [ %niter.next.3, %for.body32 ]
%arrayidx34 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx34, align 16, !tbaa !12
%cmp36 = icmp eq i32 %8, -1
%9 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp36, i32 %9, i32 %root.069
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx34.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
%10 = load i32, ptr %arrayidx34.1, align 4, !tbaa !12
%cmp36.1 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp36.1, i32 %11, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx34.2 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
%12 = load i32, ptr %arrayidx34.2, align 8, !tbaa !12
%cmp36.2 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp36.2, i32 %13, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx34.3 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
%14 = load i32, ptr %arrayidx34.3, align 4, !tbaa !12
%cmp36.3 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp36.3, i32 %15, i32 %spec.select.2
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.end41.loopexit.unr-lcssa, label %for.body32, !llvm.loop !15
for.end41.loopexit.unr-lcssa: ; preds = %for.body32, %for.body32.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body32.preheader ], [ %spec.select.3, %for.body32 ]
%indvars.iv.unr = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next.3, %for.body32 ]
%root.069.unr = phi i32 [ 0, %for.body32.preheader ], [ %spec.select.3, %for.body32 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end41, label %for.body32.epil
for.body32.epil: ; preds = %for.end41.loopexit.unr-lcssa, %for.body32.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body32.epil ], [ %indvars.iv.unr, %for.end41.loopexit.unr-lcssa ]
%root.069.epil = phi i32 [ %spec.select.epil, %for.body32.epil ], [ %root.069.unr, %for.end41.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body32.epil ], [ 0, %for.end41.loopexit.unr-lcssa ]
%arrayidx34.epil = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
%16 = load i32, ptr %arrayidx34.epil, align 4, !tbaa !12
%cmp36.epil = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp36.epil, i32 %17, i32 %root.069.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.end41, label %for.body32.epil, !llvm.loop !16
for.end41: ; preds = %for.end41.loopexit.unr-lcssa, %for.body32.epil, %entry, %for.cond30.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond30.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end41.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body32.epil ]
call void @Depth(i32 noundef %root.0.lcssa, i32 noundef 0)
%call42 = call i32 @Height(i32 noundef %root.0.lcssa)
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp4472 = icmp sgt i32 %18, 0
br i1 %cmp4472, label %for.body45, label %for.end48
for.body45: ; preds = %for.end41, %for.body45
%i.373 = phi i32 [ %inc47, %for.body45 ], [ 0, %for.end41 ]
call void @print(i32 noundef %i.373)
%inc47 = add nuw nsw i32 %i.373, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp44 = icmp slt i32 %inc47, %19
br i1 %cmp44, label %for.body45, label %for.end48, !llvm.loop !18
for.end48: ; preds = %for.body45, %for.end41
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
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 nofree norecurse nosync nounwind willreturn memory(read, 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 #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 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !14}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
typedef struct Node{int parent,left,right;}N;
N T[MAX];
int n,D[MAX],H[MAX];
void setDepth(int u,int d){
if(u == NIL)return;
D[u] = d;
setDepth(T[u].left,d+1);
setDepth(T[u].right,d+1);
}
int setHeight(int u){
int h1 = 0;
int h2 = 0;
if(T[u].left != NIL)h1 = setHeight(T[u].left)+1;
if(T[u].right != NIL)h2 = setHeight(T[u].right)+1;
H[u] = (h1 > h2 ? h1 : h2);
return H[u];
}
int getSibling(int u){
if(T[u].parent == NIL) return NIL;
if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)return T[T[u].parent].left;
if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)return T[T[u].parent].right;
return NIL;
}
void print(int u){
printf("node %d: ",u);
printf("parent = %d, ",T[u].parent);
printf("sibling = %d, ",getSibling(u));
int deg = 0;
if(T[u].left != NIL)deg++;
if(T[u].right != NIL)deg++;
printf("degree = %d, ",deg);
printf("depth = %d, ",D[u]);
printf("height = %d, ",H[u]);
if(T[u].parent == NIL){
printf("root\n");
}else if(T[u].left == NIL && T[u].right == NIL){
printf("leaf\n");
}else{
printf("internal node\n");
}
}
int main(void){
int v, l,r,root = 0;
scanf("%d",&n);
for(int i = 0;i<n;i++){
T[i].parent = NIL;
}
for(int i = 0;i < n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].left = l;
T[v].right = r;
if(l != NIL)T[l].parent = v;
if(r != NIL)T[r].parent = v;
}
for(int i = 0;i < n; i++){
if(T[i].parent == NIL)root =i;
}
setDepth(root,0);
setHeight(root);
for(int i = 0;i < n;i++)print(i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238035/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238035/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.Node = type { i32, i32, i32 }
@D = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@.str.9 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.10 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.12 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setDepth(i32 noundef %u, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%d.tr13 = phi i32 [ %add, %if.end ], [ %d, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %idxprom
store i32 %d.tr13, ptr %arrayidx, align 4, !tbaa !5
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%add = add nsw i32 %d.tr13, 1
tail call void @setDepth(i32 noundef %0, i32 noundef %add)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @setHeight(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @setHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @setHeight(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !5
ret i32 %cond
}
; 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getSibling(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %1, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %1 to i64
%left.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%2 = load i32, ptr %left.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %2, %u
%cmp13.not.i = icmp eq i32 %2, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %getSibling.exit
if.end21.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%3 = load i32, ptr %right.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %3, %u
%cmp35.not.i = icmp eq i32 %3, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %3
br label %getSibling.exit
getSibling.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %2, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp ne i32 %4, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%5 = load i32, ptr %right, align 4, !tbaa !11
%cmp8.not = icmp eq i32 %5, -1
%inc10 = select i1 %cmp.not, i32 2, i32 1
%deg.1 = select i1 %cmp8.not, i32 %spec.select, i32 %inc10
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %deg.1)
%arrayidx14 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %6)
%arrayidx17 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %idxprom
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %7)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp22 = icmp eq i32 %8, -1
br i1 %cmp22, label %if.end38, label %if.else
if.else: ; preds = %getSibling.exit
%9 = load i32, ptr %left, align 4, !tbaa !9
%cmp28 = icmp eq i32 %9, -1
br i1 %cmp28, label %land.lhs.true, label %if.else35
land.lhs.true: ; preds = %if.else
%10 = load i32, ptr %right, align 4, !tbaa !11
%cmp32 = icmp eq i32 %10, -1
br i1 %cmp32, label %if.end38, label %if.else35
if.else35: ; preds = %land.lhs.true, %if.else
br label %if.end38
if.end38: ; preds = %land.lhs.true, %getSibling.exit, %if.else35
%str.11.sink = phi ptr [ @str, %if.else35 ], [ @str.12, %getSibling.exit ], [ @str.11, %land.lhs.true ]
%puts50 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.11.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.cond.cleanup27
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond2.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond2.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond2.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond2.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond2.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond2.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond2.preheader, label %for.body.epil, !llvm.loop !13
for.cond2.preheader: ; preds = %for.body.epil, %for.cond2.preheader.unr-lcssa
br i1 %cmp57, label %for.body5, label %for.cond.cleanup27
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond2.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond25.preheader: ; preds = %for.inc21
%cmp2661 = icmp sgt i32 %6, 0
br i1 %cmp2661, label %for.body28.preheader, label %for.cond.cleanup27
for.body28.preheader: ; preds = %for.cond25.preheader
%wide.trip.count72 = zext i32 %6 to i64
%xtraiter76 = and i64 %wide.trip.count72, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.cond.cleanup27.loopexit.unr-lcssa, label %for.body28.preheader.new
for.body28.preheader.new: ; preds = %for.body28.preheader
%unroll_iter80 = and i64 %wide.trip.count72, 4294967292
br label %for.body28
for.body5: ; preds = %for.cond2.preheader, %for.inc21
%i1.060 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond2.preheader ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom7 = sext i32 %4 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom7, i32 1
store i32 %3, ptr %left, align 4, !tbaa !9
%5 = load i32, ptr %r, align 4, !tbaa !5
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom7, i32 2
store i32 %5, ptr %right, align 4, !tbaa !11
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body5
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body5
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i1.060, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc22, %6
br i1 %cmp3, label %for.body5, label %for.cond25.preheader, !llvm.loop !17
for.cond.cleanup27.loopexit.unr-lcssa: ; preds = %for.body28, %for.body28.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body28.preheader ], [ %spec.select.3, %for.body28 ]
%indvars.iv69.unr = phi i64 [ 0, %for.body28.preheader ], [ %indvars.iv.next70.3, %for.body28 ]
%root.062.unr = phi i32 [ 0, %for.body28.preheader ], [ %spec.select.3, %for.body28 ]
%lcmp.mod78.not = icmp eq i64 %xtraiter76, 0
br i1 %lcmp.mod78.not, label %for.cond.cleanup27, label %for.body28.epil
for.body28.epil: ; preds = %for.cond.cleanup27.loopexit.unr-lcssa, %for.body28.epil
%indvars.iv69.epil = phi i64 [ %indvars.iv.next70.epil, %for.body28.epil ], [ %indvars.iv69.unr, %for.cond.cleanup27.loopexit.unr-lcssa ]
%root.062.epil = phi i32 [ %spec.select.epil, %for.body28.epil ], [ %root.062.unr, %for.cond.cleanup27.loopexit.unr-lcssa ]
%epil.iter77 = phi i64 [ %epil.iter77.next, %for.body28.epil ], [ 0, %for.cond.cleanup27.loopexit.unr-lcssa ]
%arrayidx30.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv69.epil
%7 = load i32, ptr %arrayidx30.epil, align 4, !tbaa !12
%cmp32.epil = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv69.epil to i32
%spec.select.epil = select i1 %cmp32.epil, i32 %8, i32 %root.062.epil
%indvars.iv.next70.epil = add nuw nsw i64 %indvars.iv69.epil, 1
%epil.iter77.next = add i64 %epil.iter77, 1
%epil.iter77.cmp.not = icmp eq i64 %epil.iter77.next, %xtraiter76
br i1 %epil.iter77.cmp.not, label %for.cond.cleanup27, label %for.body28.epil, !llvm.loop !18
for.cond.cleanup27: ; preds = %for.cond.cleanup27.loopexit.unr-lcssa, %for.body28.epil, %entry, %for.cond2.preheader, %for.cond25.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond25.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.cond.cleanup27.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body28.epil ]
call void @setDepth(i32 noundef %root.0.lcssa, i32 noundef 0)
%call38 = call i32 @setHeight(i32 noundef %root.0.lcssa)
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp4165 = icmp sgt i32 %9, 0
br i1 %cmp4165, label %for.body43, label %for.cond.cleanup42
for.body28: ; preds = %for.body28, %for.body28.preheader.new
%indvars.iv69 = phi i64 [ 0, %for.body28.preheader.new ], [ %indvars.iv.next70.3, %for.body28 ]
%root.062 = phi i32 [ 0, %for.body28.preheader.new ], [ %spec.select.3, %for.body28 ]
%niter81 = phi i64 [ 0, %for.body28.preheader.new ], [ %niter81.next.3, %for.body28 ]
%arrayidx30 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv69
%10 = load i32, ptr %arrayidx30, align 16, !tbaa !12
%cmp32 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv69 to i32
%spec.select = select i1 %cmp32, i32 %11, i32 %root.062
%indvars.iv.next70 = or i64 %indvars.iv69, 1
%arrayidx30.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next70
%12 = load i32, ptr %arrayidx30.1, align 4, !tbaa !12
%cmp32.1 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next70 to i32
%spec.select.1 = select i1 %cmp32.1, i32 %13, i32 %spec.select
%indvars.iv.next70.1 = or i64 %indvars.iv69, 2
%arrayidx30.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next70.1
%14 = load i32, ptr %arrayidx30.2, align 8, !tbaa !12
%cmp32.2 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next70.1 to i32
%spec.select.2 = select i1 %cmp32.2, i32 %15, i32 %spec.select.1
%indvars.iv.next70.2 = or i64 %indvars.iv69, 3
%arrayidx30.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next70.2
%16 = load i32, ptr %arrayidx30.3, align 4, !tbaa !12
%cmp32.3 = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.next70.2 to i32
%spec.select.3 = select i1 %cmp32.3, i32 %17, i32 %spec.select.2
%indvars.iv.next70.3 = add nuw nsw i64 %indvars.iv69, 4
%niter81.next.3 = add i64 %niter81, 4
%niter81.ncmp.3 = icmp eq i64 %niter81.next.3, %unroll_iter80
br i1 %niter81.ncmp.3, label %for.cond.cleanup27.loopexit.unr-lcssa, label %for.body28, !llvm.loop !19
for.cond.cleanup42: ; preds = %for.body43, %for.cond.cleanup27
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7
ret i32 0
for.body43: ; preds = %for.cond.cleanup27, %for.body43
%i39.066 = phi i32 [ %inc45, %for.body43 ], [ 0, %for.cond.cleanup27 ]
call void @print(i32 noundef %i39.066)
%inc45 = add nuw nsw i32 %i39.066, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%cmp41 = icmp slt i32 %inc45, %18
br i1 %cmp41, label %for.body43, label %for.cond.cleanup42, !llvm.loop !20
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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(read, 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
|
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
struct Node {
int id;
int parent;
int left;
int right;
int depth;
int height;
};
#define MAX(x, y) ((x) > (y) ? (x) : (y))
static int FindRoot(const struct Node nodes[], int n) {
int i;
for ( i = 0; i < n; i++ ) {
if ( nodes[i].parent == -1 ) {
return nodes[i].id;
}
}
assert( 0 );
return -1;
}
static int UpdateDepthAndHeight(int root, struct Node nodes[], int n) {
int height_l = 0;
int height_r = 0;
/* left */
if ( (nodes[root].left == -1) && (nodes[root].right == -1) ) {
nodes[root].height = 0;
return 0;
}
if ( nodes[root].left != -1 ) {
int left = nodes[root].left;
nodes[left].depth = nodes[root].depth + 1;
height_l = UpdateDepthAndHeight(left, nodes, n) + 1;
}
if ( nodes[root].right != -1 ) {
int right = nodes[root].right;
nodes[right].depth = nodes[root].depth + 1;
height_r = UpdateDepthAndHeight(right, nodes, n) + 1;
}
nodes[root].height = MAX(height_l, height_r);
return nodes[root].height;
}
static const char* GetType(const struct Node* p_node) {
if ( p_node->parent == -1 ) {
return "root";
}
if ( (p_node->left == -1) && (p_node->right == -1) ) {
return "leaf";
}
return "internal node";
}
int main(void) {
int i;
int n;
int id, left, right;
struct Node* nodes;
scanf("%d\n", &n);
nodes = malloc(sizeof(struct Node) * n);
/* init */
for ( i = 0; i < n; i++ ){
nodes[i].id = -1;
nodes[i].parent = nodes[i].left = nodes[i].right = -1;
nodes[i].depth = nodes[i].height = 0;
}
for ( i = 0; i < n; i++ ) {
scanf("%d %d %d\n", &id, &left, &right);
nodes[id].id = id;
nodes[id].left = left;
if ( left != -1 ) {
nodes[left].parent = id;
}
nodes[id].right = right;
if ( right != -1 ) {
nodes[right].parent = id;
}
}
int root = FindRoot(nodes, n);
UpdateDepthAndHeight(root, nodes, n);
for ( i = 0; i < n; i++ ) {
int id = nodes[i].id;
int parent = nodes[i].parent;
int sibling = parent == -1 ?
-1 :
nodes[parent].left == id ? nodes[parent].right : nodes[parent].left;
int degree = (nodes[i].left != -1) + (nodes[i].right != -1);
int depth = nodes[i].depth;
int height = nodes[i].height;
const char* type = GetType(&nodes[i]);
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",
id, parent, sibling, degree, depth, height, type);
}
free(nodes);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238079/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238079/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.Node = type { i32, i32, i32, i32, i32, i32 }
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.2 = private unnamed_addr constant [78 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\0A\00", align 1
@.str.3 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@.str.4 = private unnamed_addr constant [63 x i8] c"/data/TheStack_IR/OJ_Samples/Collated/C/Source_238079/source.c\00", align 1
@__PRETTY_FUNCTION__.FindRoot = private unnamed_addr constant [39 x i8] c"int FindRoot(const struct Node *, int)\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"root\00", align 1
@.str.6 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%id = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = mul nsw i64 %conv, 24
%call1 = call noalias ptr @malloc(i64 noundef %mul) #10
%cmp154 = icmp sgt i32 %0, 0
br i1 %cmp154, label %for.body.preheader, label %for.end.i
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.cond16.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond16.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond16.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond16.preheader.unr-lcssa
%arrayidx.epil = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.unr
%height.epil = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.unr, i32 5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %arrayidx.epil, i8 -1, i64 16, i1 false)
store i32 0, ptr %height.epil, align 4, !tbaa !9
%depth.epil = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.unr, i32 4
store i32 0, ptr %depth.epil, align 4, !tbaa !11
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.unr-lcssa, %for.body.epil
br i1 %cmp154, label %for.body19, label %for.end.i
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv
%height = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv, i32 5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %arrayidx, i8 -1, i64 16, i1 false)
store i32 0, ptr %height, align 4, !tbaa !9
%depth = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv, i32 4
store i32 0, ptr %depth, align 4, !tbaa !11
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.next
%height.1 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.next, i32 5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %arrayidx.1, i8 -1, i64 16, i1 false)
store i32 0, ptr %height.1, align 4, !tbaa !9
%depth.1 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.next, i32 4
store i32 0, ptr %depth.1, align 4, !tbaa !11
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond16.preheader.unr-lcssa, label %for.body, !llvm.loop !12
for.body19: ; preds = %for.cond16.preheader, %for.inc42
%i.1157 = phi i32 [ %inc43, %for.inc42 ], [ 0, %for.cond16.preheader ]
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%2 = load i32, ptr %id, align 4, !tbaa !5
%idxprom21 = sext i32 %2 to i64
%arrayidx22 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom21
store i32 %2, ptr %arrayidx22, align 4, !tbaa !14
%3 = load i32, ptr %left, align 4, !tbaa !5
%left26 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom21, i32 2
store i32 %3, ptr %left26, align 4, !tbaa !15
%cmp27.not = icmp eq i32 %3, -1
br i1 %cmp27.not, label %if.end, label %if.then
if.then: ; preds = %for.body19
%idxprom29 = sext i32 %3 to i64
%parent31 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom29, i32 1
store i32 %2, ptr %parent31, align 4, !tbaa !16
br label %if.end
if.end: ; preds = %if.then, %for.body19
%4 = load i32, ptr %right, align 4, !tbaa !5
%right34 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom21, i32 3
store i32 %4, ptr %right34, align 4, !tbaa !17
%cmp35.not = icmp eq i32 %4, -1
br i1 %cmp35.not, label %for.inc42, label %if.then37
if.then37: ; preds = %if.end
%idxprom38 = sext i32 %4 to i64
%parent40 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom38, i32 1
store i32 %2, ptr %parent40, align 4, !tbaa !16
br label %for.inc42
for.inc42: ; preds = %if.end, %if.then37
%inc43 = add nuw nsw i32 %i.1157, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp slt i32 %inc43, %5
br i1 %cmp17, label %for.body19, label %for.end44, !llvm.loop !18
for.end44: ; preds = %for.inc42
%cmp8.i = icmp sgt i32 %5, 0
br i1 %cmp8.i, label %for.body.preheader.i, label %for.end.i
for.body.preheader.i: ; preds = %for.end44
%wide.trip.count.i = zext i32 %5 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%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 %for.end.i, label %for.body.i, !llvm.loop !19
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.i ]
%parent.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.i, i32 1
%6 = load i32, ptr %parent.i, align 4, !tbaa !16
%cmp1.i = icmp eq i32 %6, -1
br i1 %cmp1.i, label %for.body50.preheader, label %for.cond.i
for.end.i: ; preds = %for.cond.i, %entry, %for.cond16.preheader, %for.end44
call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 26, ptr noundef nonnull @__PRETTY_FUNCTION__.FindRoot) #11
unreachable
for.body50.preheader: ; preds = %for.body.i
%arrayidx.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv.i
%7 = load i32, ptr %arrayidx.i, align 4, !tbaa !14
%8 = call fastcc i32 @UpdateDepthAndHeight(i32 noundef %7, ptr noundef nonnull %call1)
br label %for.body50
for.body50: ; preds = %for.body50.preheader, %cond.end74
%indvars.iv163 = phi i64 [ 0, %for.body50.preheader ], [ %indvars.iv.next164, %cond.end74 ]
%arrayidx53 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv163
%9 = load i32, ptr %arrayidx53, align 4, !tbaa !14
%parent58 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv163, i32 1
%10 = load i32, ptr %parent58, align 4, !tbaa !16
%cmp59 = icmp eq i32 %10, -1
br i1 %cmp59, label %cond.end74, label %cond.false
cond.false: ; preds = %for.body50
%idxprom61 = sext i32 %10 to i64
%left63 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom61, i32 2
%11 = load i32, ptr %left63, align 4, !tbaa !15
%cmp64 = icmp eq i32 %11, %9
br i1 %cmp64, label %cond.true66, label %cond.end74
cond.true66: ; preds = %cond.false
%right69 = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom61, i32 3
%12 = load i32, ptr %right69, align 4, !tbaa !17
br label %cond.end74
cond.end74: ; preds = %cond.false, %cond.true66, %for.body50
%cond75 = phi i32 [ -1, %for.body50 ], [ %12, %cond.true66 ], [ %11, %cond.false ]
%left78 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv163, i32 2
%13 = load i32, ptr %left78, align 4, !tbaa !15
%cmp79 = icmp ne i32 %13, -1
%conv80 = zext i1 %cmp79 to i32
%right83 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv163, i32 3
%14 = load i32, ptr %right83, align 4, !tbaa !17
%cmp84 = icmp ne i32 %14, -1
%conv85 = zext i1 %cmp84 to i32
%add = add nuw nsw i32 %conv85, %conv80
%depth89 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv163, i32 4
%15 = load i32, ptr %depth89, align 4, !tbaa !11
%height93 = getelementptr inbounds %struct.Node, ptr %call1, i64 %indvars.iv163, i32 5
%16 = load i32, ptr %height93, align 4, !tbaa !9
%17 = and i32 %13, %14
%or.cond = icmp eq i32 %17, -1
%spec.select = select i1 %or.cond, ptr @.str.6, ptr @.str.7
%retval.0.i = select i1 %cmp59, ptr @.str.5, ptr %spec.select
%call97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9, i32 noundef %10, i32 noundef %cond75, i32 noundef %add, i32 noundef %15, i32 noundef %16, ptr noundef nonnull %retval.0.i)
%indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp48 = icmp slt i64 %indvars.iv.next164, %19
br i1 %cmp48, label %for.body50, label %for.end100, !llvm.loop !20
for.end100: ; preds = %cond.end74
call void @free(ptr noundef nonnull %call1) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define internal fastcc i32 @UpdateDepthAndHeight(i32 noundef %root, ptr noundef %nodes) unnamed_addr #4 {
entry:
%idxprom = sext i32 %root to i64
%left = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom, i32 2
%0 = load i32, ptr %left, align 4, !tbaa !15
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %land.lhs.true, label %if.end21
land.lhs.true: ; preds = %entry
%right = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom, i32 3
%1 = load i32, ptr %right, align 4, !tbaa !17
%cmp3 = icmp eq i32 %1, -1
br i1 %cmp3, label %cleanup, label %if.then26
if.end21: ; preds = %entry
%depth = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom, i32 4
%2 = load i32, ptr %depth, align 4, !tbaa !11
%add = add nsw i32 %2, 1
%idxprom17 = sext i32 %0 to i64
%depth19 = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom17, i32 4
store i32 %add, ptr %depth19, align 4, !tbaa !11
%call = tail call fastcc i32 @UpdateDepthAndHeight(i32 noundef %0, ptr noundef nonnull %nodes)
%add20 = add nsw i32 %call, 1
%right24.phi.trans.insert = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom, i32 3
%.pre = load i32, ptr %right24.phi.trans.insert, align 4, !tbaa !17
%cmp25.not = icmp eq i32 %.pre, -1
br i1 %cmp25.not, label %if.end40, label %if.then26
if.then26: ; preds = %land.lhs.true, %if.end21
%height_l.081 = phi i32 [ %add20, %if.end21 ], [ 0, %land.lhs.true ]
%3 = phi i32 [ %.pre, %if.end21 ], [ %1, %land.lhs.true ]
%depth33 = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom, i32 4
%4 = load i32, ptr %depth33, align 4, !tbaa !11
%add34 = add nsw i32 %4, 1
%idxprom35 = sext i32 %3 to i64
%depth37 = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom35, i32 4
store i32 %add34, ptr %depth37, align 4, !tbaa !11
%call38 = tail call fastcc i32 @UpdateDepthAndHeight(i32 noundef %3, ptr noundef nonnull %nodes)
%add39 = add nsw i32 %call38, 1
br label %if.end40
if.end40: ; preds = %if.then26, %if.end21
%height_l.082 = phi i32 [ %height_l.081, %if.then26 ], [ %add20, %if.end21 ]
%height_r.0 = phi i32 [ %add39, %if.then26 ], [ 0, %if.end21 ]
%cond = tail call i32 @llvm.smax.i32(i32 %height_l.082, i32 %height_r.0)
br label %cleanup
cleanup: ; preds = %land.lhs.true, %if.end40
%cond.sink = phi i32 [ %cond, %if.end40 ], [ 0, %land.lhs.true ]
%height44 = getelementptr inbounds %struct.Node, ptr %nodes, i64 %idxprom, i32 5
store i32 %cond.sink, ptr %height44, align 4, !tbaa !9
ret i32 %cond.sink
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
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 = { 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 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 #6 = { noreturn 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { noreturn 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, !6, i64 20}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!11 = !{!10, !6, i64 16}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 0}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 4}
!17 = !{!10, !6, i64 12}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node { int parent, left, right; };
struct Node T[MAX];
int n,D[MAX],H[MAX];
void setDepth(int u, int d){
if(u==NIL)return;
D[u]=d;
setDepth(T[u].left,d+1);
setDepth(T[u].right,d+1);
}
int setHeight(int u){
int h1 = 0,h2 = 0;
if(T[u].left != NIL)
h1 = setHeight(T[u].left) + 1;
if(T[u].right != NIL)
h2 = setHeight(T[u].right) + 1;
return H[u] = (h1 > h2 ? h1 : h2);
}
int getSibling(int u){
if (T[u].parent == NIL) return NIL;
if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
return T[T[u].parent].left;
if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
return T[T[u].parent].right;
return NIL;
}
void print(int u){
printf("node %d: ", u);
printf("parent = %d, ",T[u].parent);
printf("sibling = %d, ",getSibling(u));
int deg = 0;
if(T[u].left != NIL)deg++;
if(T[u].right != NIL)deg++;
printf("degree = %d, ",deg);
printf("depth = %d, ",D[u]);
printf("height = %d, ",H[u]);
if(T[u].parent == NIL){
printf("root\n");
}
else if(T[u].left == NIL && T[u].right == NIL){
printf("leaf\n");
}
else{
printf("internal node\n");
}
}
int main(){
int v,l,r,root =0;
scanf("%d",&n);
for (int i = 0;i<n;i++) T[i].parent = NIL;
for(int i = 0;i < n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].left = l;
T[v].right = r;
if(l != NIL)T[l].parent = v;
if(r != NIL)T[r].parent = v;
}
for(int i = 0;i < n;i++) if(T[i].parent == NIL)root = i;
setDepth(root,0);
setHeight(root);
for(int i=0;i < n;i++)print(i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238121/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238121/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.Node = type { i32, i32, i32 }
@D = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [10000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@.str.9 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.10 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.12 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setDepth(i32 noundef %u, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%d.tr13 = phi i32 [ %add, %if.end ], [ %d, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %idxprom
store i32 %d.tr13, ptr %arrayidx, align 4, !tbaa !5
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%add = add nsw i32 %d.tr13, 1
tail call void @setDepth(i32 noundef %0, i32 noundef %add)
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @setHeight(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @setHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @setHeight(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !5
ret i32 %cond
}
; 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getSibling(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %1, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %1 to i64
%left.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%2 = load i32, ptr %left.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %2, %u
%cmp13.not.i = icmp eq i32 %2, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %getSibling.exit
if.end21.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%3 = load i32, ptr %right.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %3, %u
%cmp35.not.i = icmp eq i32 %3, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %3
br label %getSibling.exit
getSibling.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %2, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp ne i32 %4, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%5 = load i32, ptr %right, align 4, !tbaa !11
%cmp8.not = icmp eq i32 %5, -1
%inc10 = select i1 %cmp.not, i32 2, i32 1
%deg.1 = select i1 %cmp8.not, i32 %spec.select, i32 %inc10
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %deg.1)
%arrayidx14 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %6)
%arrayidx17 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %idxprom
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %7)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp22 = icmp eq i32 %8, -1
br i1 %cmp22, label %if.end38, label %if.else
if.else: ; preds = %getSibling.exit
%9 = load i32, ptr %left, align 4, !tbaa !9
%cmp28 = icmp eq i32 %9, -1
br i1 %cmp28, label %land.lhs.true, label %if.else35
land.lhs.true: ; preds = %if.else
%10 = load i32, ptr %right, align 4, !tbaa !11
%cmp32 = icmp eq i32 %10, -1
br i1 %cmp32, label %if.end38, label %if.else35
if.else35: ; preds = %land.lhs.true, %if.else
br label %if.end38
if.end38: ; preds = %land.lhs.true, %getSibling.exit, %if.else35
%str.11.sink = phi ptr [ @str, %if.else35 ], [ @str.12, %getSibling.exit ], [ @str.11, %land.lhs.true ]
%puts50 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.11.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body.preheader, label %for.cond.cleanup27
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond2.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond2.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond2.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond2.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond2.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond2.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond2.preheader, label %for.body.epil, !llvm.loop !13
for.cond2.preheader: ; preds = %for.body.epil, %for.cond2.preheader.unr-lcssa
br i1 %cmp57, label %for.body5, label %for.cond.cleanup27
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond2.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond25.preheader: ; preds = %for.inc21
%cmp2661 = icmp sgt i32 %6, 0
br i1 %cmp2661, label %for.body28.preheader, label %for.cond.cleanup27
for.body28.preheader: ; preds = %for.cond25.preheader
%wide.trip.count72 = zext i32 %6 to i64
%xtraiter76 = and i64 %wide.trip.count72, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.cond.cleanup27.loopexit.unr-lcssa, label %for.body28.preheader.new
for.body28.preheader.new: ; preds = %for.body28.preheader
%unroll_iter80 = and i64 %wide.trip.count72, 4294967292
br label %for.body28
for.body5: ; preds = %for.cond2.preheader, %for.inc21
%i1.060 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond2.preheader ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom7 = sext i32 %4 to i64
%left = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom7, i32 1
store i32 %3, ptr %left, align 4, !tbaa !9
%5 = load i32, ptr %r, align 4, !tbaa !5
%right = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom7, i32 2
store i32 %5, ptr %right, align 4, !tbaa !11
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body5
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body5
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i1.060, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc22, %6
br i1 %cmp3, label %for.body5, label %for.cond25.preheader, !llvm.loop !17
for.cond.cleanup27.loopexit.unr-lcssa: ; preds = %for.body28, %for.body28.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body28.preheader ], [ %spec.select.3, %for.body28 ]
%indvars.iv69.unr = phi i64 [ 0, %for.body28.preheader ], [ %indvars.iv.next70.3, %for.body28 ]
%root.062.unr = phi i32 [ 0, %for.body28.preheader ], [ %spec.select.3, %for.body28 ]
%lcmp.mod78.not = icmp eq i64 %xtraiter76, 0
br i1 %lcmp.mod78.not, label %for.cond.cleanup27, label %for.body28.epil
for.body28.epil: ; preds = %for.cond.cleanup27.loopexit.unr-lcssa, %for.body28.epil
%indvars.iv69.epil = phi i64 [ %indvars.iv.next70.epil, %for.body28.epil ], [ %indvars.iv69.unr, %for.cond.cleanup27.loopexit.unr-lcssa ]
%root.062.epil = phi i32 [ %spec.select.epil, %for.body28.epil ], [ %root.062.unr, %for.cond.cleanup27.loopexit.unr-lcssa ]
%epil.iter77 = phi i64 [ %epil.iter77.next, %for.body28.epil ], [ 0, %for.cond.cleanup27.loopexit.unr-lcssa ]
%arrayidx30.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv69.epil
%7 = load i32, ptr %arrayidx30.epil, align 4, !tbaa !12
%cmp32.epil = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv69.epil to i32
%spec.select.epil = select i1 %cmp32.epil, i32 %8, i32 %root.062.epil
%indvars.iv.next70.epil = add nuw nsw i64 %indvars.iv69.epil, 1
%epil.iter77.next = add i64 %epil.iter77, 1
%epil.iter77.cmp.not = icmp eq i64 %epil.iter77.next, %xtraiter76
br i1 %epil.iter77.cmp.not, label %for.cond.cleanup27, label %for.body28.epil, !llvm.loop !18
for.cond.cleanup27: ; preds = %for.cond.cleanup27.loopexit.unr-lcssa, %for.body28.epil, %entry, %for.cond2.preheader, %for.cond25.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond25.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.cond.cleanup27.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body28.epil ]
call void @setDepth(i32 noundef %root.0.lcssa, i32 noundef 0)
%call38 = call i32 @setHeight(i32 noundef %root.0.lcssa)
%9 = load i32, ptr @n, align 4, !tbaa !5
%cmp4165 = icmp sgt i32 %9, 0
br i1 %cmp4165, label %for.body43, label %for.cond.cleanup42
for.body28: ; preds = %for.body28, %for.body28.preheader.new
%indvars.iv69 = phi i64 [ 0, %for.body28.preheader.new ], [ %indvars.iv.next70.3, %for.body28 ]
%root.062 = phi i32 [ 0, %for.body28.preheader.new ], [ %spec.select.3, %for.body28 ]
%niter81 = phi i64 [ 0, %for.body28.preheader.new ], [ %niter81.next.3, %for.body28 ]
%arrayidx30 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv69
%10 = load i32, ptr %arrayidx30, align 16, !tbaa !12
%cmp32 = icmp eq i32 %10, -1
%11 = trunc i64 %indvars.iv69 to i32
%spec.select = select i1 %cmp32, i32 %11, i32 %root.062
%indvars.iv.next70 = or i64 %indvars.iv69, 1
%arrayidx30.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next70
%12 = load i32, ptr %arrayidx30.1, align 4, !tbaa !12
%cmp32.1 = icmp eq i32 %12, -1
%13 = trunc i64 %indvars.iv.next70 to i32
%spec.select.1 = select i1 %cmp32.1, i32 %13, i32 %spec.select
%indvars.iv.next70.1 = or i64 %indvars.iv69, 2
%arrayidx30.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next70.1
%14 = load i32, ptr %arrayidx30.2, align 8, !tbaa !12
%cmp32.2 = icmp eq i32 %14, -1
%15 = trunc i64 %indvars.iv.next70.1 to i32
%spec.select.2 = select i1 %cmp32.2, i32 %15, i32 %spec.select.1
%indvars.iv.next70.2 = or i64 %indvars.iv69, 3
%arrayidx30.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next70.2
%16 = load i32, ptr %arrayidx30.3, align 4, !tbaa !12
%cmp32.3 = icmp eq i32 %16, -1
%17 = trunc i64 %indvars.iv.next70.2 to i32
%spec.select.3 = select i1 %cmp32.3, i32 %17, i32 %spec.select.2
%indvars.iv.next70.3 = add nuw nsw i64 %indvars.iv69, 4
%niter81.next.3 = add i64 %niter81, 4
%niter81.ncmp.3 = icmp eq i64 %niter81.next.3, %unroll_iter80
br i1 %niter81.ncmp.3, label %for.cond.cleanup27.loopexit.unr-lcssa, label %for.body28, !llvm.loop !19
for.cond.cleanup42: ; preds = %for.body43, %for.cond.cleanup27
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7
ret i32 0
for.body43: ; preds = %for.cond.cleanup27, %for.body43
%i39.066 = phi i32 [ %inc45, %for.body43 ], [ 0, %for.cond.cleanup27 ]
call void @print(i32 noundef %i39.066)
%inc45 = add nuw nsw i32 %i39.066, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%cmp41 = icmp slt i32 %inc45, %18
br i1 %cmp41, label %for.body43, label %for.cond.cleanup42, !llvm.loop !20
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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(read, 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
|
#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
#define NIL -1
typedef struct{
int p;
int l;
int r;
}Node;
Node T[MAX];
int n,D[MAX],H[MAX];
void setDepth(int u,int d){
if(u==NIL)return;
D[u]=d;
setDepth(T[u].l,d+1);
setDepth(T[u].r,d+1);
}
int setHeight(int u){
int h1=0,h2=0;
if(T[u].l!=NIL)h1=setHeight(T[u].l)+1;
if(T[u].r!=NIL)h2=setHeight(T[u].r)+1;
return H[u]=(h1>h2?h1:h2);
}
int getSibling(int u){
if(T[u].p==NIL)return NIL;
if(T[T[u].p].l!=u&&T[T[u].p].l!=NIL)return T[T[u].p].l;
if(T[T[u].p].r!=u&&T[T[u].p].r!=NIL)return T[T[u].p].r;
return NIL;
}
void print(int u){
printf("node %d: ",u);
printf("parent = %d, ",T[u].p);
printf("sibling = %d, ",getSibling(u));
int deg = 0;
if(T[u].l!=NIL)deg++;
if(T[u].r!=NIL)deg++;
printf("degree = %d, ",deg);
printf("depth = %d, ",D[u]);
printf("height = %d, ",H[u]);
if(T[u].p==NIL){
printf("root\n");
}else if(T[u].l==NIL&&T[u].r==NIL){
printf("leaf\n");
}else {
printf("internal node\n");
}
}
int main(){
int v,l,r,root=0,i;
scanf("%d",&n);
for(i=0;i<n;i++){
T[i].p=NIL;
}
for(i=0;i<n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l=l;
T[v].r=r;
if(l!=NIL)T[l].p=v;
if(r!=NIL)T[r].p=v;
}
for(i=0;i<n;i++){
if(T[i].p==NIL)root=i;
}
setDepth(root,0);
setHeight(root);
for(i=0;i<n;i++){
print(i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238172/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238172/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.Node = type { i32, i32, i32 }
@D = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [100000 x %struct.Node] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"degree = %d, \00", align 1
@.str.4 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@.str.9 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.10 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.11 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.12 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setDepth(i32 noundef %u, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %u, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%d.tr13 = phi i32 [ %add, %if.end ], [ %d, %entry ]
%u.tr12 = phi i32 [ %1, %if.end ], [ %u, %entry ]
%idxprom = sext i32 %u.tr12 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @D, i64 0, i64 %idxprom
store i32 %d.tr13, ptr %arrayidx, align 4, !tbaa !5
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
%add = add nsw i32 %d.tr13, 1
tail call void @setDepth(i32 noundef %0, i32 noundef %add)
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !11
%cmp = icmp eq i32 %1, -1
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @setHeight(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !9
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @setHeight(i32 noundef %0)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%h1.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, -1
br i1 %cmp6.not, label %if.end13, label %if.then7
if.then7: ; preds = %if.end
%call11 = tail call i32 @setHeight(i32 noundef %1)
%add12 = add nsw i32 %call11, 1
br label %if.end13
if.end13: ; preds = %if.then7, %if.end
%h2.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr @H, i64 0, i64 %idxprom
store i32 %cond, ptr %arrayidx16, align 4, !tbaa !5
ret i32 %cond
}
; 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getSibling(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %l, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %u
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.end21, label %return
if.end21: ; preds = %if.end
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %r, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %u
%cmp35.not = icmp eq i32 %2, -1
%or.cond54 = or i1 %cmp27.not, %cmp35.not
%spec.select = select i1 %or.cond54, i32 -1, i32 %2
br label %return
return: ; preds = %if.end21, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end21 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %u) local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u)
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.i = icmp eq i32 %1, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %1 to i64
%l.i = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%2 = load i32, ptr %l.i, align 4, !tbaa !9
%cmp6.not.i = icmp eq i32 %2, %u
%cmp13.not.i = icmp eq i32 %2, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.end21.i, label %getSibling.exit
if.end21.i: ; preds = %if.end.i
%r.i = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%3 = load i32, ptr %r.i, align 4, !tbaa !11
%cmp27.not.i = icmp eq i32 %3, %u
%cmp35.not.i = icmp eq i32 %3, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %3
br label %getSibling.exit
getSibling.exit: ; preds = %entry, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %entry ], [ %2, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
%l = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %l, align 4, !tbaa !9
%cmp.not = icmp ne i32 %4, -1
%spec.select = zext i1 %cmp.not to i32
%r = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%5 = load i32, ptr %r, align 4, !tbaa !11
%cmp8.not = icmp eq i32 %5, -1
%inc10 = select i1 %cmp.not, i32 2, i32 1
%deg.1 = select i1 %cmp8.not, i32 %spec.select, i32 %inc10
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %deg.1)
%arrayidx14 = getelementptr inbounds [100000 x i32], ptr @D, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %6)
%arrayidx17 = getelementptr inbounds [100000 x i32], ptr @H, i64 0, i64 %idxprom
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %7)
%8 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp22 = icmp eq i32 %8, -1
br i1 %cmp22, label %if.end38, label %if.else
if.else: ; preds = %getSibling.exit
%9 = load i32, ptr %l, align 4, !tbaa !9
%cmp28 = icmp eq i32 %9, -1
br i1 %cmp28, label %land.lhs.true, label %if.else35
land.lhs.true: ; preds = %if.else
%10 = load i32, ptr %r, align 4, !tbaa !11
%cmp32 = icmp eq i32 %10, -1
br i1 %cmp32, label %if.end38, label %if.else35
if.else35: ; preds = %land.lhs.true, %if.else
br label %if.end38
if.end38: ; preds = %land.lhs.true, %getSibling.exit, %if.else35
%str.11.sink = phi ptr [ @str, %if.else35 ], [ @str.12, %getSibling.exit ], [ @str.11, %land.lhs.true ]
%puts50 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.11.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%v = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body.preheader, label %for.end35
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond1.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond1.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond1.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.epil
store i32 -1, ptr %arrayidx.epil, align 4, !tbaa !12
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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.cond1.preheader, label %for.body.epil, !llvm.loop !13
for.cond1.preheader: ; preds = %for.body.epil, %for.cond1.preheader.unr-lcssa
br i1 %cmp56, label %for.body3, label %for.end35
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv
store i32 -1, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next
store i32 -1, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.1
store i32 -1, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next.2
store i32 -1, ptr %arrayidx.3, align 4, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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.cond1.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond24.preheader: ; preds = %for.inc21
%cmp2560 = icmp sgt i32 %6, 0
br i1 %cmp2560, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count71 = zext i32 %6 to i64
%xtraiter75 = and i64 %wide.trip.count71, 3
%2 = icmp ult i32 %6, 4
br i1 %2, label %for.end35.loopexit.unr-lcssa, label %for.body26.preheader.new
for.body26.preheader.new: ; preds = %for.body26.preheader
%unroll_iter79 = and i64 %wide.trip.count71, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.159 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %v, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !5
%4 = load i32, ptr %v, align 4, !tbaa !5
%idxprom5 = sext i32 %4 to i64
%l7 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1
store i32 %3, ptr %l7, align 4, !tbaa !9
%5 = load i32, ptr %r, align 4, !tbaa !5
%r10 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2
store i32 %5, ptr %r10, align 4, !tbaa !11
%cmp11.not = icmp eq i32 %3, -1
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %for.body3
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom12
store i32 %4, ptr %arrayidx13, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body3
%cmp15.not = icmp eq i32 %5, -1
br i1 %cmp15.not, label %for.inc21, label %if.then16
if.then16: ; preds = %if.end
%idxprom17 = sext i32 %5 to i64
%arrayidx18 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %idxprom17
store i32 %4, ptr %arrayidx18, align 4, !tbaa !12
br label %for.inc21
for.inc21: ; preds = %if.end, %if.then16
%inc22 = add nuw nsw i32 %i.159, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc22, %6
br i1 %cmp2, label %for.body3, label %for.cond24.preheader, !llvm.loop !17
for.body26: ; preds = %for.body26, %for.body26.preheader.new
%indvars.iv68 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next69.3, %for.body26 ]
%root.061 = phi i32 [ 0, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter80 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter80.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv68
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv68 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.061
%indvars.iv.next69 = or i64 %indvars.iv68, 1
%arrayidx28.1 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next69
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next69 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next69.1 = or i64 %indvars.iv68, 2
%arrayidx28.2 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next69.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next69.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next69.2 = or i64 %indvars.iv68, 3
%arrayidx28.3 = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next69.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next69.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next69.3 = add nuw nsw i64 %indvars.iv68, 4
%niter80.next.3 = add i64 %niter80, 4
%niter80.ncmp.3 = icmp eq i64 %niter80.next.3, %unroll_iter79
br i1 %niter80.ncmp.3, label %for.end35.loopexit.unr-lcssa, label %for.body26, !llvm.loop !18
for.end35.loopexit.unr-lcssa: ; preds = %for.body26, %for.body26.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%indvars.iv68.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next69.3, %for.body26 ]
%root.061.unr = phi i32 [ 0, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod77.not = icmp eq i64 %xtraiter75, 0
br i1 %lcmp.mod77.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv68.epil = phi i64 [ %indvars.iv.next69.epil, %for.body26.epil ], [ %indvars.iv68.unr, %for.end35.loopexit.unr-lcssa ]
%root.061.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.061.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter76 = phi i64 [ %epil.iter76.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [100000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv68.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv68.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.061.epil
%indvars.iv.next69.epil = add nuw nsw i64 %indvars.iv68.epil, 1
%epil.iter76.next = add i64 %epil.iter76, 1
%epil.iter76.cmp.not = icmp eq i64 %epil.iter76.next, %xtraiter75
br i1 %epil.iter76.cmp.not, label %for.end35, label %for.body26.epil, !llvm.loop !19
for.end35: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil, %entry, %for.cond1.preheader, %for.cond24.preheader
%root.0.lcssa = phi i32 [ 0, %for.cond24.preheader ], [ 0, %for.cond1.preheader ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ]
call void @setDepth(i32 noundef %root.0.lcssa, i32 noundef 0)
%call36 = call i32 @setHeight(i32 noundef %root.0.lcssa)
%17 = load i32, ptr @n, align 4, !tbaa !5
%cmp3864 = icmp sgt i32 %17, 0
br i1 %cmp3864, label %for.body39, label %for.end42
for.body39: ; preds = %for.end35, %for.body39
%i.365 = phi i32 [ %inc41, %for.body39 ], [ 0, %for.end35 ]
call void @print(i32 noundef %i.365)
%inc41 = add nuw nsw i32 %i.365, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%cmp38 = icmp slt i32 %inc41, %18
br i1 %cmp38, label %for.body39, label %for.end42, !llvm.loop !20
for.end42: ; preds = %for.body39, %for.end35
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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(read, 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !16}
|
#include<stdio.h>
struct Node_struct{int id, par, dep, left, right, sib, height;};
typedef struct Node_struct Node;
Node node[200000];
int dfs(int pos, int dep){
node[pos].dep = dep;
int a = 0, b = 0;
if(node[pos].left != -1) a = dfs(node[pos].left, dep + 1);
if(node[pos].right != -1) b = dfs(node[pos].right, dep + 1);
node[pos].height = a < b? b:a;
return node[pos].height + 1;
}
int main(){
int i, j, k;
int N;
int id, left, right;
int deg;
int root;
scanf("%d", &N);
for(int i=0;i<N;i++) node[i].par = node[i].left = node[i].right = node[i].sib = -1;
for(i=0;i<N;i++){
scanf("%d %d %d", &id, &left, &right);
node[id].id = id;
node[id].left = left;
node[id].right = right;
if(left != -1) node[left].par = id, node[left].sib = right;
if(right != -1) node[right].par = id, node[right].sib = left;
}
for(i=0;i<N;i++) if(node[i].par == -1) root = i;
dfs(root, 0);
for(i=0;i<N;i++){
deg = (node[i].left != -1) + (node[i].right != -1);
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
node[i].id, node[i].par, node[i].sib, deg, node[i].dep, node[i].height);
if(node[i].par == -1) printf("root\n");
else if(node[i].left == -1 && node[i].right == -1) printf("leaf\n");
else printf("internal node\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238215/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238215/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.Node_struct = type { i32, i32, i32, i32, i32, i32, i32 }
@node = dso_local local_unnamed_addr global [200000 x %struct.Node_struct] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [75 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, \00", align 1
@str = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.6 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %pos, i32 noundef %dep) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %pos to i64
%dep1 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom, i32 2
store i32 %dep, ptr %dep1, align 4, !tbaa !5
%left = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom, i32 3
%0 = load i32, ptr %left, align 4, !tbaa !10
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%add = add nsw i32 %dep, 1
%call = tail call i32 @dfs(i32 noundef %0, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.then, %entry
%a.0 = phi i32 [ %call, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom, i32 4
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp9.not = icmp eq i32 %1, -1
br i1 %cmp9.not, label %if.end16, label %if.then10
if.then10: ; preds = %if.end
%add14 = add nsw i32 %dep, 1
%call15 = tail call i32 @dfs(i32 noundef %1, i32 noundef %add14)
br label %if.end16
if.end16: ; preds = %if.then10, %if.end
%b.0 = phi i32 [ %call15, %if.then10 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %a.0, i32 %b.0)
%height = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom, i32 6
store i32 %cond, ptr %height, align 4, !tbaa !12
%add23 = add nsw i32 %cond, 1
ret i32 %add23
}
; 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
%id = alloca i32, align 4
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !13
%cmp132 = icmp sgt i32 %0, 0
br i1 %cmp132, label %for.body.preheader, label %for.cond42.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %0, 1
br i1 %1, label %for.cond10.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.cond10.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond10.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond10.preheader.unr-lcssa
%sib.epil = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.unr, i32 5
store i32 -1, ptr %sib.epil, align 4, !tbaa !14
%right4.epil = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.unr, i32 4
store i32 -1, ptr %right4.epil, align 4, !tbaa !11
%left7.epil = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.unr, i32 3
store i32 -1, ptr %left7.epil, align 4, !tbaa !10
%par.epil = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.unr, i32 1
store i32 -1, ptr %par.epil, align 4, !tbaa !15
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.unr-lcssa, %for.body.epil
br i1 %cmp132, label %for.body12, label %for.cond42.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%sib = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv, i32 5
store i32 -1, ptr %sib, align 4, !tbaa !14
%right4 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv, i32 4
store i32 -1, ptr %right4, align 8, !tbaa !11
%left7 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv, i32 3
store i32 -1, ptr %left7, align 4, !tbaa !10
%par = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv, i32 1
store i32 -1, ptr %par, align 4, !tbaa !15
%indvars.iv.next = or i64 %indvars.iv, 1
%sib.1 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next, i32 5
store i32 -1, ptr %sib.1, align 8, !tbaa !14
%right4.1 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next, i32 4
store i32 -1, ptr %right4.1, align 4, !tbaa !11
%left7.1 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next, i32 3
store i32 -1, ptr %left7.1, align 8, !tbaa !10
%par.1 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next, i32 1
store i32 -1, ptr %par.1, align 8, !tbaa !15
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond10.preheader.unr-lcssa, label %for.body, !llvm.loop !16
for.cond42.preheader: ; preds = %for.inc39, %entry, %for.cond10.preheader
%.lcssa = phi i32 [ %0, %for.cond10.preheader ], [ %0, %entry ], [ %6, %for.inc39 ]
%cmp43136 = icmp sgt i32 %.lcssa, 0
call void @llvm.assume(i1 %cmp43136)
%wide.trip.count147 = zext i32 %.lcssa to i64
%xtraiter155 = and i64 %wide.trip.count147, 3
%2 = icmp ult i32 %.lcssa, 4
br i1 %2, label %for.end53.unr-lcssa, label %for.cond42.preheader.new
for.cond42.preheader.new: ; preds = %for.cond42.preheader
%unroll_iter158 = and i64 %wide.trip.count147, 2147483644
br label %for.body44
for.body12: ; preds = %for.cond10.preheader, %for.inc39
%i.0135 = phi i32 [ %inc40, %for.inc39 ], [ 0, %for.cond10.preheader ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%3 = load i32, ptr %id, align 4, !tbaa !13
%idxprom14 = sext i32 %3 to i64
%arrayidx15 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom14
store i32 %3, ptr %arrayidx15, align 4, !tbaa !18
%4 = load i32, ptr %left, align 4, !tbaa !13
%left19 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom14, i32 3
store i32 %4, ptr %left19, align 4, !tbaa !10
%5 = load i32, ptr %right, align 4, !tbaa !13
%right22 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom14, i32 4
store i32 %5, ptr %right22, align 4, !tbaa !11
%cmp23.not = icmp eq i32 %4, -1
br i1 %cmp23.not, label %if.end, label %if.then
if.then: ; preds = %for.body12
%idxprom24 = sext i32 %4 to i64
%par26 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom24, i32 1
store i32 %3, ptr %par26, align 4, !tbaa !15
%sib29 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom24, i32 5
store i32 %5, ptr %sib29, align 4, !tbaa !14
br label %if.end
if.end: ; preds = %if.then, %for.body12
%cmp30.not = icmp eq i32 %5, -1
br i1 %cmp30.not, label %for.inc39, label %if.then31
if.then31: ; preds = %if.end
%idxprom32 = sext i32 %5 to i64
%par34 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom32, i32 1
store i32 %3, ptr %par34, align 4, !tbaa !15
%sib37 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %idxprom32, i32 5
store i32 %4, ptr %sib37, align 4, !tbaa !14
br label %for.inc39
for.inc39: ; preds = %if.end, %if.then31
%inc40 = add nuw nsw i32 %i.0135, 1
%6 = load i32, ptr %N, align 4, !tbaa !13
%cmp11 = icmp slt i32 %inc40, %6
br i1 %cmp11, label %for.body12, label %for.cond42.preheader, !llvm.loop !19
for.body44: ; preds = %for.body44, %for.cond42.preheader.new
%indvars.iv144 = phi i64 [ 0, %for.cond42.preheader.new ], [ %indvars.iv.next145.3, %for.body44 ]
%root.0138 = phi i32 [ undef, %for.cond42.preheader.new ], [ %spec.select.3, %for.body44 ]
%niter159 = phi i64 [ 0, %for.cond42.preheader.new ], [ %niter159.next.3, %for.body44 ]
%par47 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv144, i32 1
%7 = load i32, ptr %par47, align 4, !tbaa !15
%cmp48 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv144 to i32
%spec.select = select i1 %cmp48, i32 %8, i32 %root.0138
%indvars.iv.next145 = or i64 %indvars.iv144, 1
%par47.1 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next145, i32 1
%9 = load i32, ptr %par47.1, align 16, !tbaa !15
%cmp48.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next145 to i32
%spec.select.1 = select i1 %cmp48.1, i32 %10, i32 %spec.select
%indvars.iv.next145.1 = or i64 %indvars.iv144, 2
%par47.2 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next145.1, i32 1
%11 = load i32, ptr %par47.2, align 4, !tbaa !15
%cmp48.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next145.1 to i32
%spec.select.2 = select i1 %cmp48.2, i32 %12, i32 %spec.select.1
%indvars.iv.next145.2 = or i64 %indvars.iv144, 3
%par47.3 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv.next145.2, i32 1
%13 = load i32, ptr %par47.3, align 8, !tbaa !15
%cmp48.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next145.2 to i32
%spec.select.3 = select i1 %cmp48.3, i32 %14, i32 %spec.select.2
%indvars.iv.next145.3 = add nuw nsw i64 %indvars.iv144, 4
%niter159.next.3 = add i64 %niter159, 4
%niter159.ncmp.3 = icmp eq i64 %niter159.next.3, %unroll_iter158
br i1 %niter159.ncmp.3, label %for.end53.unr-lcssa, label %for.body44, !llvm.loop !20
for.end53.unr-lcssa: ; preds = %for.body44, %for.cond42.preheader
%indvars.iv144.unr = phi i64 [ 0, %for.cond42.preheader ], [ %indvars.iv.next145.3, %for.body44 ]
%root.0138.unr = phi i32 [ undef, %for.cond42.preheader ], [ %spec.select.3, %for.body44 ]
%lcmp.mod156.not = icmp eq i64 %xtraiter155, 0
br i1 %lcmp.mod156.not, label %for.end53, label %for.body44.epil
for.body44.epil: ; preds = %for.end53.unr-lcssa, %for.body44.epil
%indvars.iv144.epil = phi i64 [ %indvars.iv.next145.epil, %for.body44.epil ], [ %indvars.iv144.unr, %for.end53.unr-lcssa ]
%root.0138.epil = phi i32 [ %spec.select.epil, %for.body44.epil ], [ %root.0138.unr, %for.end53.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body44.epil ], [ 0, %for.end53.unr-lcssa ]
%par47.epil = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv144.epil, i32 1
%15 = load i32, ptr %par47.epil, align 4, !tbaa !15
%cmp48.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv144.epil to i32
%spec.select.epil = select i1 %cmp48.epil, i32 %16, i32 %root.0138.epil
%indvars.iv.next145.epil = add nuw nsw i64 %indvars.iv144.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter155
br i1 %epil.iter.cmp.not, label %for.end53, label %for.body44.epil, !llvm.loop !21
for.end53: ; preds = %for.body44.epil, %for.end53.unr-lcssa
%spec.select.lcssa = phi i32 [ %root.0138.unr, %for.end53.unr-lcssa ], [ %spec.select.epil, %for.body44.epil ]
%call54 = call i32 @dfs(i32 noundef %spec.select.lcssa, i32 noundef 0)
%17 = load i32, ptr %N, align 4, !tbaa !13
%cmp56140 = icmp sgt i32 %17, 0
br i1 %cmp56140, label %for.body57, label %for.end106
for.body57: ; preds = %for.end53, %for.inc104
%indvars.iv149 = phi i64 [ %indvars.iv.next150, %for.inc104 ], [ 0, %for.end53 ]
%arrayidx59 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149
%left60 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149, i32 3
%18 = load i32, ptr %left60, align 4, !tbaa !10
%cmp61 = icmp ne i32 %18, -1
%conv = zext i1 %cmp61 to i32
%right64 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149, i32 4
%19 = load i32, ptr %right64, align 4, !tbaa !11
%cmp65 = icmp ne i32 %19, -1
%conv66 = zext i1 %cmp65 to i32
%add = add nuw nsw i32 %conv66, %conv
%20 = load i32, ptr %arrayidx59, align 4, !tbaa !18
%par72 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149, i32 1
%21 = load i32, ptr %par72, align 4, !tbaa !15
%sib75 = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149, i32 5
%22 = load i32, ptr %sib75, align 4, !tbaa !14
%dep = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149, i32 2
%23 = load i32, ptr %dep, align 4, !tbaa !5
%height = getelementptr inbounds [200000 x %struct.Node_struct], ptr @node, i64 0, i64 %indvars.iv149, i32 6
%24 = load i32, ptr %height, align 4, !tbaa !12
%call80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20, i32 noundef %21, i32 noundef %22, i32 noundef %add, i32 noundef %23, i32 noundef %24)
%25 = load i32, ptr %par72, align 4, !tbaa !15
%cmp84 = icmp eq i32 %25, -1
br i1 %cmp84, label %for.inc104, label %if.else
if.else: ; preds = %for.body57
%26 = load i32, ptr %left60, align 4, !tbaa !10
%cmp91 = icmp eq i32 %26, -1
br i1 %cmp91, label %land.lhs.true, label %if.else100
land.lhs.true: ; preds = %if.else
%27 = load i32, ptr %right64, align 4, !tbaa !11
%cmp96 = icmp eq i32 %27, -1
br i1 %cmp96, label %for.inc104, label %if.else100
if.else100: ; preds = %land.lhs.true, %if.else
br label %for.inc104
for.inc104: ; preds = %land.lhs.true, %for.body57, %if.else100
%str.7.sink = phi ptr [ @str, %if.else100 ], [ @str.7, %for.body57 ], [ @str.6, %land.lhs.true ]
%puts131 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
%indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
%28 = load i32, ptr %N, align 4, !tbaa !13
%29 = sext i32 %28 to i64
%cmp56 = icmp slt i64 %indvars.iv.next150, %29
br i1 %cmp56, label %for.body57, label %for.end106, !llvm.loop !23
for.end106: ; preds = %for.inc104, %for.end53
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #6
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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"Node_struct", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 12}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 20}
!15 = !{!6, !7, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!6, !7, i64 0}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
!23 = distinct !{!23, !17}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char** argv){
int n;
scanf("%d",&n);
int b[n],a[n];
for(int i=0;i<n;i++){
scanf("%d",&b[i]);
}
for(int i=0;i<n;i++){
for(int j=n-i;j>0;j--){
if(j==b[j-1]){
for(int k=j;k<n;k++)b[k-1]=b[k];
a[i]=j;
j=1;
}else if(j==1){
printf("-1\n");
return 0;
}
}
}
for(int i=n-1;i>=0;i--)printf("%d\n",a[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238266/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238266/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp74 = icmp sgt i32 %3, 0
br i1 %cmp74, label %for.body, label %cleanup54
for.cond4.preheader: ; preds = %for.body
%cmp5.not80 = icmp sgt i32 %6, 0
br i1 %cmp5.not80, label %for.body7.preheader, label %cleanup54
for.body7.preheader: ; preds = %for.cond4.preheader
%5 = zext i32 %6 to i64
%wide.trip.count95 = zext i32 %6 to i64
%invariant.gep = getelementptr i32, ptr %vla, i64 -1
br label %for.body7
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
%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.cond4.preheader, !llvm.loop !9
for.body7: ; preds = %for.body7.preheader, %for.inc36
%indvars.iv91 = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next92, %for.inc36 ]
%8 = trunc i64 %indvars.iv91 to i32
%9 = sub i32 %6, %8
%10 = sext i32 %9 to i64
%11 = sub nsw i64 %5, %10
%12 = sub nsw i64 %5, %indvars.iv91
%cmp978 = icmp slt i64 %12, 1
br i1 %cmp978, label %for.inc36, label %for.body11.lr.ph
for.body11.lr.ph: ; preds = %for.body7
%arrayidx29 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv91
%13 = trunc i64 %12 to i32
br label %for.body11
for.body11: ; preds = %for.body11.lr.ph, %for.inc34
%indvar = phi i64 [ 0, %for.body11.lr.ph ], [ %indvar.next, %for.inc34 ]
%j.079 = phi i32 [ %13, %for.body11.lr.ph ], [ %dec, %for.inc34 ]
%sub12 = add nsw i32 %j.079, -1
%idxprom13 = zext i32 %sub12 to i64
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %idxprom13
%14 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp eq i32 %j.079, %14
br i1 %cmp15, label %for.cond16.preheader, label %if.else
for.cond16.preheader: ; preds = %for.body11
%cmp1776 = icmp slt i32 %j.079, %6
br i1 %cmp1776, label %for.body19.preheader, label %for.inc34.thread
for.body19.preheader: ; preds = %for.cond16.preheader
%15 = sext i32 %j.079 to i64
%16 = add i64 %indvar, %11
%min.iters.check = icmp ult i64 %16, 8
br i1 %min.iters.check, label %for.body19.preheader113, label %vector.ph
vector.ph: ; preds = %for.body19.preheader
%n.vec = and i64 %16, -8
%ind.end = add i64 %n.vec, %15
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %15
%17 = getelementptr inbounds i32, ptr %vla, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load112 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr i32, ptr %invariant.gep, i64 %offset.idx
store <4 x i32> %wide.load, ptr %19, align 4, !tbaa !5
%20 = getelementptr i32, ptr %19, i64 4
store <4 x i32> %wide.load112, ptr %20, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %16, %n.vec
br i1 %cmp.n, label %for.inc34.thread, label %for.body19.preheader113
for.body19.preheader113: ; preds = %for.body19.preheader, %middle.block
%indvars.iv87.ph = phi i64 [ %15, %for.body19.preheader ], [ %ind.end, %middle.block ]
br label %for.body19
for.inc34.thread: ; preds = %for.body19, %middle.block, %for.cond16.preheader
store i32 %j.079, ptr %arrayidx29, align 4, !tbaa !5
br label %for.inc36
for.body19: ; preds = %for.body19.preheader113, %for.body19
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body19 ], [ %indvars.iv87.ph, %for.body19.preheader113 ]
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv87
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv87
store i32 %22, ptr %gep, align 4, !tbaa !5
%indvars.iv.next88 = add nsw i64 %indvars.iv87, 1
%exitcond.not = icmp eq i64 %indvars.iv.next88, %5
br i1 %exitcond.not, label %for.inc34.thread, label %for.body19, !llvm.loop !14
if.else: ; preds = %for.body11
%cmp30 = icmp eq i32 %j.079, 1
br i1 %cmp30, label %if.then31, label %for.inc34
if.then31: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup54
for.inc34: ; preds = %if.else
%dec = add nsw i32 %j.079, -1
%cmp9 = icmp slt i32 %j.079, 2
%indvar.next = add i64 %indvar, 1
br i1 %cmp9, label %for.inc36, label %for.body11, !llvm.loop !15
for.inc36: ; preds = %for.inc34, %for.inc34.thread, %for.body7
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond96.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count95
br i1 %exitcond96.not, label %for.end40, label %for.body7, !llvm.loop !16
for.end40: ; preds = %for.inc36
br i1 %cmp5.not80, label %for.body46.preheader, label %cleanup54
for.body46.preheader: ; preds = %for.end40
%23 = zext i32 %6 to i64
br label %for.body46
for.body46: ; preds = %for.body46.preheader, %for.body46
%indvars.iv97 = phi i64 [ %23, %for.body46.preheader ], [ %indvars.iv.next98, %for.body46 ]
%indvars.iv.next98 = add nsw i64 %indvars.iv97, -1
%idxprom47 = and i64 %indvars.iv.next98, 4294967295
%arrayidx48 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom47
%24 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%cmp44 = icmp ugt i64 %indvars.iv97, 1
br i1 %cmp44, label %for.body46, label %cleanup54, !llvm.loop !17
cleanup54: ; preds = %for.body46, %entry, %for.cond4.preheader, %for.end40, %if.then31
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: 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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int N, i, j, k;
scanf("%d", &N);
int *a = (int *)malloc(sizeof(int) * N);
int *b = (int *)malloc(sizeof(int) * N);
for(i = 0; i < N; i++){
scanf("%d", &b[i]);
b[i]--;
}
for(i = 0; i < N; i++){
if(b[i] > i){
printf("-1\n");
return 0;
}
}
int *ans = (int *)malloc(sizeof(int) * N);
for(i = 0; i < N; i++){
ans[i] = -1;
}
for(i = N - 1; i >= 0; i--){
for(j = 0, k = 0; ; j++){
if(ans[j] == -1){
k++;
}
if(k > b[i]){
ans[j] = b[i];
break;
}
}
}
for(i = 0; i < N; i++){
printf("%d\n", ans[i] + 1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238309/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238309/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = 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) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call4 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp106 = icmp sgt i32 %0, 0
br i1 %cmp106, label %for.body, label %cleanup
for.cond9.preheader: ; preds = %for.body
%cmp10108 = icmp sgt i32 %2, 0
br i1 %cmp10108, label %for.body12.preheader, label %cleanup
for.body12.preheader: ; preds = %for.cond9.preheader
%wide.trip.count = zext i32 %2 to i64
br label %for.body12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, 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.cond9.preheader, !llvm.loop !9
for.cond9: ; preds = %for.body12
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.body12, !llvm.loop !11
for.body12: ; preds = %for.body12.preheader, %for.cond9
%indvars.iv118 = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next119, %for.cond9 ]
%arrayidx14 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv118
%4 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp15 = icmp slt i64 %indvars.iv118, %5
br i1 %cmp15, label %if.then, label %for.cond9
if.then: ; preds = %for.body12
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
for.end20: ; preds = %for.cond9
%conv21 = sext i32 %2 to i64
%mul22 = shl nsw i64 %conv21, 2
%call23 = call noalias ptr @malloc(i64 noundef %mul22) #7
br i1 %cmp10108, label %for.cond37.preheader.preheader, label %cleanup
for.cond37.preheader.preheader: ; preds = %for.end20
%6 = zext i32 %2 to i64
%7 = shl nuw nsw i64 %6, 2
call void @llvm.memset.p0.i64(ptr align 4 %call23, i8 -1, i64 %7, i1 false), !tbaa !5
%8 = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond37.preheader.prol.loopexit, label %for.cond37.preheader.prol
for.cond37.preheader.prol: ; preds = %for.cond37.preheader.preheader
%indvars.iv.next128.prol = add nsw i64 %8, -1
%idxprom45.prol = and i64 %indvars.iv.next128.prol, 4294967295
%arrayidx46.prol = getelementptr inbounds i32, ptr %call4, i64 %idxprom45.prol
%9 = load i32, ptr %arrayidx46.prol, align 4, !tbaa !5
br label %for.cond37.prol
for.cond37.prol: ; preds = %for.cond37.prol, %for.cond37.preheader.prol
%indvars.iv124.prol = phi i64 [ %indvars.iv.next125.prol, %for.cond37.prol ], [ 0, %for.cond37.preheader.prol ]
%k.0.prol = phi i32 [ %spec.select.prol, %for.cond37.prol ], [ 0, %for.cond37.preheader.prol ]
%arrayidx39.prol = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv124.prol
%10 = load i32, ptr %arrayidx39.prol, align 4, !tbaa !5
%cmp40.prol = icmp eq i32 %10, -1
%inc43.prol = zext i1 %cmp40.prol to i32
%spec.select.prol = add nuw nsw i32 %k.0.prol, %inc43.prol
%cmp47.prol = icmp sgt i32 %spec.select.prol, %9
%indvars.iv.next125.prol = add nuw i64 %indvars.iv124.prol, 1
br i1 %cmp47.prol, label %if.then49.prol, label %for.cond37.prol
if.then49.prol: ; preds = %for.cond37.prol
%arrayidx39.le.prol = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv124.prol
store i32 %9, ptr %arrayidx39.le.prol, align 4, !tbaa !5
br label %for.cond37.preheader.prol.loopexit
for.cond37.preheader.prol.loopexit: ; preds = %if.then49.prol, %for.cond37.preheader.preheader
%indvars.iv127.unr = phi i64 [ %8, %for.cond37.preheader.preheader ], [ %indvars.iv.next128.prol, %if.then49.prol ]
%11 = icmp eq i32 %2, 1
br i1 %11, label %for.cond61.preheader, label %for.cond37.preheader
for.cond37.preheader: ; preds = %for.cond37.preheader.prol.loopexit, %if.then49.1
%indvars.iv127 = phi i64 [ %indvars.iv.next128.1, %if.then49.1 ], [ %indvars.iv127.unr, %for.cond37.preheader.prol.loopexit ]
%indvars.iv.next128 = add i64 %indvars.iv127, 4294967295
%idxprom45 = and i64 %indvars.iv.next128, 4294967295
%arrayidx46 = getelementptr inbounds i32, ptr %call4, i64 %idxprom45
%12 = load i32, ptr %arrayidx46, align 4, !tbaa !5
br label %for.cond37
for.cond61.preheader: ; preds = %if.then49.1, %for.cond37.preheader.prol.loopexit
br i1 %cmp10108, label %for.body64, label %cleanup
for.cond37: ; preds = %for.cond37, %for.cond37.preheader
%indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.cond37 ], [ 0, %for.cond37.preheader ]
%k.0 = phi i32 [ %spec.select, %for.cond37 ], [ 0, %for.cond37.preheader ]
%arrayidx39 = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv124
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp40 = icmp eq i32 %13, -1
%inc43 = zext i1 %cmp40 to i32
%spec.select = add nuw nsw i32 %k.0, %inc43
%cmp47 = icmp sgt i32 %spec.select, %12
%indvars.iv.next125 = add nuw i64 %indvars.iv124, 1
br i1 %cmp47, label %if.then49, label %for.cond37
if.then49: ; preds = %for.cond37
%arrayidx39.le = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv124
store i32 %12, ptr %arrayidx39.le, align 4, !tbaa !5
%indvars.iv.next128.1 = add nsw i64 %indvars.iv127, -2
%idxprom45.1 = and i64 %indvars.iv.next128.1, 4294967295
%arrayidx46.1 = getelementptr inbounds i32, ptr %call4, i64 %idxprom45.1
%14 = load i32, ptr %arrayidx46.1, align 4, !tbaa !5
br label %for.cond37.1
for.cond37.1: ; preds = %for.cond37.1, %if.then49
%indvars.iv124.1 = phi i64 [ %indvars.iv.next125.1, %for.cond37.1 ], [ 0, %if.then49 ]
%k.0.1 = phi i32 [ %spec.select.1, %for.cond37.1 ], [ 0, %if.then49 ]
%arrayidx39.1 = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv124.1
%15 = load i32, ptr %arrayidx39.1, align 4, !tbaa !5
%cmp40.1 = icmp eq i32 %15, -1
%inc43.1 = zext i1 %cmp40.1 to i32
%spec.select.1 = add nuw nsw i32 %k.0.1, %inc43.1
%cmp47.1 = icmp sgt i32 %spec.select.1, %14
%indvars.iv.next125.1 = add nuw i64 %indvars.iv124.1, 1
br i1 %cmp47.1, label %if.then49.1, label %for.cond37.1
if.then49.1: ; preds = %for.cond37.1
%arrayidx39.le.1 = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv124.1
store i32 %14, ptr %arrayidx39.le.1, align 4, !tbaa !5
%cmp34.1 = icmp sgt i64 %indvars.iv127, 2
br i1 %cmp34.1, label %for.cond37.preheader, label %for.cond61.preheader, !llvm.loop !12
for.body64: ; preds = %for.cond61.preheader, %for.body64
%indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.body64 ], [ 0, %for.cond61.preheader ]
%arrayidx66 = getelementptr inbounds i32, ptr %call23, i64 %indvars.iv130
%16 = load i32, ptr %arrayidx66, align 4, !tbaa !5
%add = add nsw i32 %16, 1
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%17 = load i32, ptr %N, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp62 = icmp slt i64 %indvars.iv.next131, %18
br i1 %cmp62, label %for.body64, label %cleanup, !llvm.loop !13
cleanup: ; preds = %for.body64, %for.end20, %for.cond9.preheader, %entry, %for.cond61.preheader, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define G 2019
int main(void){
int n,*x,m,*a;
scanf("%d",&n);
x = (int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++){
scanf("%d",&x[i]);
}
scanf("%d",&m);
a = (int*)malloc(m*sizeof(int));
for(int i=0;i<m;i++){
scanf("%d",&a[i]);
a[i]--;
}
for(int i=0;i<m;i++){
if(x[a[i]]==G){
}else if((x[a[i]]+1) != x[a[i]+1]){
x[a[i]]++;
}
}
for(int i=0;i<n;i++){
printf("%d\n",x[i]);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238352/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238352/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) #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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #5
%cmp89 = icmp sgt i32 %0, 0
br i1 %cmp89, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%conv5 = sext i32 %1 to i64
%mul6 = shl nsw i64 %conv5, 2
%call7 = call noalias ptr @malloc(i64 noundef %mul6) #5
%cmp1091 = icmp sgt i32 %1, 0
br i1 %cmp1091, label %for.body13, label %for.cond56.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond.cleanup, !llvm.loop !9
for.cond23.preheader: ; preds = %for.body13
%cmp2493 = icmp sgt i32 %5, 0
br i1 %cmp2493, label %for.body27.preheader, label %for.cond56.preheader
for.body27.preheader: ; preds = %for.cond23.preheader
%wide.trip.count = zext i32 %5 to i64
br label %for.body27
for.body13: ; preds = %for.cond.cleanup, %for.body13
%indvars.iv99 = phi i64 [ %indvars.iv.next100, %for.body13 ], [ 0, %for.cond.cleanup ]
%arrayidx15 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv99
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx15)
%4 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %arrayidx15, align 4, !tbaa !5
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%5 = load i32, ptr %m, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp10 = icmp slt i64 %indvars.iv.next100, %6
br i1 %cmp10, label %for.body13, label %for.cond23.preheader, !llvm.loop !11
for.cond56.preheader: ; preds = %for.inc52, %for.cond.cleanup, %for.cond23.preheader
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp5795 = icmp sgt i32 %7, 0
br i1 %cmp5795, label %for.body60, label %for.cond.cleanup59
for.body27: ; preds = %for.body27.preheader, %for.inc52
%indvars.iv102 = phi i64 [ 0, %for.body27.preheader ], [ %indvars.iv.next103, %for.inc52 ]
%arrayidx29 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv102
%8 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%idxprom30 = sext i32 %8 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call1, i64 %idxprom30
%9 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%cmp32 = icmp eq i32 %9, 2019
br i1 %cmp32, label %for.inc52, label %if.else
if.else: ; preds = %for.body27
%add = add nsw i32 %9, 1
%add40 = add nsw i32 %8, 1
%idxprom41 = sext i32 %add40 to i64
%arrayidx42 = getelementptr inbounds i32, ptr %call1, i64 %idxprom41
%10 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%cmp43.not = icmp eq i32 %add, %10
br i1 %cmp43.not, label %for.inc52, label %if.then45
if.then45: ; preds = %if.else
store i32 %add, ptr %arrayidx31, align 4, !tbaa !5
br label %for.inc52
for.inc52: ; preds = %for.body27, %if.then45, %if.else
%indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
%exitcond.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count
br i1 %exitcond.not, label %for.cond56.preheader, label %for.body27, !llvm.loop !12
for.cond.cleanup59: ; preds = %for.body60, %for.cond56.preheader
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.body60: ; preds = %for.cond56.preheader, %for.body60
%indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.body60 ], [ 0, %for.cond56.preheader ]
%arrayidx62 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv105
%11 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
%indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp57 = icmp slt i64 %indvars.iv.next106, %13
br i1 %cmp57, label %for.body60, label %for.cond.cleanup59, !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 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
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 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(){
int i, j, tmp, n[5];
for(i = 0; i < 5; i++) scanf("%d", &n[i]);
for(i = 0; i < 4; i++)
for(j = 0; j < 4; j++)
if(n[j] < n[j + 1]){
tmp = n[j];
n[j] = n[j + 1];
n[j + 1] = tmp;
}
printf("%d", n[0]);
for(i = 1; i < 5; i++) printf(" %d", n[i]);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238402/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238402/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%0 = load i32, ptr %n, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc22
if.then: ; preds = %entry
store i32 %1, ptr %n, align 16, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22
for.inc22: ; preds = %entry, %if.then
%2 = phi i32 [ %0, %entry ], [ %1, %if.then ]
%3 = phi i32 [ %1, %entry ], [ %0, %if.then ]
%4 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.1 = icmp slt i32 %3, %4
br i1 %cmp11.1, label %if.then.1, label %for.inc22.1
if.then.1: ; preds = %for.inc22
store i32 %4, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %3, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.1
for.inc22.1: ; preds = %if.then.1, %for.inc22
%5 = phi i32 [ %4, %if.then.1 ], [ %3, %for.inc22 ]
%6 = phi i32 [ %3, %if.then.1 ], [ %4, %for.inc22 ]
%7 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.2 = icmp slt i32 %6, %7
br i1 %cmp11.2, label %if.then.2, label %for.inc22.2
if.then.2: ; preds = %for.inc22.1
store i32 %7, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %6, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.2
for.inc22.2: ; preds = %if.then.2, %for.inc22.1
%8 = phi i32 [ %7, %if.then.2 ], [ %6, %for.inc22.1 ]
%9 = phi i32 [ %6, %if.then.2 ], [ %7, %for.inc22.1 ]
%10 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.3 = icmp slt i32 %9, %10
br i1 %cmp11.3, label %if.then.3, label %for.inc22.3
if.then.3: ; preds = %for.inc22.2
store i32 %10, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %9, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc22.3
for.inc22.3: ; preds = %if.then.3, %for.inc22.2
%11 = phi i32 [ %9, %if.then.3 ], [ %10, %for.inc22.2 ]
%12 = phi i32 [ %10, %if.then.3 ], [ %9, %for.inc22.2 ]
%cmp11.162 = icmp slt i32 %2, %5
br i1 %cmp11.162, label %if.then.163, label %for.inc22.164
if.then.163: ; preds = %for.inc22.3
store i32 %5, ptr %n, align 16, !tbaa !5
store i32 %2, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.164
for.inc22.164: ; preds = %if.then.163, %for.inc22.3
%13 = phi i32 [ %5, %if.then.163 ], [ %2, %for.inc22.3 ]
%14 = phi i32 [ %2, %if.then.163 ], [ %5, %for.inc22.3 ]
%cmp11.1.1 = icmp slt i32 %14, %8
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc22.1.1
if.then.1.1: ; preds = %for.inc22.164
store i32 %8, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %14, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.1.1
for.inc22.1.1: ; preds = %if.then.1.1, %for.inc22.164
%15 = phi i32 [ %8, %if.then.1.1 ], [ %14, %for.inc22.164 ]
%16 = phi i32 [ %14, %if.then.1.1 ], [ %8, %for.inc22.164 ]
%cmp11.2.1 = icmp slt i32 %16, %12
br i1 %cmp11.2.1, label %if.then.2.1, label %for.inc22.2.1
if.then.2.1: ; preds = %for.inc22.1.1
store i32 %12, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %16, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.2.1
for.inc22.2.1: ; preds = %if.then.2.1, %for.inc22.1.1
%17 = phi i32 [ %12, %if.then.2.1 ], [ %16, %for.inc22.1.1 ]
%18 = phi i32 [ %16, %if.then.2.1 ], [ %12, %for.inc22.1.1 ]
%cmp11.3.1 = icmp slt i32 %18, %11
br i1 %cmp11.3.1, label %if.then.3.1, label %for.inc22.3.1
if.then.3.1: ; preds = %for.inc22.2.1
store i32 %11, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %18, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc22.3.1
for.inc22.3.1: ; preds = %if.then.3.1, %for.inc22.2.1
%19 = phi i32 [ %18, %if.then.3.1 ], [ %11, %for.inc22.2.1 ]
%20 = phi i32 [ %11, %if.then.3.1 ], [ %18, %for.inc22.2.1 ]
%cmp11.266 = icmp slt i32 %13, %15
br i1 %cmp11.266, label %if.then.267, label %for.inc22.268
if.then.267: ; preds = %for.inc22.3.1
store i32 %15, ptr %n, align 16, !tbaa !5
store i32 %13, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.268
for.inc22.268: ; preds = %if.then.267, %for.inc22.3.1
%21 = phi i32 [ %15, %if.then.267 ], [ %13, %for.inc22.3.1 ]
%22 = phi i32 [ %13, %if.then.267 ], [ %15, %for.inc22.3.1 ]
%cmp11.1.2 = icmp slt i32 %22, %17
br i1 %cmp11.1.2, label %if.then.1.2, label %for.inc22.1.2
if.then.1.2: ; preds = %for.inc22.268
store i32 %17, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %22, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.1.2
for.inc22.1.2: ; preds = %if.then.1.2, %for.inc22.268
%23 = phi i32 [ %17, %if.then.1.2 ], [ %22, %for.inc22.268 ]
%24 = phi i32 [ %22, %if.then.1.2 ], [ %17, %for.inc22.268 ]
%cmp11.2.2 = icmp slt i32 %24, %20
br i1 %cmp11.2.2, label %if.then.2.2, label %for.inc22.2.2
if.then.2.2: ; preds = %for.inc22.1.2
store i32 %20, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %24, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.2.2
for.inc22.2.2: ; preds = %if.then.2.2, %for.inc22.1.2
%25 = phi i32 [ %20, %if.then.2.2 ], [ %24, %for.inc22.1.2 ]
%26 = phi i32 [ %24, %if.then.2.2 ], [ %20, %for.inc22.1.2 ]
%cmp11.3.2 = icmp slt i32 %26, %19
br i1 %cmp11.3.2, label %if.then.3.2, label %for.inc22.3.2
if.then.3.2: ; preds = %for.inc22.2.2
store i32 %19, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %26, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc22.3.2
for.inc22.3.2: ; preds = %if.then.3.2, %for.inc22.2.2
%27 = phi i32 [ %26, %if.then.3.2 ], [ %19, %for.inc22.2.2 ]
%28 = phi i32 [ %19, %if.then.3.2 ], [ %26, %for.inc22.2.2 ]
%cmp11.370 = icmp slt i32 %21, %23
br i1 %cmp11.370, label %if.then.371, label %for.inc22.372
if.then.371: ; preds = %for.inc22.3.2
store i32 %23, ptr %n, align 16, !tbaa !5
store i32 %21, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.372
for.inc22.372: ; preds = %if.then.371, %for.inc22.3.2
%29 = phi i32 [ %23, %if.then.371 ], [ %21, %for.inc22.3.2 ]
%30 = phi i32 [ %21, %if.then.371 ], [ %23, %for.inc22.3.2 ]
%cmp11.1.3 = icmp slt i32 %30, %25
br i1 %cmp11.1.3, label %if.then.1.3, label %for.inc22.1.3
if.then.1.3: ; preds = %for.inc22.372
store i32 %25, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %30, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.1.3
for.inc22.1.3: ; preds = %if.then.1.3, %for.inc22.372
%31 = phi i32 [ %30, %if.then.1.3 ], [ %25, %for.inc22.372 ]
%cmp11.2.3 = icmp slt i32 %31, %28
br i1 %cmp11.2.3, label %if.then.2.3, label %for.inc22.2.3
if.then.2.3: ; preds = %for.inc22.1.3
store i32 %28, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %31, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.2.3
for.inc22.2.3: ; preds = %if.then.2.3, %for.inc22.1.3
%32 = phi i32 [ %31, %if.then.2.3 ], [ %28, %for.inc22.1.3 ]
%cmp11.3.3 = icmp slt i32 %32, %27
br i1 %cmp11.3.3, label %if.then.3.3, label %for.inc22.3.3
if.then.3.3: ; preds = %for.inc22.2.3
store i32 %27, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %32, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc22.3.3
for.inc22.3.3: ; preds = %if.then.3.3, %for.inc22.2.3
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %29)
%33 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %33)
%34 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%call35.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34)
%35 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%call35.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %35)
%36 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%call35.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %36)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 20, 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,i,j;
int data[6];
for(i=0;i<5;i++){
scanf("%d",&data[i]);
}
for(i=0;i<4;i++){
for(j=0;j<4-i;j++){
if(data[j]<data[j+1]){
int temp;
temp=data[j];
data[j]=data[j+1];
data[j+1]=temp;
}
}
}
for(i=0;i<5;i++){
printf("%d",data[i]);
if(i==4){
printf("\n");
} else{
printf(" ");
}
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238453/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 {
for.body6.preheader:
%data = alloca [6 x i32], align 16
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %data) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%arrayidx.1 = getelementptr inbounds [6 x i32], ptr %data, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [6 x i32], ptr %data, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [6 x i32], ptr %data, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [6 x i32], ptr %data, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%0 = load i32, ptr %data, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc22
if.then: ; preds = %for.body6.preheader
store i32 %1, ptr %data, align 16, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22
for.inc22: ; preds = %for.body6.preheader, %if.then
%2 = phi i32 [ %1, %for.body6.preheader ], [ %0, %if.then ]
%3 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.174 = icmp slt i32 %2, %3
br i1 %cmp11.174, label %if.then.176, label %for.inc22.177
if.then.176: ; preds = %for.inc22
store i32 %3, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %2, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.177
for.inc22.177: ; preds = %if.then.176, %for.inc22
%4 = phi i32 [ %2, %if.then.176 ], [ %3, %for.inc22 ]
%5 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.279 = icmp slt i32 %4, %5
br i1 %cmp11.279, label %if.then.281, label %for.inc22.282
if.then.281: ; preds = %for.inc22.177
store i32 %5, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %4, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.282
for.inc22.282: ; preds = %if.then.281, %for.inc22.177
%6 = phi i32 [ %4, %if.then.281 ], [ %5, %for.inc22.177 ]
%7 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.384 = icmp slt i32 %6, %7
br i1 %cmp11.384, label %if.then.386, label %for.body6.preheader.1
if.then.386: ; preds = %for.inc22.282
store i32 %7, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %6, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.preheader.1
for.body6.preheader.1: ; preds = %if.then.386, %for.inc22.282
%8 = load i32, ptr %data, align 16, !tbaa !5
%9 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11.1 = icmp slt i32 %8, %9
br i1 %cmp11.1, label %if.then.1, label %for.inc22.1
if.then.1: ; preds = %for.body6.preheader.1
store i32 %9, ptr %data, align 16, !tbaa !5
store i32 %8, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.1
for.inc22.1: ; preds = %if.then.1, %for.body6.preheader.1
%10 = phi i32 [ %8, %if.then.1 ], [ %9, %for.body6.preheader.1 ]
%11 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.1.1 = icmp slt i32 %10, %11
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc22.1.1
if.then.1.1: ; preds = %for.inc22.1
store i32 %11, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %10, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.1.1
for.inc22.1.1: ; preds = %if.then.1.1, %for.inc22.1
%12 = phi i32 [ %10, %if.then.1.1 ], [ %11, %for.inc22.1 ]
%13 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.1.2 = icmp slt i32 %12, %13
br i1 %cmp11.1.2, label %if.then.1.2, label %for.body6.preheader.2
if.then.1.2: ; preds = %for.inc22.1.1
store i32 %13, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %12, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.body6.preheader.2
for.body6.preheader.2: ; preds = %if.then.1.2, %for.inc22.1.1
%14 = load i32, ptr %data, align 16, !tbaa !5
%15 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11.2 = icmp slt i32 %14, %15
br i1 %cmp11.2, label %if.then.2, label %for.inc22.2
if.then.2: ; preds = %for.body6.preheader.2
store i32 %15, ptr %data, align 16, !tbaa !5
store i32 %14, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.2
for.inc22.2: ; preds = %if.then.2, %for.body6.preheader.2
%16 = phi i32 [ %14, %if.then.2 ], [ %15, %for.body6.preheader.2 ]
%17 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.2.1 = icmp slt i32 %16, %17
br i1 %cmp11.2.1, label %if.then.2.1, label %for.body6.preheader.3
if.then.2.1: ; preds = %for.inc22.2
store i32 %17, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %16, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.body6.preheader.3
for.body6.preheader.3: ; preds = %if.then.2.1, %for.inc22.2
%18 = load i32, ptr %data, align 16, !tbaa !5
%19 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11.3 = icmp slt i32 %18, %19
br i1 %cmp11.3, label %if.then.3, label %for.inc39.4
if.then.3: ; preds = %for.body6.preheader.3
store i32 %19, ptr %data, align 16, !tbaa !5
store i32 %18, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc39.4
for.inc39.4: ; preds = %for.body6.preheader.3, %if.then.3
%20 = phi i32 [ %19, %if.then.3 ], [ %18, %for.body6.preheader.3 ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20)
%putchar = call i32 @putchar(i32 32)
%.pre89 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%call33.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre89)
%putchar.1 = call i32 @putchar(i32 32)
%.pre90 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%call33.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre90)
%putchar.2 = call i32 @putchar(i32 32)
%.pre91 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%call33.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre91)
%putchar.3 = call i32 @putchar(i32 32)
%.pre92 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%call33.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre92)
%putchar59.4 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %data) #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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int arr[5];
int i,j;
int temp;
for(i=0;i<5;i++)scanf("%d",&arr[i]);
for(i=4;i>0;i--) {
for(j=0;j<i;j++) {
if(arr[j]<arr[j+1]) {
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
printf("%d %d %d %d %d\n",arr[0],arr[1],arr[2],arr[3],arr[4]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238510/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238510/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 [16 x i8] c"%d %d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%arr = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %arr) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arr)
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%0 = load i32, ptr %arr, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc22
if.then: ; preds = %entry
store i32 %1, ptr %arr, align 16, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22
for.inc22: ; preds = %entry, %if.then
%2 = phi i32 [ %0, %entry ], [ %1, %if.then ]
%3 = phi i32 [ %1, %entry ], [ %0, %if.then ]
%4 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.155 = icmp slt i32 %3, %4
br i1 %cmp11.155, label %if.then.157, label %for.inc22.158
if.then.157: ; preds = %for.inc22
store i32 %4, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %3, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.158
for.inc22.158: ; preds = %if.then.157, %for.inc22
%5 = phi i32 [ %4, %if.then.157 ], [ %3, %for.inc22 ]
%6 = phi i32 [ %3, %if.then.157 ], [ %4, %for.inc22 ]
%7 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.260 = icmp slt i32 %6, %7
br i1 %cmp11.260, label %if.then.262, label %for.inc22.263
if.then.262: ; preds = %for.inc22.158
store i32 %7, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %6, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.263
for.inc22.263: ; preds = %if.then.262, %for.inc22.158
%8 = phi i32 [ %7, %if.then.262 ], [ %6, %for.inc22.158 ]
%9 = phi i32 [ %6, %if.then.262 ], [ %7, %for.inc22.158 ]
%10 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.365 = icmp slt i32 %9, %10
br i1 %cmp11.365, label %if.then.367, label %for.inc22.368
if.then.367: ; preds = %for.inc22.263
store i32 %10, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %9, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc22.368
for.inc22.368: ; preds = %if.then.367, %for.inc22.263
%11 = phi i32 [ %9, %if.then.367 ], [ %10, %for.inc22.263 ]
%12 = phi i32 [ %10, %if.then.367 ], [ %9, %for.inc22.263 ]
%cmp11.1 = icmp slt i32 %2, %5
br i1 %cmp11.1, label %if.then.1, label %for.inc22.1
if.then.1: ; preds = %for.inc22.368
store i32 %5, ptr %arr, align 16, !tbaa !5
store i32 %2, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.1
for.inc22.1: ; preds = %if.then.1, %for.inc22.368
%13 = phi i32 [ %5, %if.then.1 ], [ %2, %for.inc22.368 ]
%14 = phi i32 [ %2, %if.then.1 ], [ %5, %for.inc22.368 ]
%cmp11.1.1 = icmp slt i32 %14, %8
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc22.1.1
if.then.1.1: ; preds = %for.inc22.1
store i32 %8, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %14, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.1.1
for.inc22.1.1: ; preds = %if.then.1.1, %for.inc22.1
%15 = phi i32 [ %8, %if.then.1.1 ], [ %14, %for.inc22.1 ]
%16 = phi i32 [ %14, %if.then.1.1 ], [ %8, %for.inc22.1 ]
%cmp11.1.2 = icmp slt i32 %16, %12
br i1 %cmp11.1.2, label %if.then.1.2, label %for.inc22.1.2
if.then.1.2: ; preds = %for.inc22.1.1
store i32 %12, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %16, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc22.1.2
for.inc22.1.2: ; preds = %if.then.1.2, %for.inc22.1.1
%17 = phi i32 [ %16, %if.then.1.2 ], [ %12, %for.inc22.1.1 ]
%18 = phi i32 [ %12, %if.then.1.2 ], [ %16, %for.inc22.1.1 ]
%cmp11.2 = icmp slt i32 %13, %15
br i1 %cmp11.2, label %if.then.2, label %for.inc22.2
if.then.2: ; preds = %for.inc22.1.2
store i32 %15, ptr %arr, align 16, !tbaa !5
store i32 %13, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.2
for.inc22.2: ; preds = %if.then.2, %for.inc22.1.2
%19 = phi i32 [ %15, %if.then.2 ], [ %13, %for.inc22.1.2 ]
%20 = phi i32 [ %13, %if.then.2 ], [ %15, %for.inc22.1.2 ]
%cmp11.2.1 = icmp slt i32 %20, %18
br i1 %cmp11.2.1, label %if.then.2.1, label %for.inc22.2.1
if.then.2.1: ; preds = %for.inc22.2
store i32 %18, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %20, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc22.2.1
for.inc22.2.1: ; preds = %if.then.2.1, %for.inc22.2
%21 = phi i32 [ %20, %if.then.2.1 ], [ %18, %for.inc22.2 ]
%22 = phi i32 [ %18, %if.then.2.1 ], [ %20, %for.inc22.2 ]
%cmp11.3 = icmp slt i32 %19, %22
br i1 %cmp11.3, label %if.then.3, label %for.inc22.3
if.then.3: ; preds = %for.inc22.2.1
store i32 %22, ptr %arr, align 16, !tbaa !5
store i32 %19, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc22.3
for.inc22.3: ; preds = %if.then.3, %for.inc22.2.1
%23 = phi i32 [ %19, %if.then.3 ], [ %22, %for.inc22.2.1 ]
%24 = phi i32 [ %22, %if.then.3 ], [ %19, %for.inc22.2.1 ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24, i32 noundef %23, i32 noundef %21, i32 noundef %17, i32 noundef %11)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %arr) #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 a[5];
scanf("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);
int i,j;
for(i=0;i<5;i++){
for(j=0;j<4;j++){
if(a[j]<a[j+1]){
int x=a[j+1];
a[j+1]=a[j];
a[j]=x;
}
}
}
printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238619/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238619/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 [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [16 x i8] c"%d %d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #3
%arrayidx1 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4)
%0 = load i32, ptr %a, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc
if.then: ; preds = %entry
store i32 %0, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %a, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %entry, %if.then
%2 = phi i32 [ %0, %entry ], [ %1, %if.then ]
%3 = phi i32 [ %1, %entry ], [ %0, %if.then ]
%4 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%cmp11.1 = icmp slt i32 %3, %4
br i1 %cmp11.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
store i32 %3, ptr %arrayidx2, align 8, !tbaa !5
store i32 %4, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%5 = phi i32 [ %4, %if.then.1 ], [ %3, %for.inc ]
%6 = phi i32 [ %3, %if.then.1 ], [ %4, %for.inc ]
%7 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp11.2 = icmp slt i32 %6, %7
br i1 %cmp11.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
store i32 %6, ptr %arrayidx3, align 4, !tbaa !5
store i32 %7, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%8 = phi i32 [ %7, %if.then.2 ], [ %6, %for.inc.1 ]
%9 = phi i32 [ %6, %if.then.2 ], [ %7, %for.inc.1 ]
%10 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%cmp11.3 = icmp slt i32 %9, %10
br i1 %cmp11.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
store i32 %9, ptr %arrayidx4, align 16, !tbaa !5
store i32 %10, ptr %arrayidx3, align 4, !tbaa !5
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%11 = phi i32 [ %9, %if.then.3 ], [ %10, %for.inc.2 ]
%12 = phi i32 [ %10, %if.then.3 ], [ %9, %for.inc.2 ]
%cmp11.144 = icmp slt i32 %2, %5
br i1 %cmp11.144, label %if.then.145, label %for.inc.146
if.then.145: ; preds = %for.inc.3
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
store i32 %5, ptr %a, align 16, !tbaa !5
br label %for.inc.146
for.inc.146: ; preds = %if.then.145, %for.inc.3
%13 = phi i32 [ %5, %if.then.145 ], [ %2, %for.inc.3 ]
%14 = phi i32 [ %2, %if.then.145 ], [ %5, %for.inc.3 ]
%cmp11.1.1 = icmp slt i32 %14, %8
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc.1.1
if.then.1.1: ; preds = %for.inc.146
store i32 %14, ptr %arrayidx2, align 8, !tbaa !5
store i32 %8, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.1.1
for.inc.1.1: ; preds = %if.then.1.1, %for.inc.146
%15 = phi i32 [ %8, %if.then.1.1 ], [ %14, %for.inc.146 ]
%16 = phi i32 [ %14, %if.then.1.1 ], [ %8, %for.inc.146 ]
%cmp11.2.1 = icmp slt i32 %16, %12
br i1 %cmp11.2.1, label %if.then.2.1, label %for.inc.2.1
if.then.2.1: ; preds = %for.inc.1.1
store i32 %16, ptr %arrayidx3, align 4, !tbaa !5
store i32 %12, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc.2.1
for.inc.2.1: ; preds = %if.then.2.1, %for.inc.1.1
%17 = phi i32 [ %12, %if.then.2.1 ], [ %16, %for.inc.1.1 ]
%18 = phi i32 [ %16, %if.then.2.1 ], [ %12, %for.inc.1.1 ]
%cmp11.3.1 = icmp slt i32 %18, %11
br i1 %cmp11.3.1, label %if.then.3.1, label %for.inc.3.1
if.then.3.1: ; preds = %for.inc.2.1
store i32 %18, ptr %arrayidx4, align 16, !tbaa !5
store i32 %11, ptr %arrayidx3, align 4, !tbaa !5
br label %for.inc.3.1
for.inc.3.1: ; preds = %if.then.3.1, %for.inc.2.1
%19 = phi i32 [ %18, %if.then.3.1 ], [ %11, %for.inc.2.1 ]
%20 = phi i32 [ %11, %if.then.3.1 ], [ %18, %for.inc.2.1 ]
%cmp11.248 = icmp slt i32 %13, %15
br i1 %cmp11.248, label %if.then.249, label %for.inc.250
if.then.249: ; preds = %for.inc.3.1
store i32 %13, ptr %arrayidx1, align 4, !tbaa !5
store i32 %15, ptr %a, align 16, !tbaa !5
br label %for.inc.250
for.inc.250: ; preds = %if.then.249, %for.inc.3.1
%21 = phi i32 [ %15, %if.then.249 ], [ %13, %for.inc.3.1 ]
%22 = phi i32 [ %13, %if.then.249 ], [ %15, %for.inc.3.1 ]
%cmp11.1.2 = icmp slt i32 %22, %17
br i1 %cmp11.1.2, label %if.then.1.2, label %for.inc.1.2
if.then.1.2: ; preds = %for.inc.250
store i32 %22, ptr %arrayidx2, align 8, !tbaa !5
store i32 %17, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.1.2
for.inc.1.2: ; preds = %if.then.1.2, %for.inc.250
%23 = phi i32 [ %17, %if.then.1.2 ], [ %22, %for.inc.250 ]
%24 = phi i32 [ %22, %if.then.1.2 ], [ %17, %for.inc.250 ]
%cmp11.2.2 = icmp slt i32 %24, %20
br i1 %cmp11.2.2, label %if.then.2.2, label %for.inc.2.2
if.then.2.2: ; preds = %for.inc.1.2
store i32 %24, ptr %arrayidx3, align 4, !tbaa !5
store i32 %20, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc.2.2
for.inc.2.2: ; preds = %if.then.2.2, %for.inc.1.2
%25 = phi i32 [ %20, %if.then.2.2 ], [ %24, %for.inc.1.2 ]
%26 = phi i32 [ %24, %if.then.2.2 ], [ %20, %for.inc.1.2 ]
%cmp11.3.2 = icmp slt i32 %26, %19
br i1 %cmp11.3.2, label %if.then.3.2, label %for.inc.3.2
if.then.3.2: ; preds = %for.inc.2.2
store i32 %26, ptr %arrayidx4, align 16, !tbaa !5
store i32 %19, ptr %arrayidx3, align 4, !tbaa !5
br label %for.inc.3.2
for.inc.3.2: ; preds = %if.then.3.2, %for.inc.2.2
%27 = phi i32 [ %26, %if.then.3.2 ], [ %19, %for.inc.2.2 ]
%28 = phi i32 [ %19, %if.then.3.2 ], [ %26, %for.inc.2.2 ]
%cmp11.352 = icmp slt i32 %21, %23
br i1 %cmp11.352, label %if.then.353, label %for.inc.354
if.then.353: ; preds = %for.inc.3.2
store i32 %21, ptr %arrayidx1, align 4, !tbaa !5
store i32 %23, ptr %a, align 16, !tbaa !5
br label %for.inc.354
for.inc.354: ; preds = %if.then.353, %for.inc.3.2
%29 = phi i32 [ %23, %if.then.353 ], [ %21, %for.inc.3.2 ]
%30 = phi i32 [ %21, %if.then.353 ], [ %23, %for.inc.3.2 ]
%cmp11.1.3 = icmp slt i32 %30, %25
br i1 %cmp11.1.3, label %if.then.1.3, label %for.inc.1.3
if.then.1.3: ; preds = %for.inc.354
store i32 %30, ptr %arrayidx2, align 8, !tbaa !5
store i32 %25, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.1.3
for.inc.1.3: ; preds = %if.then.1.3, %for.inc.354
%31 = phi i32 [ %25, %if.then.1.3 ], [ %30, %for.inc.354 ]
%32 = phi i32 [ %30, %if.then.1.3 ], [ %25, %for.inc.354 ]
%cmp11.2.3 = icmp slt i32 %32, %28
br i1 %cmp11.2.3, label %if.then.2.3, label %for.inc.2.3
if.then.2.3: ; preds = %for.inc.1.3
store i32 %32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %28, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc.2.3
for.inc.2.3: ; preds = %if.then.2.3, %for.inc.1.3
%33 = phi i32 [ %28, %if.then.2.3 ], [ %32, %for.inc.1.3 ]
%34 = phi i32 [ %32, %if.then.2.3 ], [ %28, %for.inc.1.3 ]
%cmp11.3.3 = icmp slt i32 %34, %27
br i1 %cmp11.3.3, label %if.then.3.3, label %for.inc.3.3
if.then.3.3: ; preds = %for.inc.2.3
store i32 %34, ptr %arrayidx4, align 16, !tbaa !5
store i32 %27, ptr %arrayidx3, align 4, !tbaa !5
br label %for.inc.3.3
for.inc.3.3: ; preds = %if.then.3.3, %for.inc.2.3
%35 = phi i32 [ %34, %if.then.3.3 ], [ %27, %for.inc.2.3 ]
%36 = phi i32 [ %27, %if.then.3.3 ], [ %34, %for.inc.2.3 ]
%cmp11.4 = icmp slt i32 %29, %31
br i1 %cmp11.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3.3
store i32 %29, ptr %arrayidx1, align 4, !tbaa !5
store i32 %31, ptr %a, align 16, !tbaa !5
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3.3
%37 = phi i32 [ %31, %if.then.4 ], [ %29, %for.inc.3.3 ]
%38 = phi i32 [ %29, %if.then.4 ], [ %31, %for.inc.3.3 ]
%cmp11.1.4 = icmp slt i32 %38, %33
br i1 %cmp11.1.4, label %if.then.1.4, label %for.inc.1.4
if.then.1.4: ; preds = %for.inc.4
store i32 %38, ptr %arrayidx2, align 8, !tbaa !5
store i32 %33, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.1.4
for.inc.1.4: ; preds = %if.then.1.4, %for.inc.4
%39 = phi i32 [ %33, %if.then.1.4 ], [ %38, %for.inc.4 ]
%40 = phi i32 [ %38, %if.then.1.4 ], [ %33, %for.inc.4 ]
%cmp11.2.4 = icmp slt i32 %40, %36
br i1 %cmp11.2.4, label %if.then.2.4, label %for.inc.2.4
if.then.2.4: ; preds = %for.inc.1.4
store i32 %40, ptr %arrayidx3, align 4, !tbaa !5
store i32 %36, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc.2.4
for.inc.2.4: ; preds = %if.then.2.4, %for.inc.1.4
%41 = phi i32 [ %36, %if.then.2.4 ], [ %40, %for.inc.1.4 ]
%42 = phi i32 [ %40, %if.then.2.4 ], [ %36, %for.inc.1.4 ]
%cmp11.3.4 = icmp slt i32 %42, %35
br i1 %cmp11.3.4, label %if.then.3.4, label %for.inc.3.4
if.then.3.4: ; preds = %for.inc.2.4
store i32 %42, ptr %arrayidx4, align 16, !tbaa !5
store i32 %35, ptr %arrayidx3, align 4, !tbaa !5
br label %for.inc.3.4
for.inc.3.4: ; preds = %if.then.3.4, %for.inc.2.4
%43 = phi i32 [ %42, %if.then.3.4 ], [ %35, %for.inc.2.4 ]
%44 = phi i32 [ %35, %if.then.3.4 ], [ %42, %for.inc.2.4 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %37, i32 noundef %39, i32 noundef %41, i32 noundef %44, i32 noundef %43)
call void @llvm.lifetime.end.p0(i64 20, 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: 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"}
|
#include<stdio.h>
int main(){
int a[5];
int b;
int i;
int j;
for(i = 0; i < 5; i++){
scanf("%d", &a[i]);
}
for(i = 0; i < 5; i++){
for(j = i + 1; j < 5; j++){
if(a[i] < a[j]){
b = a[i];
a[i] = a[j];
a[j] = b;
}
}
}
printf("%d %d %d %d %d\n", a[0], a[1], a[2], a[3], a[4]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238662/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238662/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 [16 x i8] c"%d %d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.body6.lr.ph:
%a = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%0 = load i32, ptr %a, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc20
for.body6.lr.ph.1: ; preds = %if.then.370, %for.inc20.266
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.1 = icmp slt i32 %2, %3
br i1 %cmp11.1, label %if.then.1, label %for.inc20.1
if.then.1: ; preds = %for.body6.lr.ph.1
store i32 %3, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %2, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.body6.lr.ph.1
%4 = phi i32 [ %3, %if.then.1 ], [ %2, %for.body6.lr.ph.1 ]
%5 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.1.1 = icmp slt i32 %4, %5
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc20.1.1
if.then.1.1: ; preds = %for.inc20.1
store i32 %5, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %4, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.1.1
for.inc20.1.1: ; preds = %if.then.1.1, %for.inc20.1
%6 = phi i32 [ %5, %if.then.1.1 ], [ %4, %for.inc20.1 ]
%7 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.1.2 = icmp slt i32 %6, %7
br i1 %cmp11.1.2, label %if.then.1.2, label %for.body6.lr.ph.2
if.then.1.2: ; preds = %for.inc20.1.1
store i32 %7, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %6, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.lr.ph.2
for.body6.lr.ph.2: ; preds = %if.then.1.2, %for.inc20.1.1
%8 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%9 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.2 = icmp slt i32 %8, %9
br i1 %cmp11.2, label %if.then.2, label %for.inc20.2
if.then.2: ; preds = %for.body6.lr.ph.2
store i32 %9, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %8, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.2
for.inc20.2: ; preds = %if.then.2, %for.body6.lr.ph.2
%10 = phi i32 [ %9, %if.then.2 ], [ %8, %for.body6.lr.ph.2 ]
%11 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.2.1 = icmp slt i32 %10, %11
br i1 %cmp11.2.1, label %if.then.2.1, label %for.body6.lr.ph.3
if.then.2.1: ; preds = %for.inc20.2
store i32 %11, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %10, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.lr.ph.3
for.body6.lr.ph.3: ; preds = %if.then.2.1, %for.inc20.2
%12 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.3 = icmp slt i32 %12, %13
br i1 %cmp11.3, label %if.then.3, label %for.cond1.loopexit.4
if.then.3: ; preds = %for.body6.lr.ph.3
store i32 %13, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %12, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.cond1.loopexit.4
for.cond1.loopexit.4: ; preds = %if.then.3, %for.body6.lr.ph.3
%14 = load i32, ptr %a, align 16, !tbaa !5
%15 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%17 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%18 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14, i32 noundef %15, i32 noundef %16, i32 noundef %17, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %a) #3
ret i32 0
if.then: ; preds = %for.body6.lr.ph
store i32 %1, ptr %a, align 16, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc20
for.inc20: ; preds = %for.body6.lr.ph, %if.then
%19 = phi i32 [ %0, %for.body6.lr.ph ], [ %1, %if.then ]
%20 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.158 = icmp slt i32 %19, %20
br i1 %cmp11.158, label %if.then.160, label %for.inc20.161
if.then.160: ; preds = %for.inc20
store i32 %20, ptr %a, align 16, !tbaa !5
store i32 %19, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.161
for.inc20.161: ; preds = %if.then.160, %for.inc20
%21 = phi i32 [ %20, %if.then.160 ], [ %19, %for.inc20 ]
%22 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.263 = icmp slt i32 %21, %22
br i1 %cmp11.263, label %if.then.265, label %for.inc20.266
if.then.265: ; preds = %for.inc20.161
store i32 %22, ptr %a, align 16, !tbaa !5
store i32 %21, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.266
for.inc20.266: ; preds = %if.then.265, %for.inc20.161
%23 = phi i32 [ %22, %if.then.265 ], [ %21, %for.inc20.161 ]
%24 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.368 = icmp slt i32 %23, %24
br i1 %cmp11.368, label %if.then.370, label %for.body6.lr.ph.1
if.then.370: ; preds = %for.inc20.266
store i32 %24, ptr %a, align 16, !tbaa !5
store i32 %23, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.lr.ph.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: 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 a[5];
int i,j,tmp;
for(i=0;i<5;i++)
scanf("%d",&a[i]);
for(i=0;i<4;i++){
for(j=i+1;j<5;j++){
if(a[i]<a[j]){
tmp=a[i];
a[i]=a[j];
a[j]=tmp;
}
}
}
for(i=0;i<4;i++)
printf("%d ",a[i]);
printf("%d\n",a[4]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238705/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238705/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 {
for.body6.lr.ph:
%a = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%arrayidx.4 = getelementptr inbounds [5 x i32], ptr %a, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%0 = load i32, ptr %a, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11 = icmp slt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc20
for.body6.lr.ph.1: ; preds = %if.then.379, %for.inc20.275
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.1 = icmp slt i32 %2, %3
br i1 %cmp11.1, label %if.then.1, label %for.inc20.1
if.then.1: ; preds = %for.body6.lr.ph.1
store i32 %3, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %2, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.body6.lr.ph.1
%4 = phi i32 [ %3, %if.then.1 ], [ %2, %for.body6.lr.ph.1 ]
%5 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.1.1 = icmp slt i32 %4, %5
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc20.1.1
if.then.1.1: ; preds = %for.inc20.1
store i32 %5, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %4, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.1.1
for.inc20.1.1: ; preds = %if.then.1.1, %for.inc20.1
%6 = phi i32 [ %5, %if.then.1.1 ], [ %4, %for.inc20.1 ]
%7 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.1.2 = icmp slt i32 %6, %7
br i1 %cmp11.1.2, label %if.then.1.2, label %for.body6.lr.ph.2
if.then.1.2: ; preds = %for.inc20.1.1
store i32 %7, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %6, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.lr.ph.2
for.body6.lr.ph.2: ; preds = %if.then.1.2, %for.inc20.1.1
%8 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%9 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.2 = icmp slt i32 %8, %9
br i1 %cmp11.2, label %if.then.2, label %for.inc20.2
if.then.2: ; preds = %for.body6.lr.ph.2
store i32 %9, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %8, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.2
for.inc20.2: ; preds = %if.then.2, %for.body6.lr.ph.2
%10 = phi i32 [ %9, %if.then.2 ], [ %8, %for.body6.lr.ph.2 ]
%11 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.2.1 = icmp slt i32 %10, %11
br i1 %cmp11.2.1, label %if.then.2.1, label %for.body6.lr.ph.3
if.then.2.1: ; preds = %for.inc20.2
store i32 %11, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %10, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.lr.ph.3
for.body6.lr.ph.3: ; preds = %if.then.2.1, %for.inc20.2
%12 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.3 = icmp slt i32 %12, %13
br i1 %cmp11.3, label %if.then.3, label %for.cond1.loopexit.3
if.then.3: ; preds = %for.body6.lr.ph.3
store i32 %13, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %12, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.cond1.loopexit.3
for.cond1.loopexit.3: ; preds = %for.body6.lr.ph.3, %if.then.3
%14 = load i32, ptr %a, align 16, !tbaa !5
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%15 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%call31.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%16 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%call31.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
%17 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%call31.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17)
%18 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %a) #3
ret i32 0
if.then: ; preds = %for.body6.lr.ph
store i32 %1, ptr %a, align 16, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc20
for.inc20: ; preds = %for.body6.lr.ph, %if.then
%19 = phi i32 [ %0, %for.body6.lr.ph ], [ %1, %if.then ]
%20 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.167 = icmp slt i32 %19, %20
br i1 %cmp11.167, label %if.then.169, label %for.inc20.170
if.then.169: ; preds = %for.inc20
store i32 %20, ptr %a, align 16, !tbaa !5
store i32 %19, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.170
for.inc20.170: ; preds = %if.then.169, %for.inc20
%21 = phi i32 [ %20, %if.then.169 ], [ %19, %for.inc20 ]
%22 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.272 = icmp slt i32 %21, %22
br i1 %cmp11.272, label %if.then.274, label %for.inc20.275
if.then.274: ; preds = %for.inc20.170
store i32 %22, ptr %a, align 16, !tbaa !5
store i32 %21, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.275
for.inc20.275: ; preds = %if.then.274, %for.inc20.170
%23 = phi i32 [ %22, %if.then.274 ], [ %21, %for.inc20.170 ]
%24 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.377 = icmp slt i32 %23, %24
br i1 %cmp11.377, label %if.then.379, label %for.body6.lr.ph.1
if.then.379: ; preds = %for.inc20.275
store i32 %24, ptr %a, align 16, !tbaa !5
store i32 %23, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.body6.lr.ph.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: 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 <stdlib.h>
#include <string.h>
#define FOR(i,a,n) for(i=a;i<n;i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define INF 1000000000000000
#define MAX_V 200
#define MAX_E 10000
#define ll long long
typedef struct LIST{
int to;
ll cap;
struct LIST *rev; //逆辺のポインタ
struct LIST *next;
}Edge;
Edge *iter[MAX_V];
Edge edge[MAX_E],rev[MAX_E];
int level[MAX_V];
int que[MAX_V];
int e_size=0;
void add_edge(Edge **g,int s,int t,ll c){
edge[e_size].next=g[s]; g[s]=&edge[e_size];
rev[e_size].next=g[t]; g[t]=&rev[e_size++];
g[s]->to=t,g[s]->cap=c;
g[t]->to=s,g[t]->cap=0;
g[s]->rev=g[t]; g[t]->rev=g[s];
return;
}
void bfs(Edge **g,int s){
int front=0,rear=0,v;
Edge *e;
memset(level,-1,sizeof(level));
level[s]=0;
que[rear++]=s;
while(front!=rear){
v=que[front++];
for(e=g[v];e!=NULL;e=e->next){
if(e->cap>0&&level[e->to]<0){
level[e->to]=level[v]+1;
que[rear++]=e->to;
}
}
}
return;
}
ll dfs(int v,int t,ll f){
ll d; Edge *e;
if(v==t) return f;
for(;iter[v]!=NULL;iter[v]=iter[v]->next){
e=iter[v];
if(e->cap>0&&level[v]<level[e->to]){
d=dfs(e->to,t,MIN(f,e->cap));
if(d>0){
e->cap-=d;
e->rev->cap+=d;
return d;
}
}
}
return 0;
}
ll max_flow(Edge *g[],int s,int t){
ll flow=0,f;
while(1){
bfs(g,s);
if(level[t]<0) return flow;
memcpy(iter,g,sizeof(iter));
while((f=dfs(s,t,INF))>0) flow+=f;
}
}
Edge *g[MAX_V];
int a[101];
int main(void)
{
int n,s,t,i,j;
ll res=0;
scanf("%d",&n);
s=0,t=n+1;
FOR(i,1,n+1){
scanf("%d",a+i);
if(a[i]>0){
add_edge(g,i,t,a[i]);
res+=a[i];
}else{
add_edge(g,s,i,-a[i]);
}
for(j=2*i;j<=n;j+=i) add_edge(g,i,j,INF);
}
printf("%lld\n",res-max_flow(g,s,t));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238756/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238756/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.LIST = type { i32, i64, ptr, ptr }
@e_size = dso_local local_unnamed_addr global i32 0, align 4
@edge = dso_local global [10000 x %struct.LIST] zeroinitializer, align 16
@rev = dso_local global [10000 x %struct.LIST] zeroinitializer, align 16
@level = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16
@que = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16
@iter = dso_local local_unnamed_addr global [200 x ptr] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [101 x i32] zeroinitializer, align 16
@g = dso_local local_unnamed_addr global [200 x ptr] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @add_edge(ptr nocapture noundef %g, i32 noundef %s, i32 noundef %t, i64 noundef %c) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %s to i64
%arrayidx = getelementptr inbounds ptr, ptr %g, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%1 = load i32, ptr @e_size, align 4, !tbaa !9
%idxprom1 = sext i32 %1 to i64
%next = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1, i32 3
store ptr %0, ptr %next, align 8, !tbaa !11
%arrayidx4 = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1
store ptr %arrayidx4, ptr %arrayidx, align 8, !tbaa !5
%idxprom7 = sext i32 %t to i64
%arrayidx8 = getelementptr inbounds ptr, ptr %g, i64 %idxprom7
%2 = load ptr, ptr %arrayidx8, align 8, !tbaa !5
%next11 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1, i32 3
store ptr %2, ptr %next11, align 8, !tbaa !11
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @e_size, align 4, !tbaa !9
%arrayidx13 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1
store ptr %arrayidx13, ptr %arrayidx8, align 8, !tbaa !5
%3 = load ptr, ptr %arrayidx, align 8, !tbaa !5
store i32 %t, ptr %3, align 8, !tbaa !14
%cap = getelementptr inbounds %struct.LIST, ptr %3, i64 0, i32 1
store i64 %c, ptr %cap, align 8, !tbaa !15
store i32 %s, ptr %arrayidx13, align 16, !tbaa !14
%cap25 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1, i32 1
store i64 0, ptr %cap25, align 8, !tbaa !15
%rev = getelementptr inbounds %struct.LIST, ptr %3, i64 0, i32 2
store ptr %arrayidx13, ptr %rev, align 8, !tbaa !16
%4 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%5 = load ptr, ptr %arrayidx8, align 8, !tbaa !5
%rev34 = getelementptr inbounds %struct.LIST, ptr %5, i64 0, i32 2
store ptr %4, ptr %rev34, align 8, !tbaa !16
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @bfs(ptr nocapture noundef readonly %g, i32 noundef %s) local_unnamed_addr #1 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) @level, i8 -1, i64 800, i1 false)
%idxprom = sext i32 %s to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom
store i32 0, ptr %arrayidx, align 4, !tbaa !9
store i32 %s, ptr @que, align 16, !tbaa !9
br label %while.body
while.cond.loopexit: ; preds = %for.inc, %while.body
%rear.1.lcssa = phi i32 [ %rear.036, %while.body ], [ %rear.2, %for.inc ]
%0 = zext i32 %rear.1.lcssa to i64
%cmp.not = icmp eq i64 %indvars.iv.next, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.body: ; preds = %entry, %while.cond.loopexit
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %while.cond.loopexit ]
%rear.036 = phi i32 [ 1, %entry ], [ %rear.1.lcssa, %while.cond.loopexit ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx5 = getelementptr inbounds [200 x i32], ptr @que, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !9
%idxprom6 = sext i32 %1 to i64
%arrayidx7 = getelementptr inbounds ptr, ptr %g, i64 %idxprom6
%e.032 = load ptr, ptr %arrayidx7, align 8, !tbaa !5
%cmp8.not33 = icmp eq ptr %e.032, null
br i1 %cmp8.not33, label %while.cond.loopexit, label %for.body.lr.ph
for.body.lr.ph: ; preds = %while.body
%arrayidx14 = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom6
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%e.035 = phi ptr [ %e.032, %for.body.lr.ph ], [ %e.0, %for.inc ]
%rear.134 = phi i32 [ %rear.036, %for.body.lr.ph ], [ %rear.2, %for.inc ]
%cap = getelementptr inbounds %struct.LIST, ptr %e.035, i64 0, i32 1
%2 = load i64, ptr %cap, align 8, !tbaa !15
%cmp9 = icmp sgt i64 %2, 0
br i1 %cmp9, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%3 = load i32, ptr %e.035, align 8, !tbaa !14
%idxprom10 = sext i32 %3 to i64
%arrayidx11 = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom10
%4 = load i32, ptr %arrayidx11, align 4, !tbaa !9
%cmp12 = icmp slt i32 %4, 0
br i1 %cmp12, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = load i32, ptr %arrayidx14, align 4, !tbaa !9
%add = add nsw i32 %5, 1
store i32 %add, ptr %arrayidx11, align 4, !tbaa !9
%6 = load i32, ptr %e.035, align 8, !tbaa !14
%inc19 = add nsw i32 %rear.134, 1
%idxprom20 = sext i32 %rear.134 to i64
%arrayidx21 = getelementptr inbounds [200 x i32], ptr @que, i64 0, i64 %idxprom20
store i32 %6, ptr %arrayidx21, align 4, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%rear.2 = phi i32 [ %inc19, %if.then ], [ %rear.134, %land.lhs.true ], [ %rear.134, %for.body ]
%next = getelementptr inbounds %struct.LIST, ptr %e.035, i64 0, i32 3
%e.0 = load ptr, ptr %next, align 8, !tbaa !5
%cmp8.not = icmp eq ptr %e.0, null
br i1 %cmp8.not, label %while.cond.loopexit, label %for.body, !llvm.loop !19
while.end: ; preds = %while.cond.loopexit
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 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) #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @dfs(i32 noundef %v, i32 noundef %t, i64 noundef %f) local_unnamed_addr #4 {
entry:
%cmp = icmp eq i32 %v, %t
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%idxprom = sext i32 %v to i64
%arrayidx = getelementptr inbounds [200 x ptr], ptr @iter, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%cmp1.not45 = icmp eq ptr %0, null
br i1 %cmp1.not45, label %cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %for.cond.preheader
%arrayidx6 = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%1 = phi ptr [ %0, %for.body.lr.ph ], [ %10, %for.inc ]
%cap = getelementptr inbounds %struct.LIST, ptr %1, i64 0, i32 1
%2 = load i64, ptr %cap, align 8, !tbaa !15
%cmp4 = icmp sgt i64 %2, 0
br i1 %cmp4, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !9
%4 = load i32, ptr %1, align 8, !tbaa !14
%idxprom7 = sext i32 %4 to i64
%arrayidx8 = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom7
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !9
%cmp9 = icmp slt i32 %3, %5
br i1 %cmp9, label %if.then10, label %for.inc
if.then10: ; preds = %land.lhs.true
%f. = tail call i64 @llvm.smin.i64(i64 %2, i64 %f)
%call = tail call i64 @dfs(i32 noundef %4, i32 noundef %t, i64 noundef %f.)
%cmp15 = icmp sgt i64 %call, 0
br i1 %cmp15, label %if.then16, label %if.then10.for.inc_crit_edge
if.then10.for.inc_crit_edge: ; preds = %if.then10
%.pre = load ptr, ptr %arrayidx, align 8, !tbaa !5
br label %for.inc
if.then16: ; preds = %if.then10
%cap.le = getelementptr inbounds %struct.LIST, ptr %1, i64 0, i32 1
%6 = load i64, ptr %cap.le, align 8, !tbaa !15
%sub = sub nsw i64 %6, %call
store i64 %sub, ptr %cap.le, align 8, !tbaa !15
%rev = getelementptr inbounds %struct.LIST, ptr %1, i64 0, i32 2
%7 = load ptr, ptr %rev, align 8, !tbaa !16
%cap18 = getelementptr inbounds %struct.LIST, ptr %7, i64 0, i32 1
%8 = load i64, ptr %cap18, align 8, !tbaa !15
%add = add nsw i64 %8, %call
store i64 %add, ptr %cap18, align 8, !tbaa !15
br label %cleanup
for.inc: ; preds = %if.then10.for.inc_crit_edge, %for.body, %land.lhs.true
%9 = phi ptr [ %.pre, %if.then10.for.inc_crit_edge ], [ %1, %for.body ], [ %1, %land.lhs.true ]
%next = getelementptr inbounds %struct.LIST, ptr %9, i64 0, i32 3
%10 = load ptr, ptr %next, align 8, !tbaa !11
store ptr %10, ptr %arrayidx, align 8, !tbaa !5
%cmp1.not = icmp eq ptr %10, null
br i1 %cmp1.not, label %cleanup, label %for.body, !llvm.loop !20
cleanup: ; preds = %for.inc, %for.cond.preheader, %entry, %if.then16
%retval.0 = phi i64 [ %call, %if.then16 ], [ %f, %entry ], [ 0, %for.cond.preheader ], [ 0, %for.inc ]
ret i64 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @max_flow(ptr nocapture noundef readonly %g, i32 noundef %s, i32 noundef %t) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %t to i64
%arrayidx = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom
%idxprom.i = sext i32 %s to i64
%arrayidx.i = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom.i
br label %while.cond
while.cond.loopexit: ; preds = %while.cond1
br label %while.cond, !llvm.loop !21
while.cond: ; preds = %while.cond.loopexit, %entry
%flow.0 = phi i64 [ 0, %entry ], [ %flow.1, %while.cond.loopexit ]
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) @level, i8 -1, i64 800, i1 false)
store i32 0, ptr %arrayidx.i, align 4, !tbaa !9
store i32 %s, ptr @que, align 16, !tbaa !9
br label %while.body.i
while.cond.loopexit.i: ; preds = %for.inc.i, %while.body.i
%rear.1.lcssa.i = phi i32 [ %rear.036.i, %while.body.i ], [ %rear.2.i, %for.inc.i ]
%0 = zext i32 %rear.1.lcssa.i to i64
%cmp.not.i = icmp eq i64 %indvars.iv.next.i, %0
br i1 %cmp.not.i, label %bfs.exit, label %while.body.i, !llvm.loop !17
while.body.i: ; preds = %while.cond.loopexit.i, %while.cond
%indvars.iv.i = phi i64 [ 0, %while.cond ], [ %indvars.iv.next.i, %while.cond.loopexit.i ]
%rear.036.i = phi i32 [ 1, %while.cond ], [ %rear.1.lcssa.i, %while.cond.loopexit.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx5.i = getelementptr inbounds [200 x i32], ptr @que, i64 0, i64 %indvars.iv.i
%1 = load i32, ptr %arrayidx5.i, align 4, !tbaa !9
%idxprom6.i = sext i32 %1 to i64
%arrayidx7.i = getelementptr inbounds ptr, ptr %g, i64 %idxprom6.i
%e.032.i = load ptr, ptr %arrayidx7.i, align 8, !tbaa !5
%cmp8.not33.i = icmp eq ptr %e.032.i, null
br i1 %cmp8.not33.i, label %while.cond.loopexit.i, label %for.body.lr.ph.i
for.body.lr.ph.i: ; preds = %while.body.i
%arrayidx14.i = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom6.i
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.lr.ph.i
%e.035.i = phi ptr [ %e.032.i, %for.body.lr.ph.i ], [ %e.0.i, %for.inc.i ]
%rear.134.i = phi i32 [ %rear.036.i, %for.body.lr.ph.i ], [ %rear.2.i, %for.inc.i ]
%cap.i = getelementptr inbounds %struct.LIST, ptr %e.035.i, i64 0, i32 1
%2 = load i64, ptr %cap.i, align 8, !tbaa !15
%cmp9.i = icmp sgt i64 %2, 0
br i1 %cmp9.i, label %land.lhs.true.i, label %for.inc.i
land.lhs.true.i: ; preds = %for.body.i
%3 = load i32, ptr %e.035.i, align 8, !tbaa !14
%idxprom10.i = sext i32 %3 to i64
%arrayidx11.i = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom10.i
%4 = load i32, ptr %arrayidx11.i, align 4, !tbaa !9
%cmp12.i = icmp slt i32 %4, 0
br i1 %cmp12.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %land.lhs.true.i
%5 = load i32, ptr %arrayidx14.i, align 4, !tbaa !9
%add.i = add nsw i32 %5, 1
store i32 %add.i, ptr %arrayidx11.i, align 4, !tbaa !9
%6 = load i32, ptr %e.035.i, align 8, !tbaa !14
%inc19.i = add nsw i32 %rear.134.i, 1
%idxprom20.i = sext i32 %rear.134.i to i64
%arrayidx21.i = getelementptr inbounds [200 x i32], ptr @que, i64 0, i64 %idxprom20.i
store i32 %6, ptr %arrayidx21.i, align 4, !tbaa !9
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %land.lhs.true.i, %for.body.i
%rear.2.i = phi i32 [ %inc19.i, %if.then.i ], [ %rear.134.i, %land.lhs.true.i ], [ %rear.134.i, %for.body.i ]
%next.i = getelementptr inbounds %struct.LIST, ptr %e.035.i, i64 0, i32 3
%e.0.i = load ptr, ptr %next.i, align 8, !tbaa !5
%cmp8.not.i = icmp eq ptr %e.0.i, null
br i1 %cmp8.not.i, label %while.cond.loopexit.i, label %for.body.i, !llvm.loop !19
bfs.exit: ; preds = %while.cond.loopexit.i
%7 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp = icmp slt i32 %7, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %bfs.exit
ret i64 %flow.0
if.end: ; preds = %bfs.exit
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) @iter, ptr noundef nonnull align 8 dereferenceable(1600) %g, i64 1600, i1 false)
br label %while.cond1
while.cond1: ; preds = %while.cond1, %if.end
%flow.1 = phi i64 [ %flow.0, %if.end ], [ %add, %while.cond1 ]
%call = tail call i64 @dfs(i32 noundef %s, i32 noundef %t, i64 noundef 1000000000000000)
%cmp2 = icmp sgt i64 %call, 0
%add = add nsw i64 %call, %flow.1
br i1 %cmp2, label %while.cond1, label %while.cond.loopexit, !llvm.loop !21
}
; 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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%add = add nsw i32 %0, 1
%cmp.not69 = icmp slt i32 %0, 1
br i1 %cmp.not69, label %entry.for.end19_crit_edge, label %for.body.lr.ph
entry.for.end19_crit_edge: ; preds = %entry
%.pre = sext i32 %add to i64
br label %for.end19
for.body.lr.ph: ; preds = %entry
%idxprom7.i = zext i32 %add to i64
%arrayidx8.i = getelementptr inbounds ptr, ptr @g, i64 %idxprom7.i
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc18
%indvars.iv72 = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next73, %for.inc18 ]
%indvars.iv = phi i64 [ 2, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc18 ]
%res.071 = phi i64 [ 0, %for.body.lr.ph ], [ %res.1, %for.inc18 ]
%add.ptr = getelementptr inbounds i32, ptr @a, i64 %indvars.iv72
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%1 = load i32, ptr %add.ptr, align 4, !tbaa !9
%cmp3 = icmp sgt i32 %1, 0
%2 = load i32, ptr @e_size, align 4, !tbaa !9
%idxprom1.i = sext i32 %2 to i64
%next.i = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1.i, i32 3
%arrayidx4.i = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1.i
%cap25.i = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i, i32 1
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
%conv = zext i32 %1 to i64
%arrayidx.i = getelementptr inbounds ptr, ptr @g, i64 %indvars.iv72
%3 = load ptr, ptr %arrayidx.i, align 8, !tbaa !5
store ptr %3, ptr %next.i, align 8, !tbaa !11
store ptr %arrayidx4.i, ptr %arrayidx.i, align 8, !tbaa !5
%4 = load ptr, ptr %arrayidx8.i, align 8, !tbaa !5
%next11.i = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i, i32 3
store ptr %4, ptr %next11.i, align 8, !tbaa !11
%inc.i = add nsw i32 %2, 1
store i32 %inc.i, ptr @e_size, align 4, !tbaa !9
%arrayidx13.i = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i
store ptr %arrayidx13.i, ptr %arrayidx8.i, align 8, !tbaa !5
%5 = load ptr, ptr %arrayidx.i, align 8, !tbaa !5
store i32 %add, ptr %5, align 8, !tbaa !14
%cap.i = getelementptr inbounds %struct.LIST, ptr %5, i64 0, i32 1
store i64 %conv, ptr %cap.i, align 8, !tbaa !15
%6 = trunc i64 %indvars.iv72 to i32
store i32 %6, ptr %arrayidx13.i, align 16, !tbaa !14
store i64 0, ptr %cap25.i, align 8, !tbaa !15
%rev.i = getelementptr inbounds %struct.LIST, ptr %5, i64 0, i32 2
store ptr %arrayidx13.i, ptr %rev.i, align 8, !tbaa !16
%7 = load ptr, ptr %arrayidx.i, align 8, !tbaa !5
%8 = load ptr, ptr %arrayidx8.i, align 8, !tbaa !5
%rev34.i = getelementptr inbounds %struct.LIST, ptr %8, i64 0, i32 2
store ptr %7, ptr %rev34.i, align 8, !tbaa !16
%9 = load i32, ptr %add.ptr, align 4, !tbaa !9
%conv8 = sext i32 %9 to i64
%add9 = add nsw i64 %res.071, %conv8
br label %if.end
if.else: ; preds = %for.body
%sub = sub nsw i32 0, %1
%conv12 = zext i32 %sub to i64
%10 = load ptr, ptr @g, align 16, !tbaa !5
store ptr %10, ptr %next.i, align 8, !tbaa !11
store ptr %arrayidx4.i, ptr @g, align 16, !tbaa !5
%arrayidx8.i43 = getelementptr inbounds ptr, ptr @g, i64 %indvars.iv72
%11 = load ptr, ptr %arrayidx8.i43, align 8, !tbaa !5
%next11.i44 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i, i32 3
store ptr %11, ptr %next11.i44, align 8, !tbaa !11
%inc.i45 = add nsw i32 %2, 1
store i32 %inc.i45, ptr @e_size, align 4, !tbaa !9
%arrayidx13.i46 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i
store ptr %arrayidx13.i46, ptr %arrayidx8.i43, align 8, !tbaa !5
%12 = trunc i64 %indvars.iv72 to i32
store i32 %12, ptr %arrayidx4.i, align 16, !tbaa !14
%cap.i47 = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1.i, i32 1
store i64 %conv12, ptr %cap.i47, align 8, !tbaa !15
store i32 0, ptr %arrayidx13.i46, align 16, !tbaa !14
store i64 0, ptr %cap25.i, align 8, !tbaa !15
%rev.i49 = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1.i, i32 2
store ptr %arrayidx13.i46, ptr %rev.i49, align 16, !tbaa !16
%rev34.i50 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i, i32 2
store ptr %arrayidx4.i, ptr %rev34.i50, align 16, !tbaa !16
br label %if.end
if.end: ; preds = %if.else, %if.then
%res.1 = phi i64 [ %add9, %if.then ], [ %res.071, %if.else ]
%13 = load i32, ptr %n, align 4, !tbaa !9
%indvars.iv72.tr = trunc i64 %indvars.iv72 to i32
%14 = shl i32 %indvars.iv72.tr, 1
%cmp14.not67 = icmp sgt i32 %14, %13
br i1 %cmp14.not67, label %for.inc18, label %for.body16.lr.ph
for.body16.lr.ph: ; preds = %if.end
%arrayidx.i52 = getelementptr inbounds ptr, ptr @g, i64 %indvars.iv72
%15 = trunc i64 %indvars.iv72 to i32
br label %for.body16
for.body16: ; preds = %for.body16.lr.ph, %for.body16
%indvars.iv74 = phi i64 [ %indvars.iv, %for.body16.lr.ph ], [ %indvars.iv.next75, %for.body16 ]
%16 = load ptr, ptr %arrayidx.i52, align 8, !tbaa !5
%17 = load i32, ptr @e_size, align 4, !tbaa !9
%idxprom1.i53 = sext i32 %17 to i64
%next.i54 = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1.i53, i32 3
store ptr %16, ptr %next.i54, align 8, !tbaa !11
%arrayidx4.i55 = getelementptr inbounds [10000 x %struct.LIST], ptr @edge, i64 0, i64 %idxprom1.i53
store ptr %arrayidx4.i55, ptr %arrayidx.i52, align 8, !tbaa !5
%arrayidx8.i57 = getelementptr inbounds ptr, ptr @g, i64 %indvars.iv74
%18 = load ptr, ptr %arrayidx8.i57, align 8, !tbaa !5
%next11.i58 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i53, i32 3
store ptr %18, ptr %next11.i58, align 8, !tbaa !11
%inc.i59 = add nsw i32 %17, 1
store i32 %inc.i59, ptr @e_size, align 4, !tbaa !9
%arrayidx13.i60 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i53
store ptr %arrayidx13.i60, ptr %arrayidx8.i57, align 8, !tbaa !5
%19 = load ptr, ptr %arrayidx.i52, align 8, !tbaa !5
%20 = trunc i64 %indvars.iv74 to i32
store i32 %20, ptr %19, align 8, !tbaa !14
%cap.i61 = getelementptr inbounds %struct.LIST, ptr %19, i64 0, i32 1
store i64 1000000000000000, ptr %cap.i61, align 8, !tbaa !15
store i32 %15, ptr %arrayidx13.i60, align 16, !tbaa !14
%cap25.i62 = getelementptr inbounds [10000 x %struct.LIST], ptr @rev, i64 0, i64 %idxprom1.i53, i32 1
store i64 0, ptr %cap25.i62, align 8, !tbaa !15
%rev.i63 = getelementptr inbounds %struct.LIST, ptr %19, i64 0, i32 2
store ptr %arrayidx13.i60, ptr %rev.i63, align 8, !tbaa !16
%21 = load ptr, ptr %arrayidx.i52, align 8, !tbaa !5
%22 = load ptr, ptr %arrayidx8.i57, align 8, !tbaa !5
%rev34.i64 = getelementptr inbounds %struct.LIST, ptr %22, i64 0, i32 2
store ptr %21, ptr %rev34.i64, align 8, !tbaa !16
%indvars.iv.next75 = add i64 %indvars.iv74, %indvars.iv72
%23 = load i32, ptr %n, align 4, !tbaa !9
%24 = trunc i64 %indvars.iv.next75 to i32
%cmp14.not = icmp slt i32 %23, %24
br i1 %cmp14.not, label %for.inc18, label %for.body16, !llvm.loop !22
for.inc18: ; preds = %for.body16, %if.end
%25 = phi i32 [ %13, %if.end ], [ %23, %for.body16 ]
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%26 = sext i32 %25 to i64
%cmp.not.not = icmp slt i64 %indvars.iv72, %26
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
br i1 %cmp.not.not, label %for.body, label %for.end19, !llvm.loop !23
for.end19: ; preds = %for.inc18, %entry.for.end19_crit_edge
%idxprom.i65.pre-phi = phi i64 [ %.pre, %entry.for.end19_crit_edge ], [ %idxprom7.i, %for.inc18 ]
%res.0.lcssa = phi i64 [ 0, %entry.for.end19_crit_edge ], [ %res.1, %for.inc18 ]
%arrayidx.i66 = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom.i65.pre-phi
br label %while.cond.i
while.cond.loopexit.i: ; preds = %while.cond1.i
br label %while.cond.i, !llvm.loop !21
while.cond.i: ; preds = %while.cond.loopexit.i, %for.end19
%flow.0.i = phi i64 [ 0, %for.end19 ], [ %flow.1.i, %while.cond.loopexit.i ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) @level, i8 -1, i64 800, i1 false)
store i32 0, ptr @level, align 16, !tbaa !9
store i32 0, ptr @que, align 16, !tbaa !9
br label %while.body.i.i
while.cond.loopexit.i.i: ; preds = %for.inc.i.i, %while.body.i.i
%rear.1.lcssa.i.i = phi i32 [ %rear.036.i.i, %while.body.i.i ], [ %rear.2.i.i, %for.inc.i.i ]
%27 = zext i32 %rear.1.lcssa.i.i to i64
%cmp.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %27
br i1 %cmp.not.i.i, label %bfs.exit.i, label %while.body.i.i, !llvm.loop !17
while.body.i.i: ; preds = %while.cond.loopexit.i.i, %while.cond.i
%indvars.iv.i.i = phi i64 [ 0, %while.cond.i ], [ %indvars.iv.next.i.i, %while.cond.loopexit.i.i ]
%rear.036.i.i = phi i32 [ 1, %while.cond.i ], [ %rear.1.lcssa.i.i, %while.cond.loopexit.i.i ]
%indvars.iv.next.i.i = add nuw nsw i64 %indvars.iv.i.i, 1
%arrayidx5.i.i = getelementptr inbounds [200 x i32], ptr @que, i64 0, i64 %indvars.iv.i.i
%28 = load i32, ptr %arrayidx5.i.i, align 4, !tbaa !9
%idxprom6.i.i = sext i32 %28 to i64
%arrayidx7.i.i = getelementptr inbounds ptr, ptr @g, i64 %idxprom6.i.i
%e.032.i.i = load ptr, ptr %arrayidx7.i.i, align 8, !tbaa !5
%cmp8.not33.i.i = icmp eq ptr %e.032.i.i, null
br i1 %cmp8.not33.i.i, label %while.cond.loopexit.i.i, label %for.body.lr.ph.i.i
for.body.lr.ph.i.i: ; preds = %while.body.i.i
%arrayidx14.i.i = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom6.i.i
br label %for.body.i.i
for.body.i.i: ; preds = %for.inc.i.i, %for.body.lr.ph.i.i
%e.035.i.i = phi ptr [ %e.032.i.i, %for.body.lr.ph.i.i ], [ %e.0.i.i, %for.inc.i.i ]
%rear.134.i.i = phi i32 [ %rear.036.i.i, %for.body.lr.ph.i.i ], [ %rear.2.i.i, %for.inc.i.i ]
%cap.i.i = getelementptr inbounds %struct.LIST, ptr %e.035.i.i, i64 0, i32 1
%29 = load i64, ptr %cap.i.i, align 8, !tbaa !15
%cmp9.i.i = icmp sgt i64 %29, 0
br i1 %cmp9.i.i, label %land.lhs.true.i.i, label %for.inc.i.i
land.lhs.true.i.i: ; preds = %for.body.i.i
%30 = load i32, ptr %e.035.i.i, align 8, !tbaa !14
%idxprom10.i.i = sext i32 %30 to i64
%arrayidx11.i.i = getelementptr inbounds [200 x i32], ptr @level, i64 0, i64 %idxprom10.i.i
%31 = load i32, ptr %arrayidx11.i.i, align 4, !tbaa !9
%cmp12.i.i = icmp slt i32 %31, 0
br i1 %cmp12.i.i, label %if.then.i.i, label %for.inc.i.i
if.then.i.i: ; preds = %land.lhs.true.i.i
%32 = load i32, ptr %arrayidx14.i.i, align 4, !tbaa !9
%add.i.i = add nsw i32 %32, 1
store i32 %add.i.i, ptr %arrayidx11.i.i, align 4, !tbaa !9
%33 = load i32, ptr %e.035.i.i, align 8, !tbaa !14
%inc19.i.i = add nsw i32 %rear.134.i.i, 1
%idxprom20.i.i = sext i32 %rear.134.i.i to i64
%arrayidx21.i.i = getelementptr inbounds [200 x i32], ptr @que, i64 0, i64 %idxprom20.i.i
store i32 %33, ptr %arrayidx21.i.i, align 4, !tbaa !9
br label %for.inc.i.i
for.inc.i.i: ; preds = %if.then.i.i, %land.lhs.true.i.i, %for.body.i.i
%rear.2.i.i = phi i32 [ %inc19.i.i, %if.then.i.i ], [ %rear.134.i.i, %land.lhs.true.i.i ], [ %rear.134.i.i, %for.body.i.i ]
%next.i.i = getelementptr inbounds %struct.LIST, ptr %e.035.i.i, i64 0, i32 3
%e.0.i.i = load ptr, ptr %next.i.i, align 8, !tbaa !5
%cmp8.not.i.i = icmp eq ptr %e.0.i.i, null
br i1 %cmp8.not.i.i, label %while.cond.loopexit.i.i, label %for.body.i.i, !llvm.loop !19
bfs.exit.i: ; preds = %while.cond.loopexit.i.i
%34 = load i32, ptr %arrayidx.i66, align 4, !tbaa !9
%cmp.i = icmp slt i32 %34, 0
br i1 %cmp.i, label %max_flow.exit, label %if.end.i
if.end.i: ; preds = %bfs.exit.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) @iter, ptr noundef nonnull align 16 dereferenceable(1600) @g, i64 1600, i1 false)
br label %while.cond1.i
while.cond1.i: ; preds = %while.cond1.i, %if.end.i
%flow.1.i = phi i64 [ %flow.0.i, %if.end.i ], [ %add.i, %while.cond1.i ]
%call.i = call i64 @dfs(i32 noundef 0, i32 noundef %add, i64 noundef 1000000000000000)
%cmp2.i = icmp sgt i64 %call.i, 0
%add.i = add nsw i64 %call.i, %flow.1.i
br i1 %cmp2.i, label %while.cond1.i, label %while.cond.loopexit.i, !llvm.loop !21
max_flow.exit: ; preds = %bfs.exit.i
%sub21 = sub nsw i64 %res.0.lcssa, %flow.0.i
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub21)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #8
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, 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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nosync nounwind memory(readwrite, 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!12, !6, i64 24}
!12 = !{!"LIST", !10, i64 0, !13, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!"long long", !7, i64 0}
!14 = !{!12, !10, i64 0}
!15 = !{!12, !13, i64 8}
!16 = !{!12, !6, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}
|
#include<stdio.h>
long m[1001*2]={0};
int main(){
long n,t=0,i,u=0,o=0,q=0;
scanf("%ld",&n);
for(i=0;i<n;i++){scanf("%ld%ld",&m[i*2],&m[i*2+1]);}
t=0;q=0;u=0;
while(u<n){
t++;
if(q>0)q--;if(!q)t=m[2*u];
if(m[2*u]==t){
q+=m[2*u+1];
if(q>o)o=q;
u++;
}
}
t+=q;
printf("%ld %ld",t,o);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2388/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"
@m = dso_local global [2002 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%ld%ld\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp44 = icmp sgt i64 %0, 0
br i1 %cmp44, label %for.body, label %while.end
while.cond.preheader: ; preds = %for.body
%cmp446 = icmp sgt i64 %1, 0
br i1 %cmp446, label %while.body, label %while.end
for.body: ; preds = %entry, %for.body
%i.045 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%mul = shl nuw nsw i64 %i.045, 1
%arrayidx = getelementptr inbounds [2002 x i64], ptr @m, i64 0, i64 %mul
%add = or i64 %mul, 1
%arrayidx2 = getelementptr inbounds [2002 x i64], ptr @m, i64 0, i64 %add
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%inc = add nuw nsw i64 %i.045, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %if.end23
%q.050 = phi i64 [ %q.2, %if.end23 ], [ 0, %while.cond.preheader ]
%o.049 = phi i64 [ %o.2, %if.end23 ], [ 0, %while.cond.preheader ]
%u.048 = phi i64 [ %u.1, %if.end23 ], [ 0, %while.cond.preheader ]
%t.047 = phi i64 [ %t.1, %if.end23 ], [ 0, %while.cond.preheader ]
%cmp6 = icmp sgt i64 %q.050, 0
%dec = sext i1 %cmp6 to i64
%spec.select = add nsw i64 %q.050, %dec
%tobool.not = icmp eq i64 %spec.select, 0
br i1 %tobool.not, label %if.then7, label %while.body.if.end10_crit_edge
while.body.if.end10_crit_edge: ; preds = %while.body
%inc5 = add nsw i64 %t.047, 1
%.pre = shl nsw i64 %u.048, 1
br label %if.end10
if.then7: ; preds = %while.body
%mul8 = shl nsw i64 %u.048, 1
%arrayidx9 = getelementptr inbounds [2002 x i64], ptr @m, i64 0, i64 %mul8
%2 = load i64, ptr %arrayidx9, align 16, !tbaa !5
br label %if.end10
if.end10: ; preds = %while.body.if.end10_crit_edge, %if.then7
%mul11.pre-phi = phi i64 [ %.pre, %while.body.if.end10_crit_edge ], [ %mul8, %if.then7 ]
%t.1 = phi i64 [ %inc5, %while.body.if.end10_crit_edge ], [ %2, %if.then7 ]
%arrayidx12 = getelementptr inbounds [2002 x i64], ptr @m, i64 0, i64 %mul11.pre-phi
%3 = load i64, ptr %arrayidx12, align 16, !tbaa !5
%cmp13 = icmp eq i64 %3, %t.1
br i1 %cmp13, label %if.then14, label %if.end23
if.then14: ; preds = %if.end10
%add16 = or i64 %mul11.pre-phi, 1
%arrayidx17 = getelementptr inbounds [2002 x i64], ptr @m, i64 0, i64 %add16
%4 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%add18 = add nsw i64 %4, %spec.select
%spec.select43 = call i64 @llvm.smax.i64(i64 %add18, i64 %o.049)
%inc22 = add nsw i64 %u.048, 1
br label %if.end23
if.end23: ; preds = %if.then14, %if.end10
%u.1 = phi i64 [ %inc22, %if.then14 ], [ %u.048, %if.end10 ]
%o.2 = phi i64 [ %spec.select43, %if.then14 ], [ %o.049, %if.end10 ]
%q.2 = phi i64 [ %add18, %if.then14 ], [ %spec.select, %if.end10 ]
%cmp4 = icmp slt i64 %u.1, %1
br i1 %cmp4, label %while.body, label %while.end.loopexit, !llvm.loop !11
while.end.loopexit: ; preds = %if.end23
%5 = add nsw i64 %q.2, %t.1
br label %while.end
while.end: ; preds = %entry, %while.end.loopexit, %while.cond.preheader
%o.0.lcssa = phi i64 [ 0, %while.cond.preheader ], [ %o.2, %while.end.loopexit ], [ 0, %entry ]
%add24 = phi i64 [ 0, %while.cond.preheader ], [ %5, %while.end.loopexit ], [ 0, %entry ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add24, i64 noundef %o.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, 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 i64 @llvm.smax.i64(i64, i64) #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 = !{!"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>
typedef long long ll;
int main(void)
{
ll x,y;
scanf("%lld %lld",&x,&y);
if(x%y==0){
puts("-1");
return 0;
}
printf("%lld\n",x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238842/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238842/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
%rem = srem i64 %0, %1
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %0)
br label %cleanup
cleanup: ; preds = %if.end, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
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 @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
; 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"}
|
#include<stdio.h>
int main(){
int x,y,a;
scanf("%d %d",&x,&y);
if(x%y==0){
printf("-1");
}else{
printf("%d",x);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238886/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238886/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"-1\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:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main (){
int h1,m1,h2,m2,k;
scanf ("%d %d %d %d %d",&h1,&m1,&h2,&m2,&k);
int h=(h2-h1)*60;
int m=m2-m1;
int total=h+m-k;
printf ("%d",total);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238936/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238936/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 [15 x i8] c"%d %d %d %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:
%h1 = alloca i32, align 4
%m1 = alloca i32, align 4
%h2 = alloca i32, align 4
%m2 = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h1, ptr noundef nonnull %m1, ptr noundef nonnull %h2, ptr noundef nonnull %m2, ptr noundef nonnull %k)
%0 = load i32, ptr %h2, align 4, !tbaa !5
%1 = load i32, ptr %h1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%mul = mul nsw i32 %sub, 60
%2 = load i32, ptr %m2, align 4, !tbaa !5
%3 = load i32, ptr %m1, align 4, !tbaa !5
%4 = load i32, ptr %k, align 4, !tbaa !5
%.neg5 = add i32 %mul, %2
%5 = add i32 %3, %4
%sub2 = sub i32 %.neg5, %5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h1) #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 <stdlib.h>
#include <math.h>
int main(void)
{
int h1,h2,m1,m2,k;
scanf("%d %d %d %d %d",&h1,&m1,&h2,&m2,&k);
int start = 60*h1+m1;
int end = 60*h2+m2;
printf("%d\n",end-start-k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238987/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238987/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 [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h1 = alloca i32, align 4
%h2 = alloca i32, align 4
%m1 = alloca i32, align 4
%m2 = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h1, ptr noundef nonnull %m1, ptr noundef nonnull %h2, ptr noundef nonnull %m2, ptr noundef nonnull %k)
%0 = load i32, ptr %h1, align 4, !tbaa !5
%1 = load i32, ptr %m1, align 4, !tbaa !5
%2 = load i32, ptr %h2, align 4, !tbaa !5
%3 = load i32, ptr %m2, align 4, !tbaa !5
%4 = load i32, ptr %k, align 4, !tbaa !5
%reass.add = sub i32 %2, %0
%reass.mul = mul i32 %reass.add, 60
%5 = add i32 %1, %4
%add2 = sub i32 %3, %5
%sub3 = add i32 %add2, %reass.mul
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h1) #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,K,ans,mae,ato;
scanf("%d%d%d%d%d",&a,&b,&c,&d,&K);
ato=c*60+d;
mae=a*60+b;
ans=ato-mae-K;
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239036/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239036/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 [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %K)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %d, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%4 = load i32, ptr %K, align 4, !tbaa !5
%reass.add = sub i32 %0, %2
%reass.mul = mul i32 %reass.add, 60
%5 = add i32 %3, %4
%add = sub i32 %1, %5
%sub3 = add i32 %add, %reass.mul
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,x;
scanf("%d %d",&n,&x);
int arr[n];
int i;
long long int sum=0;
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
sum+=arr[i];
}
if(x==(sum+n-1))
printf("YES\n");
else
printf("NO\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23908/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23908/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%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 %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, 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
%cmp16 = icmp sgt i32 %3, 0
br i1 %cmp16, 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 ], [ 0, %entry ]
%sum.018 = phi i64 [ %add, %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)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sext i32 %4 to i64
%add = add nsw i64 %sum.018, %conv
%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.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%7 = add i64 %add, -1
br label %for.end
for.end: ; preds = %entry.for.end_crit_edge, %for.end.loopexit
%conv5.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %6, %for.end.loopexit ]
%sum.0.lcssa = phi i64 [ -1, %entry.for.end_crit_edge ], [ %7, %for.end.loopexit ]
%8 = load i32, ptr %x, align 4, !tbaa !5
%conv4 = sext i32 %8 to i64
%sub = add i64 %sum.0.lcssa, %conv5.pre-phi
%cmp7 = icmp eq i64 %sub, %conv4
%str.4.str = select i1 %cmp7, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
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 %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: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; 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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
double area3(double x1, double y1, double x2, double y2, double x3, double y3)
{
double a, b, c, x;
a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
b = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
c = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
x = (a+b+c)/2;
return sqrt(x*(x-a)*(x-b)*(x-c));
}
int main()
{
double x0, y0, x1, y1, x2, y2;
double s=0;
scanf("%lf,%lf", &x0, &y0);
scanf("%lf,%lf", &x1, &y1);
while (scanf("%lf,%lf", &x2,&y2)==2) {
s+=area3(x0, y0, x1, y1, x2, y2);
x1=x2;
y1=y2;
}
printf("%lf\n", s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239137/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239137/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 [8 x i8] c"%lf,%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local double @area3(double noundef %x1, double noundef %y1, double noundef %x2, double noundef %y2, double noundef %x3, double noundef %y3) local_unnamed_addr #0 {
entry:
%sub = fsub double %x1, %x2
%sub2 = fsub double %y1, %y2
%mul4 = fmul double %sub2, %sub2
%0 = tail call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt49 = tail call double @llvm.sqrt.f64(double %0)
%1 = insertelement <2 x double> poison, double %x2, i64 0
%2 = insertelement <2 x double> %1, double %x1, i64 1
%3 = insertelement <2 x double> poison, double %x3, i64 0
%4 = shufflevector <2 x double> %3, <2 x double> poison, <2 x i32> zeroinitializer
%5 = fsub <2 x double> %2, %4
%6 = insertelement <2 x double> poison, double %y2, i64 0
%7 = insertelement <2 x double> %6, double %y1, i64 1
%8 = insertelement <2 x double> poison, double %y3, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%10 = fsub <2 x double> %7, %9
%11 = fmul <2 x double> %10, %10
%12 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %5, <2 x double> %5, <2 x double> %11)
%13 = tail call <2 x double> @llvm.sqrt.v2f64(<2 x double> %12)
%14 = extractelement <2 x double> %13, i64 1
%add = fadd double %sqrt49, %14
%15 = extractelement <2 x double> %13, i64 0
%add17 = fadd double %15, %add
%div = fmul double %add17, 5.000000e-01
%sub18 = fsub double %div, %sqrt49
%mul = fmul double %div, %sub18
%16 = insertelement <2 x double> poison, double %div, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = fsub <2 x double> %17, %13
%19 = extractelement <2 x double> %18, i64 1
%mul20 = fmul double %19, %mul
%20 = extractelement <2 x double> %18, i64 0
%mul22 = fmul double %20, %mul20
%call23 = tail call double @sqrt(double noundef %mul22) #7
ret double %call23
}
; 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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) 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 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 #4 {
entry:
%x0 = alloca double, align 8
%y0 = alloca double, align 8
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x0) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y0) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x0, ptr noundef nonnull %y0)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1)
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%cmp7 = icmp eq i32 %call26, 2
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%s.08 = phi double [ %add, %while.body ], [ 0.000000e+00, %entry ]
%0 = load double, ptr %x0, align 8, !tbaa !5
%1 = load double, ptr %y0, align 8, !tbaa !5
%2 = load double, ptr %x1, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = load double, ptr %x2, align 8, !tbaa !5
%5 = load double, ptr %y2, align 8, !tbaa !5
%sub.i = fsub double %0, %2
%sub2.i = fsub double %1, %3
%mul4.i = fmul double %sub2.i, %sub2.i
%6 = call double @llvm.fmuladd.f64(double %sub.i, double %sub.i, double %mul4.i)
%sqrt49.i = call double @llvm.sqrt.f64(double %6)
%7 = insertelement <2 x double> poison, double %2, i64 0
%8 = insertelement <2 x double> %7, double %0, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fsub <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %3, i64 0
%13 = insertelement <2 x double> %12, double %1, i64 1
%14 = insertelement <2 x double> poison, double %5, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = fsub <2 x double> %13, %15
%17 = fmul <2 x double> %16, %16
%18 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %11, <2 x double> %17)
%19 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %18)
%20 = extractelement <2 x double> %19, i64 1
%add.i = fadd double %sqrt49.i, %20
%21 = extractelement <2 x double> %19, i64 0
%add17.i = fadd double %21, %add.i
%div.i = fmul double %add17.i, 5.000000e-01
%sub18.i = fsub double %div.i, %sqrt49.i
%mul.i = fmul double %div.i, %sub18.i
%22 = insertelement <2 x double> poison, double %div.i, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = fsub <2 x double> %23, %19
%25 = extractelement <2 x double> %24, i64 1
%mul20.i = fmul double %25, %mul.i
%26 = extractelement <2 x double> %24, i64 0
%mul22.i = fmul double %26, %mul20.i
%call23.i = call double @sqrt(double noundef %mul22.i) #7
%add = fadd double %s.08, %call23.i
%27 = load double, ptr %x2, align 8, !tbaa !5
store double %27, ptr %x1, align 8, !tbaa !5
%28 = load double, ptr %y2, align 8, !tbaa !5
store double %28, ptr %y1, align 8, !tbaa !5
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%cmp = icmp eq i32 %call2, 2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%s.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %while.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y0) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x0) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #6
; 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>) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #6
attributes #0 = { mustprogress nofree nounwind willreturn memory(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 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !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 <math.h>
#define SQ(a) ((a) * (a))
typedef struct{
double x[20];
double y[20];
} POINT;
int main(void)
{
POINT p;
double s;
int i, j;
double menseki;
i = 0;
while (scanf("%lf%*c%lf", &p.x[i], &p.y[i]) != EOF){
i++;
}
menseki = 0;
for (j = 0; j < i; j++){
menseki += (p.x[j] - p.x[(j + 1) % i]) * (p.y[j] + p.y[(j + 1) % i]);
}
printf("%f\n", menseki / 2.00 < 0 ? -1 * menseki / 2.00 : menseki / 2.00);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239195/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239195/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.POINT = type { [20 x double], [20 x double] }
@.str = private unnamed_addr constant [10 x i8] c"%lf%*c%lf\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:
%p = alloca %struct.POINT, align 8
call void @llvm.lifetime.start.p0(i64 320, ptr nonnull %p) #4
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv44 = phi i32 [ %indvars.iv.next45, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%cmp.not = icmp eq i32 %call, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next45 = add nuw i32 %indvars.iv44, 1
br i1 %cmp.not, label %for.cond.preheader, label %while.cond, !llvm.loop !5
for.cond.preheader: ; preds = %while.cond
%0 = and i64 %indvars.iv, 4294967295
%cmp337.not = icmp eq i64 %0, 0
br i1 %cmp337.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%1 = and i64 %indvars.iv, 4294967295
%wide.trip.count = zext i32 %indvars.iv44 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %indvars.iv44, 1
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv41 = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next42.1, %for.body ]
%menseki.039 = phi double [ 0.000000e+00, %for.body.preheader.new ], [ %16, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx6 = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %indvars.iv41
%3 = load double, ptr %arrayidx6, align 8, !tbaa !7
%indvars.iv.next42 = or i64 %indvars.iv41, 1
%4 = icmp eq i64 %indvars.iv.next42, %1
%sext = shl i64 %indvars.iv.next42, 32
%5 = ashr exact i64 %sext, 32
%idxprom8 = select i1 %4, i64 0, i64 %5
%arrayidx9 = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %idxprom8
%6 = load double, ptr %arrayidx9, align 8, !tbaa !7
%sub = fsub double %3, %6
%arrayidx12 = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %indvars.iv41
%7 = load double, ptr %arrayidx12, align 8, !tbaa !7
%arrayidx17 = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %idxprom8
%8 = load double, ptr %arrayidx17, align 8, !tbaa !7
%add18 = fadd double %7, %8
%9 = call double @llvm.fmuladd.f64(double %sub, double %add18, double %menseki.039)
%arrayidx6.1 = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %indvars.iv.next42
%10 = load double, ptr %arrayidx6.1, align 8, !tbaa !7
%indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 2
%11 = icmp eq i64 %indvars.iv.next42.1, %1
%sext.1 = shl i64 %indvars.iv.next42.1, 32
%12 = ashr exact i64 %sext.1, 32
%idxprom8.1 = select i1 %11, i64 0, i64 %12
%arrayidx9.1 = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %idxprom8.1
%13 = load double, ptr %arrayidx9.1, align 8, !tbaa !7
%sub.1 = fsub double %10, %13
%arrayidx12.1 = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %indvars.iv.next42
%14 = load double, ptr %arrayidx12.1, align 8, !tbaa !7
%arrayidx17.1 = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %idxprom8.1
%15 = load double, ptr %arrayidx17.1, align 8, !tbaa !7
%add18.1 = fadd double %14, %15
%16 = call double @llvm.fmuladd.f64(double %sub.1, double %add18.1, double %9)
%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 !11
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %16, %for.body ]
%indvars.iv41.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next42.1, %for.body ]
%menseki.039.unr = phi double [ 0.000000e+00, %for.body.preheader ], [ %16, %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
%arrayidx6.epil = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %indvars.iv41.unr
%17 = load double, ptr %arrayidx6.epil, align 8, !tbaa !7
%indvars.iv.next42.epil = add nuw nsw i64 %indvars.iv41.unr, 1
%18 = icmp eq i64 %indvars.iv.next42.epil, %1
%sext.epil = shl i64 %indvars.iv.next42.epil, 32
%19 = ashr exact i64 %sext.epil, 32
%idxprom8.epil = select i1 %18, i64 0, i64 %19
%arrayidx9.epil = getelementptr inbounds [20 x double], ptr %p, i64 0, i64 %idxprom8.epil
%20 = load double, ptr %arrayidx9.epil, align 8, !tbaa !7
%sub.epil = fsub double %17, %20
%arrayidx12.epil = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %indvars.iv41.unr
%21 = load double, ptr %arrayidx12.epil, align 8, !tbaa !7
%arrayidx17.epil = getelementptr inbounds %struct.POINT, ptr %p, i64 0, i32 1, i64 %idxprom8.epil
%22 = load double, ptr %arrayidx17.epil, align 8, !tbaa !7
%add18.epil = fadd double %21, %22
%23 = call double @llvm.fmuladd.f64(double %sub.epil, double %add18.epil, double %menseki.039.unr)
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %for.cond.preheader
%menseki.0.lcssa = phi double [ 0.000000e+00, %for.cond.preheader ], [ %.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %23, %for.body.epil ]
%div = fmul double %menseki.0.lcssa, 5.000000e-01
%cmp20 = fcmp olt double %div, 0.000000e+00
%div21 = fmul double %menseki.0.lcssa, -5.000000e-01
%cond = select i1 %cmp20, double %div21, double %div
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %cond)
call void @llvm.lifetime.end.p0(i64 320, 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 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#include <math.h>
int main(void) {
int n, x, tmp;
scanf("%d", &n);
x = ceil((double)n / 1.08);
tmp = x * 1.08;
if (tmp == n) printf("%d\n", x);
else printf(":(\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239238/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\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
%conv = sitofp i32 %0 to double
%div = fdiv double %conv, 1.080000e+00
%1 = call double @llvm.ceil.f64(double %div)
%conv1 = fptosi double %1 to i32
%conv2 = sitofp i32 %conv1 to double
%mul = fmul double %conv2, 1.080000e+00
%conv3 = fptosi double %mul to i32
%cmp = icmp eq i32 %0, %conv3
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv1)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
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 speculatable willreturn memory(none)
declare double @llvm.ceil.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
; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(void){
double n,n1,a,b;
int c;
scanf("%lf",&n);
n1 = (double)n / 1.08;
a = ceil(n1);
b = floor(n1);
if(a != b){
if(floor(a * 1.08) == n)
printf("%d\n",(int)a);
else if(floor(b * 1.08) == n)
printf("%d\n",(int)b);
else
printf(":(\n");
}
else
printf("%d\n",(int)n1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239296/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239296/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"%lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load double, ptr %n, align 8, !tbaa !5
%div = fdiv double %0, 1.080000e+00
%1 = call double @llvm.ceil.f64(double %div)
%2 = call double @llvm.floor.f64(double %div)
%cmp = fcmp une double %1, %2
br i1 %cmp, label %if.then, label %if.else13
if.then: ; preds = %entry
%mul = fmul double %1, 1.080000e+00
%3 = call double @llvm.floor.f64(double %mul)
%cmp1 = fcmp oeq double %3, %0
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
%conv = fptosi double %1 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv)
br label %if.end16
if.else: ; preds = %if.then
%mul4 = fmul double %2, 1.080000e+00
%4 = call double @llvm.floor.f64(double %mul4)
%cmp5 = fcmp oeq double %4, %0
br i1 %cmp5, label %if.then7, label %if.else10
if.then7: ; preds = %if.else
%conv8 = fptosi double %2 to i32
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv8)
br label %if.end16
if.else10: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end16
if.else13: ; preds = %entry
%conv14 = fptosi double %div to i32
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv14)
br label %if.end16
if.end16: ; preds = %if.then2, %if.else10, %if.then7, %if.else13
call void @llvm.lifetime.end.p0(i64 8, 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 speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.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
; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int cmp(const void *a,const void *b){
return *(int*)a-*(int*)b;}
int main(){
int a,b,i,count=0;
double c,d;
scanf("%d",&a);
for(i=1;i<a+1;i++){
c=i*1.08;
b=c;
if(a==b){
printf("%d\n",i);
break;
}
else
count++;
}
if(count==a)
printf(":(\n");
return 0;}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239339/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239339/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\00", align 1
; 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) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not18 = icmp slt i32 %0, 1
br i1 %cmp.not18, label %for.end, label %for.body
for.body: ; preds = %entry, %if.else
%i.020 = phi i32 [ %inc5, %if.else ], [ 1, %entry ]
%count.019 = phi i32 [ %inc, %if.else ], [ 0, %entry ]
%conv = sitofp i32 %i.020 to double
%mul = fmul double %conv, 1.080000e+00
%conv1 = fptosi double %mul to i32
%cmp2 = icmp eq i32 %0, %conv1
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.020)
%.pre = load i32, ptr %a, align 4, !tbaa !5
br label %for.end
if.else: ; preds = %for.body
%inc = add nuw nsw i32 %count.019, 1
%inc5 = add nuw nsw i32 %i.020, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %if.then8, label %for.body, !llvm.loop !9
for.end: ; preds = %entry, %if.then
%1 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%count.017 = phi i32 [ %count.019, %if.then ], [ 0, %entry ]
%cmp6 = icmp eq i32 %count.017, %1
br i1 %cmp6, label %if.then8, label %if.end10
if.then8: ; preds = %if.else, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end10
if.end10: ; preds = %if.then8, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n,t,a,i,m=0;
scanf("%d%d",&n,&t);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
m+=86400-a;
if(m>=t){
printf("%d\n",i);
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23939/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23939/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [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
%t = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not8 = icmp slt i32 %0, 1
br i1 %cmp.not8, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%m.010 = phi i32 [ %add, %for.inc ], [ 0, %entry ]
%i.09 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%reass.sub = sub i32 %m.010, %1
%add = add i32 %reass.sub, 86400
%2 = load i32, ptr %t, align 4, !tbaa !5
%cmp2.not = icmp slt i32 %add, %2
br i1 %cmp2.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.09)
br label %for.end
for.inc: ; preds = %for.body
%inc = add nuw nsw i32 %i.09, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.09, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n , t;
scanf("%d %d",&n,&t);
int i = 0;
int x;
scanf("%d",&x);
t -= x;
while(i++ < n-1)
{
t--;
scanf("%d",&x);
t -= x;
}
if(t == 0)
printf("YES");
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23944/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23944/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %t, align 4, !tbaa !5
%sub = sub nsw i32 %1, %0
store i32 %sub, ptr %t, align 4, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %2, 1
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%i.011 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%storemerge10 = phi i32 [ %sub4, %while.body ], [ %sub, %entry ]
%inc = add nuw nsw i32 %i.011, 1
%dec = add nsw i32 %storemerge10, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%3 = load i32, ptr %x, align 4, !tbaa !5
%4 = load i32, ptr %t, align 4, !tbaa !5
%sub4 = sub nsw i32 %4, %3
store i32 %sub4, ptr %t, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub2 = add nsw i32 %5, -1
%cmp = icmp slt i32 %inc, %sub2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%storemerge.lcssa = phi i32 [ %sub, %entry ], [ %sub4, %while.body ]
%cmp5 = icmp eq i32 %storemerge.lcssa, 0
%.str.2..str.3 = select i1 %cmp5, ptr @.str.2, ptr @.str.3
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
int h,m,s,S;
scanf("%d",&S);
h=S/3600;
m=S%3600/60;
s=S%3600%60;
printf("%d:%d:%d\n",h,m,s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239483/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 [10 x i8] c"%d:%d:%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
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 i32, ptr %S, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%rem = srem i32 %0, 3600
%div1.lhs.trunc = trunc i32 %rem to i16
%div15 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div15 to i32
%rem36 = srem i16 %div1.lhs.trunc, 60
%rem3.sext = sext i16 %rem36 to i32
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem3.sext)
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#pragma warning(disable: 4996)
#include<stdio.h>
int sec, h, m, s, hp, mp;
int main() {
scanf("%d", &sec);
h = sec / 3600;
hp = sec % 3600;
m = hp / 60;
mp = hp % 60;
s = mp;
printf("%d:%d:%d\n", h, m, s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239533/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239533/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
@sec = dso_local global i32 0, align 4
@h = dso_local local_unnamed_addr global i32 0, align 4
@hp = dso_local local_unnamed_addr global i32 0, align 4
@m = dso_local local_unnamed_addr global i32 0, align 4
@mp = dso_local local_unnamed_addr global i32 0, align 4
@s = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [10 x i8] c"%d:%d:%d\0A\00", align 1
; 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 @sec)
%0 = load i32, ptr @sec, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
store i32 %div, ptr @h, align 4, !tbaa !5
%rem = srem i32 %0, 3600
store i32 %rem, ptr @hp, align 4, !tbaa !5
%div1.lhs.trunc = trunc i32 %rem to i16
%div14 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div14 to i32
store i32 %div1.sext, ptr @m, align 4, !tbaa !5
%rem25 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem25 to i32
store i32 %rem2.sext, ptr @mp, align 4, !tbaa !5
store i32 %rem2.sext, ptr @s, align 4, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.sext)
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
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" }
!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 h=0,m=0,s=0;
scanf("%d",&s);
m=s/60;
s%=60;
h=m/60;
m%=60;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239577/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 [10 x i8] c"%d:%d:%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
store i32 0, ptr %s, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4, !tbaa !5
%div = sdiv i32 %0, 60
%rem = srem i32 %0, 60
store i32 %rem, ptr %s, align 4, !tbaa !5
%div1 = sdiv i32 %0, 3600
%rem2 = srem i32 %div, 60
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div1, i32 noundef %rem2, i32 noundef %rem)
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int i,j,c,n,b;
long long int t;
scanf("%d%lld",&n,&t);
int a[n];
c=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
c=86400-a[i]+c;
if(c>=t)
{
printf("%d\n",i+1);
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23962/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%lld\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
%t = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t)
%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
%cmp22 = icmp sgt i32 %3, 0
br i1 %cmp22, label %for.body, label %for.end13
for.cond2.preheader: ; preds = %for.body
%cmp324 = icmp sgt i32 %5, 0
br i1 %cmp324, label %for.body4.lr.ph, label %for.end13
for.body4.lr.ph: ; preds = %for.cond2.preheader
%4 = load i64, ptr %t, align 8, !tbaa !9
%wide.trip.count = zext i32 %5 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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 !11
for.body4: ; preds = %for.body4.lr.ph, %for.inc11
%indvars.iv30 = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next31, %for.inc11 ]
%c.025 = phi i32 [ 0, %for.body4.lr.ph ], [ %add, %for.inc11 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv30
%7 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%reass.sub = sub i32 %c.025, %7
%add = add i32 %reass.sub, 86400
%conv = sext i32 %add to i64
%cmp7.not = icmp sgt i64 %4, %conv
br i1 %cmp7.not, label %for.inc11, label %if.then
if.then: ; preds = %for.body4
%8 = trunc i64 %indvars.iv30 to i32
%add9 = add nuw nsw i32 %8, 1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add9)
br label %for.end13
for.inc11: ; preds = %for.body4
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%exitcond.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count
br i1 %exitcond.not, label %for.end13, label %for.body4, !llvm.loop !13
for.end13: ; preds = %for.inc11, %entry, %for.cond2.preheader, %if.then
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
int main(void){
int s,h=3600,m=60;
scanf("%d",&s);
printf("%d:%d:%d\n",s/h,s%h/m,s%h%m);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239663/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 [10 x i8] c"%d:%d:%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
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 i32, ptr %s, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%rem = srem i32 %0, 3600
%div1.lhs.trunc = trunc i32 %rem to i16
%div18 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div18 to i32
%rem39 = srem i16 %div1.lhs.trunc, 60
%rem3.sext = sext i16 %rem39 to i32
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem3.sext)
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main ()
{
int S,h,m,s;
scanf("%d",&S);
h = S/3600;
S = S-(3600*h);
m = S/60;
s = S-(60*m);
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239706/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 [10 x i8] c"%d:%d:%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
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 i32, ptr %S, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%mul.neg = mul nsw i32 %div, -3600
%sub = add i32 %mul.neg, %0
store i32 %sub, ptr %S, align 4, !tbaa !5
%div1 = sdiv i32 %sub, 60
%mul2.neg = mul nsw i32 %div1, -60
%sub3 = add i32 %mul2.neg, %sub
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub3)
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int d(int a[],int b);
int main(void)
{
int n,t,i,a,arr[100];
scanf("%d %d",&n,&t);
for (i=0; i<n; i++)
{
scanf("%d",&a);
arr[i]=a;
}
int c;
c=d(arr,t);
printf("%d",c);
return 0;
}
int d(int a[],int b)
{
int i,j;
int s=0;
for (i=0;i<100;i++)
{
j=86400-a[i];
s+=j;
if (s>=b) break;
}
return i+1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23975/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
%t = alloca i32, align 4
%a = alloca i32, align 4
%arr = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %arr) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %for.end
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 %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [100 x i32], ptr %arr, i64 0, i64 %indvars.iv
store i32 %1, 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.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%4 = load i32, ptr %t, align 4, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.inc.i.3, %for.end
%indvars.iv.i = phi i64 [ 0, %for.end ], [ %indvars.iv.next.i.3, %for.inc.i.3 ]
%s.08.i = phi i32 [ 0, %for.end ], [ %add.i.3, %for.inc.i.3 ]
%arrayidx.i = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx.i, align 16, !tbaa !5
%reass.sub.i = sub i32 %s.08.i, %5
%add.i = add i32 %reass.sub.i, 86400
%cmp1.not.i = icmp slt i32 %add.i, %4
br i1 %cmp1.not.i, label %for.inc.i, label %for.end.split.loop.exit.i
for.inc.i: ; preds = %for.body.i
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.next.i
%6 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%reass.sub.i.1 = sub i32 %add.i, %6
%add.i.1 = add i32 %reass.sub.i.1, 86400
%cmp1.not.i.1 = icmp slt i32 %add.i.1, %4
br i1 %cmp1.not.i.1, label %for.inc.i.1, label %for.end.split.loop.exit.i
for.inc.i.1: ; preds = %for.inc.i
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.next.i.1
%7 = load i32, ptr %arrayidx.i.2, align 8, !tbaa !5
%reass.sub.i.2 = sub i32 %add.i.1, %7
%add.i.2 = add i32 %reass.sub.i.2, 86400
%cmp1.not.i.2 = icmp slt i32 %add.i.2, %4
br i1 %cmp1.not.i.2, label %for.inc.i.2, label %for.end.split.loop.exit.i
for.inc.i.2: ; preds = %for.inc.i.1
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.next.i.2
%8 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5
%reass.sub.i.3 = sub i32 %add.i.2, %8
%add.i.3 = add i32 %reass.sub.i.3, 86400
%cmp1.not.i.3 = icmp slt i32 %add.i.3, %4
br i1 %cmp1.not.i.3, label %for.inc.i.3, label %for.end.split.loop.exit.i
for.inc.i.3: ; preds = %for.inc.i.2
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, 100
br i1 %exitcond.not.i.3, label %d.exit, label %for.body.i, !llvm.loop !11
for.end.split.loop.exit.i: ; preds = %for.inc.i.2, %for.inc.i.1, %for.inc.i, %for.body.i
%indvars.iv.i.lcssa = phi i64 [ %indvars.iv.i, %for.body.i ], [ %indvars.iv.next.i, %for.inc.i ], [ %indvars.iv.next.i.1, %for.inc.i.1 ], [ %indvars.iv.next.i.2, %for.inc.i.2 ]
%9 = trunc i64 %indvars.iv.i.lcssa to i32
%10 = add nuw nsw i32 %9, 1
br label %d.exit
d.exit: ; preds = %for.inc.i.3, %for.end.split.loop.exit.i
%i.0.lcssa.i = phi i32 [ %10, %for.end.split.loop.exit.i ], [ 101, %for.inc.i.3 ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %arr) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @d(ptr nocapture noundef readonly %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
br label %for.body
for.body: ; preds = %for.inc.3, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.inc.3 ]
%s.08 = phi i32 [ 0, %entry ], [ %add.3, %for.inc.3 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%reass.sub = sub i32 %s.08, %0
%add = add i32 %reass.sub, 86400
%cmp1.not = icmp slt i32 %add, %b
br i1 %cmp1.not, label %for.inc, label %for.end.split.loop.exit
for.inc: ; preds = %for.body
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%reass.sub.1 = sub i32 %add, %1
%add.1 = add i32 %reass.sub.1, 86400
%cmp1.not.1 = icmp slt i32 %add.1, %b
br i1 %cmp1.not.1, label %for.inc.1, label %for.end.split.loop.exit
for.inc.1: ; preds = %for.inc
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1
%2 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%reass.sub.2 = sub i32 %add.1, %2
%add.2 = add i32 %reass.sub.2, 86400
%cmp1.not.2 = icmp slt i32 %add.2, %b
br i1 %cmp1.not.2, label %for.inc.2, label %for.end.split.loop.exit
for.inc.2: ; preds = %for.inc.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%reass.sub.3 = sub i32 %add.2, %3
%add.3 = add i32 %reass.sub.3, 86400
%cmp1.not.3 = icmp slt i32 %add.3, %b
br i1 %cmp1.not.3, label %for.inc.3, label %for.end.split.loop.exit
for.inc.3: ; preds = %for.inc.2
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 100
br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !11
for.end.split.loop.exit: ; preds = %for.inc.2, %for.inc.1, %for.inc, %for.body
%indvars.iv.lcssa = phi i64 [ %indvars.iv, %for.body ], [ %indvars.iv.next, %for.inc ], [ %indvars.iv.next.1, %for.inc.1 ], [ %indvars.iv.next.2, %for.inc.2 ]
%4 = trunc i64 %indvars.iv.lcssa to i32
%5 = add nuw nsw i32 %4, 1
br label %for.end
for.end: ; preds = %for.inc.3, %for.end.split.loop.exit
%i.0.lcssa = phi i32 [ %5, %for.end.split.loop.exit ], [ 101, %for.inc.3 ]
ret i32 %i.0.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: 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 = { 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}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.