Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main(void){
int i,j,k,n,b,f,r,v,data[4][3][10]={0};
scanf("%d\n",&n);
for(i=0;i < n;i++){
scanf("%d %d %d %d\n",&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]);
if (k == 9){
printf("\n");
}
}
if (j == 2 && i != 3){
printf("####################\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236459/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236459/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\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
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%data = 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 %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
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.inc37.preheader
for.body: ; preds = %entry, %for.body
%i.052 = 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 %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
%inc = add nuw nsw i32 %i.052, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.inc37.preheader, !llvm.loop !9
for.inc37.preheader: ; preds = %for.body, %entry
br label %for.inc37
for.inc37: ; preds = %for.inc37.preheader, %for.inc37
%indvars.iv139 = phi i64 [ %indvars.iv.next, %for.inc37 ], [ 0, %for.inc37.preheader ]
%arrayidx22 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, 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.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 1
%.pre = load i32, ptr %arrayidx22.1.phi.trans.insert, align 4, !tbaa !5
%call23.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre)
%arrayidx22.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 2
%.pre82 = load i32, ptr %arrayidx22.2.phi.trans.insert, align 8, !tbaa !5
%call23.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre82)
%arrayidx22.3.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 3
%.pre83 = load i32, ptr %arrayidx22.3.phi.trans.insert, align 4, !tbaa !5
%call23.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre83)
%arrayidx22.4.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 4
%.pre84 = load i32, ptr %arrayidx22.4.phi.trans.insert, align 8, !tbaa !5
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre84)
%arrayidx22.5.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 5
%.pre85 = load i32, ptr %arrayidx22.5.phi.trans.insert, align 4, !tbaa !5
%call23.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre85)
%arrayidx22.6.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 6
%.pre86 = load i32, ptr %arrayidx22.6.phi.trans.insert, align 8, !tbaa !5
%call23.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre86)
%arrayidx22.7.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 7
%.pre87 = load i32, ptr %arrayidx22.7.phi.trans.insert, align 4, !tbaa !5
%call23.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre87)
%arrayidx22.8.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 8
%.pre88 = load i32, ptr %arrayidx22.8.phi.trans.insert, align 8, !tbaa !5
%call23.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre88)
%arrayidx22.9.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 0, i64 9
%.pre89 = load i32, ptr %arrayidx22.9.phi.trans.insert, align 4, !tbaa !5
%call23.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre89)
%putchar.9 = call i32 @putchar(i32 10)
%arrayidx22.159.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 0
%.pre90 = load i32, ptr %arrayidx22.159.phi.trans.insert, align 8, !tbaa !5
%call23.160 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre90)
%arrayidx22.1.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 1
%.pre91 = load i32, ptr %arrayidx22.1.1.phi.trans.insert, align 4, !tbaa !5
%call23.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre91)
%arrayidx22.2.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 2
%.pre92 = load i32, ptr %arrayidx22.2.1.phi.trans.insert, align 8, !tbaa !5
%call23.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre92)
%arrayidx22.3.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 3
%.pre93 = load i32, ptr %arrayidx22.3.1.phi.trans.insert, align 4, !tbaa !5
%call23.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre93)
%arrayidx22.4.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 4
%.pre94 = load i32, ptr %arrayidx22.4.1.phi.trans.insert, align 8, !tbaa !5
%call23.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre94)
%arrayidx22.5.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 5
%.pre95 = load i32, ptr %arrayidx22.5.1.phi.trans.insert, align 4, !tbaa !5
%call23.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre95)
%arrayidx22.6.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 6
%.pre96 = load i32, ptr %arrayidx22.6.1.phi.trans.insert, align 8, !tbaa !5
%call23.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre96)
%arrayidx22.7.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 7
%.pre97 = load i32, ptr %arrayidx22.7.1.phi.trans.insert, align 4, !tbaa !5
%call23.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre97)
%arrayidx22.8.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 8
%.pre98 = load i32, ptr %arrayidx22.8.1.phi.trans.insert, align 8, !tbaa !5
%call23.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre98)
%arrayidx22.9.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 1, i64 9
%.pre99 = load i32, ptr %arrayidx22.9.1.phi.trans.insert, align 4, !tbaa !5
%call23.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre99)
%putchar.9.1 = call i32 @putchar(i32 10)
%arrayidx22.264.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 0
%.pre100 = load i32, ptr %arrayidx22.264.phi.trans.insert, align 8, !tbaa !5
%call23.265 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre100)
%arrayidx22.1.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 1
%.pre101 = load i32, ptr %arrayidx22.1.2.phi.trans.insert, align 4, !tbaa !5
%call23.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre101)
%arrayidx22.2.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 2
%.pre102 = load i32, ptr %arrayidx22.2.2.phi.trans.insert, align 8, !tbaa !5
%call23.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre102)
%arrayidx22.3.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 3
%.pre103 = load i32, ptr %arrayidx22.3.2.phi.trans.insert, align 4, !tbaa !5
%call23.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre103)
%arrayidx22.4.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 4
%.pre104 = load i32, ptr %arrayidx22.4.2.phi.trans.insert, align 8, !tbaa !5
%call23.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre104)
%arrayidx22.5.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 5
%.pre105 = load i32, ptr %arrayidx22.5.2.phi.trans.insert, align 4, !tbaa !5
%call23.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre105)
%arrayidx22.6.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 6
%.pre106 = load i32, ptr %arrayidx22.6.2.phi.trans.insert, align 8, !tbaa !5
%call23.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre106)
%arrayidx22.7.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 7
%.pre107 = load i32, ptr %arrayidx22.7.2.phi.trans.insert, align 4, !tbaa !5
%call23.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre107)
%arrayidx22.8.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 8
%.pre108 = load i32, ptr %arrayidx22.8.2.phi.trans.insert, align 8, !tbaa !5
%call23.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre108)
%arrayidx22.9.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 %indvars.iv139, i64 2, i64 9
%.pre109 = load i32, ptr %arrayidx22.9.2.phi.trans.insert, align 4, !tbaa !5
%call23.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre109)
%putchar.9.2 = call i32 @putchar(i32 10)
%puts.2 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next = add nuw nsw i64 %indvars.iv139, 1
%cmp30.not = icmp eq i64 %indvars.iv.next, 3
br i1 %cmp30.not, label %for.end39, label %for.inc37
for.end39: ; preds = %for.inc37
%arrayidx22.us = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 0
%8 = load i32, ptr %arrayidx22.us, align 8, !tbaa !5
%call23.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx22.us.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 1
%.pre110 = load i32, ptr %arrayidx22.us.1.phi.trans.insert, align 4, !tbaa !5
%call23.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre110)
%arrayidx22.us.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 2
%.pre111 = load i32, ptr %arrayidx22.us.2.phi.trans.insert, align 16, !tbaa !5
%call23.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre111)
%arrayidx22.us.3.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 3
%.pre112 = load i32, ptr %arrayidx22.us.3.phi.trans.insert, align 4, !tbaa !5
%call23.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre112)
%arrayidx22.us.4.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 4
%.pre113 = load i32, ptr %arrayidx22.us.4.phi.trans.insert, align 8, !tbaa !5
%call23.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre113)
%arrayidx22.us.5.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 5
%.pre114 = load i32, ptr %arrayidx22.us.5.phi.trans.insert, align 4, !tbaa !5
%call23.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre114)
%arrayidx22.us.6.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 6
%.pre115 = load i32, ptr %arrayidx22.us.6.phi.trans.insert, align 16, !tbaa !5
%call23.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre115)
%arrayidx22.us.7.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 7
%.pre116 = load i32, ptr %arrayidx22.us.7.phi.trans.insert, align 4, !tbaa !5
%call23.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre116)
%arrayidx22.us.8.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 8
%.pre117 = load i32, ptr %arrayidx22.us.8.phi.trans.insert, align 8, !tbaa !5
%call23.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre117)
%arrayidx22.us.9.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 0, i64 9
%.pre118 = load i32, ptr %arrayidx22.us.9.phi.trans.insert, align 4, !tbaa !5
%call23.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre118)
%putchar.us.9 = call i32 @putchar(i32 10)
%arrayidx22.us.171 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 0
%9 = load i32, ptr %arrayidx22.us.171, align 16, !tbaa !5
%call23.us.172 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%arrayidx22.us.1.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 1
%.pre119 = load i32, ptr %arrayidx22.us.1.1.phi.trans.insert, align 4, !tbaa !5
%call23.us.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre119)
%arrayidx22.us.2.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 2
%.pre120 = load i32, ptr %arrayidx22.us.2.1.phi.trans.insert, align 8, !tbaa !5
%call23.us.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre120)
%arrayidx22.us.3.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 3
%.pre121 = load i32, ptr %arrayidx22.us.3.1.phi.trans.insert, align 4, !tbaa !5
%call23.us.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre121)
%arrayidx22.us.4.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 4
%.pre122 = load i32, ptr %arrayidx22.us.4.1.phi.trans.insert, align 16, !tbaa !5
%call23.us.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre122)
%arrayidx22.us.5.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 5
%.pre123 = load i32, ptr %arrayidx22.us.5.1.phi.trans.insert, align 4, !tbaa !5
%call23.us.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre123)
%arrayidx22.us.6.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 6
%.pre124 = load i32, ptr %arrayidx22.us.6.1.phi.trans.insert, align 8, !tbaa !5
%call23.us.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre124)
%arrayidx22.us.7.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 7
%.pre125 = load i32, ptr %arrayidx22.us.7.1.phi.trans.insert, align 4, !tbaa !5
%call23.us.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre125)
%arrayidx22.us.8.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 8
%.pre126 = load i32, ptr %arrayidx22.us.8.1.phi.trans.insert, align 16, !tbaa !5
%call23.us.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre126)
%arrayidx22.us.9.1.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 1, i64 9
%.pre127 = load i32, ptr %arrayidx22.us.9.1.phi.trans.insert, align 4, !tbaa !5
%call23.us.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre127)
%putchar.us.9.1 = call i32 @putchar(i32 10)
%arrayidx22.us.276 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 0
%10 = load i32, ptr %arrayidx22.us.276, align 8, !tbaa !5
%call23.us.277 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%arrayidx22.us.1.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 1
%.pre128 = load i32, ptr %arrayidx22.us.1.2.phi.trans.insert, align 4, !tbaa !5
%call23.us.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre128)
%arrayidx22.us.2.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 2
%.pre129 = load i32, ptr %arrayidx22.us.2.2.phi.trans.insert, align 16, !tbaa !5
%call23.us.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre129)
%arrayidx22.us.3.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 3
%.pre130 = load i32, ptr %arrayidx22.us.3.2.phi.trans.insert, align 4, !tbaa !5
%call23.us.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre130)
%arrayidx22.us.4.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 4
%.pre131 = load i32, ptr %arrayidx22.us.4.2.phi.trans.insert, align 8, !tbaa !5
%call23.us.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre131)
%arrayidx22.us.5.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 5
%.pre132 = load i32, ptr %arrayidx22.us.5.2.phi.trans.insert, align 4, !tbaa !5
%call23.us.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre132)
%arrayidx22.us.6.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 6
%.pre133 = load i32, ptr %arrayidx22.us.6.2.phi.trans.insert, align 16, !tbaa !5
%call23.us.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre133)
%arrayidx22.us.7.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 7
%.pre134 = load i32, ptr %arrayidx22.us.7.2.phi.trans.insert, align 4, !tbaa !5
%call23.us.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre134)
%arrayidx22.us.8.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 8
%.pre135 = load i32, ptr %arrayidx22.us.8.2.phi.trans.insert, align 8, !tbaa !5
%call23.us.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre135)
%arrayidx22.us.9.2.phi.trans.insert = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %data, i64 0, i64 3, i64 2, i64 9
%.pre136 = load i32, ptr %arrayidx22.us.9.2.phi.trans.insert, align 4, !tbaa !5
%call23.us.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.pre136)
%putchar.us.9.2 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %data) #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 @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 room[4][3][10]={0};
int n,b,f,r,v;
int i,j,k;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d%d%d%d",&b,&f,&r,&v);
room[b-1][f-1][r-1]+=v;
}
for(i=0;i<=3;i++){
for(j=0;j<=2;j++){
for(k=0;k<=9;k++){
printf(" %d",room[i][j][k]);
}printf("\n");
}if(i!=3){
printf("####################\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236501/source.c"
target datalayout = "e-m:e-p270: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:
%room = 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 %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
%cmp.not45 = icmp slt i32 %0, 1
br i1 %cmp.not45, label %for.cond11.preheader.preheader, label %for.body
for.body: ; preds = %entry, %for.body
%i.046 = 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 %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
%inc = add nuw nsw i32 %i.046, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.046, %6
br i1 %cmp.not.not, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 %room, 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 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: 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 n, b, f, r, v;
int i, j, k;
int A[4][3][10] = {0};
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(i=0; i<4; i++) {
if(i != 0) printf("####################\n");
for(j=0; j<3; j++) {
for(k=0; k<10; k++) {
printf(" %d", A[i][j][k]);
}
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236545/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236545/source.c"
target datalayout = "e-m:e-p270: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.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
; 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
%A = 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 %A) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %A, 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.body10.peel.next
for.body10.peel.next: ; preds = %for.body, %entry
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call25.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.pre)
%arrayidx24.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 1
%1 = load i32, ptr %arrayidx24.1.peel, align 4, !tbaa !5
%call25.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%arrayidx24.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 2
%2 = load i32, ptr %arrayidx24.2.peel, align 8, !tbaa !5
%call25.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2)
%arrayidx24.3.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 3
%3 = load i32, ptr %arrayidx24.3.peel, align 4, !tbaa !5
%call25.3.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %3)
%arrayidx24.4.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 4
%4 = load i32, ptr %arrayidx24.4.peel, align 16, !tbaa !5
%call25.4.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %4)
%arrayidx24.5.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 5
%5 = load i32, ptr %arrayidx24.5.peel, align 4, !tbaa !5
%call25.5.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %5)
%arrayidx24.6.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 6
%6 = load i32, ptr %arrayidx24.6.peel, align 8, !tbaa !5
%call25.6.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %6)
%arrayidx24.7.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 7
%7 = load i32, ptr %arrayidx24.7.peel, align 4, !tbaa !5
%call25.7.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %7)
%arrayidx24.8.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 8
%8 = load i32, ptr %arrayidx24.8.peel, align 16, !tbaa !5
%call25.8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
%arrayidx24.9.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 0, i64 9
%9 = load i32, ptr %arrayidx24.9.peel, align 4, !tbaa !5
%call25.9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
%putchar.peel = call i32 @putchar(i32 10)
%arrayidx24.152.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 0
%10 = load i32, ptr %arrayidx24.152.peel, align 8, !tbaa !5
%call25.153.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
%arrayidx24.1.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 1
%11 = load i32, ptr %arrayidx24.1.1.peel, align 4, !tbaa !5
%call25.1.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %11)
%arrayidx24.2.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 2
%12 = load i32, ptr %arrayidx24.2.1.peel, align 16, !tbaa !5
%call25.2.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
%arrayidx24.3.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 3
%13 = load i32, ptr %arrayidx24.3.1.peel, align 4, !tbaa !5
%call25.3.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %13)
%arrayidx24.4.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 4
%14 = load i32, ptr %arrayidx24.4.1.peel, align 8, !tbaa !5
%call25.4.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %14)
%arrayidx24.5.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 5
%15 = load i32, ptr %arrayidx24.5.1.peel, align 4, !tbaa !5
%call25.5.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %15)
%arrayidx24.6.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 6
%16 = load i32, ptr %arrayidx24.6.1.peel, align 16, !tbaa !5
%call25.6.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %16)
%arrayidx24.7.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 7
%17 = load i32, ptr %arrayidx24.7.1.peel, align 4, !tbaa !5
%call25.7.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %17)
%arrayidx24.8.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 8
%18 = load i32, ptr %arrayidx24.8.1.peel, align 8, !tbaa !5
%call25.8.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18)
%arrayidx24.9.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 1, i64 9
%19 = load i32, ptr %arrayidx24.9.1.peel, align 4, !tbaa !5
%call25.9.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %19)
%putchar.1.peel = call i32 @putchar(i32 10)
%arrayidx24.254.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 0
%20 = load i32, ptr %arrayidx24.254.peel, align 16, !tbaa !5
%call25.255.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %20)
%arrayidx24.1.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 1
%21 = load i32, ptr %arrayidx24.1.2.peel, align 4, !tbaa !5
%call25.1.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %21)
%arrayidx24.2.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 2
%22 = load i32, ptr %arrayidx24.2.2.peel, align 8, !tbaa !5
%call25.2.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
%arrayidx24.3.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 3
%23 = load i32, ptr %arrayidx24.3.2.peel, align 4, !tbaa !5
%call25.3.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %23)
%arrayidx24.4.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 4
%24 = load i32, ptr %arrayidx24.4.2.peel, align 16, !tbaa !5
%call25.4.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %24)
%arrayidx24.5.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 5
%25 = load i32, ptr %arrayidx24.5.2.peel, align 4, !tbaa !5
%call25.5.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %25)
%arrayidx24.6.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 6
%26 = load i32, ptr %arrayidx24.6.2.peel, align 8, !tbaa !5
%call25.6.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %26)
%arrayidx24.7.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 7
%27 = load i32, ptr %arrayidx24.7.2.peel, align 4, !tbaa !5
%call25.7.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %27)
%arrayidx24.8.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 8
%28 = load i32, ptr %arrayidx24.8.2.peel, align 16, !tbaa !5
%call25.8.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %28)
%arrayidx24.9.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 0, i64 2, i64 9
%29 = load i32, ptr %arrayidx24.9.2.peel, align 4, !tbaa !5
%call25.9.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %29)
%putchar.2.peel = call i32 @putchar(i32 10)
br label %if.end
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)
%30 = load i32, ptr %v, align 4, !tbaa !5
%31 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %31, -1
%idxprom = sext i32 %sub to i64
%32 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %32, -1
%idxprom3 = sext i32 %sub2 to i64
%33 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %33, -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
%34 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %34, %30
store i32 %add, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.046, 1
%35 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %35
br i1 %cmp, label %for.body, label %for.body10.peel.next, !llvm.loop !9
if.end: ; preds = %for.body10.peel.next, %if.end
%indvars.iv = phi i64 [ 1, %for.body10.peel.next ], [ %indvars.iv.next, %if.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%arrayidx24 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 0
%36 = load i32, ptr %arrayidx24, align 8, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %36)
%arrayidx24.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 1
%37 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%call25.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %37)
%arrayidx24.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 2
%38 = load i32, ptr %arrayidx24.2, align 8, !tbaa !5
%call25.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %38)
%arrayidx24.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 3
%39 = load i32, ptr %arrayidx24.3, align 4, !tbaa !5
%call25.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %39)
%arrayidx24.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 4
%40 = load i32, ptr %arrayidx24.4, align 8, !tbaa !5
%call25.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %40)
%arrayidx24.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 5
%41 = load i32, ptr %arrayidx24.5, align 4, !tbaa !5
%call25.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %41)
%arrayidx24.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 6
%42 = load i32, ptr %arrayidx24.6, align 8, !tbaa !5
%call25.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %42)
%arrayidx24.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 7
%43 = load i32, ptr %arrayidx24.7, align 4, !tbaa !5
%call25.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %43)
%arrayidx24.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 8
%44 = load i32, ptr %arrayidx24.8, align 8, !tbaa !5
%call25.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %44)
%arrayidx24.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 0, i64 9
%45 = load i32, ptr %arrayidx24.9, align 4, !tbaa !5
%call25.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %45)
%putchar = call i32 @putchar(i32 10)
%arrayidx24.152 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 0
%46 = load i32, ptr %arrayidx24.152, align 8, !tbaa !5
%call25.153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %46)
%arrayidx24.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 1
%47 = load i32, ptr %arrayidx24.1.1, align 4, !tbaa !5
%call25.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %47)
%arrayidx24.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 2
%48 = load i32, ptr %arrayidx24.2.1, align 8, !tbaa !5
%call25.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %48)
%arrayidx24.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 3
%49 = load i32, ptr %arrayidx24.3.1, align 4, !tbaa !5
%call25.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %49)
%arrayidx24.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 4
%50 = load i32, ptr %arrayidx24.4.1, align 8, !tbaa !5
%call25.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %50)
%arrayidx24.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 5
%51 = load i32, ptr %arrayidx24.5.1, align 4, !tbaa !5
%call25.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %51)
%arrayidx24.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 6
%52 = load i32, ptr %arrayidx24.6.1, align 8, !tbaa !5
%call25.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %52)
%arrayidx24.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 7
%53 = load i32, ptr %arrayidx24.7.1, align 4, !tbaa !5
%call25.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %53)
%arrayidx24.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 8
%54 = load i32, ptr %arrayidx24.8.1, align 8, !tbaa !5
%call25.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %54)
%arrayidx24.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 1, i64 9
%55 = load i32, ptr %arrayidx24.9.1, align 4, !tbaa !5
%call25.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %55)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx24.254 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 0
%56 = load i32, ptr %arrayidx24.254, align 8, !tbaa !5
%call25.255 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %56)
%arrayidx24.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 1
%57 = load i32, ptr %arrayidx24.1.2, align 4, !tbaa !5
%call25.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %57)
%arrayidx24.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 2
%58 = load i32, ptr %arrayidx24.2.2, align 8, !tbaa !5
%call25.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %58)
%arrayidx24.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 3
%59 = load i32, ptr %arrayidx24.3.2, align 4, !tbaa !5
%call25.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %59)
%arrayidx24.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 4
%60 = load i32, ptr %arrayidx24.4.2, align 8, !tbaa !5
%call25.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %60)
%arrayidx24.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 5
%61 = load i32, ptr %arrayidx24.5.2, align 4, !tbaa !5
%call25.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %61)
%arrayidx24.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 6
%62 = load i32, ptr %arrayidx24.6.2, align 8, !tbaa !5
%call25.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %62)
%arrayidx24.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 7
%63 = load i32, ptr %arrayidx24.7.2, align 4, !tbaa !5
%call25.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %63)
%arrayidx24.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 8
%64 = load i32, ptr %arrayidx24.8.2, align 8, !tbaa !5
%call25.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %64)
%arrayidx24.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %A, i64 0, i64 %indvars.iv, i64 2, i64 9
%65 = load i32, ptr %arrayidx24.9.2, align 4, !tbaa !5
%call25.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %65)
%putchar.2 = call i32 @putchar(i32 10)
%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 %if.end, !llvm.loop !11
for.end35: ; preds = %if.end
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %A) #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 @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}
!12 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int main(void){
int n, b, f, r, v;
int cou1, cou2, cou3, cou4;
int da [4] [3] [10];
for(cou1 = 0; cou1 < 4; cou1++){
for(cou2 = 0; cou2 < 3; cou2++){
for(cou3 = 0; cou3 < 10; cou3++){
da [cou1] [cou2] [cou3] = 0;
}
}
}
scanf("%d", &n);
for(cou1 = 0; cou1 < n; cou1++){
scanf("%d %d %d %d", &b, &f, &r, &v);
da [b - 1] [f - 1] [r - 1] += v;
}
for(cou1 = 0; cou1 < 4; cou1++){
for(cou2 = 0; cou2 < 3; cou2++){
for(cou3 = 0; cou3 < 10; cou3++){
printf(" %d", da [cou1] [cou2] [cou3]);
}
printf("\n");
}
if(cou1 < 3) printf("####################\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236589/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236589/source.c"
target datalayout = "e-m:e-p270: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
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%da = 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 %da) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %da, 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
%cou1.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 %da, 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 %cou1.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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 %da, 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 480, ptr nonnull %da) #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 @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(void)
{
int room[4][3][10] = {0};
int n, b, f, r, v, i, j, k;
scanf("%d\n", &n);
for (i = 0; i < n; i++) {
scanf("%d %d %d %d", &b, &f, &r, &v);
room[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", room[b][f][r]);
}
printf("\n");
}
if (b < 3) printf("####################\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236639/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236639/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [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 [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 %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
%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 %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.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 %room, 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 = icmp slt i32 %12, 3
br i1 %cmp31, label %for.inc33, label %for.end35
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 %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: 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>
double max(double a, double b)
{
return a > b ? a : b;
}
int main()
{
double a, b, c, d;
double max1, max2;
scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
max1 = max(3.0 * a / 10.0, a - a / 250.0 * c);
max2 = max(3.0 * b / 10.0, b - b / 250.0 * d);
if(max1 > max2)
printf("Misha\n");
else if(max1 == max2)
printf("Tie\n");
else
printf("Vasya\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23669/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23669/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@str = private unnamed_addr constant [6 x i8] c"Vasya\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Tie\00", align 1
@str.5 = private unnamed_addr constant [6 x i8] c"Misha\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @max(double noundef %a, double noundef %b) local_unnamed_addr #0 {
entry:
%cmp = fcmp ogt double %a, %b
%cond = select i1 %cmp, double %a, double %b
ret double %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %c, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = fmul <2 x double> %5, <double 3.000000e+00, double 3.000000e+00>
%7 = fdiv <2 x double> %6, <double 1.000000e+01, double 1.000000e+01>
%8 = fdiv <2 x double> %5, <double -2.500000e+02, double -2.500000e+02>
%9 = insertelement <2 x double> poison, double %1, i64 0
%10 = insertelement <2 x double> %9, double %3, i64 1
%11 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> %10, <2 x double> %5)
%12 = fcmp ogt <2 x double> %7, %11
%13 = select <2 x i1> %12, <2 x double> %7, <2 x double> %11
%14 = extractelement <2 x double> %13, i64 0
%15 = extractelement <2 x double> %13, i64 1
%cmp = fcmp ogt double %14, %15
%cmp11 = fcmp oeq double %14, %15
%str.4.str = select i1 %cmp11, ptr @str.4, ptr @str
%str.4.sink = select i1 %cmp, ptr @str.5, ptr %str.4.str
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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
; 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>) #5
attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int count[4][3][10] = {};
int N, i, j, k;
scanf("%d", &N);
for (i = 0; i < N; i++) {
int b, f, r, v;
scanf("%d %d %d %d", &b, &f, &r, &v);
count[b - 1][f - 1][r - 1] += v;
}
for (i = 0; i < 4; i++) {
if (i > 0) printf("####################\n");
for (j = 0; j < 3; j++) {
for (k = 0; k < 10; k++) {
printf(" %d", count[i][j][k]);
}
printf("\n");
}
}
return 0;
}// Your code here!
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236732/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236732/source.c"
target datalayout = "e-m:e-p270: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.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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%count = 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 %count) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %count, 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
%cmp45 = icmp sgt i32 %0, 0
br i1 %cmp45, label %for.body, label %for.body10.peel.next
for.body10.peel.next: ; preds = %for.body, %entry
%.pre = load i32, ptr %count, align 16, !tbaa !5
%call25.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.pre)
%arrayidx24.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 1
%1 = load i32, ptr %arrayidx24.1.peel, align 4, !tbaa !5
%call25.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%arrayidx24.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 2
%2 = load i32, ptr %arrayidx24.2.peel, align 8, !tbaa !5
%call25.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2)
%arrayidx24.3.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 3
%3 = load i32, ptr %arrayidx24.3.peel, align 4, !tbaa !5
%call25.3.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %3)
%arrayidx24.4.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 4
%4 = load i32, ptr %arrayidx24.4.peel, align 16, !tbaa !5
%call25.4.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %4)
%arrayidx24.5.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 5
%5 = load i32, ptr %arrayidx24.5.peel, align 4, !tbaa !5
%call25.5.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %5)
%arrayidx24.6.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 6
%6 = load i32, ptr %arrayidx24.6.peel, align 8, !tbaa !5
%call25.6.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %6)
%arrayidx24.7.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 7
%7 = load i32, ptr %arrayidx24.7.peel, align 4, !tbaa !5
%call25.7.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %7)
%arrayidx24.8.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 8
%8 = load i32, ptr %arrayidx24.8.peel, align 16, !tbaa !5
%call25.8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
%arrayidx24.9.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 0, i64 9
%9 = load i32, ptr %arrayidx24.9.peel, align 4, !tbaa !5
%call25.9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
%putchar.peel = call i32 @putchar(i32 10)
%arrayidx24.152.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 0
%10 = load i32, ptr %arrayidx24.152.peel, align 8, !tbaa !5
%call25.153.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
%arrayidx24.1.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 1
%11 = load i32, ptr %arrayidx24.1.1.peel, align 4, !tbaa !5
%call25.1.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %11)
%arrayidx24.2.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 2
%12 = load i32, ptr %arrayidx24.2.1.peel, align 16, !tbaa !5
%call25.2.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12)
%arrayidx24.3.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 3
%13 = load i32, ptr %arrayidx24.3.1.peel, align 4, !tbaa !5
%call25.3.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %13)
%arrayidx24.4.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 4
%14 = load i32, ptr %arrayidx24.4.1.peel, align 8, !tbaa !5
%call25.4.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %14)
%arrayidx24.5.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 5
%15 = load i32, ptr %arrayidx24.5.1.peel, align 4, !tbaa !5
%call25.5.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %15)
%arrayidx24.6.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 6
%16 = load i32, ptr %arrayidx24.6.1.peel, align 16, !tbaa !5
%call25.6.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %16)
%arrayidx24.7.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 7
%17 = load i32, ptr %arrayidx24.7.1.peel, align 4, !tbaa !5
%call25.7.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %17)
%arrayidx24.8.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 8
%18 = load i32, ptr %arrayidx24.8.1.peel, align 8, !tbaa !5
%call25.8.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18)
%arrayidx24.9.1.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 1, i64 9
%19 = load i32, ptr %arrayidx24.9.1.peel, align 4, !tbaa !5
%call25.9.1.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %19)
%putchar.1.peel = call i32 @putchar(i32 10)
%arrayidx24.254.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 0
%20 = load i32, ptr %arrayidx24.254.peel, align 16, !tbaa !5
%call25.255.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %20)
%arrayidx24.1.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 1
%21 = load i32, ptr %arrayidx24.1.2.peel, align 4, !tbaa !5
%call25.1.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %21)
%arrayidx24.2.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 2
%22 = load i32, ptr %arrayidx24.2.2.peel, align 8, !tbaa !5
%call25.2.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
%arrayidx24.3.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 3
%23 = load i32, ptr %arrayidx24.3.2.peel, align 4, !tbaa !5
%call25.3.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %23)
%arrayidx24.4.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 4
%24 = load i32, ptr %arrayidx24.4.2.peel, align 16, !tbaa !5
%call25.4.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %24)
%arrayidx24.5.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 5
%25 = load i32, ptr %arrayidx24.5.2.peel, align 4, !tbaa !5
%call25.5.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %25)
%arrayidx24.6.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 6
%26 = load i32, ptr %arrayidx24.6.2.peel, align 8, !tbaa !5
%call25.6.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %26)
%arrayidx24.7.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 7
%27 = load i32, ptr %arrayidx24.7.2.peel, align 4, !tbaa !5
%call25.7.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %27)
%arrayidx24.8.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 8
%28 = load i32, ptr %arrayidx24.8.2.peel, align 16, !tbaa !5
%call25.8.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %28)
%arrayidx24.9.2.peel = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 0, i64 2, i64 9
%29 = load i32, ptr %arrayidx24.9.2.peel, align 4, !tbaa !5
%call25.9.2.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %29)
%putchar.2.peel = call i32 @putchar(i32 10)
br label %if.end
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)
%30 = load i32, ptr %v, align 4, !tbaa !5
%31 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %31, -1
%idxprom = sext i32 %sub to i64
%32 = load i32, ptr %f, align 4, !tbaa !5
%sub2 = add nsw i32 %32, -1
%idxprom3 = sext i32 %sub2 to i64
%33 = load i32, ptr %r, align 4, !tbaa !5
%sub5 = add nsw i32 %33, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %idxprom, i64 %idxprom3, i64 %idxprom6
%34 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %34, %30
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
%35 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %35
br i1 %cmp, label %for.body, label %for.body10.peel.next, !llvm.loop !9
if.end: ; preds = %for.body10.peel.next, %if.end
%indvars.iv = phi i64 [ 1, %for.body10.peel.next ], [ %indvars.iv.next, %if.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%arrayidx24 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 0
%36 = load i32, ptr %arrayidx24, align 8, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %36)
%arrayidx24.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 1
%37 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%call25.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %37)
%arrayidx24.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 2
%38 = load i32, ptr %arrayidx24.2, align 8, !tbaa !5
%call25.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %38)
%arrayidx24.3 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 3
%39 = load i32, ptr %arrayidx24.3, align 4, !tbaa !5
%call25.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %39)
%arrayidx24.4 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 4
%40 = load i32, ptr %arrayidx24.4, align 8, !tbaa !5
%call25.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %40)
%arrayidx24.5 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 5
%41 = load i32, ptr %arrayidx24.5, align 4, !tbaa !5
%call25.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %41)
%arrayidx24.6 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 6
%42 = load i32, ptr %arrayidx24.6, align 8, !tbaa !5
%call25.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %42)
%arrayidx24.7 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 7
%43 = load i32, ptr %arrayidx24.7, align 4, !tbaa !5
%call25.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %43)
%arrayidx24.8 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 8
%44 = load i32, ptr %arrayidx24.8, align 8, !tbaa !5
%call25.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %44)
%arrayidx24.9 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 0, i64 9
%45 = load i32, ptr %arrayidx24.9, align 4, !tbaa !5
%call25.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %45)
%putchar = call i32 @putchar(i32 10)
%arrayidx24.152 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 0
%46 = load i32, ptr %arrayidx24.152, align 8, !tbaa !5
%call25.153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %46)
%arrayidx24.1.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 1
%47 = load i32, ptr %arrayidx24.1.1, align 4, !tbaa !5
%call25.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %47)
%arrayidx24.2.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 2
%48 = load i32, ptr %arrayidx24.2.1, align 8, !tbaa !5
%call25.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %48)
%arrayidx24.3.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 3
%49 = load i32, ptr %arrayidx24.3.1, align 4, !tbaa !5
%call25.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %49)
%arrayidx24.4.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 4
%50 = load i32, ptr %arrayidx24.4.1, align 8, !tbaa !5
%call25.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %50)
%arrayidx24.5.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 5
%51 = load i32, ptr %arrayidx24.5.1, align 4, !tbaa !5
%call25.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %51)
%arrayidx24.6.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 6
%52 = load i32, ptr %arrayidx24.6.1, align 8, !tbaa !5
%call25.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %52)
%arrayidx24.7.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 7
%53 = load i32, ptr %arrayidx24.7.1, align 4, !tbaa !5
%call25.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %53)
%arrayidx24.8.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 8
%54 = load i32, ptr %arrayidx24.8.1, align 8, !tbaa !5
%call25.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %54)
%arrayidx24.9.1 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 1, i64 9
%55 = load i32, ptr %arrayidx24.9.1, align 4, !tbaa !5
%call25.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %55)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx24.254 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 0
%56 = load i32, ptr %arrayidx24.254, align 8, !tbaa !5
%call25.255 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %56)
%arrayidx24.1.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 1
%57 = load i32, ptr %arrayidx24.1.2, align 4, !tbaa !5
%call25.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %57)
%arrayidx24.2.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 2
%58 = load i32, ptr %arrayidx24.2.2, align 8, !tbaa !5
%call25.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %58)
%arrayidx24.3.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 3
%59 = load i32, ptr %arrayidx24.3.2, align 4, !tbaa !5
%call25.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %59)
%arrayidx24.4.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 4
%60 = load i32, ptr %arrayidx24.4.2, align 8, !tbaa !5
%call25.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %60)
%arrayidx24.5.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 5
%61 = load i32, ptr %arrayidx24.5.2, align 4, !tbaa !5
%call25.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %61)
%arrayidx24.6.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 6
%62 = load i32, ptr %arrayidx24.6.2, align 8, !tbaa !5
%call25.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %62)
%arrayidx24.7.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 7
%63 = load i32, ptr %arrayidx24.7.2, align 4, !tbaa !5
%call25.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %63)
%arrayidx24.8.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 8
%64 = load i32, ptr %arrayidx24.8.2, align 8, !tbaa !5
%call25.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %64)
%arrayidx24.9.2 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %count, i64 0, i64 %indvars.iv, i64 2, i64 9
%65 = load i32, ptr %arrayidx24.9.2, align 4, !tbaa !5
%call25.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %65)
%putchar.2 = call i32 @putchar(i32 10)
%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 %if.end, !llvm.loop !11
for.end35: ; preds = %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %count) #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"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
int main(void)
{
int building1[3][10] = { 0 }, building2[3][10] = { 0 }, building3[3][10] = { 0 }, building4[3][10] = { 0 };
int 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)
{
building1[f - 1][r - 1] += v;
}
if (b == 2)
{
building2[f - 1][r - 1] += v;
}
if (b == 3)
{
building3[f - 1][r - 1] += v;
}
if (b == 4)
{
building4[f - 1][r - 1] += v;
}
}
for (i = 0; i < 3; i++)
{
for (j = 0; j < 10; j++)
{
printf(" %d", building1[i][j]);
}
printf("\n");
}
printf("####################\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 10; j++)
{
printf(" %d", building2[i][j]);
}
printf("\n");
}
printf("####################\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 10; j++)
{
printf(" %d", building3[i][j]);
}
printf("\n");
}
printf("####################\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 10; j++)
{
printf(" %d", building4[i][j]);
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236776/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236776/source.c"
target datalayout = "e-m:e-p270: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.6 = 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:
%building1 = alloca [3 x [10 x i32]], align 16
%building2 = alloca [3 x [10 x i32]], align 16
%building3 = alloca [3 x [10 x i32]], align 16
%building4 = 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 %building1) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %building1, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %building2) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %building2, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %building3) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %building3, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %building4) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %building4, 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
%cmp143 = icmp sgt i32 %0, 0
br i1 %cmp143, label %for.body, label %for.cond36.preheader
for.cond36.preheader.loopexit: ; preds = %for.inc
%.pre = load i32, ptr %building1, align 16, !tbaa !5
%arrayidx45.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 1
%.pre177 = load i32, ptr %arrayidx45.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 2
%.pre178 = load i32, ptr %arrayidx45.2.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.3.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 3
%.pre179 = load i32, ptr %arrayidx45.3.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.4.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 4
%.pre180 = load i32, ptr %arrayidx45.4.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.5.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 5
%.pre181 = load i32, ptr %arrayidx45.5.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.6.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 6
%.pre182 = load i32, ptr %arrayidx45.6.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.7.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 7
%.pre183 = load i32, ptr %arrayidx45.7.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.8.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 8
%.pre184 = load i32, ptr %arrayidx45.8.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.9.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 0, i64 9
%.pre185 = load i32, ptr %arrayidx45.9.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.1155.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 0
%.pre186 = load i32, ptr %arrayidx45.1155.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.1.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 1
%.pre187 = load i32, ptr %arrayidx45.1.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.2.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 2
%.pre188 = load i32, ptr %arrayidx45.2.1.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.3.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 3
%.pre189 = load i32, ptr %arrayidx45.3.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.4.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 4
%.pre190 = load i32, ptr %arrayidx45.4.1.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.5.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 5
%.pre191 = load i32, ptr %arrayidx45.5.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.6.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 6
%.pre192 = load i32, ptr %arrayidx45.6.1.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.7.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 7
%.pre193 = load i32, ptr %arrayidx45.7.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.8.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 8
%.pre194 = load i32, ptr %arrayidx45.8.1.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.9.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 1, i64 9
%.pre195 = load i32, ptr %arrayidx45.9.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.2157.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 0
%.pre196 = load i32, ptr %arrayidx45.2157.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.1.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 1
%.pre197 = load i32, ptr %arrayidx45.1.2.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.2.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 2
%.pre198 = load i32, ptr %arrayidx45.2.2.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.3.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 3
%.pre199 = load i32, ptr %arrayidx45.3.2.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.4.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 4
%.pre200 = load i32, ptr %arrayidx45.4.2.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.5.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 5
%.pre201 = load i32, ptr %arrayidx45.5.2.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.6.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 6
%.pre202 = load i32, ptr %arrayidx45.6.2.phi.trans.insert, align 8, !tbaa !5
%arrayidx45.7.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 7
%.pre203 = load i32, ptr %arrayidx45.7.2.phi.trans.insert, align 4, !tbaa !5
%arrayidx45.8.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 8
%.pre204 = load i32, ptr %arrayidx45.8.2.phi.trans.insert, align 16, !tbaa !5
%arrayidx45.9.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 2, i64 9
%.pre205 = load i32, ptr %arrayidx45.9.2.phi.trans.insert, align 4, !tbaa !5
%.pre206 = load i32, ptr %building2, align 16, !tbaa !5
%arrayidx64.1.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 1
%.pre207 = load i32, ptr %arrayidx64.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx64.2.phi.trans.insert = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 2
%.pre208 = load i32, ptr %arrayidx64.2.phi.trans.insert, align 8, !tbaa !5
br label %for.cond36.preheader
for.cond36.preheader: ; preds = %for.cond36.preheader.loopexit, %entry
%1 = phi i32 [ %.pre208, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%2 = phi i32 [ %.pre207, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%3 = phi i32 [ %.pre206, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%4 = phi i32 [ %.pre205, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%5 = phi i32 [ %.pre204, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%6 = phi i32 [ %.pre203, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%7 = phi i32 [ %.pre202, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%8 = phi i32 [ %.pre201, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%9 = phi i32 [ %.pre200, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%10 = phi i32 [ %.pre199, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%11 = phi i32 [ %.pre198, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%12 = phi i32 [ %.pre197, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%13 = phi i32 [ %.pre196, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%14 = phi i32 [ %.pre195, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%15 = phi i32 [ %.pre194, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%16 = phi i32 [ %.pre193, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%17 = phi i32 [ %.pre192, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%18 = phi i32 [ %.pre191, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%19 = phi i32 [ %.pre190, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%20 = phi i32 [ %.pre189, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%21 = phi i32 [ %.pre188, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%22 = phi i32 [ %.pre187, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%23 = phi i32 [ %.pre186, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%24 = phi i32 [ %.pre185, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%25 = phi i32 [ %.pre184, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%26 = phi i32 [ %.pre183, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%27 = phi i32 [ %.pre182, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%28 = phi i32 [ %.pre181, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%29 = phi i32 [ %.pre180, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%30 = phi i32 [ %.pre179, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%31 = phi i32 [ %.pre178, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%32 = phi i32 [ %.pre177, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%33 = phi i32 [ %.pre, %for.cond36.preheader.loopexit ], [ 0, %entry ]
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
%call46.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %32)
%call46.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%call46.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %30)
%call46.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29)
%call46.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
%call46.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%call46.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%call46.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%call46.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %24)
%putchar139 = call i32 @putchar(i32 10)
%call46.1156 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%call46.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22)
%call46.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%call46.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
%call46.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
%call46.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%call46.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%call46.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%call46.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%call46.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%putchar139.1 = call i32 @putchar(i32 10)
%call46.2158 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%call46.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
%call46.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%call46.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%call46.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
%call46.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%call46.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%call46.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %6)
%call46.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %5)
%call46.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
%putchar139.2 = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3)
%call65.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %2)
%call65.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1)
%arrayidx64.3 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 3
%34 = load i32, ptr %arrayidx64.3, align 4, !tbaa !5
%call65.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%arrayidx64.4 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 4
%35 = load i32, ptr %arrayidx64.4, align 16, !tbaa !5
%call65.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx64.5 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 5
%36 = load i32, ptr %arrayidx64.5, align 4, !tbaa !5
%call65.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %36)
%arrayidx64.6 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 6
%37 = load i32, ptr %arrayidx64.6, align 8, !tbaa !5
%call65.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %37)
%arrayidx64.7 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 7
%38 = load i32, ptr %arrayidx64.7, align 4, !tbaa !5
%call65.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38)
%arrayidx64.8 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 8
%39 = load i32, ptr %arrayidx64.8, align 16, !tbaa !5
%call65.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %39)
%arrayidx64.9 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 0, i64 9
%40 = load i32, ptr %arrayidx64.9, align 4, !tbaa !5
%call65.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %40)
%putchar138 = call i32 @putchar(i32 10)
%arrayidx64.1161 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 0
%41 = load i32, ptr %arrayidx64.1161, align 8, !tbaa !5
%call65.1162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %41)
%arrayidx64.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 1
%42 = load i32, ptr %arrayidx64.1.1, align 4, !tbaa !5
%call65.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %42)
%arrayidx64.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 2
%43 = load i32, ptr %arrayidx64.2.1, align 16, !tbaa !5
%call65.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %43)
%arrayidx64.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 3
%44 = load i32, ptr %arrayidx64.3.1, align 4, !tbaa !5
%call65.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %44)
%arrayidx64.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 4
%45 = load i32, ptr %arrayidx64.4.1, align 8, !tbaa !5
%call65.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %45)
%arrayidx64.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 5
%46 = load i32, ptr %arrayidx64.5.1, align 4, !tbaa !5
%call65.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %46)
%arrayidx64.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 6
%47 = load i32, ptr %arrayidx64.6.1, align 16, !tbaa !5
%call65.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %47)
%arrayidx64.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 7
%48 = load i32, ptr %arrayidx64.7.1, align 4, !tbaa !5
%call65.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %48)
%arrayidx64.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 8
%49 = load i32, ptr %arrayidx64.8.1, align 8, !tbaa !5
%call65.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %49)
%arrayidx64.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 1, i64 9
%50 = load i32, ptr %arrayidx64.9.1, align 4, !tbaa !5
%call65.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %50)
%putchar138.1 = call i32 @putchar(i32 10)
%arrayidx64.2163 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 0
%51 = load i32, ptr %arrayidx64.2163, align 16, !tbaa !5
%call65.2164 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %51)
%arrayidx64.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 1
%52 = load i32, ptr %arrayidx64.1.2, align 4, !tbaa !5
%call65.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %52)
%arrayidx64.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 2
%53 = load i32, ptr %arrayidx64.2.2, align 8, !tbaa !5
%call65.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %53)
%arrayidx64.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 3
%54 = load i32, ptr %arrayidx64.3.2, align 4, !tbaa !5
%call65.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %54)
%arrayidx64.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 4
%55 = load i32, ptr %arrayidx64.4.2, align 16, !tbaa !5
%call65.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %55)
%arrayidx64.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 5
%56 = load i32, ptr %arrayidx64.5.2, align 4, !tbaa !5
%call65.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %56)
%arrayidx64.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 6
%57 = load i32, ptr %arrayidx64.6.2, align 8, !tbaa !5
%call65.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %57)
%arrayidx64.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 7
%58 = load i32, ptr %arrayidx64.7.2, align 4, !tbaa !5
%call65.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %58)
%arrayidx64.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 8
%59 = load i32, ptr %arrayidx64.8.2, align 16, !tbaa !5
%call65.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %59)
%arrayidx64.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 2, i64 9
%60 = load i32, ptr %arrayidx64.9.2, align 4, !tbaa !5
%call65.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %60)
%putchar138.2 = call i32 @putchar(i32 10)
%puts135 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%61 = load i32, ptr %building3, align 16, !tbaa !5
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %61)
%arrayidx83.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 1
%62 = load i32, ptr %arrayidx83.1, align 4, !tbaa !5
%call84.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %62)
%arrayidx83.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 2
%63 = load i32, ptr %arrayidx83.2, align 8, !tbaa !5
%call84.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %63)
%arrayidx83.3 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 3
%64 = load i32, ptr %arrayidx83.3, align 4, !tbaa !5
%call84.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %64)
%arrayidx83.4 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 4
%65 = load i32, ptr %arrayidx83.4, align 16, !tbaa !5
%call84.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %65)
%arrayidx83.5 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 5
%66 = load i32, ptr %arrayidx83.5, align 4, !tbaa !5
%call84.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %66)
%arrayidx83.6 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 6
%67 = load i32, ptr %arrayidx83.6, align 8, !tbaa !5
%call84.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %67)
%arrayidx83.7 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 7
%68 = load i32, ptr %arrayidx83.7, align 4, !tbaa !5
%call84.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %68)
%arrayidx83.8 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 8
%69 = load i32, ptr %arrayidx83.8, align 16, !tbaa !5
%call84.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %69)
%arrayidx83.9 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 0, i64 9
%70 = load i32, ptr %arrayidx83.9, align 4, !tbaa !5
%call84.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %70)
%putchar137 = call i32 @putchar(i32 10)
%arrayidx83.1167 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 0
%71 = load i32, ptr %arrayidx83.1167, align 8, !tbaa !5
%call84.1168 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %71)
%arrayidx83.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 1
%72 = load i32, ptr %arrayidx83.1.1, align 4, !tbaa !5
%call84.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %72)
%arrayidx83.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 2
%73 = load i32, ptr %arrayidx83.2.1, align 16, !tbaa !5
%call84.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %73)
%arrayidx83.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 3
%74 = load i32, ptr %arrayidx83.3.1, align 4, !tbaa !5
%call84.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %74)
%arrayidx83.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 4
%75 = load i32, ptr %arrayidx83.4.1, align 8, !tbaa !5
%call84.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %75)
%arrayidx83.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 5
%76 = load i32, ptr %arrayidx83.5.1, align 4, !tbaa !5
%call84.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %76)
%arrayidx83.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 6
%77 = load i32, ptr %arrayidx83.6.1, align 16, !tbaa !5
%call84.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %77)
%arrayidx83.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 7
%78 = load i32, ptr %arrayidx83.7.1, align 4, !tbaa !5
%call84.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %78)
%arrayidx83.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 8
%79 = load i32, ptr %arrayidx83.8.1, align 8, !tbaa !5
%call84.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %79)
%arrayidx83.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 1, i64 9
%80 = load i32, ptr %arrayidx83.9.1, align 4, !tbaa !5
%call84.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %80)
%putchar137.1 = call i32 @putchar(i32 10)
%arrayidx83.2169 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 0
%81 = load i32, ptr %arrayidx83.2169, align 16, !tbaa !5
%call84.2170 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %81)
%arrayidx83.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 1
%82 = load i32, ptr %arrayidx83.1.2, align 4, !tbaa !5
%call84.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %82)
%arrayidx83.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 2
%83 = load i32, ptr %arrayidx83.2.2, align 8, !tbaa !5
%call84.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %83)
%arrayidx83.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 3
%84 = load i32, ptr %arrayidx83.3.2, align 4, !tbaa !5
%call84.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %84)
%arrayidx83.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 4
%85 = load i32, ptr %arrayidx83.4.2, align 16, !tbaa !5
%call84.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %85)
%arrayidx83.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 5
%86 = load i32, ptr %arrayidx83.5.2, align 4, !tbaa !5
%call84.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %86)
%arrayidx83.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 6
%87 = load i32, ptr %arrayidx83.6.2, align 8, !tbaa !5
%call84.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %87)
%arrayidx83.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 7
%88 = load i32, ptr %arrayidx83.7.2, align 4, !tbaa !5
%call84.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %88)
%arrayidx83.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 8
%89 = load i32, ptr %arrayidx83.8.2, align 16, !tbaa !5
%call84.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %89)
%arrayidx83.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 2, i64 9
%90 = load i32, ptr %arrayidx83.9.2, align 4, !tbaa !5
%call84.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %90)
%putchar137.2 = call i32 @putchar(i32 10)
%puts136 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%91 = load i32, ptr %building4, align 16, !tbaa !5
%call103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %91)
%arrayidx102.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 1
%92 = load i32, ptr %arrayidx102.1, align 4, !tbaa !5
%call103.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %92)
%arrayidx102.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 2
%93 = load i32, ptr %arrayidx102.2, align 8, !tbaa !5
%call103.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %93)
%arrayidx102.3 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 3
%94 = load i32, ptr %arrayidx102.3, align 4, !tbaa !5
%call103.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %94)
%arrayidx102.4 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 4
%95 = load i32, ptr %arrayidx102.4, align 16, !tbaa !5
%call103.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %95)
%arrayidx102.5 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 5
%96 = load i32, ptr %arrayidx102.5, align 4, !tbaa !5
%call103.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %96)
%arrayidx102.6 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 6
%97 = load i32, ptr %arrayidx102.6, align 8, !tbaa !5
%call103.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %97)
%arrayidx102.7 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 7
%98 = load i32, ptr %arrayidx102.7, align 4, !tbaa !5
%call103.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %98)
%arrayidx102.8 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 8
%99 = load i32, ptr %arrayidx102.8, align 16, !tbaa !5
%call103.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %99)
%arrayidx102.9 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 0, i64 9
%100 = load i32, ptr %arrayidx102.9, align 4, !tbaa !5
%call103.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %100)
%putchar = call i32 @putchar(i32 10)
%arrayidx102.1173 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 0
%101 = load i32, ptr %arrayidx102.1173, align 8, !tbaa !5
%call103.1174 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %101)
%arrayidx102.1.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 1
%102 = load i32, ptr %arrayidx102.1.1, align 4, !tbaa !5
%call103.1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %102)
%arrayidx102.2.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 2
%103 = load i32, ptr %arrayidx102.2.1, align 16, !tbaa !5
%call103.2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %103)
%arrayidx102.3.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 3
%104 = load i32, ptr %arrayidx102.3.1, align 4, !tbaa !5
%call103.3.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %104)
%arrayidx102.4.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 4
%105 = load i32, ptr %arrayidx102.4.1, align 8, !tbaa !5
%call103.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %105)
%arrayidx102.5.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 5
%106 = load i32, ptr %arrayidx102.5.1, align 4, !tbaa !5
%call103.5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %106)
%arrayidx102.6.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 6
%107 = load i32, ptr %arrayidx102.6.1, align 16, !tbaa !5
%call103.6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %107)
%arrayidx102.7.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 7
%108 = load i32, ptr %arrayidx102.7.1, align 4, !tbaa !5
%call103.7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %108)
%arrayidx102.8.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 8
%109 = load i32, ptr %arrayidx102.8.1, align 8, !tbaa !5
%call103.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %109)
%arrayidx102.9.1 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 1, i64 9
%110 = load i32, ptr %arrayidx102.9.1, align 4, !tbaa !5
%call103.9.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %110)
%putchar.1 = call i32 @putchar(i32 10)
%arrayidx102.2175 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 0
%111 = load i32, ptr %arrayidx102.2175, align 16, !tbaa !5
%call103.2176 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %111)
%arrayidx102.1.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 1
%112 = load i32, ptr %arrayidx102.1.2, align 4, !tbaa !5
%call103.1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %112)
%arrayidx102.2.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 2
%113 = load i32, ptr %arrayidx102.2.2, align 8, !tbaa !5
%call103.2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %113)
%arrayidx102.3.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 3
%114 = load i32, ptr %arrayidx102.3.2, align 4, !tbaa !5
%call103.3.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %114)
%arrayidx102.4.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 4
%115 = load i32, ptr %arrayidx102.4.2, align 16, !tbaa !5
%call103.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %115)
%arrayidx102.5.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 5
%116 = load i32, ptr %arrayidx102.5.2, align 4, !tbaa !5
%call103.5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %116)
%arrayidx102.6.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 6
%117 = load i32, ptr %arrayidx102.6.2, align 8, !tbaa !5
%call103.6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %117)
%arrayidx102.7.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 7
%118 = load i32, ptr %arrayidx102.7.2, align 4, !tbaa !5
%call103.7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %118)
%arrayidx102.8.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 8
%119 = load i32, ptr %arrayidx102.8.2, align 16, !tbaa !5
%call103.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %119)
%arrayidx102.9.2 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, i64 0, i64 2, i64 9
%120 = load i32, ptr %arrayidx102.9.2, align 4, !tbaa !5
%call103.9.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %120)
%putchar.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 %building4) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %building3) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %building2) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %building1) #5
ret i32 0
for.body: ; preds = %entry, %for.inc
%i.0144 = 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)
%121 = load i32, ptr %b, align 4, !tbaa !5
switch i32 %121, 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
%122 = load i32, ptr %f, align 4, !tbaa !5
%sub = add nsw i32 %122, -1
%idxprom = sext i32 %sub to i64
%123 = load i32, ptr %r, align 4, !tbaa !5
%sub3 = add nsw i32 %123, -1
%idxprom4 = sext i32 %sub3 to i64
%arrayidx5 = getelementptr inbounds [3 x [10 x i32]], ptr %building1, i64 0, i64 %idxprom, i64 %idxprom4
br label %for.inc.sink.split
if.then7: ; preds = %for.body
%124 = load i32, ptr %f, align 4, !tbaa !5
%sub8 = add nsw i32 %124, -1
%idxprom9 = sext i32 %sub8 to i64
%125 = load i32, ptr %r, align 4, !tbaa !5
%sub11 = add nsw i32 %125, -1
%idxprom12 = sext i32 %sub11 to i64
%arrayidx13 = getelementptr inbounds [3 x [10 x i32]], ptr %building2, i64 0, i64 %idxprom9, i64 %idxprom12
br label %for.inc.sink.split
if.then17: ; preds = %for.body
%126 = load i32, ptr %f, align 4, !tbaa !5
%sub18 = add nsw i32 %126, -1
%idxprom19 = sext i32 %sub18 to i64
%127 = load i32, ptr %r, align 4, !tbaa !5
%sub21 = add nsw i32 %127, -1
%idxprom22 = sext i32 %sub21 to i64
%arrayidx23 = getelementptr inbounds [3 x [10 x i32]], ptr %building3, i64 0, i64 %idxprom19, i64 %idxprom22
br label %for.inc.sink.split
if.then27: ; preds = %for.body
%128 = load i32, ptr %f, align 4, !tbaa !5
%sub28 = add nsw i32 %128, -1
%idxprom29 = sext i32 %sub28 to i64
%129 = load i32, ptr %r, align 4, !tbaa !5
%sub31 = add nsw i32 %129, -1
%idxprom32 = sext i32 %sub31 to i64
%arrayidx33 = getelementptr inbounds [3 x [10 x i32]], ptr %building4, 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.sink210 = phi ptr [ %arrayidx13, %if.then7 ], [ %arrayidx5, %if.end.thread ], [ %arrayidx23, %if.then17 ], [ %arrayidx33, %if.then27 ]
%.sink209 = load i32, ptr %v, align 4, !tbaa !5
%130 = load i32, ptr %arrayidx13.sink210, align 4, !tbaa !5
%add14 = add nsw i32 %130, %.sink209
store i32 %add14, ptr %arrayidx13.sink210, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body
%inc = add nuw nsw i32 %i.0144, 1
%131 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %131
br i1 %cmp, label %for.body, label %for.cond36.preheader.loopexit, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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"}
|
//======================================================================
// Contents : AOJ ITP1_6_C
// 公舎の入居・退去の情報を読み込み、各部屋の入居者数を出力
// 1フロア10部屋、3階建ての公舎が4棟存在
// Input : 情報の数 n
// 棟 building (1 ≦ b ≦ 4)
// 階数 floor (1 ≦ f ≦ 3)
// 部屋番号 room (1 ≦ r ≦ 10)
// 追加(退去)人数 move ( - 元の人数 ≦ v ≦ 9 - 元の人数)
// Output : 入居者数 (例参照)
// Constraints : 最初、全ての部屋には誰も入居していない
// 各棟の間には####################(20個の#)で区切られる
// 0 ≦ 1部屋の入居者数 ≦ 9
// Example : 入力)
// 3
// 1 1 3 8
// 3 2 2 7
// 4 3 8 1
// 出力)
// 0 0 8 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 0 0 0
// ####################
// 0 0 0 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 0 0 0
// ####################
// 0 0 0 0 0 0 0 0 0 0
// 0 7 0 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 0 0 0
// ####################
// 0 0 0 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 0 0 0
// 0 0 0 0 0 0 0 1 0 0
// Author : 廣部智也
// LastUpdate : 2020/06/23
// Since : 2020/06/23
//======================================================================
#include <stdio.h>
#include <stdlib.h> // exit 関数を使用するため
#define LOWER_LIMIT_b 1
#define UPPER_LIMIT_b 4
#define LOWER_LIMIT_f 1
#define UPPER_LIMIT_f 3
#define LOWER_LIMIT_r 1
#define UPPER_LIMIT_r 10
#define LOWER_LIMIT_m 0
#define UPPER_LIMIT_m 9
#define FLOOR 3
#define ROOM 10
#define between_buildings printf("####################\n");
// 入力エラーを判断する関数
int Input_error( int number, int lower_limit, int upper_limit );
// 住居者の住居、退去情報を更新する関数
void resident_update( int floor, int room, int move, int resident_number[FLOOR][ROOM] );
// 住居者情報を表示する関数
void resident_display( int resident_number[FLOOR][ROOM] );
int main(){
int resident_1[FLOOR][ROOM] = {}, resident_2[FLOOR][ROOM] = {},
resident_3[FLOOR][ROOM] = {}, resident_4[FLOOR][ROOM] = {};
int n = 0, building = 0, floor = 0, room = 0, move = 0;
// データの入力:カードの所持数
scanf("%d", &n );
while( n-- > 0){
scanf("%d %d %d %d", &building, &floor, &room, &move);
Input_error( building , LOWER_LIMIT_b, UPPER_LIMIT_b );
Input_error( floor , LOWER_LIMIT_f, UPPER_LIMIT_f );
Input_error( room , LOWER_LIMIT_r, UPPER_LIMIT_r );
// データの処理:居住者の情報を反映
switch( building ) {
case 1:
resident_update( floor, room, move, resident_1 );
break;
case 2:
resident_update( floor, room, move, resident_2 );
break;
case 3:
resident_update( floor, room, move, resident_3 );
break;
case 4:
resident_update( floor, room, move, resident_4 );
break;
default:
printf("error\n");
break;
}
}
// データの出力:不足カードを表示
resident_display( resident_1 );
between_buildings;
resident_display( resident_2 );
between_buildings;
resident_display( resident_3 );
between_buildings;
resident_display( resident_4 );
return 0;
}
//==========================================================================================
// Contents : ある一部屋の居住者の情報を更新
// Author : 廣部智也
// LastUpdate : 2020/06/23
// Since : 2020/06/17
//==========================================================================================
void resident_update( int floor, int room, int move, int resident_number[FLOOR][ROOM] ){
int resident = 0;
resident = resident_number[floor-1][room-1];
Input_error( resident + move , LOWER_LIMIT_m, UPPER_LIMIT_m );
resident_number[floor-1][room-1] = resident + move;
return;
}
//=========================================================================
// Contents : ○棟の居住者の情報を表示
// Author : 廣部智也
// LastUpdate : 2020/06/23
// Since : 2020/06/23
//=========================================================================
void resident_display( int resident_number[FLOOR][ROOM] ){
int i = 0;
int j = 0;
for ( i = 0; i < FLOOR; ++i ) {
for ( j = 0; j < ROOM; ++j ) {
printf(" %d", resident_number[i][j] );
}
printf("\n");
}
return;
}
//============================================================
// Contents : 入力エラーを判断
// Input : 調べる変数, 下限, 上限
// Output : エラーなら強制終了
// Author : 廣部智也
// LastUpdate : 2020/06/05
// Since : 2020/06/05
//============================================================
int Input_error( int number, int lower_limit, int upper_limit ){
if( number < lower_limit || number > upper_limit ){
printf("Input error\n");
exit(1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236848/source.c"
target datalayout = "e-m:e-p270: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.4 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str.8 = private unnamed_addr constant [21 x i8] c"####################\00", align 1
@str.9 = private unnamed_addr constant [6 x i8] c"error\00", align 1
@str.10 = private unnamed_addr constant [12 x i8] c"Input error\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%resident_1 = alloca [3 x [10 x i32]], align 16
%resident_2 = alloca [3 x [10 x i32]], align 16
%resident_3 = alloca [3 x [10 x i32]], align 16
%resident_4 = alloca [3 x [10 x i32]], align 16
%n = alloca i32, align 4
%building = alloca i32, align 4
%floor = alloca i32, align 4
%room = alloca i32, align 4
%move = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %resident_1) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %resident_1, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %resident_2) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %resident_2, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %resident_3) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %resident_3, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %resident_4) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %resident_4, i8 0, i64 120, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %building) #7
store i32 0, ptr %building, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %floor) #7
store i32 0, ptr %floor, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %room) #7
store i32 0, ptr %room, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %move) #7
store i32 0, ptr %move, align 4, !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
%dec64 = add nsw i32 %0, -1
store i32 %dec64, ptr %n, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %while.body, label %while.end
while.body: ; preds = %entry, %sw.epilog
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %building, ptr noundef nonnull %floor, ptr noundef nonnull %room, ptr noundef nonnull %move)
%1 = load i32, ptr %building, align 4, !tbaa !5
%2 = add i32 %1, -5
%or.cond.i = icmp ult i32 %2, -4
br i1 %or.cond.i, label %if.then.i, label %Input_error.exit
if.then.i: ; preds = %while.body
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
Input_error.exit: ; preds = %while.body
%3 = load i32, ptr %floor, align 4, !tbaa !5
%4 = add i32 %3, -4
%or.cond.i24 = icmp ult i32 %4, -3
br i1 %or.cond.i24, label %if.then.i25, label %Input_error.exit27
if.then.i25: ; preds = %Input_error.exit
%puts.i26 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
Input_error.exit27: ; preds = %Input_error.exit
%5 = load i32, ptr %room, align 4, !tbaa !5
%6 = add i32 %5, -11
%or.cond.i30 = icmp ult i32 %6, -10
br i1 %or.cond.i30, label %if.then.i31, label %Input_error.exit33
if.then.i31: ; preds = %Input_error.exit27
%puts.i32 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
Input_error.exit33: ; preds = %Input_error.exit27
switch i32 %1, label %sw.default [
i32 1, label %sw.bb
i32 2, label %sw.bb5
i32 3, label %sw.bb7
i32 4, label %sw.bb9
]
sw.bb: ; preds = %Input_error.exit33
%7 = load i32, ptr %move, align 4, !tbaa !5
%sub.i = add nsw i32 %3, -1
%idxprom.i = zext i32 %sub.i to i64
%sub1.i = add nsw i32 %5, -1
%idxprom2.i = zext i32 %sub1.i to i64
%arrayidx3.i = getelementptr inbounds [10 x i32], ptr %resident_1, i64 %idxprom.i, i64 %idxprom2.i
%8 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%add.i = add nsw i32 %8, %7
%or.cond.i.i = icmp ugt i32 %add.i, 9
br i1 %or.cond.i.i, label %if.then.i.i, label %resident_update.exit
if.then.i.i: ; preds = %sw.bb
%puts.i.i = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
resident_update.exit: ; preds = %sw.bb
store i32 %add.i, ptr %arrayidx3.i, align 4, !tbaa !5
br label %sw.epilog
sw.bb5: ; preds = %Input_error.exit33
%9 = load i32, ptr %move, align 4, !tbaa !5
%sub.i34 = add nsw i32 %3, -1
%idxprom.i35 = zext i32 %sub.i34 to i64
%sub1.i36 = add nsw i32 %5, -1
%idxprom2.i37 = zext i32 %sub1.i36 to i64
%arrayidx3.i38 = getelementptr inbounds [10 x i32], ptr %resident_2, i64 %idxprom.i35, i64 %idxprom2.i37
%10 = load i32, ptr %arrayidx3.i38, align 4, !tbaa !5
%add.i39 = add nsw i32 %10, %9
%or.cond.i.i40 = icmp ugt i32 %add.i39, 9
br i1 %or.cond.i.i40, label %if.then.i.i41, label %resident_update.exit43
if.then.i.i41: ; preds = %sw.bb5
%puts.i.i42 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
resident_update.exit43: ; preds = %sw.bb5
store i32 %add.i39, ptr %arrayidx3.i38, align 4, !tbaa !5
br label %sw.epilog
sw.bb7: ; preds = %Input_error.exit33
%11 = load i32, ptr %move, align 4, !tbaa !5
%sub.i44 = add nsw i32 %3, -1
%idxprom.i45 = zext i32 %sub.i44 to i64
%sub1.i46 = add nsw i32 %5, -1
%idxprom2.i47 = zext i32 %sub1.i46 to i64
%arrayidx3.i48 = getelementptr inbounds [10 x i32], ptr %resident_3, i64 %idxprom.i45, i64 %idxprom2.i47
%12 = load i32, ptr %arrayidx3.i48, align 4, !tbaa !5
%add.i49 = add nsw i32 %12, %11
%or.cond.i.i50 = icmp ugt i32 %add.i49, 9
br i1 %or.cond.i.i50, label %if.then.i.i51, label %resident_update.exit53
if.then.i.i51: ; preds = %sw.bb7
%puts.i.i52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
resident_update.exit53: ; preds = %sw.bb7
store i32 %add.i49, ptr %arrayidx3.i48, align 4, !tbaa !5
br label %sw.epilog
sw.bb9: ; preds = %Input_error.exit33
%13 = load i32, ptr %move, align 4, !tbaa !5
%sub.i54 = add nsw i32 %3, -1
%idxprom.i55 = zext i32 %sub.i54 to i64
%sub1.i56 = add nsw i32 %5, -1
%idxprom2.i57 = zext i32 %sub1.i56 to i64
%arrayidx3.i58 = getelementptr inbounds [10 x i32], ptr %resident_4, i64 %idxprom.i55, i64 %idxprom2.i57
%14 = load i32, ptr %arrayidx3.i58, align 4, !tbaa !5
%add.i59 = add nsw i32 %14, %13
%or.cond.i.i60 = icmp ugt i32 %add.i59, 9
br i1 %or.cond.i.i60, label %if.then.i.i61, label %resident_update.exit63
if.then.i.i61: ; preds = %sw.bb9
%puts.i.i62 = call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
call void @exit(i32 noundef 1) #8
unreachable
resident_update.exit63: ; preds = %sw.bb9
store i32 %add.i59, ptr %arrayidx3.i58, align 4, !tbaa !5
br label %sw.epilog
sw.default: ; preds = %Input_error.exit33
%puts21 = call i32 @puts(ptr nonnull dereferenceable(1) @str.9)
br label %sw.epilog
sw.epilog: ; preds = %sw.default, %resident_update.exit63, %resident_update.exit53, %resident_update.exit43, %resident_update.exit
%15 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %15, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %15, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %sw.epilog, %entry
call void @resident_display(ptr noundef nonnull %resident_1)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @resident_display(ptr noundef nonnull %resident_2)
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @resident_display(ptr noundef nonnull %resident_3)
%puts20 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
call void @resident_display(ptr noundef nonnull %resident_4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %move) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %room) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %floor) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %building) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %resident_4) #7
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %resident_3) #7
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %resident_2) #7
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %resident_1) #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: 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: nounwind uwtable
define dso_local i32 @Input_error(i32 noundef %number, i32 noundef %lower_limit, i32 noundef %upper_limit) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %number, %lower_limit
%cmp1 = icmp sgt i32 %number, %upper_limit
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
tail call void @exit(i32 noundef 1) #8
unreachable
if.end: ; preds = %entry
ret i32 0
}
; Function Attrs: nounwind uwtable
define dso_local void @resident_update(i32 noundef %floor, i32 noundef %room, i32 noundef %move, ptr nocapture noundef %resident_number) local_unnamed_addr #0 {
entry:
%sub = add nsw i32 %floor, -1
%idxprom = sext i32 %sub to i64
%sub1 = add nsw i32 %room, -1
%idxprom2 = sext i32 %sub1 to i64
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %resident_number, i64 %idxprom, i64 %idxprom2
%0 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%add = add nsw i32 %0, %move
%or.cond.i = icmp ugt i32 %add, 9
br i1 %or.cond.i, label %if.then.i, label %Input_error.exit
if.then.i: ; preds = %entry
%puts.i = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.10)
tail call void @exit(i32 noundef 1) #8
unreachable
Input_error.exit: ; preds = %entry
store i32 %add, ptr %arrayidx3, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @resident_display(ptr nocapture noundef readonly %resident_number) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %resident_number, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %0)
%arrayidx5.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %1)
%arrayidx5.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %2)
%arrayidx5.3 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %3)
%arrayidx5.4 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %4)
%arrayidx5.5 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %5)
%arrayidx5.6 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %6)
%arrayidx5.7 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %7)
%arrayidx5.8 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %8)
%arrayidx5.9 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %9)
%putchar = tail call i32 @putchar(i32 10)
%arrayidx5.118 = getelementptr inbounds [10 x i32], ptr %resident_number, i64 1, i64 0
%10 = load i32, ptr %arrayidx5.118, align 4, !tbaa !5
%call.119 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %10)
%arrayidx5.1.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %11)
%arrayidx5.2.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %12)
%arrayidx5.3.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %13)
%arrayidx5.4.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %14)
%arrayidx5.5.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %15)
%arrayidx5.6.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %16)
%arrayidx5.7.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %17)
%arrayidx5.8.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %18)
%arrayidx5.9.1 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %19)
%putchar.1 = tail call i32 @putchar(i32 10)
%arrayidx5.220 = getelementptr inbounds [10 x i32], ptr %resident_number, i64 2, i64 0
%20 = load i32, ptr %arrayidx5.220, align 4, !tbaa !5
%call.221 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %20)
%arrayidx5.1.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %21)
%arrayidx5.2.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %22)
%arrayidx5.3.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %23)
%arrayidx5.4.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %24)
%arrayidx5.5.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %25)
%arrayidx5.6.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %26)
%arrayidx5.7.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %27)
%arrayidx5.8.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %28)
%arrayidx5.9.2 = getelementptr inbounds [10 x i32], ptr %resident_number, 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.4, i32 noundef %29)
%putchar.2 = tail call i32 @putchar(i32 10)
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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
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 = { nofree nounwind "no-trapping-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 uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n,i,j,k,b,f,r,v,count[4][3][10] ={0};
char gara;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d %d %d",&b,&f,&r,&v);
count[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",count[i][j][k]);
}
printf("\n");
}
if(i<3) printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236891/source.c"
target datalayout = "e-m:e-p270: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
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%count = 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 %count) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 %count, 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 = icmp ult i64 %indvars.iv, 3
br i1 %cmp31, label %if.then, label %for.inc33
if.then: ; preds = %for.cond11.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
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 !11
for.end35: ; preds = %for.inc33
call void @llvm.lifetime.end.p0(i64 480, ptr nonnull %count) #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 @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}
|
#include <stdio.h>
int main() {
int i,n,j,k,b,f,r,v;
int 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(k=0; k<4; k++) {
for(j=0; j<3; j++) {
for(i=0; i<10;i++) {
printf(" %d",house[k][j][i]);
}
printf("\n");
}
if(k == 3){
break;
}
printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236934/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236934/source.c"
target datalayout = "e-m:e-p270: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
%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, %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 %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)
%putchar = call i32 @putchar(i32 10)
%arrayidx22.152 = getelementptr inbounds [4 x [3 x [10 x i32]]], ptr %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 %house, 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 = icmp eq i64 %indvars.iv, 3
br i1 %cmp31, label %for.end35, label %if.end
if.end: ; 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 @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>
#include<math.h>
void print_info(int array[][10]);
int main (void)
{
int input,b,f,r,v;
int A[3][10],B[3][10],C[3][10],D[3][10];
int i,j;
for(i = 0 ; i < 3 ; i++)
{
for(j = 0 ; j < 10 ; j++)
{
A[i][j] = 0;
B[i][j] = 0;
C[i][j] = 0;
D[i][j] = 0;
}
}
scanf("%d",&input);
for(i = 0 ; i < input ; i++)
{
scanf("%d %d %d %d",&b,&f,&r,&v);
switch(b)
{
case 1:
A[f-1][r-1] += v;
break;
case 2:
B[f-1][r-1] += v;
break;
case 3:
C[f-1][r-1] += v;
break;
case 4:
D[f-1][r-1] += v;
break;
}
}
print_info(A);
printf("####################\n");
print_info(B);
printf("####################\n");
print_info(C);
printf("####################\n");
print_info(D);
return 0;
}
void print_info(int array[][10])
{
int i,j;
for(i = 0 ; i < 3; i++)
{
for(j = 0 ; j < 10 ; j++)
{
printf(" %d",array[i][j]);
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_236978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_236978/source.c"
target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str.6 = 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:
%input = alloca i32, align 4
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%A = alloca [3 x [10 x i32]], align 16
%B = alloca [3 x [10 x i32]], align 16
%C = alloca [3 x [10 x i32]], align 16
%D = alloca [3 x [10 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #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 120, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %B) #5
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %C) #5
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %D) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %A, i8 0, i64 120, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %B, i8 0, i64 120, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %C, i8 0, i64 120, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %D, i8 0, i64 120, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i32, ptr %input, align 4, !tbaa !5
%cmp2279 = icmp sgt i32 %0, 0
br i1 %cmp2279, label %for.body23, label %for.end56
for.body23: ; preds = %entry, %for.inc54
%i.180 = phi i32 [ %inc55, %for.inc54 ], [ 0, %entry ]
%call24 = 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.inc54 [
i32 1, label %sw.bb
i32 2, label %sw.bb30
i32 3, label %sw.bb38
i32 4, label %sw.bb46
]
sw.bb: ; preds = %for.body23
%2 = load i32, ptr %f, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom25 = sext i32 %sub to i64
%3 = load i32, ptr %r, align 4, !tbaa !5
%sub27 = add nsw i32 %3, -1
%idxprom28 = sext i32 %sub27 to i64
%arrayidx29 = getelementptr inbounds [3 x [10 x i32]], ptr %A, i64 0, i64 %idxprom25, i64 %idxprom28
br label %for.inc54.sink.split
sw.bb30: ; preds = %for.body23
%4 = load i32, ptr %f, align 4, !tbaa !5
%sub31 = add nsw i32 %4, -1
%idxprom32 = sext i32 %sub31 to i64
%5 = load i32, ptr %r, align 4, !tbaa !5
%sub34 = add nsw i32 %5, -1
%idxprom35 = sext i32 %sub34 to i64
%arrayidx36 = getelementptr inbounds [3 x [10 x i32]], ptr %B, i64 0, i64 %idxprom32, i64 %idxprom35
br label %for.inc54.sink.split
sw.bb38: ; preds = %for.body23
%6 = load i32, ptr %f, align 4, !tbaa !5
%sub39 = add nsw i32 %6, -1
%idxprom40 = sext i32 %sub39 to i64
%7 = load i32, ptr %r, align 4, !tbaa !5
%sub42 = add nsw i32 %7, -1
%idxprom43 = sext i32 %sub42 to i64
%arrayidx44 = getelementptr inbounds [3 x [10 x i32]], ptr %C, i64 0, i64 %idxprom40, i64 %idxprom43
br label %for.inc54.sink.split
sw.bb46: ; preds = %for.body23
%8 = load i32, ptr %f, align 4, !tbaa !5
%sub47 = add nsw i32 %8, -1
%idxprom48 = sext i32 %sub47 to i64
%9 = load i32, ptr %r, align 4, !tbaa !5
%sub50 = add nsw i32 %9, -1
%idxprom51 = sext i32 %sub50 to i64
%arrayidx52 = getelementptr inbounds [3 x [10 x i32]], ptr %D, i64 0, i64 %idxprom48, i64 %idxprom51
br label %for.inc54.sink.split
for.inc54.sink.split: ; preds = %sw.bb46, %sw.bb38, %sw.bb30, %sw.bb
%arrayidx29.sink87 = phi ptr [ %arrayidx29, %sw.bb ], [ %arrayidx36, %sw.bb30 ], [ %arrayidx44, %sw.bb38 ], [ %arrayidx52, %sw.bb46 ]
%.sink86 = load i32, ptr %v, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx29.sink87, align 4, !tbaa !5
%add = add nsw i32 %10, %.sink86
store i32 %add, ptr %arrayidx29.sink87, align 4, !tbaa !5
br label %for.inc54
for.inc54: ; preds = %for.inc54.sink.split, %for.body23
%inc55 = add nuw nsw i32 %i.180, 1
%11 = load i32, ptr %input, align 4, !tbaa !5
%cmp22 = icmp slt i32 %inc55, %11
br i1 %cmp22, label %for.body23, label %for.end56, !llvm.loop !9
for.end56: ; preds = %for.inc54, %entry
call void @print_info(ptr noundef nonnull %A)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
call void @print_info(ptr noundef nonnull %B)
%puts75 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
call void @print_info(ptr noundef nonnull %C)
%puts76 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
call void @print_info(ptr noundef nonnull %D)
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %D) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %C) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %A) #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 %input) #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 uwtable
define dso_local void @print_info(ptr nocapture noundef readonly %array) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %array, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%arrayidx5.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %1)
%arrayidx5.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %2)
%arrayidx5.3 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %3)
%arrayidx5.4 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %4)
%arrayidx5.5 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %5)
%arrayidx5.6 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %6)
%arrayidx5.7 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %7)
%arrayidx5.8 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %8)
%arrayidx5.9 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %9)
%putchar = tail call i32 @putchar(i32 10)
%arrayidx5.118 = getelementptr inbounds [10 x i32], ptr %array, i64 1, i64 0
%10 = load i32, ptr %arrayidx5.118, align 4, !tbaa !5
%call.119 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
%arrayidx5.1.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %11)
%arrayidx5.2.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %12)
%arrayidx5.3.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %13)
%arrayidx5.4.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %14)
%arrayidx5.5.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %15)
%arrayidx5.6.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %16)
%arrayidx5.7.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %17)
%arrayidx5.8.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %18)
%arrayidx5.9.1 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %19)
%putchar.1 = tail call i32 @putchar(i32 10)
%arrayidx5.220 = getelementptr inbounds [10 x i32], ptr %array, i64 2, i64 0
%20 = load i32, ptr %arrayidx5.220, align 4, !tbaa !5
%call.221 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %20)
%arrayidx5.1.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %21)
%arrayidx5.2.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %22)
%arrayidx5.3.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %23)
%arrayidx5.4.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %24)
%arrayidx5.5.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %25)
%arrayidx5.6.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %26)
%arrayidx5.7.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %27)
%arrayidx5.8.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %28)
%arrayidx5.9.2 = getelementptr inbounds [10 x i32], ptr %array, 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.3, i32 noundef %29)
%putchar.2 = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree 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>
#include <stdlib.h>
#include <string.h>
#define MAX 100
int main(){
char teams[MAX][10];
int goals[MAX], max, i, j, n, index;
char team[10];
memset(goals, 0, MAX*sizeof(int));
scanf("%d", &n);
for(i=0; i < n; i++){
scanf("%s", &team);
for(j=0; j < i; j++)
if(!strcmp(team, teams[j])){
goals[j]++;
continue;
}
strcpy(teams[i], team);
}
index = max = 0;
for(j = 0; j < i; j++){
if(goals[j] > max){
index = j;
max = goals[j];
}
}
printf("%s\n", teams[index]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23702/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23702/source.c"
target datalayout = "e-m:e-p270: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:
%teams = alloca [100 x [10 x i8]], align 16
%goals = alloca [100 x i32], align 16
%n = alloca i32, align 4
%team = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %teams) #8
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %goals) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %team) #8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %goals, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %for.end31
for.cond19.preheader: ; preds = %for.end
%1 = and i64 %indvars.iv.next60, 4294967295
%cmp2053.not = icmp eq i64 %1, 0
br i1 %cmp2053.not, label %for.end31, label %for.body21.preheader
for.body21.preheader: ; preds = %for.cond19.preheader
%xtraiter = and i64 %indvars.iv.next60, 3
%2 = icmp ult i64 %indvars.iv59, 3
br i1 %2, label %for.end31.loopexit.unr-lcssa, label %for.body21.preheader.new
for.body21.preheader.new: ; preds = %for.body21.preheader
%unroll_iter = and i64 %indvars.iv.next60, 9223372036854775804
br label %for.body21
for.body: ; preds = %entry, %for.end
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %team)
%cmp349.not = icmp eq i64 %indvars.iv59, 0
br i1 %cmp349.not, label %for.end, label %for.body4
for.body4: ; preds = %for.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds [100 x [10 x i8]], ptr %teams, i64 0, i64 %indvars.iv
%call7 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %team, ptr noundef nonnull dereferenceable(1) %arrayidx) #9
%tobool.not = icmp eq i32 %call7, 0
br i1 %tobool.not, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx9 = getelementptr inbounds [100 x i32], ptr %goals, i64 0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx9, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv59
br i1 %exitcond.not, label %for.end, label %for.body4, !llvm.loop !9
for.end: ; preds = %for.inc, %for.body
%arrayidx12 = getelementptr inbounds [100 x [10 x i8]], ptr %teams, i64 0, i64 %indvars.iv59
%call15 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx12, ptr noundef nonnull dereferenceable(1) %team) #8
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next60, %5
br i1 %cmp, label %for.body, label %for.cond19.preheader, !llvm.loop !11
for.body21: ; preds = %for.body21, %for.body21.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.body21.preheader.new ], [ %indvars.iv.next63.3, %for.body21 ]
%index.056 = phi i32 [ 0, %for.body21.preheader.new ], [ %spec.select48.3, %for.body21 ]
%max.054 = phi i32 [ 0, %for.body21.preheader.new ], [ %spec.select.3, %for.body21 ]
%niter = phi i64 [ 0, %for.body21.preheader.new ], [ %niter.next.3, %for.body21 ]
%arrayidx23 = getelementptr inbounds [100 x i32], ptr %goals, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx23, align 16, !tbaa !5
%cmp24 = icmp sgt i32 %6, %max.054
%spec.select = call i32 @llvm.smax.i32(i32 %6, i32 %max.054)
%7 = trunc i64 %indvars.iv62 to i32
%spec.select48 = select i1 %cmp24, i32 %7, i32 %index.056
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx23.1 = getelementptr inbounds [100 x i32], ptr %goals, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%cmp24.1 = icmp sgt i32 %8, %spec.select
%spec.select.1 = call i32 @llvm.smax.i32(i32 %8, i32 %spec.select)
%9 = trunc i64 %indvars.iv.next63 to i32
%spec.select48.1 = select i1 %cmp24.1, i32 %9, i32 %spec.select48
%indvars.iv.next63.1 = or i64 %indvars.iv62, 2
%arrayidx23.2 = getelementptr inbounds [100 x i32], ptr %goals, i64 0, i64 %indvars.iv.next63.1
%10 = load i32, ptr %arrayidx23.2, align 8, !tbaa !5
%cmp24.2 = icmp sgt i32 %10, %spec.select.1
%spec.select.2 = call i32 @llvm.smax.i32(i32 %10, i32 %spec.select.1)
%11 = trunc i64 %indvars.iv.next63.1 to i32
%spec.select48.2 = select i1 %cmp24.2, i32 %11, i32 %spec.select48.1
%indvars.iv.next63.2 = or i64 %indvars.iv62, 3
%arrayidx23.3 = getelementptr inbounds [100 x i32], ptr %goals, i64 0, i64 %indvars.iv.next63.2
%12 = load i32, ptr %arrayidx23.3, align 4, !tbaa !5
%cmp24.3 = icmp sgt i32 %12, %spec.select.2
%spec.select.3 = call i32 @llvm.smax.i32(i32 %12, i32 %spec.select.2)
%13 = trunc i64 %indvars.iv.next63.2 to i32
%spec.select48.3 = select i1 %cmp24.3, i32 %13, i32 %spec.select48.2
%indvars.iv.next63.3 = add nuw nsw i64 %indvars.iv62, 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.end31.loopexit.unr-lcssa, label %for.body21, !llvm.loop !12
for.end31.loopexit.unr-lcssa: ; preds = %for.body21, %for.body21.preheader
%spec.select48.lcssa.ph = phi i32 [ undef, %for.body21.preheader ], [ %spec.select48.3, %for.body21 ]
%indvars.iv62.unr = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next63.3, %for.body21 ]
%index.056.unr = phi i32 [ 0, %for.body21.preheader ], [ %spec.select48.3, %for.body21 ]
%max.054.unr = phi i32 [ 0, %for.body21.preheader ], [ %spec.select.3, %for.body21 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end31.loopexit, label %for.body21.epil
for.body21.epil: ; preds = %for.end31.loopexit.unr-lcssa, %for.body21.epil
%indvars.iv62.epil = phi i64 [ %indvars.iv.next63.epil, %for.body21.epil ], [ %indvars.iv62.unr, %for.end31.loopexit.unr-lcssa ]
%index.056.epil = phi i32 [ %spec.select48.epil, %for.body21.epil ], [ %index.056.unr, %for.end31.loopexit.unr-lcssa ]
%max.054.epil = phi i32 [ %spec.select.epil, %for.body21.epil ], [ %max.054.unr, %for.end31.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body21.epil ], [ 0, %for.end31.loopexit.unr-lcssa ]
%arrayidx23.epil = getelementptr inbounds [100 x i32], ptr %goals, i64 0, i64 %indvars.iv62.epil
%14 = load i32, ptr %arrayidx23.epil, align 4, !tbaa !5
%cmp24.epil = icmp sgt i32 %14, %max.054.epil
%spec.select.epil = call i32 @llvm.smax.i32(i32 %14, i32 %max.054.epil)
%15 = trunc i64 %indvars.iv62.epil to i32
%spec.select48.epil = select i1 %cmp24.epil, i32 %15, i32 %index.056.epil
%indvars.iv.next63.epil = add nuw nsw i64 %indvars.iv62.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.end31.loopexit, label %for.body21.epil, !llvm.loop !13
for.end31.loopexit: ; preds = %for.body21.epil, %for.end31.loopexit.unr-lcssa
%spec.select48.lcssa = phi i32 [ %spec.select48.lcssa.ph, %for.end31.loopexit.unr-lcssa ], [ %spec.select48.epil, %for.body21.epil ]
%16 = sext i32 %spec.select48.lcssa to i64
br label %for.end31
for.end31: ; preds = %entry, %for.end31.loopexit, %for.cond19.preheader
%index.0.lcssa = phi i64 [ 0, %for.cond19.preheader ], [ %16, %for.end31.loopexit ], [ 0, %entry ]
%arrayidx33 = getelementptr inbounds [100 x [10 x i8]], ptr %teams, i64 0, i64 %index.0.lcssa
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx33)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %team) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %goals) #8
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %teams) #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: 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 nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; 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 #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, 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 = { 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 = { 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 nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { 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}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main()
{
int b,f,r,v,n,i,j,k;
int X[5][5][20]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d %d %d",&b,&f,&r,&v);
X[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",X[i][j][k]);
}
printf("\n");
}
if(i<3) printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237063/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237063/source.c"
target datalayout = "e-m:e-p270: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:
%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
%X = alloca [5 x [5 x [20 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 2000, ptr nonnull %X) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000) %X, i8 0, i64 2000, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 0, i64 0
%7 = load i32, ptr %arrayidx22, align 16, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%arrayidx22.1 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 0, i64 4
%11 = load i32, ptr %arrayidx22.4, align 16, !tbaa !5
%call23.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%arrayidx22.5 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 0, i64 8
%15 = load i32, ptr %arrayidx22.8, align 16, !tbaa !5
%call23.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
%arrayidx22.9 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 1, i64 0
%17 = load i32, ptr %arrayidx22.152, align 16, !tbaa !5
%call23.153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17)
%arrayidx22.1.1 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 1, i64 4
%21 = load i32, ptr %arrayidx22.4.1, align 16, !tbaa !5
%call23.4.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
%arrayidx22.5.1 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 1, i64 8
%25 = load i32, ptr %arrayidx22.8.1, align 16, !tbaa !5
%call23.8.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx22.9.1 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 2, i64 0
%27 = load i32, ptr %arrayidx22.254, align 16, !tbaa !5
%call23.255 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27)
%arrayidx22.1.2 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 2, i64 4
%31 = load i32, ptr %arrayidx22.4.2, align 16, !tbaa !5
%call23.4.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %31)
%arrayidx22.5.2 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, 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 [5 x [5 x [20 x i32]]], ptr %X, i64 0, i64 %indvars.iv, i64 2, i64 8
%35 = load i32, ptr %arrayidx22.8.2, align 16, !tbaa !5
%call23.8.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%arrayidx22.9.2 = getelementptr inbounds [5 x [5 x [20 x i32]]], ptr %X, 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 = icmp ult i64 %indvars.iv, 3
br i1 %cmp31, label %if.then, label %for.inc33
if.then: ; preds = %for.cond11.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
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 !11
for.end35: ; preds = %for.inc33
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %X) #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: 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}
|
#include<stdio.h>
int main(){
int n, b, f, r, v;
int nor[4][3][10]={};
int i, j, k;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d %d %d %d", &b, &f, &r, &v);
nor[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", nor[i][j][k]);
}
printf("\n");
}
if(i!=3) printf("####################\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237106/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237106/source.c"
target datalayout = "e-m:e-p270: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
%b = alloca i32, align 4
%f = alloca i32, align 4
%r = alloca i32, align 4
%v = alloca i32, align 4
%nor = 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 %nor) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(480) %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor, 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 %nor) #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 @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,flag=0;
long long i=0;
scanf("%d ",&n);
while(i*1234567<=n)
{
long long j=0;
while(i*1234567+j*123456<=n)
{
if((n-i*1234567-j*123456)%1234==0) flag=1;
j++;
}
i++;
}
if(flag) printf("YES\n");
else printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23715/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23715/source.c"
target datalayout = "e-m:e-p270: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 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%conv = sext i32 %0 to i64
%cmp.not30 = icmp slt i32 %0, 0
br i1 %cmp.not30, label %if.else, label %while.cond2.preheader
while.cond2.preheader: ; preds = %entry, %while.end
%mul33 = phi i64 [ %mul, %while.end ], [ 0, %entry ]
%i.032 = phi i64 [ %inc15, %while.end ], [ 0, %entry ]
%flag.031 = phi i32 [ %spec.select, %while.end ], [ 0, %entry ]
br label %while.body8
while.body8: ; preds = %while.cond2.preheader, %while.body8
%add29 = phi i64 [ %mul33, %while.cond2.preheader ], [ %add, %while.body8 ]
%j.028 = phi i64 [ 0, %while.cond2.preheader ], [ %inc, %while.body8 ]
%flag.127 = phi i32 [ %flag.031, %while.cond2.preheader ], [ %spec.select, %while.body8 ]
%sub12 = sub nsw i64 %conv, %add29
%rem = srem i64 %sub12, 1234
%cmp13 = icmp eq i64 %rem, 0
%spec.select = select i1 %cmp13, i32 1, i32 %flag.127
%inc = add nuw nsw i64 %j.028, 1
%mul4 = mul nuw nsw i64 %inc, 123456
%add = add nuw nsw i64 %mul4, %mul33
%cmp6.not = icmp sgt i64 %add, %conv
br i1 %cmp6.not, label %while.end, label %while.body8, !llvm.loop !9
while.end: ; preds = %while.body8
%inc15 = add nuw nsw i64 %i.032, 1
%mul = mul nuw nsw i64 %inc15, 1234567
%cmp.not = icmp sgt i64 %mul, %conv
br i1 %cmp.not, label %while.end16, label %while.cond2.preheader, !llvm.loop !11
while.end16: ; preds = %while.end
%1 = icmp eq i32 %spec.select, 0
br i1 %1, label %if.else, label %if.end20
if.else: ; preds = %entry, %while.end16
br label %if.end20
if.end20: ; preds = %while.end16, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %while.end16 ]
%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"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int k,c,i,total,kai,t;
for(t=0; t<100; t++){
scanf("%d",&k);
if(k ==0 ) break;
total=0;
for(i=0; i<(k*k-k)/2; i++){
scanf("%d",&c);
total+=c;
}
kai=total/(k-1);
printf("%d\n",kai);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237207/source.c"
target datalayout = "e-m:e-p270: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:
%k = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
br label %for.body
for.body: ; preds = %entry, %for.end
%t.021 = phi i32 [ 0, %entry ], [ %inc10, %for.end ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, 0
br i1 %cmp1, label %for.end11, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body
%1 = add i32 %0, -1
%sub15 = mul i32 %1, %0
%cmp317 = icmp sgt i32 %sub15, 1
br i1 %cmp317, label %for.body4, label %for.end
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.019 = phi i32 [ %inc, %for.body4 ], [ 0, %for.cond2.preheader ]
%total.018 = phi i32 [ %add, %for.body4 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%2 = load i32, ptr %c, align 4, !tbaa !5
%add = add nsw i32 %2, %total.018
%inc = add nuw nsw i32 %i.019, 1
%3 = load i32, ptr %k, align 4, !tbaa !5
%4 = add i32 %3, -1
%sub = mul i32 %4, %3
%div = sdiv i32 %sub, 2
%cmp3 = icmp slt i32 %inc, %div
br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body4, %for.cond2.preheader
%total.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %add, %for.body4 ]
%.lcssa = phi i32 [ %1, %for.cond2.preheader ], [ %4, %for.body4 ]
%div7 = sdiv i32 %total.0.lcssa, %.lcssa
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div7)
%inc10 = add nuw nsw i32 %t.021, 1
%exitcond.not = icmp eq i32 %inc10, 100
br i1 %exitcond.not, label %for.end11, label %for.body, !llvm.loop !11
for.end11: ; preds = %for.body, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
long keisan(long x, long y, char z){
long ans;
if(z=='+') ans=x+y;
else if(z=='-') ans=x-y;
else if(z=='*') ans=x*y;
else if(z=='/') ans=x/y;
return ans;
}
int main(void){
long a, b, result;
char num[10], c;
scanf("%ld", &a);
scanf(" %c", &c);
scanf(" %ld", &b);
result = keisan(a,b,c);
while(1){
scanf(" %c", &c);
if(c=='=') break;
scanf(" %ld", &a);
result = keisan(result, a, c);
}
printf("%ld\n", result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237265/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237265/source.c"
target datalayout = "e-m:e-p270: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 [4 x i8] c" %c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c" %ld\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @keisan(i64 noundef %x, i64 noundef %y, i8 noundef signext %z) local_unnamed_addr #0 {
entry:
switch i8 %z, label %if.end18 [
i8 43, label %if.then
i8 45, label %if.then5
i8 42, label %if.then10
i8 47, label %if.then15
]
if.then: ; preds = %entry
%add = add nsw i64 %y, %x
br label %if.end18
if.then5: ; preds = %entry
%sub = sub nsw i64 %x, %y
br label %if.end18
if.then10: ; preds = %entry
%mul = mul nsw i64 %y, %x
br label %if.end18
if.then15: ; preds = %entry
%div = sdiv i64 %x, %y
br label %if.end18
if.end18: ; preds = %entry, %if.then5, %if.then15, %if.then10, %if.then
%ans.0 = phi i64 [ %add, %if.then ], [ %sub, %if.then5 ], [ %mul, %if.then10 ], [ %div, %if.then15 ], [ undef, %entry ]
ret i64 %ans.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%2 = load i8, ptr %c, align 1, !tbaa !9
switch i8 %2, label %keisan.exit [
i8 43, label %if.then.i
i8 45, label %if.then5.i
i8 42, label %if.then10.i
i8 47, label %if.then15.i
]
if.then.i: ; preds = %entry
%add.i = add nsw i64 %1, %0
br label %keisan.exit
if.then5.i: ; preds = %entry
%sub.i = sub nsw i64 %0, %1
br label %keisan.exit
if.then10.i: ; preds = %entry
%mul.i = mul nsw i64 %1, %0
br label %keisan.exit
if.then15.i: ; preds = %entry
%div.i = sdiv i64 %0, %1
br label %keisan.exit
keisan.exit: ; preds = %entry, %if.then.i, %if.then5.i, %if.then10.i, %if.then15.i
%ans.0.i = phi i64 [ %add.i, %if.then.i ], [ %sub.i, %if.then5.i ], [ %mul.i, %if.then10.i ], [ %div.i, %if.then15.i ], [ undef, %entry ]
%call420 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%3 = load i8, ptr %c, align 1, !tbaa !9
%cmp21 = icmp eq i8 %3, 61
br i1 %cmp21, label %while.end, label %if.end
if.end: ; preds = %keisan.exit, %keisan.exit19
%result.022 = phi i64 [ %ans.0.i12, %keisan.exit19 ], [ %ans.0.i, %keisan.exit ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a)
%4 = load i64, ptr %a, align 8, !tbaa !5
%5 = load i8, ptr %c, align 1, !tbaa !9
switch i8 %5, label %keisan.exit19 [
i8 43, label %if.then.i17
i8 45, label %if.then5.i15
i8 42, label %if.then10.i13
i8 47, label %if.then15.i10
]
if.then.i17: ; preds = %if.end
%add.i18 = add nsw i64 %4, %result.022
br label %keisan.exit19
if.then5.i15: ; preds = %if.end
%sub.i16 = sub nsw i64 %result.022, %4
br label %keisan.exit19
if.then10.i13: ; preds = %if.end
%mul.i14 = mul nsw i64 %4, %result.022
br label %keisan.exit19
if.then15.i10: ; preds = %if.end
%div.i11 = sdiv i64 %result.022, %4
br label %keisan.exit19
keisan.exit19: ; preds = %if.end, %if.then.i17, %if.then5.i15, %if.then10.i13, %if.then15.i10
%ans.0.i12 = phi i64 [ %add.i18, %if.then.i17 ], [ %sub.i16, %if.then5.i15 ], [ %mul.i14, %if.then10.i13 ], [ %div.i11, %if.then15.i10 ], [ undef, %if.end ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%6 = load i8, ptr %c, align 1, !tbaa !9
%cmp = icmp eq i8 %6, 61
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %keisan.exit19, %keisan.exit
%result.0.lcssa = phi i64 [ %ans.0.i, %keisan.exit ], [ %ans.0.i12, %keisan.exit19 ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include<stdio.h>
#define MAX 10000
#define NIL -1
typedef struct N {
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 );
}
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 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_237315/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237315/source.c"
target datalayout = "e-m:e-p270: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.N = 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.N] 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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.N], 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 = !{!"N", !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>
#define MAX 100005
#define NIL -1
struct Node{
int p, l, r;
};
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].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){
int deg=0;
printf("node %d: parent = %d, sibling = %d, ", u, T[u].p, getSibling(u));
if(T[u].l != NIL) deg++;
if(T[u].r != NIL) deg++;
printf("degree = %d, depth = %d, height = %d, ", deg, D[u], 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 i;
int v, l, r, root=0;
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_237359/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237359/source.c"
target datalayout = "e-m:e-p270: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 [100005 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [100005 x %struct.Node] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [100005 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
@n = dso_local global i32 0, align 4
@.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 @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 [100005 x i32], ptr @D, i64 0, i64 %idxprom
store i32 %d.tr13, ptr %arrayidx, align 4, !tbaa !5
%l = getelementptr inbounds [100005 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 [100005 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 [100005 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 [100005 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 [100005 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 [100005 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 [100005 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 [100005 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:
%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 !12
%cmp.i = icmp eq i32 %0, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %0 to i64
%l.i = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%1 = load i32, ptr %l.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 %getSibling.exit
if.end21.i: ; preds = %if.end.i
%r.i = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%2 = load i32, ptr %r.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 %getSibling.exit
getSibling.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 %u, i32 noundef %0, i32 noundef %retval.0.i)
%l = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 1
%3 = load i32, ptr %l, align 4, !tbaa !9
%cmp.not = icmp ne i32 %3, -1
%spec.select = zext i1 %cmp.not to i32
%r = getelementptr inbounds [100005 x %struct.Node], ptr @T, i64 0, i64 %idxprom, i32 2
%4 = load i32, ptr %r, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %4, -1
%inc8 = select i1 %cmp.not, i32 2, i32 1
%deg.1 = select i1 %cmp6.not, i32 %spec.select, i32 %inc8
%arrayidx11 = getelementptr inbounds [100005 x i32], ptr @D, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [100005 x i32], ptr @H, 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.1, i32 noundef %deg.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 = %getSibling.exit
%8 = load i32, ptr %l, 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 %r, 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, %getSibling.exit, %if.else31
%str.7.sink = phi ptr [ @str, %if.else31 ], [ @str.8, %getSibling.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:
%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.5, 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 [100005 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 [100005 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 [100005 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 [100005 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 [100005 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.6, 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 [100005 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 [100005 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 [100005 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 [100005 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.062 = 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 [100005 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.062
%indvars.iv.next69 = or i64 %indvars.iv68, 1
%arrayidx28.1 = getelementptr inbounds [100005 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 [100005 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 [100005 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.062.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.062.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.062.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 [100005 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.062.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 = !{!"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, !16}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !16}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#define lpton(i,n) for(int i=0;i<(int)n;i++)
#define lpto0(i,n) for(int i=n;i>-1;i--)
#define lpmn(i,m,n) for(i=m;i<n;i++)
#define ms0(l) memset(l,0,sizeof(l))
#define ms(l,n,s) memset(l,n,s)
#define m(x,n) (x*)malloc(n*sizeof(x))
typedef struct tree{
int nnode;
int parent;
int left;
int right;
}tree;
int dep;
void print(tree*,int);
int sibling(tree*,int);
int degree(tree*,int);
int depth(tree*,int);
int height(tree*,int);
char* typename(tree*,int);
int main(){
int n,nnode;
tree *tr;
scanf("%d",&n);
tr=m(tree,n);
ms(tr,-1,n*sizeof(tree));
lpton(i,n){
scanf("%d",&nnode);
(tr+nnode)->nnode=nnode;
scanf("%d%d",&(tr+nnode)->left,&(tr+nnode)->right);
(tr+((tr+nnode)->left))->parent=nnode;
(tr+((tr+nnode)->right))->parent=nnode;
}
print(tr,n);
free(tr);
return 0;
}
void print(tree *tr,int n){
int sb,dg,dp,hg;
lpton(i,n){
dep=0;
sb=sibling(tr,i);
dg=degree(tr,i);
dp=depth(tr,i);
hg=height(tr,i);
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",(tr+i)->nnode,(tr+i)->parent,sb,dg,dp,hg,typename(tr,i));
}
}
int sibling(tree *tr,int i){
if((tr+i)->parent==-1)return -1;
else if((tr+((tr+i)->parent))->left==(tr+i)->nnode)return (tr+((tr+i)->parent))->right;
else return (tr+((tr+i)->parent))->left;
}
int degree(tree *tr,int i){
if((tr+i)->right==-1&&(tr+i)->left==-1)return 0;
else if((tr+i)->right!=-1&&(tr+i)->left!=-1)return 2;
else return 1;
}
int depth(tree *tr,int i){
if((tr+i)->parent==-1)return dep;
depth(tr,(tr+i)->parent);
return dep+=1;
}
int height(tree *tr,int i){
int h1=0,h2=0;
if((tr+i)->left!=-1)h1=(height(tr,(tr+i)->left))+1;
if((tr+i)->right!=-1)h2=(height(tr,(tr+i)->right))+1;
return (h1>h2?h1:h2);
}
char *typename(tree *tr,int i){
if((tr+i)->parent==-1)return "root";
else if(degree(tr,i)==0)return "leaf";
else return "internal node";
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237409/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237409/source.c"
target datalayout = "e-m:e-p270: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 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@dep = dso_local local_unnamed_addr global i32 0, align 4
@.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 [5 x i8] c"root\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@.str.5 = 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
%nnode = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nnode) #11
%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, 4
%call1 = call noalias ptr @malloc(i64 noundef %mul) #12
call void @llvm.memset.p0.i64(ptr align 4 %call1, i8 -1, i64 %mul, i1 false)
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %5, %for.body ]
call void @print(ptr noundef %call1, i32 noundef %.lcssa)
call void @free(ptr noundef %call1) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nnode) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
for.body: ; preds = %entry, %for.body
%i.034 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %nnode)
%1 = load i32, ptr %nnode, align 4, !tbaa !5
%idx.ext = sext i32 %1 to i64
%add.ptr = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext
store i32 %1, ptr %add.ptr, align 4, !tbaa !9
%left = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext, i32 2
%right = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext, i32 3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%2 = load i32, ptr %nnode, align 4, !tbaa !5
%idx.ext12 = sext i32 %2 to i64
%left14 = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext12, i32 2
%3 = load i32, ptr %left14, align 4, !tbaa !11
%idx.ext15 = sext i32 %3 to i64
%parent = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext15, i32 1
store i32 %2, ptr %parent, align 4, !tbaa !12
%right19 = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext12, i32 3
%4 = load i32, ptr %right19, align 4, !tbaa !13
%idx.ext20 = sext i32 %4 to i64
%parent22 = getelementptr inbounds %struct.tree, ptr %call1, i64 %idx.ext20, i32 1
store i32 %2, ptr %parent22, align 4, !tbaa !12
%inc = add nuw nsw i32 %i.034, 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 !14
}
; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr noundef %tr, i32 noundef %n) local_unnamed_addr #5 {
entry:
%cmp32 = icmp sgt i32 %n, 0
br i1 %cmp32, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %typename.exit, %entry
ret void
for.body: ; preds = %for.body.preheader, %typename.exit
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %typename.exit ]
store i32 0, ptr @dep, align 4, !tbaa !5
%parent.i = getelementptr inbounds %struct.tree, ptr %tr, i64 %indvars.iv, i32 1
%0 = load i32, ptr %parent.i, align 4, !tbaa !12
%cmp.i = icmp eq i32 %0, -1
br i1 %cmp.i, label %sibling.exit, label %if.else.i
if.else.i: ; preds = %for.body
%add.ptr.i = getelementptr inbounds %struct.tree, ptr %tr, i64 %indvars.iv
%idx.ext4.i = sext i32 %0 to i64
%left.i = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext4.i, i32 2
%1 = load i32, ptr %left.i, align 4, !tbaa !11
%2 = load i32, ptr %add.ptr.i, align 4, !tbaa !9
%cmp8.i = icmp eq i32 %1, %2
br i1 %cmp8.i, label %if.then9.i, label %sibling.exit
if.then9.i: ; preds = %if.else.i
%right.i = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext4.i, i32 3
%3 = load i32, ptr %right.i, align 4, !tbaa !13
br label %sibling.exit
sibling.exit: ; preds = %for.body, %if.else.i, %if.then9.i
%retval.0.i = phi i32 [ %3, %if.then9.i ], [ -1, %for.body ], [ %1, %if.else.i ]
%right.i23 = getelementptr inbounds %struct.tree, ptr %tr, i64 %indvars.iv, i32 3
%4 = load i32, ptr %right.i23, align 4, !tbaa !13
%cmp.i24 = icmp eq i32 %4, -1
%left.i25 = getelementptr inbounds %struct.tree, ptr %tr, i64 %indvars.iv, i32 2
%5 = load i32, ptr %left.i25, align 4, !tbaa !11
%cmp3.i = icmp eq i32 %5, -1
br i1 %cmp.i24, label %land.lhs.true.i, label %land.lhs.true8.i
land.lhs.true.i: ; preds = %sibling.exit
br i1 %cmp3.i, label %degree.exit, label %if.else14.i
land.lhs.true8.i: ; preds = %sibling.exit
br i1 %cmp3.i, label %if.else14.i, label %degree.exit
if.else14.i: ; preds = %land.lhs.true8.i, %land.lhs.true.i
br label %degree.exit
degree.exit: ; preds = %land.lhs.true.i, %land.lhs.true8.i, %if.else14.i
%retval.0.i26 = phi i32 [ 1, %if.else14.i ], [ 0, %land.lhs.true.i ], [ 2, %land.lhs.true8.i ]
%6 = trunc i64 %indvars.iv to i32
%call2 = tail call i32 @depth(ptr noundef nonnull %tr, i32 noundef %6)
%call3 = tail call i32 @height(ptr noundef nonnull %tr, i32 noundef %6)
%add.ptr = getelementptr inbounds %struct.tree, ptr %tr, i64 %indvars.iv
%7 = load i32, ptr %add.ptr, align 4, !tbaa !9
%8 = load i32, ptr %parent.i, align 4, !tbaa !12
%cmp.i29 = icmp eq i32 %8, -1
br i1 %cmp.i29, label %typename.exit, label %if.else.i30
if.else.i30: ; preds = %degree.exit
%9 = load i32, ptr %right.i23, align 4, !tbaa !13
%cmp.i.i = icmp ne i32 %9, -1
%10 = load i32, ptr %left.i25, align 4, !tbaa !11
%cmp3.i.i = icmp ne i32 %10, -1
%brmerge.i = select i1 %cmp.i.i, i1 true, i1 %cmp3.i.i
%spec.select.i = select i1 %brmerge.i, ptr @.str.5, ptr @.str.4
br label %typename.exit
typename.exit: ; preds = %degree.exit, %if.else.i30
%retval.0.i31 = phi ptr [ @.str.3, %degree.exit ], [ %spec.select.i, %if.else.i30 ]
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7, i32 noundef %8, i32 noundef %retval.0.i, i32 noundef %retval.0.i26, i32 noundef %call2, i32 noundef %call3, ptr noundef nonnull %retval.0.i31)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !16
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sibling(ptr nocapture noundef readonly %tr, i32 noundef %i) local_unnamed_addr #7 {
entry:
%idx.ext = sext i32 %i to i64
%parent = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 1
%0 = load i32, ptr %parent, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.else
if.else: ; preds = %entry
%add.ptr = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext
%idx.ext4 = sext i32 %0 to i64
%left = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext4, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !11
%2 = load i32, ptr %add.ptr, align 4, !tbaa !9
%cmp8 = icmp eq i32 %1, %2
br i1 %cmp8, label %if.then9, label %return
if.then9: ; preds = %if.else
%right = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext4, i32 3
%3 = load i32, ptr %right, align 4, !tbaa !13
br label %return
return: ; preds = %if.else, %entry, %if.then9
%retval.0 = phi i32 [ %3, %if.then9 ], [ -1, %entry ], [ %1, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @degree(ptr nocapture noundef readonly %tr, i32 noundef %i) local_unnamed_addr #7 {
entry:
%idx.ext = sext i32 %i to i64
%right = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 3
%0 = load i32, ptr %right, align 4, !tbaa !13
%cmp = icmp eq i32 %0, -1
%left = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 2
%1 = load i32, ptr %left, align 4, !tbaa !11
%cmp3 = icmp eq i32 %1, -1
br i1 %cmp, label %land.lhs.true, label %land.lhs.true8
land.lhs.true: ; preds = %entry
br i1 %cmp3, label %return, label %if.else14
land.lhs.true8: ; preds = %entry
br i1 %cmp3, label %if.else14, label %return
if.else14: ; preds = %land.lhs.true, %land.lhs.true8
br label %return
return: ; preds = %land.lhs.true8, %land.lhs.true, %if.else14
%retval.0 = phi i32 [ 1, %if.else14 ], [ 0, %land.lhs.true ], [ 2, %land.lhs.true8 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @depth(ptr nocapture noundef readonly %tr, i32 noundef %i) local_unnamed_addr #8 {
entry:
%idx.ext = sext i32 %i to i64
%parent = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 1
%0 = load i32, ptr %parent, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load i32, ptr @dep, align 4, !tbaa !5
br label %common.ret7
common.ret7: ; preds = %if.end, %if.then
%common.ret7.op = phi i32 [ %1, %if.then ], [ %add, %if.end ]
ret i32 %common.ret7.op
if.end: ; preds = %entry
%call = tail call i32 @depth(ptr noundef nonnull %tr, i32 noundef %0)
%2 = load i32, ptr @dep, align 4, !tbaa !5
%add = add nsw i32 %2, 1
store i32 %add, ptr @dep, align 4, !tbaa !5
br label %common.ret7
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @height(ptr noundef %tr, i32 noundef %i) local_unnamed_addr #9 {
entry:
%idx.ext = sext i32 %i to i64
%left = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 2
%0 = load i32, ptr %left, align 4, !tbaa !11
%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(ptr noundef nonnull %tr, 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 %struct.tree, ptr %tr, i64 %idx.ext, i32 3
%1 = load i32, ptr %right, align 4, !tbaa !13
%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(ptr noundef nonnull %tr, 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)
ret i32 %cond
}
; 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(argmem: read) uwtable
define dso_local nonnull ptr @typename(ptr nocapture noundef readonly %tr, i32 noundef %i) local_unnamed_addr #7 {
entry:
%idx.ext = sext i32 %i to i64
%parent = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 1
%0 = load i32, ptr %parent, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.else
if.else: ; preds = %entry
%right.i = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 3
%1 = load i32, ptr %right.i, align 4, !tbaa !13
%cmp.i = icmp ne i32 %1, -1
%left.i = getelementptr inbounds %struct.tree, ptr %tr, i64 %idx.ext, i32 2
%2 = load i32, ptr %left.i, align 4, !tbaa !11
%cmp3.i = icmp ne i32 %2, -1
%brmerge = select i1 %cmp.i, i1 true, i1 %cmp3.i
%spec.select = select i1 %brmerge, ptr @.str.5, ptr @.str.4
br label %return
return: ; preds = %if.else, %entry
%retval.0 = phi ptr [ @.str.3, %entry ], [ %spec.select, %if.else ]
ret ptr %retval.0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #10
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress 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 #7 = { 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 #8 = { 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 #9 = { 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 #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind }
attributes #12 = { 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, !6, i64 0}
!10 = !{!"tree", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 4}
!13 = !{!10, !6, i64 12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Node {
int key;
struct Node* parent;
struct Node* left;
struct Node* right;
struct Node* sibling;
int degree;
int depth;
int height;
char type[15];
};
typedef struct Node * NodePointer;
void serach_depth (NodePointer ,int );
int main (){
int n;
scanf("%d\n",&n);
//setting part
NodePointer array [n];
for (int i = 0; i < n;i++)
{
array[i] = (NodePointer) malloc (sizeof(struct Node));
array[i]->parent = NULL;
array[i]->sibling = NULL;
array[i]->left = NULL;
array[i]->right = NULL;
array[i]->degree = 0;
strcpy(array[i]->type,"internal node");
}
//input part
for (int i = 0; i < n;i++)
{
int id ,left_id,right_id;
scanf("%d %d %d\n",&id,&left_id,&right_id);
array[id]->key = id;
if (left_id != -1){
array[id]->left = array[left_id];
array[left_id]->parent = array[id];
array[id]->degree++;
}
if (right_id != -1){
array[id]->right = array[right_id];
array[right_id]->parent = array[id];
array[id]->degree++;
}
if (left_id != -1 && right_id != -1){
array[left_id]->sibling = array[right_id];
array[right_id]->sibling = array[left_id];
}
if (left_id == -1 && right_id == -1){
strcpy(array[id]->type ,"leaf");
}
}
//search part
for (int i = 0; i < n;i++)
{
if(array[i]->parent == NULL) {
strcpy(array[i]->type ,"root");
serach_depth(array[i],0); break;
}
}
//print part
for (int i=0; i<n ;i++){
printf("node %d: ",i);
if (array[i] -> parent != NULL){
printf("parent = %d, ",array[i]->parent->key);
}else {
printf("parent = -1, ");
}if (array[i] -> sibling != NULL){
printf("sibling = %d, ",array[i]->sibling->key);
}else {
printf("sibling = -1, ");
}
printf("degree = %d, depth = %d, height = %d, %s\n",array[i]->degree,array[i]->depth,array[i]->height,array[i]->type );
}
return 0;
}
void serach_depth (NodePointer tag,int dep){
tag->depth = dep;
if(tag->left == NULL && tag->right == NULL){tag->height = 0; return;}
if ( tag->left != NULL){serach_depth(tag->left , dep+1);}
if ( tag->right != NULL){serach_depth(tag->right , dep+1);}
if ( tag->left == NULL ){
tag->height = tag->right->height + 1;
}
if ( tag->right == NULL){
tag->height = tag->left->height + 1;
}
if ( tag->left != NULL && tag->right != NULL){
if ( tag->left->height > tag->right->height){
tag->height = tag->left->height + 1;
}else {
tag->height = tag->right->height + 1;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237452/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237452/source.c"
target datalayout = "e-m:e-p270: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, ptr, ptr, ptr, ptr, i32, i32, i32, [15 x i8] }
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"root\00", align 1
@.str.5 = private unnamed_addr constant [10 x i8] c"node %d: \00", align 1
@.str.6 = private unnamed_addr constant [14 x i8] c"parent = %d, \00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"parent = -1, \00", align 1
@.str.8 = private unnamed_addr constant [15 x i8] c"sibling = %d, \00", align 1
@.str.9 = private unnamed_addr constant [15 x i8] c"sibling = -1, \00", align 1
@.str.10 = private unnamed_addr constant [42 x i8] c"degree = %d, depth = %d, height = %d, %s\0A\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
%left_id = alloca i32, align 4
%right_id = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%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 ptr, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp186 = icmp sgt i32 %3, 0
br i1 %cmp186, label %for.body.preheader, label %for.cond.cleanup106
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %3 to i64
br label %for.body
for.cond16.preheader: ; preds = %for.body
br i1 %cmp186, label %for.body19, label %for.cond.cleanup106
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call1 = call noalias dereferenceable_or_null(72) ptr @malloc(i64 noundef 72) #9
%arrayidx = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv
store ptr %call1, ptr %arrayidx, align 8, !tbaa !9
%parent = getelementptr inbounds %struct.Node, ptr %call1, i64 0, i32 1
%type = getelementptr inbounds %struct.Node, ptr %call1, i64 0, i32 8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(36) %parent, i8 0, i64 36, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(14) %type, ptr noundef nonnull align 1 dereferenceable(14) @.str.1, i64 14, i1 false) #8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond16.preheader, label %for.body, !llvm.loop !11
for.cond83.preheader: ; preds = %if.end78
%cmp84190 = icmp sgt i32 %21, 0
br i1 %cmp84190, label %for.body86.preheader, label %for.cond.cleanup106
for.body86.preheader: ; preds = %for.cond83.preheader
%wide.trip.count200 = zext i32 %21 to i64
br label %for.body86
for.body19: ; preds = %for.cond16.preheader, %if.end78
%i15.0189 = phi i32 [ %inc80, %if.end78 ], [ 0, %for.cond16.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left_id) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right_id) #8
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %id, ptr noundef nonnull %left_id, ptr noundef nonnull %right_id)
%4 = load i32, ptr %id, align 4, !tbaa !5
%idxprom21 = sext i32 %4 to i64
%arrayidx22 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom21
%5 = load ptr, ptr %arrayidx22, align 8, !tbaa !9
store i32 %4, ptr %5, align 8, !tbaa !13
%6 = load i32, ptr %left_id, align 4, !tbaa !5
%cmp23.not = icmp eq i32 %6, -1
br i1 %cmp23.not, label %if.end, label %if.end.thread
if.end: ; preds = %for.body19
%7 = load i32, ptr %right_id, align 4
%cmp38.not = icmp eq i32 %7, -1
br i1 %cmp38.not, label %if.then72, label %if.end54
if.end.thread: ; preds = %for.body19
%idxprom24 = sext i32 %6 to i64
%arrayidx25 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom24
%8 = load ptr, ptr %arrayidx25, align 8, !tbaa !9
%9 = load i32, ptr %id, align 4, !tbaa !5
%idxprom26 = sext i32 %9 to i64
%arrayidx27 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom26
%10 = load ptr, ptr %arrayidx27, align 8, !tbaa !9
%left28 = getelementptr inbounds %struct.Node, ptr %10, i64 0, i32 2
store ptr %8, ptr %left28, align 8, !tbaa !15
%parent33 = getelementptr inbounds %struct.Node, ptr %8, i64 0, i32 1
store ptr %10, ptr %parent33, align 8, !tbaa !16
%degree36 = getelementptr inbounds %struct.Node, ptr %10, i64 0, i32 5
%11 = load i32, ptr %degree36, align 8, !tbaa !17
%inc37 = add nsw i32 %11, 1
store i32 %inc37, ptr %degree36, align 8, !tbaa !17
%12 = load i32, ptr %right_id, align 4
%cmp38.not207 = icmp eq i32 %12, -1
br i1 %cmp38.not207, label %if.end78, label %if.end54
if.end54: ; preds = %if.end.thread, %if.end
%13 = phi i32 [ %12, %if.end.thread ], [ %7, %if.end ]
%idxprom40 = sext i32 %13 to i64
%arrayidx41 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom40
%14 = load ptr, ptr %arrayidx41, align 8, !tbaa !9
%15 = load i32, ptr %id, align 4, !tbaa !5
%idxprom42 = sext i32 %15 to i64
%arrayidx43 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom42
%16 = load ptr, ptr %arrayidx43, align 8, !tbaa !9
%right44 = getelementptr inbounds %struct.Node, ptr %16, i64 0, i32 3
store ptr %14, ptr %right44, align 8, !tbaa !18
%parent49 = getelementptr inbounds %struct.Node, ptr %14, i64 0, i32 1
store ptr %16, ptr %parent49, align 8, !tbaa !16
%degree52 = getelementptr inbounds %struct.Node, ptr %16, i64 0, i32 5
%17 = load i32, ptr %degree52, align 8, !tbaa !17
%inc53 = add nsw i32 %17, 1
store i32 %inc53, ptr %degree52, align 8, !tbaa !17
br i1 %cmp23.not, label %if.end78, label %if.then57
if.then57: ; preds = %if.end54
%idxprom60 = sext i32 %6 to i64
%arrayidx61 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom60
%18 = load ptr, ptr %arrayidx61, align 8, !tbaa !9
%sibling62 = getelementptr inbounds %struct.Node, ptr %18, i64 0, i32 4
store ptr %14, ptr %sibling62, align 8, !tbaa !19
%sibling67 = getelementptr inbounds %struct.Node, ptr %14, i64 0, i32 4
store ptr %18, ptr %sibling67, align 8, !tbaa !19
br label %if.end78
if.then72: ; preds = %if.end
%19 = load i32, ptr %id, align 4, !tbaa !5
%idxprom73 = sext i32 %19 to i64
%arrayidx74 = getelementptr inbounds ptr, ptr %vla, i64 %idxprom73
%20 = load ptr, ptr %arrayidx74, align 8, !tbaa !9
%type75 = getelementptr inbounds %struct.Node, ptr %20, i64 0, i32 8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %type75, ptr noundef nonnull align 1 dereferenceable(5) @.str.3, i64 5, i1 false) #8
br label %if.end78
if.end78: ; preds = %if.end.thread, %if.end54, %if.then57, %if.then72
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right_id) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left_id) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #8
%inc80 = add nuw nsw i32 %i15.0189, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp slt i32 %inc80, %21
br i1 %cmp17, label %for.body19, label %for.cond83.preheader, !llvm.loop !20
for.cond83: ; preds = %for.body86
%indvars.iv.next198 = add nuw nsw i64 %indvars.iv197, 1
%exitcond201.not = icmp eq i64 %indvars.iv.next198, %wide.trip.count200
br i1 %exitcond201.not, label %cleanup, label %for.body86, !llvm.loop !21
for.body86: ; preds = %for.body86.preheader, %for.cond83
%indvars.iv197 = phi i64 [ 0, %for.body86.preheader ], [ %indvars.iv.next198, %for.cond83 ]
%arrayidx88 = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv197
%22 = load ptr, ptr %arrayidx88, align 8, !tbaa !9
%parent89 = getelementptr inbounds %struct.Node, ptr %22, i64 0, i32 1
%23 = load ptr, ptr %parent89, align 8, !tbaa !16
%cmp90 = icmp eq ptr %23, null
br i1 %cmp90, label %if.then91, label %for.cond83
if.then91: ; preds = %for.body86
%type94 = getelementptr inbounds %struct.Node, ptr %22, i64 0, i32 8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %type94, ptr noundef nonnull align 1 dereferenceable(5) @.str.4, i64 5, i1 false) #8
call void @serach_depth(ptr noundef nonnull %22, i32 noundef 0)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %for.cond83, %if.then91
%24 = phi i32 [ %.pre, %if.then91 ], [ %21, %for.cond83 ]
%cmp105192 = icmp sgt i32 %24, 0
br i1 %cmp105192, label %for.body107, label %for.cond.cleanup106
for.cond.cleanup106: ; preds = %if.end133, %entry, %for.cond16.preheader, %for.cond83.preheader, %cleanup
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body107: ; preds = %cleanup, %if.end133
%indvars.iv202 = phi i64 [ %indvars.iv.next203, %if.end133 ], [ 0, %cleanup ]
%25 = trunc i64 %indvars.iv202 to i32
%call108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %25)
%arrayidx110 = getelementptr inbounds ptr, ptr %vla, i64 %indvars.iv202
%26 = load ptr, ptr %arrayidx110, align 8, !tbaa !9
%parent111 = getelementptr inbounds %struct.Node, ptr %26, i64 0, i32 1
%27 = load ptr, ptr %parent111, align 8, !tbaa !16
%cmp112.not = icmp eq ptr %27, null
br i1 %cmp112.not, label %if.else, label %if.then113
if.then113: ; preds = %for.body107
%28 = load i32, ptr %27, align 8, !tbaa !13
%call118 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %28)
br label %if.end120
if.else: ; preds = %for.body107
%call119 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
br label %if.end120
if.end120: ; preds = %if.else, %if.then113
%sibling123 = getelementptr inbounds %struct.Node, ptr %26, i64 0, i32 4
%29 = load ptr, ptr %sibling123, align 8, !tbaa !19
%cmp124.not = icmp eq ptr %29, null
br i1 %cmp124.not, label %if.else131, label %if.then125
if.then125: ; preds = %if.end120
%30 = load i32, ptr %29, align 8, !tbaa !13
%call130 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %30)
br label %if.end133
if.else131: ; preds = %if.end120
%call132 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
br label %if.end133
if.end133: ; preds = %if.else131, %if.then125
%degree136 = getelementptr inbounds %struct.Node, ptr %26, i64 0, i32 5
%31 = load i32, ptr %degree136, align 8, !tbaa !17
%depth = getelementptr inbounds %struct.Node, ptr %26, i64 0, i32 6
%32 = load i32, ptr %depth, align 4, !tbaa !22
%height = getelementptr inbounds %struct.Node, ptr %26, i64 0, i32 7
%33 = load i32, ptr %height, align 8, !tbaa !23
%type143 = getelementptr inbounds %struct.Node, ptr %26, i64 0, i32 8
%call145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %31, i32 noundef %32, i32 noundef %33, ptr noundef nonnull %type143)
%indvars.iv.next203 = add nuw nsw i64 %indvars.iv202, 1
%34 = load i32, ptr %n, align 4, !tbaa !5
%35 = sext i32 %34 to i64
%cmp105 = icmp slt i64 %indvars.iv.next203, %35
br i1 %cmp105, label %for.body107, label %for.cond.cleanup106, !llvm.loop !24
}
; 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @serach_depth(ptr nocapture noundef %tag, i32 noundef %dep) local_unnamed_addr #5 {
entry:
%depth = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 6
store i32 %dep, ptr %depth, align 4, !tbaa !22
%left = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !15
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %land.lhs.true, label %if.end6
land.lhs.true: ; preds = %entry
%right = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 3
%1 = load ptr, ptr %right, align 8, !tbaa !18
%cmp1 = icmp eq ptr %1, null
br i1 %cmp1, label %if.then, label %if.end6.thread
if.end6.thread: ; preds = %land.lhs.true
%right786 = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 3
br label %if.then9
if.then: ; preds = %land.lhs.true
%height = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 7
store i32 0, ptr %height, align 8, !tbaa !23
br label %if.end50
if.end6: ; preds = %entry
%add = add nsw i32 %dep, 1
tail call void @serach_depth(ptr noundef nonnull %0, i32 noundef %add)
%right7.phi.trans.insert = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 3
%.pre = load ptr, ptr %right7.phi.trans.insert, align 8, !tbaa !18
%right7 = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 3
%cmp8.not = icmp eq ptr %.pre, null
br i1 %cmp8.not, label %if.end12, label %if.then9
if.then9: ; preds = %if.end6.thread, %if.end6
%right788 = phi ptr [ %right786, %if.end6.thread ], [ %right7, %if.end6 ]
%2 = phi ptr [ %1, %if.end6.thread ], [ %.pre, %if.end6 ]
%add11 = add nsw i32 %dep, 1
tail call void @serach_depth(ptr noundef nonnull %2, i32 noundef %add11)
br label %if.end12
if.end12: ; preds = %if.then9, %if.end6
%right789 = phi ptr [ %right788, %if.then9 ], [ %right7, %if.end6 ]
%3 = load ptr, ptr %left, align 8, !tbaa !15
%cmp14 = icmp eq ptr %3, null
%4 = load ptr, ptr %right789, align 8, !tbaa !18
br i1 %cmp14, label %if.end20, label %if.end20.thread
if.end20: ; preds = %if.end12
%height17 = getelementptr inbounds %struct.Node, ptr %4, i64 0, i32 7
%5 = load i32, ptr %height17, align 8, !tbaa !23
%add18 = add nsw i32 %5, 1
%height19 = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 7
store i32 %add18, ptr %height19, align 8, !tbaa !23
br label %if.end50
if.end20.thread: ; preds = %if.end12
%cmp2279 = icmp eq ptr %4, null
%height25 = getelementptr inbounds %struct.Node, ptr %3, i64 0, i32 7
%6 = load i32, ptr %height25, align 8, !tbaa !23
br i1 %cmp2279, label %land.lhs.true31, label %if.then34
land.lhs.true31: ; preds = %if.end20.thread
%add26 = add nsw i32 %6, 1
%height27 = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 7
store i32 %add26, ptr %height27, align 8, !tbaa !23
br label %if.end50
if.then34: ; preds = %if.end20.thread
%height38 = getelementptr inbounds %struct.Node, ptr %4, i64 0, i32 7
%7 = load i32, ptr %height38, align 8, !tbaa !23
%cmp39 = icmp sgt i32 %6, %7
%height44 = getelementptr inbounds %struct.Node, ptr %tag, i64 0, i32 7
br i1 %cmp39, label %if.then40, label %if.else
if.then40: ; preds = %if.then34
%add43 = add nsw i32 %6, 1
store i32 %add43, ptr %height44, align 8, !tbaa !23
br label %if.end50
if.else: ; preds = %if.then34
%add47 = add nsw i32 %7, 1
store i32 %add47, ptr %height44, align 8, !tbaa !23
br label %if.end50
if.end50: ; preds = %if.end20, %land.lhs.true31, %if.then40, %if.else, %if.then
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: 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) #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"Node", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !6, i64 44, !6, i64 48, !7, i64 52}
!15 = !{!14, !10, i64 16}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !6, i64 40}
!18 = !{!14, !10, i64 24}
!19 = !{!14, !10, i64 32}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = !{!14, !6, i64 44}
!23 = !{!14, !6, i64 48}
!24 = distinct !{!24, !12}
|
#include <stdio.h>
int main() {
long int n; scanf("%ld", &n);
int flag = 0;
for(long int i = n / 1234567; i >= 0; i--){
for(long int j = (n - 1234567 * i) / 123456; j >= 0; j--){
if ((n - (1234567 * i + 123456 * j)) % 1234 == 0) flag = 1;
}
}
if(flag) printf("YES");
else printf("NO");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23751/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23751/source.c"
target datalayout = "e-m:e-p270: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 [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca 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
%cmp25 = icmp sgt i64 %0, -1234567
br i1 %cmp25, label %for.body.preheader, label %if.else
for.body.preheader: ; preds = %entry
%div = sdiv i64 %0, 1234567
br label %for.body
for.cond.cleanup: ; preds = %for.cond.cleanup4
%1 = icmp eq i32 %flag.1.lcssa, 0
br i1 %1, label %if.else, label %if.end16
for.body: ; preds = %for.body.preheader, %for.cond.cleanup4
%i.027 = phi i64 [ %dec11, %for.cond.cleanup4 ], [ %div, %for.body.preheader ]
%flag.026 = phi i32 [ %flag.1.lcssa, %for.cond.cleanup4 ], [ 0, %for.body.preheader ]
%mul.neg = mul i64 %i.027, -1234567
%sub = add i64 %mul.neg, %0
%cmp322 = icmp sgt i64 %sub, -123456
br i1 %cmp322, label %for.body5.lr.ph, label %for.cond.cleanup4
for.body5.lr.ph: ; preds = %for.body
%div1 = sdiv i64 %sub, 123456
%2 = and i64 %div1, 1
%lcmp.mod.not.not = icmp eq i64 %2, 0
br i1 %lcmp.mod.not.not, label %for.body5.prol, label %for.body5.prol.loopexit
for.body5.prol: ; preds = %for.body5.lr.ph
%mul7.neg.prol = mul i64 %div1, -123456
%sub8.prol = add i64 %sub, %mul7.neg.prol
%rem.prol = srem i64 %sub8.prol, 1234
%cmp9.prol = icmp eq i64 %rem.prol, 0
%spec.select.prol = select i1 %cmp9.prol, i32 1, i32 %flag.026
%dec.prol = add nsw i64 %div1, -1
br label %for.body5.prol.loopexit
for.body5.prol.loopexit: ; preds = %for.body5.prol, %for.body5.lr.ph
%spec.select.lcssa.unr = phi i32 [ undef, %for.body5.lr.ph ], [ %spec.select.prol, %for.body5.prol ]
%j.024.unr = phi i64 [ %div1, %for.body5.lr.ph ], [ %dec.prol, %for.body5.prol ]
%flag.123.unr = phi i32 [ %flag.026, %for.body5.lr.ph ], [ %spec.select.prol, %for.body5.prol ]
%sub.off = add i64 %sub, 123455
%3 = icmp ult i64 %sub.off, 246911
br i1 %3, label %for.cond.cleanup4, label %for.body5
for.cond.cleanup4: ; preds = %for.body5.prol.loopexit, %for.body5, %for.body
%flag.1.lcssa = phi i32 [ %flag.026, %for.body ], [ %spec.select.lcssa.unr, %for.body5.prol.loopexit ], [ %spec.select.1, %for.body5 ]
%dec11 = add nsw i64 %i.027, -1
%cmp = icmp sgt i64 %i.027, 0
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body5: ; preds = %for.body5.prol.loopexit, %for.body5
%j.024 = phi i64 [ %dec.1, %for.body5 ], [ %j.024.unr, %for.body5.prol.loopexit ]
%flag.123 = phi i32 [ %spec.select.1, %for.body5 ], [ %flag.123.unr, %for.body5.prol.loopexit ]
%mul7.neg = mul i64 %j.024, -123456
%sub8 = add i64 %sub, %mul7.neg
%rem = srem i64 %sub8, 1234
%cmp9 = icmp eq i64 %rem, 0
%dec = add nsw i64 %j.024, -1
%mul7.neg.1 = mul i64 %dec, -123456
%sub8.1 = add i64 %sub, %mul7.neg.1
%rem.1 = srem i64 %sub8.1, 1234
%cmp9.1 = icmp eq i64 %rem.1, 0
%4 = or i1 %cmp9.1, %cmp9
%spec.select.1 = select i1 %4, i32 1, i32 %flag.123
%dec.1 = add nsw i64 %j.024, -2
%cmp3.not.1 = icmp eq i64 %dec, 0
br i1 %cmp3.not.1, label %for.cond.cleanup4, label %for.body5, !llvm.loop !11
if.else: ; preds = %entry, %for.cond.cleanup
br label %if.end16
if.end16: ; preds = %for.cond.cleanup, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %for.cond.cleanup ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.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"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define MAX 100000
int getDepth(int);
int getSibling(int);
int getHeight(int);
struct nibunki {
int parent;
int left;
int right;
};
struct nibunki array[MAX];
int height[MAX];
int main(){
int n, i, id, degree, left, right, root;
scanf("%d", &n);
for( i=0; i<n; i++){
array[i].parent = array[i].left = array[i].right = -1;
}
for( i=0; i<n; i++){
scanf("%d %d %d", &id, &left, &right);
array[id].left = left;
array[id].right = right;
if( left != -1 ) array[left].parent = id;
if( right != -1 ) array[right].parent = id;
}
for( i=0; i<n; i++){
if( array[i].parent == -1 ) root = i;
}
getHeight(root);
for( i=0; i<n; i++){
printf("node %d: parent = %d, ", i, array[i].parent);
printf("sibling = %d, ", getSibling(i));
degree = 0;
if( array[i].left != -1 ) degree++;
if( array[i].right != -1 ) degree++;
printf("degree = %d, ", degree);
printf("depth = %d, ", getDepth(i));
printf("height = %d, ", height[i]);
if( array[i].parent == -1 ) printf("root");
else if( array[i].left == -1 && array[i].right == -1 ) printf("leaf");
else printf("internal node");
printf("\n");
}
return 0;
}
int getDepth(int u){
int d=0;
while( array[u].parent != -1 ){
u = array[u].parent;
d++;
}
return d;
}
int getSibling(int u){
int parent;
parent = array[u].parent;
if( parent == -1 ) return -1;
if( array[parent].left != u && array[parent].left != -1 ) return array[parent].left;
if( array[parent].right != u && array[parent].right != -1 ) return array[parent].right;
return -1;
}
int getHeight(int u){
int h1 = 0, h2 = 0;
if( array[u].left != -1 ) h1 = getHeight(array[u].left) + 1;
if( array[u].right != -1 ) h2 = getHeight(array[u].right) + 1;
return height[u] = ( h1 > h2 ? h1 : h2 );
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237568/source.c"
target datalayout = "e-m:e-p270: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.nibunki = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@array = dso_local local_unnamed_addr global [100000 x %struct.nibunki] 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 [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 [14 x i8] c"degree = %d, \00", align 1
@.str.5 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.6 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@height = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
@.str.8 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@.str.9 = private unnamed_addr constant [14 x i8] c"internal node\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
%left = alloca i32, align 4
%right = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #10
%call = 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.body9.preheader, label %for.cond30.preheader
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 @array, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body9
for.cond30.preheader: ; preds = %for.inc27, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %7, %for.inc27 ]
%cmp31128 = icmp sgt i32 %.lcssa, 0
call void @llvm.assume(i1 %cmp31128)
%wide.trip.count = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %.lcssa, 4
br i1 %3, label %for.end41.unr-lcssa, label %for.cond30.preheader.new
for.cond30.preheader.new: ; preds = %for.cond30.preheader
%unroll_iter = and i64 %wide.trip.count, 2147483644
br label %for.body32
for.body9: ; preds = %for.body9.preheader, %for.inc27
%i.1127 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !5
%5 = load i32, ptr %id, align 4, !tbaa !5
%idxprom11 = sext i32 %5 to i64
%left13 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, 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.nibunki], ptr @array, 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.nibunki], ptr @array, 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.nibunki], ptr @array, 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.1127, 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.cond30.preheader.new
%indvars.iv = phi i64 [ 0, %for.cond30.preheader.new ], [ %indvars.iv.next.3, %for.body32 ]
%root.0130 = phi i32 [ undef, %for.cond30.preheader.new ], [ %spec.select.3, %for.body32 ]
%niter = phi i64 [ 0, %for.cond30.preheader.new ], [ %niter.next.3, %for.body32 ]
%arrayidx34 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, 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.0130
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx34.1 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, 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.nibunki], ptr @array, 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.nibunki], ptr @array, 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.unr-lcssa, label %for.body32, !llvm.loop !15
for.end41.unr-lcssa: ; preds = %for.body32, %for.cond30.preheader
%indvars.iv.unr = phi i64 [ 0, %for.cond30.preheader ], [ %indvars.iv.next.3, %for.body32 ]
%root.0130.unr = phi i32 [ undef, %for.cond30.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.unr-lcssa, %for.body32.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body32.epil ], [ %indvars.iv.unr, %for.end41.unr-lcssa ]
%root.0130.epil = phi i32 [ %spec.select.epil, %for.body32.epil ], [ %root.0130.unr, %for.end41.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body32.epil ], [ 0, %for.end41.unr-lcssa ]
%arrayidx34.epil = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, 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.0130.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.body32.epil, %for.end41.unr-lcssa
%spec.select.lcssa = phi i32 [ %root.0130.unr, %for.end41.unr-lcssa ], [ %spec.select.epil, %for.body32.epil ]
%call42 = call i32 @getHeight(i32 noundef %spec.select.lcssa)
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp44132 = icmp sgt i32 %18, 0
br i1 %cmp44132, label %for.body45, label %for.end95
for.body45: ; preds = %for.end41, %if.end91
%indvars.iv137 = phi i64 [ %indvars.iv.next138, %if.end91 ], [ 0, %for.end41 ]
%arrayidx47 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %indvars.iv137
%19 = load i32, ptr %arrayidx47, align 4, !tbaa !12
%20 = trunc i64 %indvars.iv137 to i32
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20, i32 noundef %19)
%21 = load i32, ptr %arrayidx47, align 4, !tbaa !12
%cmp.i = icmp eq i32 %21, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %for.body45
%idxprom2.i = sext i32 %21 to i64
%left.i = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom2.i, i32 1
%22 = load i32, ptr %left.i, align 4, !tbaa !9
%23 = zext i32 %22 to i64
%cmp4.not.i = icmp eq i64 %indvars.iv137, %23
%cmp8.not.i = icmp eq i32 %22, -1
%or.cond.i = or i1 %cmp4.not.i, %cmp8.not.i
br i1 %or.cond.i, label %if.end13.i, label %getSibling.exit
if.end13.i: ; preds = %if.end.i
%right.i = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom2.i, i32 2
%24 = load i32, ptr %right.i, align 4, !tbaa !11
%25 = zext i32 %24 to i64
%cmp16.not.i = icmp eq i64 %indvars.iv137, %25
%cmp21.not.i = icmp eq i32 %24, -1
%or.cond37.i = or i1 %cmp16.not.i, %cmp21.not.i
%spec.select.i = select i1 %or.cond37.i, i32 -1, i32 %24
br label %getSibling.exit
getSibling.exit: ; preds = %for.body45, %if.end.i, %if.end13.i
%retval.0.i = phi i32 [ -1, %for.body45 ], [ %22, %if.end.i ], [ %spec.select.i, %if.end13.i ]
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %retval.0.i)
%left54 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %indvars.iv137, i32 1
%26 = load i32, ptr %left54, align 4, !tbaa !9
%cmp55.not = icmp ne i32 %26, -1
%spec.select121 = zext i1 %cmp55.not to i32
%right61 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %indvars.iv137, i32 2
%27 = load i32, ptr %right61, align 4, !tbaa !11
%cmp62.not = icmp eq i32 %27, -1
%inc64 = select i1 %cmp55.not, i32 2, i32 1
%degree.1 = select i1 %cmp62.not, i32 %spec.select121, i32 %inc64
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %degree.1)
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %getSibling.exit
%u.addr.0.i = phi i32 [ %20, %getSibling.exit ], [ %28, %while.cond.i ]
%d.0.i = phi i32 [ 0, %getSibling.exit ], [ %inc.i, %while.cond.i ]
%idxprom.i122 = sext i32 %u.addr.0.i to i64
%arrayidx.i123 = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom.i122
%28 = load i32, ptr %arrayidx.i123, align 4, !tbaa !12
%cmp.not.i = icmp eq i32 %28, -1
%inc.i = add nuw nsw i32 %d.0.i, 1
br i1 %cmp.not.i, label %getDepth.exit, label %while.cond.i, !llvm.loop !18
getDepth.exit: ; preds = %while.cond.i
%call68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %d.0.i)
%arrayidx70 = getelementptr inbounds [100000 x i32], ptr @height, i64 0, i64 %indvars.iv137
%29 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %29)
%30 = load i32, ptr %arrayidx47, align 4, !tbaa !12
%cmp75 = icmp eq i32 %30, -1
br i1 %cmp75, label %if.end91, label %if.else
if.else: ; preds = %getDepth.exit
%31 = load i32, ptr %left54, align 4, !tbaa !9
%cmp81 = icmp eq i32 %31, -1
br i1 %cmp81, label %land.lhs.true, label %if.else88
land.lhs.true: ; preds = %if.else
%32 = load i32, ptr %right61, align 4, !tbaa !11
%cmp85 = icmp eq i32 %32, -1
br i1 %cmp85, label %if.end91, label %if.else88
if.else88: ; preds = %land.lhs.true, %if.else
br label %if.end91
if.end91: ; preds = %land.lhs.true, %getDepth.exit, %if.else88
%.str.8.sink = phi ptr [ @.str.9, %if.else88 ], [ @.str.7, %getDepth.exit ], [ @.str.8, %land.lhs.true ]
%call87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.8.sink)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%33 = load i32, ptr %n, align 4, !tbaa !5
%34 = sext i32 %33 to i64
%cmp44 = icmp slt i64 %indvars.iv.next138, %34
br i1 %cmp44, label %for.body45, label %for.end95, !llvm.loop !19
for.end95: ; preds = %if.end91, %for.end41
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i32 @getHeight(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%left = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, 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 @getHeight(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.nibunki], ptr @array, 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 @getHeight(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: 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 @getSibling(i32 noundef %u) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom2 = sext i32 %0 to i64
%left = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom2, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%cmp4.not = icmp eq i32 %1, %u
%cmp8.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp4.not, %cmp8.not
br i1 %or.cond, label %if.end13, label %cleanup
if.end13: ; preds = %if.end
%right = getelementptr inbounds [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom2, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp16.not = icmp eq i32 %2, %u
%cmp21.not = icmp eq i32 %2, -1
%or.cond37 = or i1 %cmp16.not, %cmp21.not
%spec.select = select i1 %or.cond37, i32 -1, i32 %2
br label %cleanup
cleanup: ; preds = %if.end13, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.end ], [ %spec.select, %if.end13 ]
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 #5 {
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 [100000 x %struct.nibunki], ptr @array, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.not = icmp eq i32 %0, -1
%inc = add nuw nsw i32 %d.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !18
while.end: ; preds = %while.cond
ret i32 %d.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 @putchar(i32 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 nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 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 nounwind }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
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 = !{!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 = !{!"nibunki", !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}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#define NIL -1
struct Node{
int left;
int right;
int parent;
};
int sibling(int);
int children(int);
int depth(int);
int height(int);
void judge(int);
struct Node inputNodedata[10000];
int main(){
int sumNode,Nodeid,i,j,leftdata,rightdata;
scanf("%d",&sumNode);
for(i = 0; i < sumNode; i++){
inputNodedata[i].left = NIL;
inputNodedata[i].right = NIL;
inputNodedata[i].parent = NIL;
}
for(i = 0; i < sumNode; i++){
scanf("%d",&Nodeid);
scanf("%d",&leftdata);
scanf("%d",&rightdata);
inputNodedata[Nodeid].left = leftdata;
inputNodedata[Nodeid].right = rightdata;
if(leftdata != NIL) {
inputNodedata[leftdata].parent = Nodeid;
}
if(rightdata != NIL){
inputNodedata[rightdata].parent = Nodeid;
}
}
for(i = 0; i < sumNode; i++){
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,inputNodedata[i].parent,sibling(i),children(i),depth(i),height(i));
judge(i);
}
return 0;
}
int sibling(int Nodeid){
if(inputNodedata[Nodeid].parent == NIL){
return NIL;
}
else if(inputNodedata[inputNodedata[Nodeid].parent].left != Nodeid && inputNodedata[inputNodedata[Nodeid].parent].left != NIL){
return inputNodedata[inputNodedata[Nodeid].parent].left;
}
else if(inputNodedata[inputNodedata[Nodeid].parent].right != Nodeid && inputNodedata[inputNodedata[Nodeid].parent].right != NIL){
return inputNodedata[inputNodedata[Nodeid].parent].right;
}
else {
return NIL;
}
}
int children(int Nodeid){
int sumchild ;
sumchild = 0;
if(inputNodedata[Nodeid].left != NIL){
sumchild = sumchild + 1;
}
if(inputNodedata[Nodeid].right != NIL){
sumchild = sumchild + 1;
}
return sumchild;
}
int depth(int Nodeid){
int depth = 0;
int id = inputNodedata[Nodeid].parent;
while(id != NIL){
id = inputNodedata[id].parent;
depth = depth + 1;
}
return depth;
}
int height(int Nodeid){
int leftheight=0,rightheight=0;
if(inputNodedata[Nodeid].left != NIL){
leftheight = height(inputNodedata[Nodeid].left) + 1;
}
if(inputNodedata[Nodeid].right != NIL){
rightheight = height(inputNodedata[Nodeid].right) + 1;
}
if(leftheight > rightheight){
return leftheight;
}
else{
return rightheight;
}
}
void judge(int i){
if(inputNodedata[i].parent == NIL){
printf("root\n");
}
else if(inputNodedata[i].left ==NIL && inputNodedata[i].right == NIL){
printf("leaf\n");
}
else{
printf("internal node\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237618/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237618/source.c"
target datalayout = "e-m:e-p270: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
@inputNodedata = dso_local local_unnamed_addr global [10000 x %struct.Node] zeroinitializer, align 16
@.str.1 = 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.5 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.6 = 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:
%sumNode = alloca i32, align 4
%Nodeid = alloca i32, align 4
%leftdata = alloca i32, align 4
%rightdata = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sumNode) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Nodeid) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %leftdata) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %rightdata) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sumNode)
%0 = load i32, ptr %sumNode, align 4, !tbaa !5
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, label %for.body7.preheader, label %for.end43
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 @inputNodedata, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond30.preheader: ; preds = %for.inc27
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body32, label %for.end43
for.body7: ; preds = %for.body7.preheader, %for.inc27
%i.173 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body7.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Nodeid)
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %leftdata)
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %rightdata)
%4 = load i32, ptr %leftdata, align 4, !tbaa !5
%5 = load i32, ptr %Nodeid, align 4, !tbaa !5
%idxprom11 = sext i32 %5 to i64
%arrayidx12 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom11
store i32 %4, ptr %arrayidx12, align 4, !tbaa !9
%6 = load i32, ptr %rightdata, align 4, !tbaa !5
%right16 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom11, i32 1
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.body7
%idxprom18 = sext i32 %4 to i64
%parent20 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom18, i32 2
store i32 %5, ptr %parent20, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body7
%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
%parent25 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom23, i32 2
store i32 %5, ptr %parent25, align 4, !tbaa !12
br label %for.inc27
for.inc27: ; preds = %if.end, %if.then22
%inc28 = add nuw nsw i32 %i.173, 1
%7 = load i32, ptr %sumNode, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc28, %7
br i1 %cmp6, label %for.body7, label %for.cond30.preheader, !llvm.loop !13
for.body32: ; preds = %for.cond30.preheader, %judge.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %judge.exit ], [ 0, %for.cond30.preheader ]
%parent35 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %indvars.iv, i32 2
%8 = load i32, ptr %parent35, align 4, !tbaa !12
%cmp.i = icmp eq i32 %8, -1
br i1 %cmp.i, label %sibling.exit, label %if.else.i
if.else.i: ; preds = %for.body32
%idxprom4.i = sext i32 %8 to i64
%arrayidx5.i = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom4.i
%9 = load i32, ptr %arrayidx5.i, align 4, !tbaa !9
%10 = zext i32 %9 to i64
%cmp6.not.i = icmp eq i64 %indvars.iv, %10
%cmp13.not.i = icmp eq i32 %9, -1
%or.cond.i = or i1 %cmp6.not.i, %cmp13.not.i
br i1 %or.cond.i, label %if.else21.i, label %sibling.exit
if.else21.i: ; preds = %if.else.i
%right.i = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom4.i, i32 1
%11 = load i32, ptr %right.i, align 4, !tbaa !11
%12 = zext i32 %11 to i64
%cmp27.not.i = icmp eq i64 %indvars.iv, %12
%cmp35.not.i = icmp eq i32 %11, -1
%or.cond54.i = or i1 %cmp27.not.i, %cmp35.not.i
%spec.select.i = select i1 %or.cond54.i, i32 -1, i32 %11
br label %sibling.exit
sibling.exit: ; preds = %for.body32, %if.else.i, %if.else21.i
%retval.0.i = phi i32 [ -1, %for.body32 ], [ %9, %if.else.i ], [ %spec.select.i, %if.else21.i ]
%arrayidx.i = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp.not.i = icmp ne i32 %13, -1
%right.i62 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %indvars.iv, i32 1
%14 = load i32, ptr %right.i62, align 4, !tbaa !11
%add5.i = select i1 %cmp.not.i, i32 2, i32 1
%15 = trunc i64 %indvars.iv to i32
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %sibling.exit
%depth.0.i = phi i32 [ 0, %sibling.exit ], [ %add.i, %while.cond.i ]
%idxprom.pn.in.i = phi i32 [ %15, %sibling.exit ], [ %id.0.i, %while.cond.i ]
%idxprom.pn.i = sext i32 %idxprom.pn.in.i to i64
%id.0.in.i = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom.pn.i, i32 2
%id.0.i = load i32, ptr %id.0.in.i, align 4, !tbaa !12
%cmp.not.i63 = icmp eq i32 %id.0.i, -1
%add.i = add nuw nsw i32 %depth.0.i, 1
br i1 %cmp.not.i63, label %depth.exit, label %while.cond.i, !llvm.loop !15
depth.exit: ; preds = %while.cond.i
%spec.select.i61 = zext i1 %cmp.not.i to i32
%cmp3.not.i = icmp eq i32 %14, -1
%sumchild.1.i = select i1 %cmp3.not.i, i32 %spec.select.i61, i32 %add5.i
%call39 = call i32 @height(i32 noundef %15)
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15, i32 noundef %8, i32 noundef %retval.0.i, i32 noundef %sumchild.1.i, i32 noundef %depth.0.i, i32 noundef %call39)
%16 = load i32, ptr %parent35, align 4, !tbaa !12
%cmp.i66 = icmp eq i32 %16, -1
br i1 %cmp.i66, label %judge.exit, label %if.else.i67
if.else.i67: ; preds = %depth.exit
%17 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%cmp3.i = icmp eq i32 %17, -1
br i1 %cmp3.i, label %land.lhs.true.i, label %if.else9.i
land.lhs.true.i: ; preds = %if.else.i67
%18 = load i32, ptr %right.i62, align 4, !tbaa !11
%cmp6.i = icmp eq i32 %18, -1
br i1 %cmp6.i, label %judge.exit, label %if.else9.i
if.else9.i: ; preds = %land.lhs.true.i, %if.else.i67
br label %judge.exit
judge.exit: ; preds = %depth.exit, %land.lhs.true.i, %if.else9.i
%str.5.sink.i = phi ptr [ @str, %if.else9.i ], [ @str.6, %depth.exit ], [ @str.5, %land.lhs.true.i ]
%puts14.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink.i)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%19 = load i32, ptr %sumNode, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp31 = icmp slt i64 %indvars.iv.next, %20
br i1 %cmp31, label %for.body32, label %for.end43, !llvm.loop !16
for.end43: ; preds = %judge.exit, %entry, %for.cond30.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %rightdata) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %leftdata) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Nodeid) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sumNode) #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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @sibling(i32 noundef %Nodeid) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %Nodeid to i64
%parent = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %parent, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %return, label %if.else
if.else: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%arrayidx5 = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom4
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !9
%cmp6.not = icmp eq i32 %1, %Nodeid
%cmp13.not = icmp eq i32 %1, -1
%or.cond = or i1 %cmp6.not, %cmp13.not
br i1 %or.cond, label %if.else21, label %return
if.else21: ; preds = %if.else
%right = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom4, i32 1
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %Nodeid
%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.else21, %if.else, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.else ], [ %spec.select, %if.else21 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @children(i32 noundef %Nodeid) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %Nodeid to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !9
%cmp.not = icmp ne i32 %0, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp3.not = icmp eq i32 %1, -1
%add5 = select i1 %cmp.not, i32 2, i32 1
%sumchild.1 = select i1 %cmp3.not, i32 %spec.select, i32 %add5
ret i32 %sumchild.1
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @depth(i32 noundef %Nodeid) local_unnamed_addr #4 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%depth.0 = phi i32 [ 0, %entry ], [ %add, %while.cond ]
%idxprom.pn.in = phi i32 [ %Nodeid, %entry ], [ %id.0, %while.cond ]
%idxprom.pn = sext i32 %idxprom.pn.in to i64
%id.0.in = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom.pn, i32 2
%id.0 = load i32, ptr %id.0.in, align 4, !tbaa !12
%cmp.not = icmp eq i32 %id.0, -1
%add = add nuw nsw i32 %depth.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !15
while.end: ; preds = %while.cond
ret i32 %depth.0
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @height(i32 noundef %Nodeid) local_unnamed_addr #5 {
entry:
%idxprom = sext i32 %Nodeid to i64
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, 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 %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
%leftheight.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%right = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom, i32 1
%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
%rightheight.0 = phi i32 [ %add12, %if.then7 ], [ 0, %if.end ]
%leftheight.0.rightheight.0 = tail call i32 @llvm.smax.i32(i32 %leftheight.0, i32 %rightheight.0)
ret i32 %leftheight.0.rightheight.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @judge(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%parent = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %parent, align 4, !tbaa !12
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.end11, label %if.else
if.else: ; preds = %entry
%arrayidx = getelementptr inbounds [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !9
%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 [10000 x %struct.Node], ptr @inputNodedata, i64 0, i64 %idxprom, i32 1
%2 = load i32, ptr %right, align 4, !tbaa !11
%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.5.sink = phi ptr [ @str, %if.else9 ], [ @str.6, %entry ], [ @str.5, %land.lhs.true ]
%puts14 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.5.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 @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 = { 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 = { 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 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 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 = !{!"Node", !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}
!16 = distinct !{!16, !14}
|
#include <stdio.h>
#define N 10000
typedef struct{
int p,l,r;
}Node;
Node T[N];
int n, D[N], H[N];
void setDepth(int u, int d){
if(u == -1) 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 != -1) h1 = setHeight(T[u].l) + 1;
if(T[u].r != -1) h2 = setHeight(T[u].r) + 1;
return H[u] = (h1 > h2 ? h1 : h2);
}
int getSibling(int u){
if(T[u].p == -1) return -1;
if(T[T[u].p].l != u && T[T[u].p].l != -1) return T[T[u].p].l;
if(T[T[u].p].r != u && T[T[u].p].r != -1) return T[T[u].p].r;
return -1;
}
int main(){
int i, v, l, r, d, root=0;
scanf("%d", &n);
for(i=0; i<n; i++) T[i].p = -1;
for(i=0; i<n; i++){
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if(l != -1) T[l].p = v;
if(r != -1) T[r].p = v;
}
for(i=0; i<n; i++){
if(T[i].p == -1) root = i;
}
setDepth(root, 0);
setHeight(root);
for(i=0; i<n; i++){
printf("node %d: ", i);
printf("parent = %d, ", T[i].p);
printf("sibling = %d, ", getSibling(i));
d = 0;
if(T[i].l != -1) d++;
if(T[i].r != -1) d++;
printf("degree = %d, ", d);
printf("depth = %d, ", D[i]);
printf("height = %d, ", H[i]);
if(T[i].p == -1) printf("root\n");
else if(T[i].l == -1 && T[i].r == -1) printf("leaf\n");
else printf("internal node\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237661/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237661/source.c"
target datalayout = "e-m:e-p270: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 [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.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 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
%l = getelementptr inbounds [10000 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 [10000 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 [10000 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 [10000 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 [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
%l = getelementptr inbounds [10000 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 [10000 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 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, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp118 = icmp sgt i32 %0, 0
br i1 %cmp118, 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 [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 %cmp118, 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 [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.cond24.preheader: ; preds = %for.inc21
%cmp25122 = icmp sgt i32 %6, 0
br i1 %cmp25122, label %for.body26.preheader, label %for.end35
for.body26.preheader: ; preds = %for.cond24.preheader
%wide.trip.count133 = zext i32 %6 to i64
%xtraiter140 = and i64 %wide.trip.count133, 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_iter144 = and i64 %wide.trip.count133, 4294967292
br label %for.body26
for.body3: ; preds = %for.cond1.preheader, %for.inc21
%i.1121 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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 [10000 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 [10000 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 [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.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 [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 %i.1121, 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.iv130 = phi i64 [ 0, %for.body26.preheader.new ], [ %indvars.iv.next131.3, %for.body26 ]
%root.0124 = phi i32 [ 0, %for.body26.preheader.new ], [ %spec.select.3, %for.body26 ]
%niter145 = phi i64 [ 0, %for.body26.preheader.new ], [ %niter145.next.3, %for.body26 ]
%arrayidx28 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv130
%7 = load i32, ptr %arrayidx28, align 16, !tbaa !12
%cmp30 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv130 to i32
%spec.select = select i1 %cmp30, i32 %8, i32 %root.0124
%indvars.iv.next131 = or i64 %indvars.iv130, 1
%arrayidx28.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next131
%9 = load i32, ptr %arrayidx28.1, align 4, !tbaa !12
%cmp30.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next131 to i32
%spec.select.1 = select i1 %cmp30.1, i32 %10, i32 %spec.select
%indvars.iv.next131.1 = or i64 %indvars.iv130, 2
%arrayidx28.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next131.1
%11 = load i32, ptr %arrayidx28.2, align 8, !tbaa !12
%cmp30.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next131.1 to i32
%spec.select.2 = select i1 %cmp30.2, i32 %12, i32 %spec.select.1
%indvars.iv.next131.2 = or i64 %indvars.iv130, 3
%arrayidx28.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next131.2
%13 = load i32, ptr %arrayidx28.3, align 4, !tbaa !12
%cmp30.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next131.2 to i32
%spec.select.3 = select i1 %cmp30.3, i32 %14, i32 %spec.select.2
%indvars.iv.next131.3 = add nuw nsw i64 %indvars.iv130, 4
%niter145.next.3 = add i64 %niter145, 4
%niter145.ncmp.3 = icmp eq i64 %niter145.next.3, %unroll_iter144
br i1 %niter145.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.iv130.unr = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next131.3, %for.body26 ]
%root.0124.unr = phi i32 [ 0, %for.body26.preheader ], [ %spec.select.3, %for.body26 ]
%lcmp.mod142.not = icmp eq i64 %xtraiter140, 0
br i1 %lcmp.mod142.not, label %for.end35, label %for.body26.epil
for.body26.epil: ; preds = %for.end35.loopexit.unr-lcssa, %for.body26.epil
%indvars.iv130.epil = phi i64 [ %indvars.iv.next131.epil, %for.body26.epil ], [ %indvars.iv130.unr, %for.end35.loopexit.unr-lcssa ]
%root.0124.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %root.0124.unr, %for.end35.loopexit.unr-lcssa ]
%epil.iter141 = phi i64 [ %epil.iter141.next, %for.body26.epil ], [ 0, %for.end35.loopexit.unr-lcssa ]
%arrayidx28.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv130.epil
%15 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !12
%cmp30.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv130.epil to i32
%spec.select.epil = select i1 %cmp30.epil, i32 %16, i32 %root.0124.epil
%indvars.iv.next131.epil = add nuw nsw i64 %indvars.iv130.epil, 1
%epil.iter141.next = add i64 %epil.iter141, 1
%epil.iter141.cmp.not = icmp eq i64 %epil.iter141.next, %xtraiter140
br i1 %epil.iter141.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
%cmp38126 = icmp sgt i32 %17, 0
br i1 %cmp38126, label %for.body39, label %for.end90
for.body39: ; preds = %for.end35, %for.inc88
%indvars.iv135 = phi i64 [ %indvars.iv.next136, %for.inc88 ], [ 0, %for.end35 ]
%18 = trunc i64 %indvars.iv135 to i32
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%arrayidx42 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv135
%19 = load i32, ptr %arrayidx42, align 4, !tbaa !12
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %19)
%20 = load i32, ptr %arrayidx42, align 4, !tbaa !12
%cmp.i = icmp eq i32 %20, -1
br i1 %cmp.i, label %getSibling.exit, label %if.end.i
if.end.i: ; preds = %for.body39
%idxprom4.i = sext i32 %20 to i64
%l.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%21 = load i32, ptr %l.i, align 4, !tbaa !9
%22 = zext i32 %21 to i64
%cmp6.not.i = icmp eq i64 %indvars.iv135, %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 %getSibling.exit
if.end21.i: ; preds = %if.end.i
%r.i = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%23 = load i32, ptr %r.i, align 4, !tbaa !11
%24 = zext i32 %23 to i64
%cmp27.not.i = icmp eq i64 %indvars.iv135, %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 %getSibling.exit
getSibling.exit: ; preds = %for.body39, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %for.body39 ], [ %21, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %retval.0.i)
%l49 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv135, i32 1
%25 = load i32, ptr %l49, align 4, !tbaa !9
%cmp50.not = icmp ne i32 %25, -1
%spec.select117 = zext i1 %cmp50.not to i32
%r56 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv135, i32 2
%26 = load i32, ptr %r56, align 4, !tbaa !11
%cmp57.not = icmp eq i32 %26, -1
%inc59 = select i1 %cmp50.not, i32 2, i32 1
%d.1 = select i1 %cmp57.not, i32 %spec.select117, i32 %inc59
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %d.1)
%arrayidx63 = getelementptr inbounds [10000 x i32], ptr @D, i64 0, i64 %indvars.iv135
%27 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %27)
%arrayidx66 = getelementptr inbounds [10000 x i32], ptr @H, i64 0, i64 %indvars.iv135
%28 = load i32, ptr %arrayidx66, align 4, !tbaa !5
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %28)
%29 = load i32, ptr %arrayidx42, align 4, !tbaa !12
%cmp71 = icmp eq i32 %29, -1
br i1 %cmp71, label %for.inc88, label %if.else
if.else: ; preds = %getSibling.exit
%30 = load i32, ptr %l49, align 4, !tbaa !9
%cmp77 = icmp eq i32 %30, -1
br i1 %cmp77, label %land.lhs.true, label %if.else84
land.lhs.true: ; preds = %if.else
%31 = load i32, ptr %r56, align 4, !tbaa !11
%cmp81 = icmp eq i32 %31, -1
br i1 %cmp81, label %for.inc88, label %if.else84
if.else84: ; preds = %land.lhs.true, %if.else
br label %for.inc88
for.inc88: ; preds = %land.lhs.true, %getSibling.exit, %if.else84
%str.12.sink = phi ptr [ @str, %if.else84 ], [ @str.12, %getSibling.exit ], [ @str.11, %land.lhs.true ]
%puts116 = call i32 @puts(ptr nonnull dereferenceable(1) %str.12.sink)
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%32 = load i32, ptr @n, align 4, !tbaa !5
%33 = sext i32 %32 to i64
%cmp38 = icmp slt i64 %indvars.iv.next136, %33
br i1 %cmp38, label %for.body39, label %for.end90, !llvm.loop !20
for.end90: ; preds = %for.inc88, %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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: 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>
int N;
int deg[100001];
int par[100001];
int sib[100001];
int Depth(int);
int Height(int);
int main() {
int j,i;
scanf("%d", &N);
for(i = 0; i < N; ++i) {
par[i] = -1;
sib[i] = -1;
deg[i] = 0;
}
for(i = 0; i < N; i++) {
int id, lef, rig;
scanf("%d %d %d", &id, &lef, &rig);
if(lef != -1) {
par[lef] = id;
sib[lef] = rig;
deg[id]++;
}
if(rig != -1) {
par[rig] = id;
sib[rig] = lef;
deg[id]++;
}
}
for(i = 0; i < N; ++i) {
int depth = Depth(i);
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
i, par[i], sib[i], deg[i], depth, Height(i));
if(depth == 0) {
printf("root\n");
} else if(deg[i] == 0) {
printf("leaf\n");
} else {
printf("internal node\n");
}
}
return 0;
}
int Depth(int i) {
if(par[i] == -1) return 0;
return Depth(par[i]) + 1;
}
int Height(int i) {
int j, h;
h = 0;
for(j = 0; j < N; ++j) {
if(par[j] == i) {
int tmp = Height(j) + 1;
if(tmp > h) h = tmp;
}
}
return h;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@par = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@sib = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@deg = dso_local local_unnamed_addr global [100001 x i32] 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 [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:
%id = alloca i32, align 4
%lef = alloca i32, align 4
%rig = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body7.preheader, label %for.end56
for.body7.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 @par, i8 -1, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @sib, i8 -1, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @deg, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.body7
for.cond30.preheader: ; preds = %if.end26
%3 = icmp sgt i32 %9, 0
br i1 %3, label %tailrecurse.i.preheader, label %for.end56
for.body7: ; preds = %for.body7.preheader, %if.end26
%i.179 = phi i32 [ %inc28, %if.end26 ], [ 0, %for.body7.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %lef) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %rig) #7
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %lef, ptr noundef nonnull %rig)
%4 = load i32, ptr %lef, align 4, !tbaa !5
%cmp9.not = icmp eq i32 %4, -1
%.pre = load i32, ptr %rig, align 4, !tbaa !5
br i1 %cmp9.not, label %if.end, label %if.then
if.then: ; preds = %for.body7
%5 = load i32, ptr %id, align 4, !tbaa !5
%idxprom10 = sext i32 %4 to i64
%arrayidx11 = getelementptr inbounds [100001 x i32], ptr @par, i64 0, i64 %idxprom10
store i32 %5, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [100001 x i32], ptr @sib, i64 0, i64 %idxprom10
store i32 %.pre, ptr %arrayidx13, align 4, !tbaa !5
%idxprom14 = sext i32 %5 to i64
%arrayidx15 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %idxprom14
%6 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%inc16 = add nsw i32 %6, 1
store i32 %inc16, ptr %arrayidx15, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body7
%cmp17.not = icmp eq i32 %.pre, -1
br i1 %cmp17.not, label %if.end26, label %if.then18
if.then18: ; preds = %if.end
%7 = load i32, ptr %id, align 4, !tbaa !5
%idxprom19 = sext i32 %.pre to i64
%arrayidx20 = getelementptr inbounds [100001 x i32], ptr @par, i64 0, i64 %idxprom19
store i32 %7, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx22 = getelementptr inbounds [100001 x i32], ptr @sib, i64 0, i64 %idxprom19
store i32 %4, ptr %arrayidx22, align 4, !tbaa !5
%idxprom23 = sext i32 %7 to i64
%arrayidx24 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %idxprom23
%8 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%inc25 = add nsw i32 %8, 1
store i32 %inc25, ptr %arrayidx24, align 4, !tbaa !5
br label %if.end26
if.end26: ; preds = %if.then18, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %rig) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %lef) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #7
%inc28 = add nuw nsw i32 %i.179, 1
%9 = load i32, ptr @N, align 4, !tbaa !5
%cmp6 = icmp slt i32 %inc28, %9
br i1 %cmp6, label %for.body7, label %for.cond30.preheader, !llvm.loop !9
tailrecurse.i.preheader: ; preds = %for.cond30.preheader, %if.end53
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end53 ], [ 0, %for.cond30.preheader ]
%10 = trunc i64 %indvars.iv to i32
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i.preheader, %tailrecurse.i
%accumulator.tr.i = phi i32 [ %add.i, %tailrecurse.i ], [ 0, %tailrecurse.i.preheader ]
%i.tr.i = phi i32 [ %11, %tailrecurse.i ], [ %10, %tailrecurse.i.preheader ]
%idxprom.i = sext i32 %i.tr.i to i64
%arrayidx.i = getelementptr inbounds [100001 x i32], ptr @par, i64 0, i64 %idxprom.i
%11 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp.i = icmp eq i32 %11, -1
%add.i = add nuw nsw i32 %accumulator.tr.i, 1
br i1 %cmp.i, label %Depth.exit, label %tailrecurse.i
Depth.exit: ; preds = %tailrecurse.i
%arrayidx35 = getelementptr inbounds [100001 x i32], ptr @par, i64 0, i64 %indvars.iv
%12 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%arrayidx37 = getelementptr inbounds [100001 x i32], ptr @sib, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%arrayidx39 = getelementptr inbounds [100001 x i32], ptr @deg, i64 0, i64 %indvars.iv
%14 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 @Height(i32 noundef %10)
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10, i32 noundef %12, i32 noundef %13, i32 noundef %14, i32 noundef %accumulator.tr.i, i32 noundef %call40)
%cmp42 = icmp eq i32 %accumulator.tr.i, 0
br i1 %cmp42, label %if.end53, label %if.else
if.else: ; preds = %Depth.exit
%15 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp47 = icmp eq i32 %15, 0
%str.6.str = select i1 %cmp47, ptr @str.6, ptr @str
br label %if.end53
if.end53: ; preds = %if.else, %Depth.exit
%str.6.sink = phi ptr [ @str.7, %Depth.exit ], [ %str.6.str, %if.else ]
%puts74 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%16 = load i32, ptr @N, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp31 = icmp slt i64 %indvars.iv.next, %17
br i1 %cmp31, label %tailrecurse.i.preheader, label %for.end56, !llvm.loop !11
for.end56: ; preds = %if.end53, %entry, %for.cond30.preheader
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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Depth(i32 noundef %i) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%accumulator.tr = phi i32 [ 0, %entry ], [ %add, %tailrecurse ]
%i.tr = phi i32 [ %i, %entry ], [ %0, %tailrecurse ]
%idxprom = sext i32 %i.tr to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr @par, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Height(i32 noundef %i) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, 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 ]
%h.011 = phi i32 [ 0, %for.body.preheader ], [ %h.2, %for.inc ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr @par, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %i
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %for.body
%2 = trunc i64 %indvars.iv to i32
%call = tail call i32 @Height(i32 noundef %2)
%cmp2.not = icmp slt i32 %call, %h.011
%add = add nsw i32 %call, 1
%spec.select = select i1 %cmp2.not, i32 %h.011, i32 %add
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%h.2 = phi i32 [ %spec.select, %if.then ], [ %h.011, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.inc, %entry
%h.0.lcssa = phi i32 [ 0, %entry ], [ %h.2, %for.inc ]
ret i32 %h.0.lcssa
}
; 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 = { 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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define N 100000
typedef struct Ki{
int p;
int r;
int l;
int h;
}tree;
int n;
tree T[N];
void sibling(int i){
int j;
for(j=0;j<n;j++){
if(T[i].p == -1){
printf("-1");
break;
}
else if(T[i].p==T[j].p&&i != j){
printf("%d",j);
break;
}
if(j==n-1)printf("-1");
}
}
int depth(int i){
int count=0,iNoOya;
iNoOya=i;
while(1){
if(T[iNoOya].p==-1) break;
iNoOya=T[iNoOya].p;
count++;
}
return count;
}
void hantei(int i){
if( T[i].p == -1)printf("root");
else if(T[i].p!=-1 && T[i].h==0) printf("leaf");
else printf("internal node");
printf("\n");
}
int degree(int i){
int j,count=0;
for(j=0;j<n;j++){
if(T[j].p==i) count++;
}
return count;
}
int height(int i){
int j,left,right,a,b;
if(T[i].h==-1){
if(T[i].l==-1 && T[i].r==-1){
T[i].h=0;
}
else{
if(T[i].l!=-1){
left = T[i].l;
a = height(left);
}
else a = 0;
if(T[i].r!=-1){
right = T[i].r;
b = height(right);
}
else b = 0;
if(a==b) T[i].h = a+1;
if(a>b) T[i].h = a+1;
if(a<b) T[i].h = b+1;
}
}
return T[i].h;
}
int main(){
int i,id,left,right;
scanf("%d",&n);
for(i=0;i<n;i++){
T[i].p = -1;
T[i].l = -1;
T[i].r = -1;
T[i].h = -1;
}
for(i=0;i<n;i++){
scanf("%d%d%d",&id,&left,&right);
T[id].r = right;
T[right].p = id;
T[id].l = left;
T[left].p = id;
}
for(i=0;i<n;i++){
printf("node %d: parent = %d, sibling = ",i,T[i].p);
sibling(i);
printf(", degree = %d, depth = %d, height = %d, ",degree(i),depth(i),height(i));
hantei(i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237748/source.c"
target datalayout = "e-m:e-p270: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.Ki = type { i32, i32, i32, i32 }
@n = dso_local global i32 0, align 4
@T = dso_local local_unnamed_addr global [100000 x %struct.Ki] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"root\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@.str.4 = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.7 = private unnamed_addr constant [33 x i8] c"node %d: parent = %d, sibling = \00", align 1
@.str.8 = private unnamed_addr constant [41 x i8] c", degree = %d, depth = %d, height = %d, \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @sibling(i32 noundef %i) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom
%1 = zext i32 %i to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%2 = phi i32 [ %0, %for.body.lr.ph ], [ %7, %for.inc ]
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%3 = load i32, ptr %arrayidx, align 16, !tbaa !9
%cmp1 = icmp eq i32 %3, -1
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
br label %for.end
if.else: ; preds = %for.body
%arrayidx6 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx6, align 16, !tbaa !9
%cmp8 = icmp ne i32 %3, %4
%cmp9.not = icmp eq i64 %indvars.iv, %1
%or.cond = or i1 %cmp9.not, %cmp8
br i1 %or.cond, label %if.end12, label %if.then10
if.then10: ; preds = %if.else
%5 = trunc i64 %indvars.iv to i32
%call11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
br label %for.end
if.end12: ; preds = %if.else
%sub = add nsw i32 %2, -1
%6 = zext i32 %sub to i64
%cmp13 = icmp eq i64 %indvars.iv, %6
br i1 %cmp13, label %if.then14, label %for.inc
if.then14: ; preds = %if.end12
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end12, %if.then14
%7 = phi i32 [ %2, %if.end12 ], [ %.pre, %if.then14 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry, %if.then10, %if.then
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @depth(i32 noundef %i) local_unnamed_addr #3 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%count.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%iNoOya.0 = phi i32 [ %i, %entry ], [ %0, %while.cond ]
%idxprom = sext i32 %iNoOya.0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 16, !tbaa !9
%cmp = icmp eq i32 %0, -1
%inc = add nuw nsw i32 %count.0, 1
br i1 %cmp, label %while.end, label %while.cond
while.end: ; preds = %while.cond
ret i32 %count.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @hantei(i32 noundef %i) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 16, !tbaa !9
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.end12, label %land.lhs.true
land.lhs.true: ; preds = %entry
%h = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom, i32 3
%1 = load i32, ptr %h, align 4, !tbaa !13
%cmp7 = icmp eq i32 %1, 0
%.str.3..str.4 = select i1 %cmp7, ptr @.str.3, ptr @.str.4
br label %if.end12
if.end12: ; preds = %land.lhs.true, %entry
%.str.3.sink = phi ptr [ @.str.2, %entry ], [ %.str.3..str.4, %land.lhs.true ]
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @degree(i32 noundef %i) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 9
br i1 %min.iters.check, label %for.body.preheader11, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %wide.trip.count, 7
%1 = icmp eq i64 %n.mod.vf, 0
%2 = select i1 %1, i64 8, i64 %n.mod.vf
%n.vec = sub nsw i64 %wide.trip.count, %2
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %38, %vector.body ]
%vec.phi10 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %39, %vector.body ]
%3 = or i64 %index, 1
%4 = or i64 %index, 2
%5 = or i64 %index, 3
%6 = or i64 %index, 4
%7 = or i64 %index, 5
%8 = or i64 %index, 6
%9 = or i64 %index, 7
%10 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %index
%11 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %3
%12 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %4
%13 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %5
%14 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %6
%15 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %7
%16 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %8
%17 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %9
%18 = load i32, ptr %10, align 16, !tbaa !9
%19 = load i32, ptr %11, align 16, !tbaa !9
%20 = load i32, ptr %12, align 16, !tbaa !9
%21 = load i32, ptr %13, align 16, !tbaa !9
%22 = insertelement <4 x i32> poison, i32 %18, i64 0
%23 = insertelement <4 x i32> %22, i32 %19, i64 1
%24 = insertelement <4 x i32> %23, i32 %20, i64 2
%25 = insertelement <4 x i32> %24, i32 %21, i64 3
%26 = load i32, ptr %14, align 16, !tbaa !9
%27 = load i32, ptr %15, align 16, !tbaa !9
%28 = load i32, ptr %16, align 16, !tbaa !9
%29 = load i32, ptr %17, align 16, !tbaa !9
%30 = insertelement <4 x i32> poison, i32 %26, i64 0
%31 = insertelement <4 x i32> %30, i32 %27, i64 1
%32 = insertelement <4 x i32> %31, i32 %28, i64 2
%33 = insertelement <4 x i32> %32, i32 %29, i64 3
%34 = icmp eq <4 x i32> %25, %broadcast.splat
%35 = icmp eq <4 x i32> %33, %broadcast.splat
%36 = zext <4 x i1> %34 to <4 x i32>
%37 = zext <4 x i1> %35 to <4 x i32>
%38 = add <4 x i32> %vec.phi, %36
%39 = add <4 x i32> %vec.phi10, %37
%index.next = add nuw i64 %index, 8
%40 = icmp eq i64 %index.next, %n.vec
br i1 %40, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %39, %38
%41 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br label %for.body.preheader11
for.body.preheader11: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%count.08.ph = phi i32 [ 0, %for.body.preheader ], [ %41, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader11, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader11 ]
%count.08 = phi i32 [ %spec.select, %for.body ], [ %count.08.ph, %for.body.preheader11 ]
%arrayidx = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv
%42 = load i32, ptr %arrayidx, align 16, !tbaa !9
%cmp1 = icmp eq i32 %42, %i
%inc = zext i1 %cmp1 to i32
%spec.select = add nuw nsw i32 %count.08, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %count.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @height(i32 noundef %i) local_unnamed_addr #4 {
entry:
%idxprom = sext i32 %i to i64
%h = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom, i32 3
%0 = load i32, ptr %h, align 4, !tbaa !13
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.then, label %if.end52
if.then: ; preds = %entry
%l = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %l, align 8, !tbaa !18
%cmp3 = icmp eq i32 %1, -1
br i1 %cmp3, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %if.then
%r = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom, i32 1
%2 = load i32, ptr %r, align 4, !tbaa !19
%cmp6 = icmp eq i32 %2, -1
br i1 %cmp6, label %if.end52.sink.split, label %if.then24
if.end: ; preds = %if.then
%call = tail call i32 @height(i32 noundef %1)
%r22.phi.trans.insert = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom, i32 1
%.pre = load i32, ptr %r22.phi.trans.insert, align 4, !tbaa !19
%cmp23.not = icmp eq i32 %.pre, -1
br i1 %cmp23.not, label %if.end30, label %if.then24
if.then24: ; preds = %land.lhs.true, %if.end
%a.079 = phi i32 [ %call, %if.end ], [ 0, %land.lhs.true ]
%3 = phi i32 [ %.pre, %if.end ], [ %2, %land.lhs.true ]
%call28 = tail call i32 @height(i32 noundef %3)
br label %if.end30
if.end30: ; preds = %if.then24, %if.end
%a.080 = phi i32 [ %a.079, %if.then24 ], [ %call, %if.end ]
%b.0 = phi i32 [ %call28, %if.then24 ], [ 0, %if.end ]
%spec.select.v = tail call i32 @llvm.smax.i32(i32 %a.080, i32 %b.0)
%spec.select = add nsw i32 %spec.select.v, 1
br label %if.end52.sink.split
if.end52.sink.split: ; preds = %land.lhs.true, %if.end30
%spec.select.sink = phi i32 [ %spec.select, %if.end30 ], [ 0, %land.lhs.true ]
store i32 %spec.select.sink, ptr %h, align 4, !tbaa !13
br label %if.end52
if.end52: ; preds = %if.end52.sink.split, %entry
%4 = phi i32 [ %0, %entry ], [ %spec.select.sink, %if.end52.sink.split ]
ret i32 %4
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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 %id) #8
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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body9.preheader, label %for.end39
for.body9.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 4
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body9
for.cond26.preheader: ; preds = %for.body9
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body28, label %for.end39
for.body9: ; preds = %for.body9.preheader, %for.body9
%i.175 = phi i32 [ %inc24, %for.body9 ], [ 0, %for.body9.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %right, align 4, !tbaa !5
%5 = load i32, ptr %id, align 4, !tbaa !5
%idxprom11 = sext i32 %5 to i64
%r13 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom11, i32 1
store i32 %4, ptr %r13, align 4, !tbaa !19
%idxprom14 = sext i32 %4 to i64
%arrayidx15 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom14
store i32 %5, ptr %arrayidx15, align 16, !tbaa !9
%6 = load i32, ptr %left, align 4, !tbaa !5
%l19 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom11, i32 2
store i32 %6, ptr %l19, align 8, !tbaa !18
%idxprom20 = sext i32 %6 to i64
%arrayidx21 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom20
store i32 %5, ptr %arrayidx21, align 16, !tbaa !9
%inc24 = add nuw nsw i32 %i.175, 1
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc24, %7
br i1 %cmp8, label %for.body9, label %for.cond26.preheader, !llvm.loop !20
for.body28: ; preds = %for.cond26.preheader, %hantei.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %hantei.exit ], [ 0, %for.cond26.preheader ]
%arrayidx30 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx30, align 16, !tbaa !9
%9 = trunc i64 %indvars.iv to i32
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %9, i32 noundef %8)
%10 = load i32, ptr @n, align 4, !tbaa !5
%cmp26.i = icmp sgt i32 %10, 0
br i1 %cmp26.i, label %for.body.i, label %degree.exit
for.body.i: ; preds = %for.body28, %for.inc.i
%11 = phi i32 [ %16, %for.inc.i ], [ %10, %for.body28 ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ 0, %for.body28 ]
%12 = load i32, ptr %arrayidx30, align 16, !tbaa !9
%cmp1.i = icmp eq i32 %12, -1
br i1 %cmp1.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body.i
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
br label %sibling.exit
if.else.i: ; preds = %for.body.i
%arrayidx6.i = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv.i
%13 = load i32, ptr %arrayidx6.i, align 16, !tbaa !9
%cmp8.i = icmp ne i32 %12, %13
%cmp9.not.i = icmp eq i64 %indvars.iv.i, %indvars.iv
%or.cond.i = or i1 %cmp9.not.i, %cmp8.i
br i1 %or.cond.i, label %if.end12.i, label %if.then10.i
if.then10.i: ; preds = %if.else.i
%14 = trunc i64 %indvars.iv.i to i32
%call11.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
br label %sibling.exit
if.end12.i: ; preds = %if.else.i
%sub.i = add nsw i32 %11, -1
%15 = zext i32 %sub.i to i64
%cmp13.i = icmp eq i64 %indvars.iv.i, %15
br i1 %cmp13.i, label %if.then14.i, label %for.inc.i
if.then14.i: ; preds = %if.end12.i
%call15.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc.i
for.inc.i: ; preds = %if.then14.i, %if.end12.i
%16 = phi i32 [ %11, %if.end12.i ], [ %.pre.i, %if.then14.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%17 = sext i32 %16 to i64
%cmp.i = icmp slt i64 %indvars.iv.next.i, %17
br i1 %cmp.i, label %for.body.i, label %sibling.exit, !llvm.loop !11
sibling.exit: ; preds = %for.inc.i, %if.then.i, %if.then10.i
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp6.i = icmp sgt i32 %.pr, 0
br i1 %cmp6.i, label %for.body.preheader.i, label %degree.exit
for.body.preheader.i: ; preds = %sibling.exit
%wide.trip.count.i = zext i32 %.pr to i64
%xtraiter = and i64 %wide.trip.count.i, 3
%18 = icmp ult i32 %.pr, 4
br i1 %18, label %degree.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = and i64 %wide.trip.count.i, 4294967292
br label %for.body.i56
for.body.i56: ; preds = %for.body.i56, %for.body.preheader.i.new
%indvars.iv.i57 = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i60.3, %for.body.i56 ]
%count.08.i = phi i32 [ 0, %for.body.preheader.i.new ], [ %spec.select.i.3, %for.body.i56 ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i56 ]
%arrayidx.i58 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv.i57
%19 = load i32, ptr %arrayidx.i58, align 16, !tbaa !9
%20 = zext i32 %19 to i64
%cmp1.i59 = icmp eq i64 %indvars.iv, %20
%inc.i = zext i1 %cmp1.i59 to i32
%spec.select.i = add nuw nsw i32 %count.08.i, %inc.i
%indvars.iv.next.i60 = or i64 %indvars.iv.i57, 1
%arrayidx.i58.1 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv.next.i60
%21 = load i32, ptr %arrayidx.i58.1, align 16, !tbaa !9
%22 = zext i32 %21 to i64
%cmp1.i59.1 = icmp eq i64 %indvars.iv, %22
%inc.i.1 = zext i1 %cmp1.i59.1 to i32
%spec.select.i.1 = add nuw nsw i32 %spec.select.i, %inc.i.1
%indvars.iv.next.i60.1 = or i64 %indvars.iv.i57, 2
%arrayidx.i58.2 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv.next.i60.1
%23 = load i32, ptr %arrayidx.i58.2, align 16, !tbaa !9
%24 = zext i32 %23 to i64
%cmp1.i59.2 = icmp eq i64 %indvars.iv, %24
%inc.i.2 = zext i1 %cmp1.i59.2 to i32
%spec.select.i.2 = add nuw nsw i32 %spec.select.i.1, %inc.i.2
%indvars.iv.next.i60.2 = or i64 %indvars.iv.i57, 3
%arrayidx.i58.3 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv.next.i60.2
%25 = load i32, ptr %arrayidx.i58.3, align 16, !tbaa !9
%26 = zext i32 %25 to i64
%cmp1.i59.3 = icmp eq i64 %indvars.iv, %26
%inc.i.3 = zext i1 %cmp1.i59.3 to i32
%spec.select.i.3 = add nuw nsw i32 %spec.select.i.2, %inc.i.3
%indvars.iv.next.i60.3 = add nuw nsw i64 %indvars.iv.i57, 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 %degree.exit.loopexit.unr-lcssa, label %for.body.i56, !llvm.loop !21
degree.exit.loopexit.unr-lcssa: ; preds = %for.body.i56, %for.body.preheader.i
%spec.select.i.lcssa.ph = phi i32 [ undef, %for.body.preheader.i ], [ %spec.select.i.3, %for.body.i56 ]
%indvars.iv.i57.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i60.3, %for.body.i56 ]
%count.08.i.unr = phi i32 [ 0, %for.body.preheader.i ], [ %spec.select.i.3, %for.body.i56 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %degree.exit, label %for.body.i56.epil
for.body.i56.epil: ; preds = %degree.exit.loopexit.unr-lcssa, %for.body.i56.epil
%indvars.iv.i57.epil = phi i64 [ %indvars.iv.next.i60.epil, %for.body.i56.epil ], [ %indvars.iv.i57.unr, %degree.exit.loopexit.unr-lcssa ]
%count.08.i.epil = phi i32 [ %spec.select.i.epil, %for.body.i56.epil ], [ %count.08.i.unr, %degree.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i56.epil ], [ 0, %degree.exit.loopexit.unr-lcssa ]
%arrayidx.i58.epil = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv.i57.epil
%27 = load i32, ptr %arrayidx.i58.epil, align 16, !tbaa !9
%28 = zext i32 %27 to i64
%cmp1.i59.epil = icmp eq i64 %indvars.iv, %28
%inc.i.epil = zext i1 %cmp1.i59.epil to i32
%spec.select.i.epil = add nuw nsw i32 %count.08.i.epil, %inc.i.epil
%indvars.iv.next.i60.epil = add nuw nsw i64 %indvars.iv.i57.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 %degree.exit, label %for.body.i56.epil, !llvm.loop !22
degree.exit: ; preds = %degree.exit.loopexit.unr-lcssa, %for.body.i56.epil, %for.body28, %sibling.exit
%count.0.lcssa.i = phi i32 [ 0, %sibling.exit ], [ 0, %for.body28 ], [ %spec.select.i.lcssa.ph, %degree.exit.loopexit.unr-lcssa ], [ %spec.select.i.epil, %for.body.i56.epil ]
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %degree.exit
%count.0.i = phi i32 [ 0, %degree.exit ], [ %inc.i64, %while.cond.i ]
%iNoOya.0.i = phi i32 [ %9, %degree.exit ], [ %29, %while.cond.i ]
%idxprom.i61 = sext i32 %iNoOya.0.i to i64
%arrayidx.i62 = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %idxprom.i61
%29 = load i32, ptr %arrayidx.i62, align 16, !tbaa !9
%cmp.i63 = icmp eq i32 %29, -1
%inc.i64 = add nuw nsw i32 %count.0.i, 1
br i1 %cmp.i63, label %depth.exit, label %while.cond.i
depth.exit: ; preds = %while.cond.i
%call35 = call i32 @height(i32 noundef %9)
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %count.0.lcssa.i, i32 noundef %count.0.i, i32 noundef %call35)
%30 = load i32, ptr %arrayidx30, align 16, !tbaa !9
%cmp.i67 = icmp eq i32 %30, -1
br i1 %cmp.i67, label %hantei.exit, label %land.lhs.true.i
land.lhs.true.i: ; preds = %depth.exit
%h.i = getelementptr inbounds [100000 x %struct.Ki], ptr @T, i64 0, i64 %indvars.iv, i32 3
%31 = load i32, ptr %h.i, align 4, !tbaa !13
%cmp7.i = icmp eq i32 %31, 0
%.str.3..str.4.i = select i1 %cmp7.i, ptr @.str.3, ptr @.str.4
br label %hantei.exit
hantei.exit: ; preds = %depth.exit, %land.lhs.true.i
%.str.3.sink.i = phi ptr [ @.str.2, %depth.exit ], [ %.str.3..str.4.i, %land.lhs.true.i ]
%call9.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink.i)
%putchar.i = call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%32 = load i32, ptr @n, align 4, !tbaa !5
%33 = sext i32 %32 to i64
%cmp27 = icmp slt i64 %indvars.iv.next, %33
br i1 %cmp27, label %for.body28, label %for.end39, !llvm.loop !24
for.end39: ; preds = %hantei.exit, %entry, %for.cond26.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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(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 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 = !{!"Ki", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 12}
!14 = distinct !{!14, !12, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !12, !16, !15}
!18 = !{!10, !6, i64 8}
!19 = !{!10, !6, i64 4}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = distinct !{!24, !12}
|
#include<stdio.h>
#define NIL -1
typedef struct{
int parent,sibling,leftgaki,rightgaki,degree;
}Node;
Node tree[100001];
int count=0,count3=0; //再帰関数、子供表示用
int count2[100001];
int n;
int retdepth(int id){ //再帰で根っこまでの長さを計る
if (tree[id].parent==NIL){
return count/2;
} else {
count++;
return retdepth(tree[id].parent);
}
}
void retheight(int id,int countid,int startdepth,int depth){ //逆に葉っぱまでの長さを返す
int i,newcountid;
for (i=1;i<n;i++){
if (count2[i]==0){
newcountid=i;
break;
}
}
//printf("->tree[%d]search. countid=%d, newcountid=%d, left=%d,right=%d.height=%d\n",id,countid,newcountid,tree[id].leftgaki,tree[id].rightgaki,count2[countid]);
if (tree[id].leftgaki!=NIL && tree[id].rightgaki!=NIL){
count2[countid]++;
count2[newcountid]=depth-startdepth+1;
retheight(tree[id].leftgaki,countid,startdepth,depth+1);
retheight(tree[id].rightgaki,newcountid,startdepth,depth+1);
} else if (tree[id].leftgaki!=NIL){
count2[countid]++;
retheight(tree[id].leftgaki,countid,startdepth,depth+1);
} else if (tree[id].rightgaki!=NIL){
count2[countid]++;
retheight(tree[id].rightgaki,countid,startdepth,depth+1);
} else {
count3=countid;
}
}
int returnheight(int id,int depth){
int i,ret=0;
for (i=0;i<n;i++){
count2[i]=0;
}
retheight(id,0,depth,depth);
for(i=0;i<count3+1;i++){
if(ret<count2[i]){
ret = count2[i];
}
}
return ret;
}
int main(){
int i,j,nownode,deg,leftgaki,rightgaki;
scanf("%d",&n);
for (i=0;i<n;i++){
tree[i].parent=tree[i].degree=tree[i].sibling=tree[i].leftgaki=tree[i].rightgaki=NIL;
//NILで初期化を行う
}
for (i=0; i<n; i++){
scanf("%d%d%d",&nownode,&leftgaki,&rightgaki);
count=0;
if (leftgaki!=-1){
tree[leftgaki].parent=nownode;
tree[leftgaki].sibling=rightgaki;
tree[nownode].leftgaki=leftgaki;
count++;
}
if (rightgaki!=-1){
tree[rightgaki].parent=nownode;
tree[rightgaki].sibling=leftgaki;
tree[nownode].rightgaki=rightgaki;
count++;
}
tree[nownode].degree=count;
}
//---------------------
//表示部分
for(i=0; i<n; i++){
count=count3=0;
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,tree[i].parent,tree[i].sibling,tree[i].degree,retdepth(i),returnheight(i,retdepth(i)));
if(tree[i].parent == NIL){
printf("root\n");
} else if(tree[i].leftgaki == NIL && tree[i].rightgaki == NIL){
printf("leaf\n");
} else {
printf("internal node\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237799/source.c"
target datalayout = "e-m:e-p270: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
@count3 = dso_local local_unnamed_addr global i32 0, align 4
@tree = dso_local local_unnamed_addr global [100001 x %struct.Node] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@count2 = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@.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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @retdepth(i32 noundef %id) local_unnamed_addr #0 {
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, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @retheight(i32 noundef %id, i32 noundef %countid, i32 noundef %startdepth, i32 noundef %depth) local_unnamed_addr #1 {
entry:
br label %tailrecurse.outer
tailrecurse.outer: ; preds = %if.then8, %entry
%id.tr.ph = phi i32 [ %8, %if.then8 ], [ %id, %entry ]
%countid.tr.ph = phi i32 [ %.us-phi84, %if.then8 ], [ %countid, %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 %countid.tr.ph to i64
%arrayidx28 = getelementptr inbounds [100001 x i32], ptr @count2, 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 @count2, 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 !11
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
%leftgaki.us = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2.us, i32 2
%3 = load i32, ptr %leftgaki.us, align 4, !tbaa !13
%cmp4.not.us = icmp eq i32 %3, -1
%rightgaki37.us = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2.us, i32 3
%4 = load i32, ptr %rightgaki37.us, align 4, !tbaa !14
%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
%leftgaki = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2, i32 2
%5 = load i32, ptr %leftgaki, align 4, !tbaa !13
%cmp4.not = icmp eq i32 %5, -1
%rightgaki37 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom2, i32 3
%6 = load i32, ptr %rightgaki37, align 4, !tbaa !14
%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 [ %rightgaki37.us, %land.lhs.true.us ], [ %rightgaki37, %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 @count2, 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 %countid.tr.ph, i32 noundef %startdepth, i32 noundef %add17)
%8 = load i32, ptr %.us-phi83, align 4, !tbaa !14
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 %countid.tr.ph, ptr @count3, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @returnheight(i32 noundef %id, i32 noundef %depth) local_unnamed_addr #3 {
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 @count2, 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 @count3, 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 @count2, 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 !15
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 @count2, 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 !18
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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%nownode = alloca i32, align 4
%leftgaki = alloca i32, align 4
%rightgaki = 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 %leftgaki) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %rightgaki) #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 %leftgaki, ptr noundef nonnull %rightgaki)
store i32 0, ptr @count, align 4, !tbaa !5
%3 = load i32, ptr %leftgaki, align 4, !tbaa !5
%cmp15.not = icmp eq i32 %3, -1
%.pre = load i32, ptr %rightgaki, 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 !19
%idxprom22 = sext i32 %.pre133.pre to i64
%leftgaki24 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom22, i32 2
store i32 %3, ptr %leftgaki24, align 4, !tbaa !13
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 !19
%idxprom34 = sext i32 %.pre133.pre to i64
%rightgaki36 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %idxprom34, i32 3
store i32 %.pre, ptr %rightgaki36, align 4, !tbaa !14
%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 !20
%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 !21
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 @count3, 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 !19
%degree56 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 4
%10 = load i32, ptr %degree56, align 4, !tbaa !20
%cmp8.i = icmp eq i32 %8, -1
br i1 %cmp8.i, label %retdepth.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 %retdepth.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
retdepth.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 = %retdepth.exit119
%16 = zext i32 %7 to i64
%17 = shl nuw nsw i64 %16, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @count2, i8 0, i64 %17, i1 false), !tbaa !5
br label %for.end.i
for.end.i: ; preds = %for.body.preheader.i, %retdepth.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 @count3, align 4, !tbaa !5
%cmp2.not22.i = icmp slt i32 %19, 0
br i1 %cmp2.not22.i, label %returnheight.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 @count2, 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 !22
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 %returnheight.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 @count2, 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 %returnheight.exit, label %for.body3.i, !llvm.loop !23
returnheight.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 = %returnheight.exit
%leftgaki69 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 2
%29 = load i32, ptr %leftgaki69, align 4, !tbaa !13
%cmp70 = icmp eq i32 %29, -1
br i1 %cmp70, label %land.lhs.true, label %if.else77
land.lhs.true: ; preds = %if.else
%rightgaki73 = getelementptr inbounds [100001 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv, i32 3
%30 = load i32, ptr %rightgaki73, align 4, !tbaa !14
%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, %returnheight.exit, %if.else77
%str.7.sink = phi ptr [ @str, %if.else77 ], [ @str.7, %returnheight.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 !24
for.end83: ; preds = %for.inc81, %entry, %for.cond45.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %rightgaki) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %leftgaki) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nownode) #9
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: 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 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 #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 = { 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !6, i64 12}
!15 = distinct !{!15, !12, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !12, !17, !16}
!19 = !{!10, !6, i64 4}
!20 = !{!10, !6, i64 16}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !16, !17}
!23 = distinct !{!23, !12, !17, !16}
!24 = distinct !{!24, !12}
|
#include<stdio.h>
#define MAX 100000
typedef struct{
int p,l,r;
}Node;
Node N [MAX];
int Depth(int i){//id の深さ 上中
int count=0;
Node X=N[i];
for(;X.p!=-1;count++)X=N[X.p];
return count;
}
int Degree(int i){//子供の数 0-2
int count=0;
if(N[i].r!=-1)count++;
if(N[i].l!=-1)count++;
return count;
}
int Sibling(int i){//兄弟の id を返す
int R,L;
if(N[i].p==-1)return -1;
L=N[N[i].p].l;
R=N[N[i].p].r;
return i!=L?L:R;
}
int Height(int i){//idの中下
Node X=N[i];
int a,b;
a=b=0;
if(X.r!=-1)a=Height(X.r)+1;//左右の子供をたどって長い方を高さとして採用
if(X.l!=-1)b=Height(X.l)+1;
return a>=b ? a : b;
}
void Print(int i){
int j;
printf("node %d: ",i);
printf("parent = %d, ",N[i].p);
printf("sibling = %d, ",Sibling(i));
printf("degree = %d, ",Degree(i));
printf("depth = %d, ",Depth(i));
printf("height = %d, ",Height(i));
if(N[i].p==-1)printf("root\n");//親がいなかったらルート
else if(N[i].l==-1&&N[i].r==-1)printf("leaf\n");//子供いなかったら葉
else printf("internal node\n");//ほかはinternal
return ;
}
int main(){
int n;
int i;
int j;
scanf("%d",&n);
for(i=0;i<100000;i++){//INITIATE
N[i].p = N[i].l = N[i].r = -1;
}
for(i=0;i<n;i++){//input
scanf("%d",&j);
scanf("%d",&N[j].l);
scanf("%d",&N[j].r);
if(N[j].l!=-1) N[N[j].l].p = j;//子供がいたら、そいつらの親おや決定
if(N[j].r!=-1) N[N[j].r].p = j;
}
for(i=0;i<n;i++){//idごとに必要
Print(i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237863/source.c"
target datalayout = "e-m:e-p270: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 }
@N = dso_local global [100000 x %struct.Node] 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 = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
@str.10 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@str.11 = 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 %i) local_unnamed_addr #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%count.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ]
%idxprom.pn.in = phi i32 [ %i, %entry ], [ %X.sroa.0.0, %for.cond ]
%idxprom.pn = sext i32 %idxprom.pn.in to i64
%X.sroa.0.0.in = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom.pn
%X.sroa.0.0 = load i32, ptr %X.sroa.0.0.in, align 4
%cmp.not = icmp eq i32 %X.sroa.0.0, -1
%inc = add nuw nsw i32 %count.0, 1
br i1 %cmp.not, label %for.end, label %for.cond, !llvm.loop !5
for.end: ; preds = %for.cond
ret i32 %count.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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Degree(i32 noundef %i) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %i to i64
%r = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %r, align 4, !tbaa !7
%cmp.not = icmp ne i32 %0, -1
%spec.select = zext i1 %cmp.not to i32
%l = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %l, align 4, !tbaa !12
%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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Sibling(i32 noundef %i) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !13
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%l = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4, i32 1
%1 = load i32, ptr %l, align 4, !tbaa !12
%r = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %r, align 4, !tbaa !7
%cmp11.not = icmp eq i32 %1, %i
%cond = select i1 %cmp11.not, i32 %2, i32 %1
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %cond, %if.end ], [ -1, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Height(i32 noundef %i) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom
%X.sroa.3.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
%X.sroa.3.0.copyload = load i32, ptr %X.sroa.3.0.arrayidx.sroa_idx, align 4, !tbaa.struct !14
%X.sroa.5.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
%X.sroa.5.0.copyload = load i32, ptr %X.sroa.5.0.arrayidx.sroa_idx, align 4, !tbaa.struct !16
%cmp.not = icmp eq i32 %X.sroa.5.0.copyload, -1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call = tail call i32 @Height(i32 noundef %X.sroa.5.0.copyload)
%add = add nsw i32 %call, 1
br label %if.end
if.end: ; preds = %if.then, %entry
%a.0 = phi i32 [ %add, %if.then ], [ 0, %entry ]
%cmp2.not = icmp eq i32 %X.sroa.3.0.copyload, -1
br i1 %cmp2.not, label %if.end7, label %if.then3
if.then3: ; preds = %if.end
%call5 = tail call i32 @Height(i32 noundef %X.sroa.3.0.copyload)
%add6 = add nsw i32 %call5, 1
br label %if.end7
if.end7: ; preds = %if.then3, %if.end
%b.0 = phi i32 [ %add6, %if.then3 ], [ 0, %if.end ]
%cond = tail call i32 @llvm.smax.i32(i32 %a.0, i32 %b.0)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Print(i32 noundef %i) local_unnamed_addr #4 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i)
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !13
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !13
%cmp.i = icmp eq i32 %1, -1
br i1 %cmp.i, label %Sibling.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 @N, i64 0, i64 %idxprom4.i, i32 1
%2 = load i32, ptr %l.i, align 4, !tbaa !12
%r.i = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom4.i, i32 2
%3 = load i32, ptr %r.i, align 4, !tbaa !7
%cmp11.not.i = icmp eq i32 %2, %i
%cond.i = select i1 %cmp11.not.i, i32 %3, i32 %2
br label %Sibling.exit
Sibling.exit: ; preds = %entry, %if.end.i
%retval.0.i = phi i32 [ %cond.i, %if.end.i ], [ -1, %entry ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
%r.i36 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom, i32 2
%4 = load i32, ptr %r.i36, align 4, !tbaa !7
%cmp.not.i = icmp ne i32 %4, -1
%spec.select.i = zext i1 %cmp.not.i to i32
%l.i37 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom, i32 1
%5 = load i32, ptr %l.i37, align 4, !tbaa !12
%cmp3.not.i = icmp eq i32 %5, -1
%inc5.i = select i1 %cmp.not.i, i32 2, i32 1
%count.1.i = select i1 %cmp3.not.i, i32 %spec.select.i, i32 %inc5.i
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.1.i)
br label %for.cond.i
for.cond.i: ; preds = %for.cond.i, %Sibling.exit
%count.0.i = phi i32 [ 0, %Sibling.exit ], [ %inc.i, %for.cond.i ]
%idxprom.pn.in.i = phi i32 [ %i, %Sibling.exit ], [ %X.sroa.0.0.i, %for.cond.i ]
%idxprom.pn.i = sext i32 %idxprom.pn.in.i to i64
%X.sroa.0.0.in.i = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom.pn.i
%X.sroa.0.0.i = load i32, ptr %X.sroa.0.0.in.i, align 4
%cmp.not.i38 = icmp eq i32 %X.sroa.0.0.i, -1
%inc.i = add nuw nsw i32 %count.0.i, 1
br i1 %cmp.not.i38, label %Depth.exit, label %for.cond.i, !llvm.loop !5
Depth.exit: ; preds = %for.cond.i
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %count.0.i)
%call8 = tail call i32 @Height(i32 noundef %i)
%call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %call8)
%6 = load i32, ptr %arrayidx, align 4, !tbaa !13
%cmp = icmp eq i32 %6, -1
br i1 %cmp, label %if.end24, label %if.else
if.else: ; preds = %Depth.exit
%7 = load i32, ptr %l.i37, align 4, !tbaa !12
%cmp16 = icmp eq i32 %7, -1
br i1 %cmp16, label %land.lhs.true, label %if.else22
land.lhs.true: ; preds = %if.else
%8 = load i32, ptr %r.i36, align 4, !tbaa !7
%cmp19 = icmp eq i32 %8, -1
br i1 %cmp19, label %if.end24, label %if.else22
if.else22: ; preds = %land.lhs.true, %if.else
br label %if.end24
if.end24: ; preds = %land.lhs.true, %Depth.exit, %if.else22
%str.10.sink = phi ptr [ @str, %if.else22 ], [ @str.11, %Depth.exit ], [ @str.10, %land.lhs.true ]
%puts33 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.10.sink)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%j = 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 %j) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull %n)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1200000) @N, i8 -1, i64 1200000, i1 false), !tbaa !15
%0 = load i32, ptr %n, align 4, !tbaa !15
%cmp659 = icmp sgt i32 %0, 0
br i1 %cmp659, label %for.body7, label %for.end47
for.cond42.preheader: ; preds = %for.inc39
%1 = icmp sgt i32 %7, 0
br i1 %1, label %for.body44, label %for.end47
for.body7: ; preds = %entry, %for.inc39
%i.160 = phi i32 [ %inc40, %for.inc39 ], [ 0, %entry ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull %j)
%2 = load i32, ptr %j, align 4, !tbaa !15
%idxprom9 = sext i32 %2 to i64
%l11 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom9, i32 1
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull %l11)
%3 = load i32, ptr %j, align 4, !tbaa !15
%idxprom13 = sext i32 %3 to i64
%r15 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom13, i32 2
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.9, ptr noundef nonnull %r15)
%4 = load i32, ptr %j, align 4, !tbaa !15
%idxprom17 = sext i32 %4 to i64
%l19 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom17, i32 1
%5 = load i32, ptr %l19, align 4, !tbaa !12
%cmp20.not = icmp eq i32 %5, -1
br i1 %cmp20.not, label %if.end, label %if.then
if.then: ; preds = %for.body7
%idxprom24 = sext i32 %5 to i64
%arrayidx25 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom24
store i32 %4, ptr %arrayidx25, align 4, !tbaa !13
br label %if.end
if.end: ; preds = %if.then, %for.body7
%r29 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom17, i32 2
%6 = load i32, ptr %r29, align 4, !tbaa !7
%cmp30.not = icmp eq i32 %6, -1
br i1 %cmp30.not, label %for.inc39, label %if.then31
if.then31: ; preds = %if.end
%idxprom35 = sext i32 %6 to i64
%arrayidx36 = getelementptr inbounds [100000 x %struct.Node], ptr @N, i64 0, i64 %idxprom35
store i32 %4, ptr %arrayidx36, align 4, !tbaa !13
br label %for.inc39
for.inc39: ; preds = %if.end, %if.then31
%inc40 = add nuw nsw i32 %i.160, 1
%7 = load i32, ptr %n, align 4, !tbaa !15
%cmp6 = icmp slt i32 %inc40, %7
br i1 %cmp6, label %for.body7, label %for.cond42.preheader, !llvm.loop !17
for.body44: ; preds = %for.cond42.preheader, %for.body44
%i.262 = phi i32 [ %inc46, %for.body44 ], [ 0, %for.cond42.preheader ]
call void @Print(i32 noundef %i.262)
%inc46 = add nuw nsw i32 %i.262, 1
%8 = load i32, ptr %n, align 4, !tbaa !15
%cmp43 = icmp slt i32 %inc46, %8
br i1 %cmp43, label %for.body44, label %for.end47, !llvm.loop !18
for.end47: ; preds = %for.body44, %entry, %for.cond42.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #9
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 #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 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 = { 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 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nofree nounwind }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !9, i64 8}
!8 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!8, !9, i64 4}
!13 = !{!8, !9, i64 0}
!14 = !{i64 0, i64 4, !15, i64 4, i64 4, !15}
!15 = !{!9, !9, i64 0}
!16 = !{i64 0, i64 4, !15}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
|
#include<stdio.h>
#define MAX 25
typedef struct{
int parent;
int left;
int right;
}Tree;
int DEGREE( int );
int DEPTH( int );
int HEIGHT( int );
int get_sibling( int );
Tree T[MAX];
int main()
{
int i, n, id, left, right, degree, depth, height, sibling;
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, &left, &right);
T[id].left = left;
T[id].right = right;
if( left != -1) T[left].parent = id;
if( right != -1 ) T[right].parent = id;
}
for( i=0; i<n; i++ )
{
printf("node %d: ", i);
printf("parent = %d, ", T[i].parent);
sibling = get_sibling(i);
printf("sibling = %d, ", sibling);
degree = DEGREE(i);
printf("degree = %d, ", degree );
depth = DEPTH(i);
printf("depth = %d, ", depth);
height = HEIGHT(i);
printf("height = %d, ", height);
if( T[i].parent == -1 ) printf("root\n");
else if( degree == 0 ) printf("leaf\n");
else printf("internal node\n");
}
return 0;
}
int DEGREE( int id )
{
int count=0;
if( T[id].left != -1 ) count++;
if( T[id].right != -1 ) count++;
return count;
}
int DEPTH( int id )
{
int count=0;
while( T[id].parent != -1 )
{
id = T[id].parent;
count++;
}
return count;
}
int HEIGHT( int id )
{
int h1=0, h2=0;
if( T[id].right != -1 )
{
h1 = HEIGHT( T[id].right ) + 1;
}
if( T[id].left != -1 )
{
h2 = HEIGHT( T[id].left ) + 1;
}
if( h1 > h2 ) return h1;
else return h2;
}
int get_sibling( int id )
{
if( T[id].parent == -1 )
{
return -1;
}
else if( T[T[id].parent].left != id )
{
return T[T[id].parent].left;
}
else if( T[T[id].parent].right != id )
{
return T[T[id].parent].right;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237906/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237906/source.c"
target datalayout = "e-m:e-p270: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
@T = dso_local local_unnamed_addr global [25 x %struct.Tree] 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 [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:
%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
%cmp88 = icmp sgt i32 %0, 0
br i1 %cmp88, label %for.body9.preheader, label %for.end61
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
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body32, label %for.end61
for.body9: ; preds = %for.body9.preheader, %for.inc27
%i.191 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right)
%4 = load i32, ptr %left, align 4, !tbaa !5
%5 = load i32, ptr %id, align 4, !tbaa !5
%idxprom11 = sext i32 %5 to i64
%left13 = getelementptr inbounds [25 x %struct.Tree], 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 [25 x %struct.Tree], 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 [25 x %struct.Tree], 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 [25 x %struct.Tree], 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.191, 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.cond30.preheader, %DEPTH.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %DEPTH.exit ], [ 0, %for.cond30.preheader ]
%8 = trunc i64 %indvars.iv to i32
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%arrayidx35 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx35, align 4, !tbaa !12
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
%10 = load i32, ptr %arrayidx35, align 4, !tbaa !12
%cmp.i = icmp eq i32 %10, -1
br i1 %cmp.i, label %get_sibling.exit, label %if.else.i
if.else.i: ; preds = %for.body32
%idxprom4.i = sext i32 %10 to i64
%left.i = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom4.i, i32 1
%11 = load i32, ptr %left.i, align 4, !tbaa !9
%12 = zext i32 %11 to i64
%cmp6.not.i = icmp eq i64 %indvars.iv, %12
br i1 %cmp6.not.i, label %if.else14.i, label %get_sibling.exit
if.else14.i: ; preds = %if.else.i
%right.i = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom4.i, i32 2
%13 = load i32, ptr %right.i, align 4, !tbaa !11
%14 = zext i32 %13 to i64
%cmp20.not.i = icmp eq i64 %indvars.iv, %14
%spec.select.i = select i1 %cmp20.not.i, i32 undef, i32 %13
br label %get_sibling.exit
get_sibling.exit: ; preds = %for.body32, %if.else.i, %if.else14.i
%retval.0.i = phi i32 [ -1, %for.body32 ], [ %11, %if.else.i ], [ %spec.select.i, %if.else14.i ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %retval.0.i)
%left.i82 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv, i32 1
%15 = load i32, ptr %left.i82, align 4, !tbaa !9
%cmp.not.i = icmp ne i32 %15, -1
%spec.select.i83 = zext i1 %cmp.not.i to i32
%right.i84 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %indvars.iv, i32 2
%16 = load i32, ptr %right.i84, align 4, !tbaa !11
%cmp3.not.i = icmp eq i32 %16, -1
%inc5.i = select i1 %cmp.not.i, i32 2, i32 1
%count.1.i = select i1 %cmp3.not.i, i32 %spec.select.i83, i32 %inc5.i
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %count.1.i)
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %get_sibling.exit
%id.addr.0.i = phi i32 [ %8, %get_sibling.exit ], [ %17, %while.cond.i ]
%count.0.i = phi i32 [ 0, %get_sibling.exit ], [ %inc.i, %while.cond.i ]
%idxprom.i85 = sext i32 %id.addr.0.i to i64
%arrayidx.i86 = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom.i85
%17 = load i32, ptr %arrayidx.i86, align 4, !tbaa !12
%cmp.not.i87 = icmp eq i32 %17, -1
%inc.i = add nuw nsw i32 %count.0.i, 1
br i1 %cmp.not.i87, label %DEPTH.exit, label %while.cond.i, !llvm.loop !15
DEPTH.exit: ; preds = %while.cond.i
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %count.0.i)
%call44 = call i32 @HEIGHT(i32 noundef %8)
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %call44)
%18 = load i32, ptr %arrayidx35, align 4, !tbaa !12
%cmp49 = icmp eq i32 %18, -1
%cmp52 = icmp eq i32 %count.1.i, 0
%str.11.str = select i1 %cmp52, ptr @str.11, ptr @str
%str.12.sink = select i1 %cmp49, ptr @str.12, ptr %str.11.str
%puts80 = call i32 @puts(ptr nonnull dereferenceable(1) %str.12.sink)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp31 = icmp slt i64 %indvars.iv.next, %20
br i1 %cmp31, label %for.body32, label %for.end61, !llvm.loop !16
for.end61: ; preds = %DEPTH.exit, %entry, %for.cond30.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 %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
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 @get_sibling(i32 noundef %id) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [25 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 %if.end29, label %if.else
if.else: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%left = getelementptr inbounds [25 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, %id
br i1 %cmp6.not, label %if.else14, label %if.end29
if.else14: ; preds = %if.else
%right = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom4, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp20.not = icmp eq i32 %2, %id
%spec.select = select i1 %cmp20.not, i32 undef, i32 %2
br label %if.end29
if.end29: ; preds = %if.else14, %if.else, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %1, %if.else ], [ %spec.select, %if.else14 ]
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 %id) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %id to i64
%left = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%cmp.not = icmp ne i32 %0, -1
%spec.select = zext i1 %cmp.not to i32
%right = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%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 @DEPTH(i32 noundef %id) local_unnamed_addr #4 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%id.addr.0 = phi i32 [ %id, %entry ], [ %0, %while.cond ]
%count.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%idxprom = sext i32 %id.addr.0 to i64
%arrayidx = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.not = icmp eq i32 %0, -1
%inc = add nuw nsw i32 %count.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !15
while.end: ; preds = %while.cond
ret i32 %count.0
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @HEIGHT(i32 noundef %id) local_unnamed_addr #5 {
entry:
%idxprom = sext i32 %id to i64
%right = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %right, align 4, !tbaa !11
%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 ]
%left = getelementptr inbounds [25 x %struct.Tree], ptr @T, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%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 ]
%h1.0.h2.0 = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
ret i32 %h1.0.h2.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 #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 = { 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 = { 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 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 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 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, !14}
|
#include <stdio.h>
#define NIL -1
typedef struct{
int left, right, par, dep, hei;
}tree;
tree t[100000];
void depth(int id, int d)
{
if (id == NIL)
return;
t[id].dep = d;
depth(t[id].left,d+1);
depth(t[id].right,d+1);
}
int height(int id)
{
int h1 = 0, h2 = 0;
if (t[id].left != NIL)
h1 = height(t[id].left)+1;
if (t[id].right != NIL)
h2 = height(t[id].right)+1;
if (h1 >= h2)
return t[id].hei = h1;
return t[id].hei = h2;
}
int sibling(int id)
{
if (t[id].par == NIL)
return NIL;
if (t[t[id].par].left != id && t[t[id].par].left != NIL)
return t[t[id].par].left;
if (t[t[id].par].right != id && t[t[id].par].right != NIL)
return t[t[id].par].right;
return NIL;
}
int main()
{
int n, i, id, l, r, root, deg;
scanf("%d",&n);
for (i = 0; i < n; i++){
t[i].par = NIL;
t[i].dep = t[i].hei = 0;
}
for (i = 0; i < n; i++){
scanf("%d%d%d",&id,&l,&r);
t[id].left = l;
t[id].right = r;
if (l != NIL)
t[l].par = id;
if (r != NIL)
t[r].par = id;
}
for (i = 0; i < n; i++)
if (t[i].par == NIL)
root = i;
depth(root,0);
height(root);
for (i = 0; i < n; i++){
deg = 0;
if (t[i].left != NIL)
deg++;
if (t[i].right != NIL)
deg++;
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,t[i].par,sibling(i),deg,t[i].dep,t[i].hei);
if (t[i].par == NIL)
printf("root\n");
else if (t[i].left == NIL && t[i].right == NIL)
printf("leaf\n");
else
printf("internal node\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_237957/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_237957/source.c"
target datalayout = "e-m:e-p270: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 }
@t = dso_local local_unnamed_addr global [100000 x %struct.tree] zeroinitializer, align 16
@.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, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @depth(i32 noundef %id, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp11 = icmp eq i32 %id, -1
br i1 %cmp11, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%d.tr13 = phi i32 [ %add, %if.end ], [ %d, %entry ]
%id.tr12 = phi i32 [ %1, %if.end ], [ %id, %entry ]
%idxprom = sext i32 %id.tr12 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom
%dep = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom, i32 3
store i32 %d.tr13, ptr %dep, align 4, !tbaa !5
%0 = load i32, ptr %arrayidx, align 4, !tbaa !10
%add = add nsw i32 %d.tr13, 1
tail call void @depth(i32 noundef %0, i32 noundef %add)
%right = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom, i32 1
%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 @height(i32 noundef %id) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, 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
%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.tree], ptr @t, i64 0, i64 %idxprom, i32 1
%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 ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %h1.0, i32 %h2.0)
%2 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom, i32 4
store i32 %spec.select, ptr %2, align 4
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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @sibling(i32 noundef %id) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %id to i64
%par = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %par, 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
%arrayidx5 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom4
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !10
%cmp6.not = icmp eq i32 %1, %id
%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 1
%2 = load i32, ptr %right, align 4, !tbaa !11
%cmp27.not = icmp eq i32 %2, %id
%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 i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%id = 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) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp119 = icmp sgt i32 %0, 0
br i1 %cmp119, label %for.body.preheader, label %for.cond26.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.cond5.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.cond5.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.cond5.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond5.preheader.unr-lcssa
%par.epil = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.unr, i32 2
store i32 -1, ptr %par.epil, align 4, !tbaa !12
%hei.epil = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.unr, i32 4
store i32 0, ptr %hei.epil, align 4, !tbaa !14
%dep.epil = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.unr, i32 3
store i32 0, ptr %dep.epil, align 4, !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond5.preheader.unr-lcssa, %for.body.epil
br i1 %cmp119, label %for.body7, label %for.cond26.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 ]
%par = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv, i32 2
store i32 -1, ptr %par, align 8, !tbaa !12
%hei = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv, i32 4
store i32 0, ptr %hei, align 8, !tbaa !14
%dep = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv, i32 3
store i32 0, ptr %dep, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%par.1 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.next, i32 2
store i32 -1, ptr %par.1, align 4, !tbaa !12
%hei.1 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.next, i32 4
store i32 0, ptr %hei.1, align 4, !tbaa !14
%dep.1 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.next, i32 3
store i32 0, ptr %dep.1, align 8, !tbaa !5
%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.cond5.preheader.unr-lcssa, label %for.body, !llvm.loop !15
for.cond26.preheader: ; preds = %for.inc23, %entry, %for.cond5.preheader
%.lcssa = phi i32 [ %0, %for.cond5.preheader ], [ %0, %entry ], [ %6, %for.inc23 ]
%cmp27123 = icmp sgt i32 %.lcssa, 0
call void @llvm.assume(i1 %cmp27123)
%wide.trip.count134 = zext i32 %.lcssa to i64
%xtraiter142 = and i64 %wide.trip.count134, 3
%2 = icmp ult i32 %.lcssa, 4
br i1 %2, label %for.end37.unr-lcssa, label %for.cond26.preheader.new
for.cond26.preheader.new: ; preds = %for.cond26.preheader
%unroll_iter145 = and i64 %wide.trip.count134, 2147483644
br label %for.body28
for.body7: ; preds = %for.cond5.preheader, %for.inc23
%i.1122 = phi i32 [ %inc24, %for.inc23 ], [ 0, %for.cond5.preheader ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %l, ptr noundef nonnull %r)
%3 = load i32, ptr %l, align 4, !tbaa !13
%4 = load i32, ptr %id, align 4, !tbaa !13
%idxprom9 = sext i32 %4 to i64
%arrayidx10 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom9
store i32 %3, ptr %arrayidx10, align 4, !tbaa !10
%5 = load i32, ptr %r, align 4, !tbaa !13
%right = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom9, i32 1
store i32 %5, ptr %right, align 4, !tbaa !11
%cmp13.not = icmp eq i32 %3, -1
br i1 %cmp13.not, label %if.end, label %if.then
if.then: ; preds = %for.body7
%idxprom14 = sext i32 %3 to i64
%par16 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom14, i32 2
store i32 %4, ptr %par16, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body7
%cmp17.not = icmp eq i32 %5, -1
br i1 %cmp17.not, label %for.inc23, label %if.then18
if.then18: ; preds = %if.end
%idxprom19 = sext i32 %5 to i64
%par21 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom19, i32 2
store i32 %4, ptr %par21, align 4, !tbaa !12
br label %for.inc23
for.inc23: ; preds = %if.end, %if.then18
%inc24 = add nuw nsw i32 %i.1122, 1
%6 = load i32, ptr %n, align 4, !tbaa !13
%cmp6 = icmp slt i32 %inc24, %6
br i1 %cmp6, label %for.body7, label %for.cond26.preheader, !llvm.loop !17
for.body28: ; preds = %for.body28, %for.cond26.preheader.new
%indvars.iv131 = phi i64 [ 0, %for.cond26.preheader.new ], [ %indvars.iv.next132.3, %for.body28 ]
%root.0125 = phi i32 [ undef, %for.cond26.preheader.new ], [ %spec.select.3, %for.body28 ]
%niter146 = phi i64 [ 0, %for.cond26.preheader.new ], [ %niter146.next.3, %for.body28 ]
%par31 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv131, i32 2
%7 = load i32, ptr %par31, align 8, !tbaa !12
%cmp32 = icmp eq i32 %7, -1
%8 = trunc i64 %indvars.iv131 to i32
%spec.select = select i1 %cmp32, i32 %8, i32 %root.0125
%indvars.iv.next132 = or i64 %indvars.iv131, 1
%par31.1 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.next132, i32 2
%9 = load i32, ptr %par31.1, align 4, !tbaa !12
%cmp32.1 = icmp eq i32 %9, -1
%10 = trunc i64 %indvars.iv.next132 to i32
%spec.select.1 = select i1 %cmp32.1, i32 %10, i32 %spec.select
%indvars.iv.next132.1 = or i64 %indvars.iv131, 2
%par31.2 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.next132.1, i32 2
%11 = load i32, ptr %par31.2, align 16, !tbaa !12
%cmp32.2 = icmp eq i32 %11, -1
%12 = trunc i64 %indvars.iv.next132.1 to i32
%spec.select.2 = select i1 %cmp32.2, i32 %12, i32 %spec.select.1
%indvars.iv.next132.2 = or i64 %indvars.iv131, 3
%par31.3 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv.next132.2, i32 2
%13 = load i32, ptr %par31.3, align 4, !tbaa !12
%cmp32.3 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv.next132.2 to i32
%spec.select.3 = select i1 %cmp32.3, i32 %14, i32 %spec.select.2
%indvars.iv.next132.3 = add nuw nsw i64 %indvars.iv131, 4
%niter146.next.3 = add i64 %niter146, 4
%niter146.ncmp.3 = icmp eq i64 %niter146.next.3, %unroll_iter145
br i1 %niter146.ncmp.3, label %for.end37.unr-lcssa, label %for.body28, !llvm.loop !18
for.end37.unr-lcssa: ; preds = %for.body28, %for.cond26.preheader
%indvars.iv131.unr = phi i64 [ 0, %for.cond26.preheader ], [ %indvars.iv.next132.3, %for.body28 ]
%root.0125.unr = phi i32 [ undef, %for.cond26.preheader ], [ %spec.select.3, %for.body28 ]
%lcmp.mod143.not = icmp eq i64 %xtraiter142, 0
br i1 %lcmp.mod143.not, label %for.end37, label %for.body28.epil
for.body28.epil: ; preds = %for.end37.unr-lcssa, %for.body28.epil
%indvars.iv131.epil = phi i64 [ %indvars.iv.next132.epil, %for.body28.epil ], [ %indvars.iv131.unr, %for.end37.unr-lcssa ]
%root.0125.epil = phi i32 [ %spec.select.epil, %for.body28.epil ], [ %root.0125.unr, %for.end37.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body28.epil ], [ 0, %for.end37.unr-lcssa ]
%par31.epil = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv131.epil, i32 2
%15 = load i32, ptr %par31.epil, align 4, !tbaa !12
%cmp32.epil = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv131.epil to i32
%spec.select.epil = select i1 %cmp32.epil, i32 %16, i32 %root.0125.epil
%indvars.iv.next132.epil = add nuw nsw i64 %indvars.iv131.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter142
br i1 %epil.iter.cmp.not, label %for.end37, label %for.body28.epil, !llvm.loop !19
for.end37: ; preds = %for.body28.epil, %for.end37.unr-lcssa
%spec.select.lcssa = phi i32 [ %root.0125.unr, %for.end37.unr-lcssa ], [ %spec.select.epil, %for.body28.epil ]
call void @depth(i32 noundef %spec.select.lcssa, i32 noundef 0)
%call38 = call i32 @height(i32 noundef %spec.select.lcssa)
%17 = load i32, ptr %n, align 4, !tbaa !13
%cmp40127 = icmp sgt i32 %17, 0
br i1 %cmp40127, label %for.body41, label %for.end89
for.body41: ; preds = %for.end37, %for.inc87
%indvars.iv136 = phi i64 [ %indvars.iv.next137, %for.inc87 ], [ 0, %for.end37 ]
%arrayidx43 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv136
%18 = load i32, ptr %arrayidx43, align 4, !tbaa !10
%cmp45.not = icmp ne i32 %18, -1
%spec.select118 = zext i1 %cmp45.not to i32
%right51 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv136, i32 1
%19 = load i32, ptr %right51, align 4, !tbaa !11
%cmp52.not = icmp eq i32 %19, -1
%inc54 = select i1 %cmp45.not, i32 2, i32 1
%deg.1 = select i1 %cmp52.not, i32 %spec.select118, i32 %inc54
%par58 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv136, i32 2
%20 = load i32, ptr %par58, align 4, !tbaa !12
%cmp.i = icmp eq i32 %20, -1
br i1 %cmp.i, label %sibling.exit, label %if.end.i
if.end.i: ; preds = %for.body41
%idxprom4.i = sext i32 %20 to i64
%arrayidx5.i = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom4.i
%21 = load i32, ptr %arrayidx5.i, align 4, !tbaa !10
%22 = zext i32 %21 to i64
%cmp6.not.i = icmp eq i64 %indvars.iv136, %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
%right.i = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %idxprom4.i, i32 1
%23 = load i32, ptr %right.i, align 4, !tbaa !11
%24 = zext i32 %23 to i64
%cmp27.not.i = icmp eq i64 %indvars.iv136, %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.body41, %if.end.i, %if.end21.i
%retval.0.i = phi i32 [ -1, %for.body41 ], [ %21, %if.end.i ], [ %spec.select.i, %if.end21.i ]
%dep62 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv136, i32 3
%25 = load i32, ptr %dep62, align 4, !tbaa !5
%hei65 = getelementptr inbounds [100000 x %struct.tree], ptr @t, i64 0, i64 %indvars.iv136, i32 4
%26 = load i32, ptr %hei65, align 4, !tbaa !14
%27 = trunc i64 %indvars.iv136 to i32
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27, i32 noundef %20, i32 noundef %retval.0.i, i32 noundef %deg.1, i32 noundef %25, i32 noundef %26)
%28 = load i32, ptr %par58, align 4, !tbaa !12
%cmp70 = icmp eq i32 %28, -1
br i1 %cmp70, label %for.inc87, label %if.else
if.else: ; preds = %sibling.exit
%29 = load i32, ptr %arrayidx43, align 4, !tbaa !10
%cmp76 = icmp eq i32 %29, -1
br i1 %cmp76, label %land.lhs.true, label %if.else83
land.lhs.true: ; preds = %if.else
%30 = load i32, ptr %right51, align 4, !tbaa !11
%cmp80 = icmp eq i32 %30, -1
br i1 %cmp80, label %for.inc87, label %if.else83
if.else83: ; preds = %land.lhs.true, %if.else
br label %for.inc87
for.inc87: ; preds = %land.lhs.true, %sibling.exit, %if.else83
%str.7.sink = phi ptr [ @str, %if.else83 ], [ @str.7, %sibling.exit ], [ @str.6, %land.lhs.true ]
%puts117 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%31 = load i32, ptr %n, align 4, !tbaa !13
%32 = sext i32 %31 to i64
%cmp40 = icmp slt i64 %indvars.iv.next137, %32
br i1 %cmp40, label %for.body41, label %for.end89, !llvm.loop !21
for.end89: ; preds = %for.inc87, %for.end37
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 %id) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 @printf(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 nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 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 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: 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 12}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !16}
|
#include <stdio.h>
#include <stdlib.h>
int max(int a, int b)
{
if (a > b)
return a;
else
return b;
}
int main(void)
{
int n, i, t, c, tmpt, tmpc = 0, maxc = 0;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d%d", &t, &c);
if (tmpc > 0)
tmpc = max(0, tmpc - t + tmpt);
tmpt = t;
tmpc += c;
maxc = max(maxc, tmpc);
}
printf("%d %d", tmpt + tmpc, maxc);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2380/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
%c = 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 %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp16)
br label %for.body
for.body: ; preds = %entry, %if.end
%maxc.020 = phi i32 [ %a.b.i15, %if.end ], [ 0, %entry ]
%tmpc.019 = phi i32 [ %add4, %if.end ], [ 0, %entry ]
%tmpt.018 = phi i32 [ %.pre, %if.end ], [ undef, %entry ]
%i.017 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %c)
%cmp2 = icmp sgt i32 %tmpc.019, 0
%.pre = load i32, ptr %t, align 4, !tbaa !5
br i1 %cmp2, label %if.then, label %if.end
if.then: ; preds = %for.body
%sub = add i32 %tmpc.019, %tmpt.018
%add = sub i32 %sub, %.pre
%a.b.i = call i32 @llvm.smax.i32(i32 %add, i32 0)
br label %if.end
if.end: ; preds = %if.then, %for.body
%tmpc.1 = phi i32 [ %a.b.i, %if.then ], [ %tmpc.019, %for.body ]
%1 = load i32, ptr %c, align 4, !tbaa !5
%add4 = add nsw i32 %1, %tmpc.1
%a.b.i15 = call i32 @llvm.smax.i32(i32 %maxc.020, i32 %add4)
%inc = add nuw nsw i32 %i.017, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %if.end
%3 = add nsw i32 %add4, %.pre
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3, i32 noundef %a.b.i15)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
// AOJ ALDS1_7_B Binary Trees
// 2018.5.1 bal4u
#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_238042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238042/source.c"
target datalayout = "e-m:e-p270: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>
#define max(x,y) ((x>y)?x:y)
typedef struct {
int parent;
int left;
int right;
} node_t;
node_t node[100];
int n;
void printTree();
int getSibling(int);
int getDegree(int);
int getDepth(int);
int getHeight(int);
int main() {
int i;
int ID, left, right;
scanf("%d", &n);
for (i = 0; i < n; i++) node[i].left = node[i].right = node[i].parent = -1;
for (i = 0; i < n; i++) {
scanf("%d %d %d", &ID, &left, &right);
node[ID].left = left;
node[ID].right = right;
if (left != -1) node[left].parent = ID;
if (right != -1) node[right].parent = ID;
}
printTree();
}
void printTree() {
int i;
for (i = 0; i < n; i++) {
printf("node %d: parent = %d, ", i, node[i].parent);
printf("sibling = %d, ", getSibling(i));
printf("degree = %d, ", getDegree(i));
printf("depth = %d, ", getDepth(i));
printf("height = %d, ", getHeight(i));
if (node[i].parent == -1) printf("root");
else if (node[i].left == -1 && node[i].right == -1) printf("leaf");
else printf("internal node");
printf("\n");
}
}
int getSibling(int ID) {
if (node[ID].parent != -1 && node[node[ID].parent].right != ID) return node[node[ID].parent].right;
if (node[ID].parent != -1 && node[node[ID].parent].left != ID) return node[node[ID].parent].left;
return -1;
}
int getDegree(int ID) {
int count = 0;
if (node[ID].right != -1) count++;
if (node[ID].left != -1) count++;
return count;
}
int getDepth(int ID) {
int depth = 0;
while (node[ID].parent != -1) {
depth++;
ID = node[ID].parent;
}
return depth;
}
int getHeight(int ID) {
if (ID == -1) return -1;
return 1 + max(getHeight(node[ID].left), getHeight(node[ID].right));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238086/source.c"
target datalayout = "e-m:e-p270: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_t = 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
@node = dso_local local_unnamed_addr global [100 x %struct.node_t] 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 [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 [14 x i8] c"degree = %d, \00", align 1
@.str.5 = private unnamed_addr constant [13 x i8] c"depth = %d, \00", align 1
@.str.6 = private unnamed_addr constant [14 x i8] c"height = %d, \00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c"root\00", align 1
@.str.8 = private unnamed_addr constant [5 x i8] c"leaf\00", align 1
@.str.9 = private unnamed_addr constant [14 x i8] c"internal node\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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 %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 = tail 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.body9.preheader, label %for.end29
for.body9.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 @node, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.inc27
%i.140 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ]
%call10 = 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 %left, align 4, !tbaa !5
%4 = load i32, ptr %ID, align 4, !tbaa !5
%idxprom11 = sext i32 %4 to i64
%left13 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom11, i32 1
store i32 %3, ptr %left13, align 4, !tbaa !9
%5 = load i32, ptr %right, align 4, !tbaa !5
%right16 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom11, i32 2
store i32 %5, ptr %right16, align 4, !tbaa !11
%cmp17.not = icmp eq i32 %3, -1
br i1 %cmp17.not, label %if.end, label %if.then
if.then: ; preds = %for.body9
%idxprom18 = sext i32 %3 to i64
%arrayidx19 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom18
store i32 %4, ptr %arrayidx19, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %if.then, %for.body9
%cmp21.not = icmp eq i32 %5, -1
br i1 %cmp21.not, label %for.inc27, label %if.then22
if.then22: ; preds = %if.end
%idxprom23 = sext i32 %5 to i64
%arrayidx24 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom23
store i32 %4, ptr %arrayidx24, align 4, !tbaa !12
br label %for.inc27
for.inc27: ; preds = %if.end, %if.then22
%inc28 = add nuw nsw i32 %i.140, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc28, %6
br i1 %cmp8, label %for.body9, label %for.end29, !llvm.loop !13
for.end29: ; preds = %for.inc27, %entry
call void @printTree()
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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printTree() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %0, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end24
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end24 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !12
%2 = trunc i64 %indvars.iv to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %2, i32 noundef %1)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.not.i = icmp eq i32 %3, -1
br i1 %cmp.not.i, label %if.end31.i, label %land.lhs.true.i
land.lhs.true.i: ; preds = %for.body
%idxprom4.i = sext i32 %3 to i64
%right.i = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom4.i, i32 2
%4 = load i32, ptr %right.i, align 4, !tbaa !11
%5 = zext i32 %4 to i64
%cmp6.not.i = icmp eq i64 %indvars.iv, %5
br i1 %cmp6.not.i, label %land.lhs.true17.i, label %getSibling.exit
land.lhs.true17.i: ; preds = %land.lhs.true.i
%left.i = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom4.i, i32 1
%6 = load i32, ptr %left.i, align 4, !tbaa !9
%7 = zext i32 %6 to i64
%cmp23.not.i = icmp eq i64 %indvars.iv, %7
br i1 %cmp23.not.i, label %if.end31.i, label %getSibling.exit
if.end31.i: ; preds = %land.lhs.true17.i, %for.body
br label %getSibling.exit
getSibling.exit: ; preds = %land.lhs.true.i, %land.lhs.true17.i, %if.end31.i
%retval.0.i = phi i32 [ -1, %if.end31.i ], [ %4, %land.lhs.true.i ], [ %6, %land.lhs.true17.i ]
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %retval.0.i)
%right.i37 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %indvars.iv, i32 2
%8 = load i32, ptr %right.i37, align 4, !tbaa !11
%cmp.not.i38 = icmp ne i32 %8, -1
%spec.select.i = zext i1 %cmp.not.i38 to i32
%left.i39 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %indvars.iv, i32 1
%9 = load i32, ptr %left.i39, align 4, !tbaa !9
%cmp3.not.i = icmp eq i32 %9, -1
%inc5.i = select i1 %cmp.not.i38, i32 2, i32 1
%count.1.i = select i1 %cmp3.not.i, i32 %spec.select.i, i32 %inc5.i
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %count.1.i)
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %getSibling.exit
%ID.addr.0.i = phi i32 [ %2, %getSibling.exit ], [ %10, %while.cond.i ]
%depth.0.i = phi i32 [ 0, %getSibling.exit ], [ %inc.i, %while.cond.i ]
%idxprom.i40 = sext i32 %ID.addr.0.i to i64
%arrayidx.i41 = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom.i40
%10 = load i32, ptr %arrayidx.i41, align 4, !tbaa !12
%cmp.not.i42 = icmp eq i32 %10, -1
%inc.i = add nuw nsw i32 %depth.0.i, 1
br i1 %cmp.not.i42, label %getDepth.exit, label %while.cond.i, !llvm.loop !15
getDepth.exit: ; preds = %while.cond.i
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %depth.0.i)
%call7 = tail call i32 @getHeight(i32 noundef %2)
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %call7)
%11 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp12 = icmp eq i32 %11, -1
br i1 %cmp12, label %if.end24, label %if.else
if.else: ; preds = %getDepth.exit
%12 = load i32, ptr %left.i39, align 4, !tbaa !9
%cmp16 = icmp eq i32 %12, -1
br i1 %cmp16, label %land.lhs.true, label %if.else22
land.lhs.true: ; preds = %if.else
%13 = load i32, ptr %right.i37, align 4, !tbaa !11
%cmp19 = icmp eq i32 %13, -1
br i1 %cmp19, label %if.end24, label %if.else22
if.else22: ; preds = %land.lhs.true, %if.else
br label %if.end24
if.end24: ; preds = %land.lhs.true, %getDepth.exit, %if.else22
%.str.8.sink = phi ptr [ @.str.9, %if.else22 ], [ @.str.7, %getDepth.exit ], [ @.str.8, %land.lhs.true ]
%call21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.8.sink)
%putchar = tail call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%14 = load i32, ptr @n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %if.end24, %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 @getSibling(i32 noundef %ID) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %ID to i64
%arrayidx = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end31, label %land.lhs.true
land.lhs.true: ; preds = %entry
%idxprom4 = sext i32 %0 to i64
%right = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom4, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%cmp6.not = icmp eq i32 %1, %ID
br i1 %cmp6.not, label %land.lhs.true17, label %return
land.lhs.true17: ; preds = %land.lhs.true
%left = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom4, i32 1
%2 = load i32, ptr %left, align 4, !tbaa !9
%cmp23.not = icmp eq i32 %2, %ID
br i1 %cmp23.not, label %if.end31, label %return
if.end31: ; preds = %entry, %land.lhs.true17
br label %return
return: ; preds = %land.lhs.true17, %land.lhs.true, %if.end31
%retval.0 = phi i32 [ -1, %if.end31 ], [ %1, %land.lhs.true ], [ %2, %land.lhs.true17 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getDegree(i32 noundef %ID) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %ID to i64
%right = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom, i32 2
%0 = load i32, ptr %right, align 4, !tbaa !11
%cmp.not = icmp ne i32 %0, -1
%spec.select = zext i1 %cmp.not to i32
%left = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !9
%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 @getDepth(i32 noundef %ID) local_unnamed_addr #4 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%ID.addr.0 = phi i32 [ %ID, %entry ], [ %0, %while.cond ]
%depth.0 = phi i32 [ 0, %entry ], [ %inc, %while.cond ]
%idxprom = sext i32 %ID.addr.0 to i64
%arrayidx = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !12
%cmp.not = icmp eq i32 %0, -1
%inc = add nuw nsw i32 %depth.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !15
while.end: ; preds = %while.cond
ret i32 %depth.0
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getHeight(i32 noundef %ID) local_unnamed_addr #5 {
entry:
%cmp = icmp eq i32 %ID, -1
br i1 %cmp, label %common.ret17, label %if.end
common.ret17: ; preds = %entry, %if.end
%common.ret17.op = phi i32 [ %add, %if.end ], [ -1, %entry ]
ret i32 %common.ret17.op
if.end: ; preds = %entry
%idxprom = sext i32 %ID to i64
%left = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !9
%call = tail call i32 @getHeight(i32 noundef %0)
%right = getelementptr inbounds [100 x %struct.node_t], ptr @node, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %right, align 4, !tbaa !11
%call3 = tail call i32 @getHeight(i32 noundef %1)
%spec.select = tail call i32 @llvm.smax.i32(i32 %call, i32 %call3)
%add = add nsw i32 %spec.select, 1
br label %common.ret17
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 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 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 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, !14}
|
#include<stdio.h>
#define NIL -1
struct Node_struct{int p, l, r, s, d;};
typedef struct Node_struct Node;
Node T[25];
int D[25];
int H[25];
void print(int u){
int i, c;
printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", u, T[u].p, T[u].s, T[u].d+1, D[u], 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");
}
void calcDepth(int u, int p){
D[u] = p;
if(T[u].l != NIL) calcDepth(T[u].l,p+1);
if(T[u].r != NIL) calcDepth(T[u].r,p+1);
}
void calcHeight(int u){
if(T[u].d == NIL) H[u] = 0;
else{
if(T[u].l != NIL) calcHeight(T[u].l);if(T[u].r != NIL) calcHeight(T[u].r);
H[u] = H[T[u].l]+1;
if( H[T[u].l] < H[T[u].r]) H[u] = H[T[u].r]+1;
}
}
int main(){
int i, j;
int n;
int id,l,r;
int root = NIL;
scanf("%d", &n);
for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = T[i].s = T[i].d = H[i] = NIL;
for(i=0; i<n; i++)
{
scanf("%d %d %d", &id, &l, &r);
if(l != -1)
{
T[id].l = l;
T[l].p = id;
T[id].d++;
if(r != -1) T[l].s = r;
}
if(r != -1)
{
T[id].r = r;
T[r].p = id;
T[id].d++;
if(l != -1) T[r].s = l;
}
}
//根を求める (find the root)
for(i=0; i<n; i++){
if(T[i].p == -1) root = i;
}
//それぞれのノードの深さを求める (find depth of each node)
calcDepth(root, 0);
calcHeight(root);
//出力 (output)
for(i=0; i<n; i++) print(i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238129/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238129/source.c"
target datalayout = "e-m:e-p270: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 }
@.str = private unnamed_addr constant [75 x i8] c"node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, \00", align 1
@T = dso_local local_unnamed_addr global [25 x %struct.Node_struct] zeroinitializer, align 16
@D = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@H = dso_local local_unnamed_addr global [25 x i32] zeroinitializer, align 16
@.str.4 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.5 = 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.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 void @print(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%s = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 3
%1 = load i32, ptr %s, align 4, !tbaa !10
%d = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 4
%2 = load i32, ptr %d, align 4, !tbaa !11
%add = add nsw i32 %2, 1
%arrayidx6 = getelementptr inbounds [25 x i32], ptr @D, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !12
%arrayidx8 = getelementptr inbounds [25 x i32], ptr @H, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %u, i32 noundef %0, i32 noundef %1, i32 noundef %add, i32 noundef %3, i32 noundef %4)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %5, -1
br i1 %cmp, label %if.end23, label %if.else
if.else: ; preds = %entry
%l = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 1
%6 = load i32, ptr %l, align 4, !tbaa !13
%cmp15 = icmp eq i32 %6, -1
br i1 %cmp15, label %land.lhs.true, label %if.else21
land.lhs.true: ; preds = %if.else
%r = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 2
%7 = load i32, ptr %r, align 4, !tbaa !14
%cmp18 = icmp eq i32 %7, -1
br i1 %cmp18, label %if.end23, label %if.else21
if.else21: ; preds = %land.lhs.true, %if.else
br label %if.end23
if.end23: ; preds = %land.lhs.true, %entry, %if.else21
%str.6.sink = phi ptr [ @str, %if.else21 ], [ @str.7, %entry ], [ @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.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @calcDepth(i32 noundef %u, i32 noundef %p) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%u.tr = phi i32 [ %u, %entry ], [ %1, %if.end ]
%p.tr = phi i32 [ %p, %entry ], [ %.pre, %if.end ]
%idxprom = sext i32 %u.tr to i64
%arrayidx = getelementptr inbounds [25 x i32], ptr @D, i64 0, i64 %idxprom
store i32 %p.tr, ptr %arrayidx, align 4, !tbaa !12
%l = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 1
%0 = load i32, ptr %l, align 4, !tbaa !13
%cmp.not = icmp eq i32 %0, -1
%.pre = add nsw i32 %p.tr, 1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @calcDepth(i32 noundef %0, i32 noundef %.pre)
br label %if.end
if.end: ; preds = %tailrecurse, %if.then
%r = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 2
%1 = load i32, ptr %r, align 4, !tbaa !14
%cmp8.not = icmp eq i32 %1, -1
br i1 %cmp8.not, label %if.end14, label %tailrecurse
if.end14: ; preds = %if.end
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @calcHeight(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%d = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 4
%0 = load i32, ptr %d, align 4, !tbaa !11
%cmp = icmp eq i32 %0, -1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%arrayidx2 = getelementptr inbounds [25 x i32], ptr @H, i64 0, i64 %idxprom
store i32 0, ptr %arrayidx2, align 4, !tbaa !12
br label %if.end46
if.else: ; preds = %entry
%l = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %l, align 4, !tbaa !13
%cmp5.not = icmp eq i32 %1, -1
br i1 %cmp5.not, label %if.end, label %if.then6
if.then6: ; preds = %if.else
tail call void @calcHeight(i32 noundef %1)
br label %if.end
if.end: ; preds = %if.then6, %if.else
%r = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom, i32 2
%2 = load i32, ptr %r, align 4, !tbaa !14
%cmp12.not = icmp eq i32 %2, -1
br i1 %cmp12.not, label %if.end17, label %if.then13
if.then13: ; preds = %if.end
tail call void @calcHeight(i32 noundef %2)
%.pre = load i32, ptr %r, align 4, !tbaa !14
%3 = sext i32 %.pre to i64
br label %if.end17
if.end17: ; preds = %if.then13, %if.end
%idxprom33 = phi i64 [ %3, %if.then13 ], [ -1, %if.end ]
%4 = load i32, ptr %l, align 4, !tbaa !13
%idxprom21 = sext i32 %4 to i64
%arrayidx22 = getelementptr inbounds [25 x i32], ptr @H, i64 0, i64 %idxprom21
%5 = load i32, ptr %arrayidx22, align 4, !tbaa !12
%add = add nsw i32 %5, 1
%arrayidx24 = getelementptr inbounds [25 x i32], ptr @H, i64 0, i64 %idxprom
store i32 %add, ptr %arrayidx24, align 4, !tbaa !12
%6 = load i32, ptr %arrayidx22, align 4, !tbaa !12
%arrayidx34 = getelementptr inbounds [25 x i32], ptr @H, i64 0, i64 %idxprom33
%7 = load i32, ptr %arrayidx34, align 4, !tbaa !12
%cmp35 = icmp slt i32 %6, %7
br i1 %cmp35, label %if.then36, label %if.end46
if.then36: ; preds = %if.end17
%add42 = add nsw i32 %7, 1
store i32 %add42, ptr %arrayidx24, align 4, !tbaa !12
br label %if.end46
if.end46: ; preds = %if.end17, %if.then36, %if.then
ret void
}
; 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
%l = alloca i32, align 4
%r = 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 %id) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !12
%cmp97 = icmp sgt i32 %0, 0
br i1 %cmp97, label %for.body15.preheader, label %for.end67
for.body15.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @H, i8 -1, i64 %2, i1 false), !tbaa !12
%3 = mul nuw nsw i64 %1, 20
call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %3, i1 false), !tbaa !12
br label %for.body15
for.cond56.preheader: ; preds = %for.inc53
%cmp57101 = icmp sgt i32 %12, 0
br i1 %cmp57101, label %for.body58.preheader, label %for.end67
for.body58.preheader: ; preds = %for.cond56.preheader
%wide.trip.count = zext i32 %12 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %12, 4
br i1 %4, label %for.end67.loopexit.unr-lcssa, label %for.body58.preheader.new
for.body58.preheader.new: ; preds = %for.body58.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body58
for.body15: ; preds = %for.body15.preheader, %for.inc53
%i.1100 = phi i32 [ %inc54, %for.inc53 ], [ 0, %for.body15.preheader ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %id, ptr noundef nonnull %l, ptr noundef nonnull %r)
%5 = load i32, ptr %l, align 4, !tbaa !12
%cmp17.not = icmp eq i32 %5, -1
br i1 %cmp17.not, label %if.end33, label %if.then
if.then: ; preds = %for.body15
%6 = load i32, ptr %id, align 4, !tbaa !12
%idxprom18 = sext i32 %6 to i64
%l20 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom18, i32 1
store i32 %5, ptr %l20, align 4, !tbaa !13
%idxprom21 = sext i32 %5 to i64
%arrayidx22 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom21
store i32 %6, ptr %arrayidx22, align 4, !tbaa !5
%d26 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom18, i32 4
%7 = load i32, ptr %d26, align 4, !tbaa !11
%inc27 = add nsw i32 %7, 1
store i32 %inc27, ptr %d26, align 4, !tbaa !11
%8 = load i32, ptr %r, align 4, !tbaa !12
%cmp28.not = icmp eq i32 %8, -1
br i1 %cmp28.not, label %for.inc53, label %if.end33.thread95
if.end33.thread95: ; preds = %if.then
%s32 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom21, i32 3
store i32 %8, ptr %s32, align 4, !tbaa !10
br label %if.then35
if.end33: ; preds = %for.body15
%.pr = load i32, ptr %r, align 4, !tbaa !12
%cmp34.not = icmp eq i32 %.pr, -1
br i1 %cmp34.not, label %for.inc53, label %if.end33.if.then35_crit_edge
if.end33.if.then35_crit_edge: ; preds = %if.end33
%.pre = load i32, ptr %id, align 4, !tbaa !12
%idxprom36.phi.trans.insert = sext i32 %.pre to i64
%d44.phi.trans.insert = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom36.phi.trans.insert, i32 4
%.pre113 = load i32, ptr %d44.phi.trans.insert, align 4, !tbaa !11
br label %if.then35
if.then35: ; preds = %if.end33.if.then35_crit_edge, %if.end33.thread95
%idxprom36.pre-phi = phi i64 [ %idxprom36.phi.trans.insert, %if.end33.if.then35_crit_edge ], [ %idxprom18, %if.end33.thread95 ]
%9 = phi i32 [ %.pre113, %if.end33.if.then35_crit_edge ], [ %inc27, %if.end33.thread95 ]
%10 = phi i32 [ %.pre, %if.end33.if.then35_crit_edge ], [ %6, %if.end33.thread95 ]
%11 = phi i32 [ %.pr, %if.end33.if.then35_crit_edge ], [ %8, %if.end33.thread95 ]
%r38 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom36.pre-phi, i32 2
store i32 %11, ptr %r38, align 4, !tbaa !14
%idxprom39 = sext i32 %11 to i64
%arrayidx40 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom39
store i32 %10, ptr %arrayidx40, align 4, !tbaa !5
%d44 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom36.pre-phi, i32 4
%inc45 = add nsw i32 %9, 1
store i32 %inc45, ptr %d44, align 4, !tbaa !11
br i1 %cmp17.not, label %for.inc53, label %if.then47
if.then47: ; preds = %if.then35
%s50 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %idxprom39, i32 3
store i32 %5, ptr %s50, align 4, !tbaa !10
br label %for.inc53
for.inc53: ; preds = %if.then, %if.end33, %if.then47, %if.then35
%inc54 = add nuw nsw i32 %i.1100, 1
%12 = load i32, ptr %n, align 4, !tbaa !12
%cmp14 = icmp slt i32 %inc54, %12
br i1 %cmp14, label %for.body15, label %for.cond56.preheader, !llvm.loop !15
for.body58: ; preds = %for.body58, %for.body58.preheader.new
%indvars.iv = phi i64 [ 0, %for.body58.preheader.new ], [ %indvars.iv.next.3, %for.body58 ]
%root.0103 = phi i32 [ -1, %for.body58.preheader.new ], [ %spec.select.3, %for.body58 ]
%niter = phi i64 [ 0, %for.body58.preheader.new ], [ %niter.next.3, %for.body58 ]
%arrayidx60 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx60, align 16, !tbaa !5
%cmp62 = icmp eq i32 %13, -1
%14 = trunc i64 %indvars.iv to i32
%spec.select = select i1 %cmp62, i32 %14, i32 %root.0103
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx60.1 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv.next
%15 = load i32, ptr %arrayidx60.1, align 4, !tbaa !5
%cmp62.1 = icmp eq i32 %15, -1
%16 = trunc i64 %indvars.iv.next to i32
%spec.select.1 = select i1 %cmp62.1, i32 %16, i32 %spec.select
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx60.2 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv.next.1
%17 = load i32, ptr %arrayidx60.2, align 8, !tbaa !5
%cmp62.2 = icmp eq i32 %17, -1
%18 = trunc i64 %indvars.iv.next.1 to i32
%spec.select.2 = select i1 %cmp62.2, i32 %18, i32 %spec.select.1
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx60.3 = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv.next.2
%19 = load i32, ptr %arrayidx60.3, align 4, !tbaa !5
%cmp62.3 = icmp eq i32 %19, -1
%20 = trunc i64 %indvars.iv.next.2 to i32
%spec.select.3 = select i1 %cmp62.3, i32 %20, 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.end67.loopexit.unr-lcssa, label %for.body58, !llvm.loop !17
for.end67.loopexit.unr-lcssa: ; preds = %for.body58, %for.body58.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %for.body58.preheader ], [ %spec.select.3, %for.body58 ]
%indvars.iv.unr = phi i64 [ 0, %for.body58.preheader ], [ %indvars.iv.next.3, %for.body58 ]
%root.0103.unr = phi i32 [ -1, %for.body58.preheader ], [ %spec.select.3, %for.body58 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end67, label %for.body58.epil
for.body58.epil: ; preds = %for.end67.loopexit.unr-lcssa, %for.body58.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body58.epil ], [ %indvars.iv.unr, %for.end67.loopexit.unr-lcssa ]
%root.0103.epil = phi i32 [ %spec.select.epil, %for.body58.epil ], [ %root.0103.unr, %for.end67.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body58.epil ], [ 0, %for.end67.loopexit.unr-lcssa ]
%arrayidx60.epil = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv.epil
%21 = load i32, ptr %arrayidx60.epil, align 4, !tbaa !5
%cmp62.epil = icmp eq i32 %21, -1
%22 = trunc i64 %indvars.iv.epil to i32
%spec.select.epil = select i1 %cmp62.epil, i32 %22, i32 %root.0103.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.end67, label %for.body58.epil, !llvm.loop !18
for.end67: ; preds = %for.end67.loopexit.unr-lcssa, %for.body58.epil, %entry, %for.cond56.preheader
%root.0.lcssa = phi i32 [ -1, %for.cond56.preheader ], [ -1, %entry ], [ %spec.select.lcssa.ph, %for.end67.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body58.epil ]
call void @calcDepth(i32 noundef %root.0.lcssa, i32 noundef 0)
call void @calcHeight(i32 noundef %root.0.lcssa)
%23 = load i32, ptr %n, align 4, !tbaa !12
%cmp69105 = icmp sgt i32 %23, 0
br i1 %cmp69105, label %for.body70, label %for.end73
for.body70: ; preds = %for.end67, %print.exit
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %print.exit ], [ 0, %for.end67 ]
%arrayidx.i = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv110
%24 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%s.i = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv110, i32 3
%25 = load i32, ptr %s.i, align 4, !tbaa !10
%d.i = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv110, i32 4
%26 = load i32, ptr %d.i, align 4, !tbaa !11
%add.i = add nsw i32 %26, 1
%arrayidx6.i = getelementptr inbounds [25 x i32], ptr @D, i64 0, i64 %indvars.iv110
%27 = load i32, ptr %arrayidx6.i, align 4, !tbaa !12
%arrayidx8.i = getelementptr inbounds [25 x i32], ptr @H, i64 0, i64 %indvars.iv110
%28 = load i32, ptr %arrayidx8.i, align 4, !tbaa !12
%29 = trunc i64 %indvars.iv110 to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %29, i32 noundef %24, i32 noundef %25, i32 noundef %add.i, i32 noundef %27, i32 noundef %28)
%30 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp.i = icmp eq i32 %30, -1
br i1 %cmp.i, label %print.exit, label %if.else.i
if.else.i: ; preds = %for.body70
%l.i = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv110, i32 1
%31 = load i32, ptr %l.i, align 4, !tbaa !13
%cmp15.i = icmp eq i32 %31, -1
br i1 %cmp15.i, label %land.lhs.true.i, label %if.else21.i
land.lhs.true.i: ; preds = %if.else.i
%r.i = getelementptr inbounds [25 x %struct.Node_struct], ptr @T, i64 0, i64 %indvars.iv110, i32 2
%32 = load i32, ptr %r.i, align 4, !tbaa !14
%cmp18.i = icmp eq i32 %32, -1
br i1 %cmp18.i, label %print.exit, label %if.else21.i
if.else21.i: ; preds = %land.lhs.true.i, %if.else.i
br label %print.exit
print.exit: ; preds = %for.body70, %land.lhs.true.i, %if.else21.i
%str.6.sink.i = phi ptr [ @str, %if.else21.i ], [ @str.7, %for.body70 ], [ @str.6, %land.lhs.true.i ]
%puts32.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink.i)
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%33 = load i32, ptr %n, align 4, !tbaa !12
%34 = sext i32 %33 to i64
%cmp69 = icmp slt i64 %indvars.iv.next111, %34
br i1 %cmp69, label %for.body70, label %for.end73, !llvm.loop !20
for.end73: ; preds = %print.exit, %for.end67
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; 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 = { 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 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"Node_struct", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!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 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !7, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !16}
|
#include<stdio.h>
#include<string.h>
int main()
{
int i,t,a=0,b=0,c,d=0,s[10]={};
scanf("%d",&t);
for(i=1;i<=t;i++){
scanf("%s %d %d",&s,&a,&b);
if(a>=2400 && b>=2400 && b>a){
c=1;
d=d+c;
}
else{
c=0;
d=d+c;
}
}
if(d>0){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23818/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23818/source.c"
target datalayout = "e-m:e-p270: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"%s %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%s = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
store i32 0, ptr %a, align 4, !tbaa !5
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 40, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %s, i8 0, i64 40, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not20 = icmp slt i32 %0, 1
br i1 %cmp.not20, label %if.else10, label %for.body
for.body: ; preds = %entry, %for.body
%d.022 = phi i32 [ %d.1, %for.body ], [ 0, %entry ]
%i.021 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %1, 2399
%2 = load i32, ptr %b, align 4
%cmp3 = icmp sgt i32 %2, 2399
%or.cond = select i1 %cmp2, i1 %cmp3, i1 false
%cmp5 = icmp sgt i32 %2, %1
%or.cond19 = select i1 %or.cond, i1 %cmp5, i1 false
%add = zext i1 %or.cond19 to i32
%d.1 = add nuw nsw i32 %d.022, %add
%inc = add nuw nsw i32 %i.021, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.021, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%4 = icmp eq i32 %d.1, 0
br i1 %4, label %if.else10, label %if.end12
if.else10: ; preds = %entry, %for.end
br label %if.end12
if.end12: ; preds = %for.end, %if.else10
%str.sink = phi ptr [ @str, %if.else10 ], [ @str.4, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %s) #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 %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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 max 10000
#define nil -1
#define min(x,y) (((x)>(y)) ?(x):(y))
struct node {int parent;int left;int right;};
struct node t[max];
int n,d[max],h[max];
void setdepth(int u,int a){
if(u==nil) return;
d[u]=a;
setdepth(t[u].left,a+1);
setdepth(t[u].right,a+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]=min(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: parent = %d, sibling = %d, ",u,t[u].parent,getsibling(u));
int deg =0;
if(t[u].left!=nil) deg++;
if(t[u].right!=nil) deg++;
printf("degree = %d, depth = %d, height = %d, ",deg,d[u],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,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;
setdepth(root,0);
setheight(root);
for(i=0;i<n;i++) print(i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238222/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238222/source.c"
target datalayout = "e-m:e-p270: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 [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
@n = dso_local global i32 0, align 4
@.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 @setdepth(i32 noundef %u, i32 noundef %a) 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
%a.tr13 = phi i32 [ %add, %if.end ], [ %a, %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 %a.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 %a.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:
%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.i = icmp eq i32 %0, -1
br i1 %cmp.i, label %getsibling.exit, label %if.end.i
if.end.i: ; preds = %entry
%idxprom4.i = sext i32 %0 to i64
%left.i = getelementptr inbounds [10000 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, %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 %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
%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 %getsibling.exit
getsibling.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 %u, i32 noundef %0, i32 noundef %retval.0.i)
%left = getelementptr inbounds [10000 x %struct.node], 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 [10000 x %struct.node], 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
%deg.1 = select i1 %cmp6.not, i32 %spec.select, i32 %inc8
%arrayidx11 = getelementptr inbounds [10000 x i32], ptr @d, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [10000 x i32], ptr @h, 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.1, i32 noundef %deg.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 = %getsibling.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, %getsibling.exit, %if.else31
%str.7.sink = phi ptr [ @str, %if.else31 ], [ @str.8, %getsibling.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:
%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.5, 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.6, 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.059 = 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.059
%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.059.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.059.epil = phi i32 [ %spec.select.epil, %for.body24.epil ], [ %root.059.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.059.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 = !{!"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, !16}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !16}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
int n;
scanf("%d", &n);
int b[n+1];
for(int i = 1;i <= n;i++){
scanf("%d", &b[i]);
}
int j;
int ans[n+1];
for(int i = n;i > 0;i--){
j = i;
while(1){
if(b[j]==j){
ans[i]=j;
break;
}else j--;
if(j==0)break;
}
if(j==0)break;
for(int k = j;k < i;k++){
b[k] = b[k+1];
}
}
if(j == 0)printf("-1\n");
else{
for(int i = 1;i <= n;i++){
printf("%d\n", ans[i]);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238273/source.c"
target datalayout = "e-m:e-p270: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
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not76 = icmp slt i32 %3, 1
br i1 %cmp.not76, label %if.end51, label %for.body
for.cond.cleanup: ; preds = %for.body
%add2 = add nsw i32 %7, 1
%4 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %4, align 16
%cmp680 = icmp sgt i32 %7, 0
br i1 %cmp680, label %while.cond.preheader.preheader, label %if.end51
while.cond.preheader.preheader: ; preds = %for.cond.cleanup
%5 = zext i32 %7 to i64
%6 = add i32 %7, 1
br label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%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.cond.cleanup, !llvm.loop !9
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.cond.cleanup22
%indvar = phi i32 [ 0, %while.cond.preheader.preheader ], [ %indvar.next, %for.cond.cleanup22 ]
%indvars.iv96 = phi i64 [ %5, %while.cond.preheader.preheader ], [ %indvars.iv.next97, %for.cond.cleanup22 ]
%9 = trunc i64 %indvars.iv96 to i32
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %if.else
%indvar112 = phi i32 [ 0, %while.cond.preheader ], [ %indvar.next113, %if.else ]
%j.1 = phi i32 [ %9, %while.cond.preheader ], [ %dec, %if.else ]
%idxprom9 = zext i32 %j.1 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %idxprom9
%10 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %10, %j.1
br i1 %cmp11, label %while.end, label %if.else
if.else: ; preds = %while.cond
%dec = add nsw i32 %j.1, -1
%cmp14 = icmp eq i32 %dec, 0
%indvar.next113 = add i32 %indvar112, 1
br i1 %cmp14, label %if.then36, label %while.cond
while.end: ; preds = %while.cond
%arrayidx13 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv96
store i32 %j.1, ptr %arrayidx13, align 4, !tbaa !5
%11 = sext i32 %j.1 to i64
%cmp2178 = icmp sgt i64 %indvars.iv96, %11
br i1 %cmp2178, label %for.body23.preheader, label %for.cond.cleanup22
for.body23.preheader: ; preds = %while.end
%12 = add i32 %indvar, %indvar112
%13 = sub i32 %6, %12
%14 = sext i32 %13 to i64
%smax117 = call i64 @llvm.smax.i64(i64 %indvars.iv96, i64 %14)
%15 = add i64 %smax117, 1
%16 = sub i64 %15, %14
%min.iters.check = icmp ult i64 %16, 20
br i1 %min.iters.check, label %for.body23.preheader119, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body23.preheader
%17 = add i32 %indvar, %indvar112
%18 = sub i32 %6, %17
%19 = sext i32 %18 to i64
%smax = call i64 @llvm.smax.i64(i64 %indvars.iv96, i64 %19)
%20 = sub i64 %smax, %19
%21 = trunc i64 %20 to i32
%22 = add i32 %18, %21
%23 = icmp slt i32 %22, %18
%24 = icmp ugt i64 %20, 4294967295
%25 = or i1 %23, %24
br i1 %25, label %for.body23.preheader119, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %16, -8
%ind.end = add i64 %n.vec, %idxprom9
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, %idxprom9
%26 = getelementptr i32, ptr %vla, i64 %offset.idx
%27 = getelementptr i32, ptr %26, i64 1
%wide.load = load <4 x i32>, ptr %27, align 4, !tbaa !5
%28 = getelementptr i32, ptr %26, i64 5
%wide.load118 = load <4 x i32>, ptr %28, align 4, !tbaa !5
%29 = getelementptr inbounds i32, ptr %vla, i64 %offset.idx
store <4 x i32> %wide.load, ptr %29, align 4, !tbaa !5
%30 = getelementptr inbounds i32, ptr %29, i64 4
store <4 x i32> %wide.load118, ptr %30, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%31 = icmp eq i64 %index.next, %n.vec
br i1 %31, 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.cond.cleanup22, label %for.body23.preheader119
for.body23.preheader119: ; preds = %vector.scevcheck, %for.body23.preheader, %middle.block
%indvars.iv93.ph = phi i64 [ %idxprom9, %vector.scevcheck ], [ %idxprom9, %for.body23.preheader ], [ %ind.end, %middle.block ]
br label %for.body23
for.cond.cleanup22: ; preds = %for.body23, %middle.block, %while.end
%indvars.iv.next97 = add i64 %indvars.iv96, -1
%cmp6 = icmp sgt i64 %indvars.iv96, 1
%indvar.next = add i32 %indvar, 1
br i1 %cmp6, label %while.cond.preheader, label %if.else38, !llvm.loop !14
for.body23: ; preds = %for.body23.preheader119, %for.body23
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.body23 ], [ %indvars.iv93.ph, %for.body23.preheader119 ]
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next94
%32 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%arrayidx28 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv93
store i32 %32, ptr %arrayidx28, align 4, !tbaa !5
%sext = shl i64 %indvars.iv.next94, 32
%33 = ashr exact i64 %sext, 32
%cmp21 = icmp slt i64 %33, %indvars.iv96
br i1 %cmp21, label %for.body23, label %for.cond.cleanup22, !llvm.loop !15
if.then36: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end51
if.else38: ; preds = %for.cond.cleanup22
%cmp41.not82 = icmp slt i32 %7, 1
br i1 %cmp41.not82, label %if.end51, label %for.body43
for.body43: ; preds = %if.else38, %for.body43
%indvars.iv99 = phi i64 [ %indvars.iv.next100, %for.body43 ], [ 1, %if.else38 ]
%arrayidx45 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv99
%34 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34)
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%35 = load i32, ptr %n, align 4, !tbaa !5
%36 = sext i32 %35 to i64
%cmp41.not.not = icmp slt i64 %indvars.iv99, %36
br i1 %cmp41.not.not, label %for.body43, label %if.end51, !llvm.loop !16
if.end51: ; preds = %for.body43, %entry, %for.cond.cleanup, %if.else38, %if.then36
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main(void)
{
int H, A, B;
int h, n;
scanf("%d%d%d", &H, &A, &B);
n = 0;
for (h = A; h <= B; h++){
if (H % h == 0){
n++;
}
}
printf("%d\n", n);
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238316/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238316/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp.not7 = icmp sgt i32 %0, %1
br i1 %cmp.not7, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%2 = load i32, ptr %H, align 4, !tbaa !5
%3 = add i32 %1, 1
%4 = sub i32 %3, %0
%xtraiter = and i32 %4, 1
%5 = icmp eq i32 %1, %0
br i1 %5, 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 %4, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%n.09 = phi i32 [ 0, %for.body.lr.ph.new ], [ %spec.select.1, %for.body ]
%h.08 = phi i32 [ %0, %for.body.lr.ph.new ], [ %inc2.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%rem = srem i32 %2, %h.08
%cmp1 = icmp eq i32 %rem, 0
%inc = zext i1 %cmp1 to i32
%spec.select = add nuw nsw i32 %n.09, %inc
%inc2 = add i32 %h.08, 1
%rem.1 = srem i32 %2, %inc2
%cmp1.1 = icmp eq i32 %rem.1, 0
%inc.1 = zext i1 %cmp1.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc.1
%inc2.1 = add i32 %h.08, 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 !9
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %spec.select.1, %for.body ]
%n.09.unr = phi i32 [ 0, %for.body.lr.ph ], [ %spec.select.1, %for.body ]
%h.08.unr = phi i32 [ %0, %for.body.lr.ph ], [ %inc2.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
%rem.epil = srem i32 %2, %h.08.unr
%cmp1.epil = icmp eq i32 %rem.epil, 0
%inc.epil = zext i1 %cmp1.epil to i32
%spec.select.epil = add nuw nsw i32 %n.09.unr, %inc.epil
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%n.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body.epil ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
// your code goes here
int i, x, j, n, temp1, temp2, neg;
char buffer[65536];
x = fread(buffer, sizeof(char), sizeof(buffer), stdin);
i=0;
n=0;
while(buffer[i]!='\n'){
n=n*10+(buffer[i]-'0');
i++;
}
i++;
j=0;
while(j<n && i<x){
while(buffer[i]!=' '){
i++;
}
i++;
temp1=0;
temp2=0;
neg=1;
if(buffer[i]=='-'){
neg=-1;
i++;
}
while(buffer[i]!=' '){
temp1=temp1*10+(buffer[i]-'0');
i++;
}
i++;
temp1 *= neg;
neg=1;
if(buffer[i]=='-'){
neg=-1;
i++;
}
while(buffer[i]!='\n' && i<x){
temp2=temp2*10+(buffer[i]-'0');
i++;
}
i++;
temp2 *= neg;
if(temp1>=2400 && temp1<temp2){
printf("YES\n");
neg=2;
break;
}
j++;
}
if(neg!=2){
printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23836/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23836/source.c"
target datalayout = "e-m:e-p270: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"YES\00", align 1
@str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%buffer = alloca [65536 x i8], align 16
call void @llvm.lifetime.start.p0(i64 65536, ptr nonnull %buffer) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call i64 @fread(ptr noundef nonnull %buffer, i64 noundef 1, i64 noundef 65536, ptr noundef %0)
%conv = trunc i64 %call to i32
%1 = load i8, ptr %buffer, align 16, !tbaa !9
%cmp.not125 = icmp eq i8 %1, 10
br i1 %cmp.not125, label %if.end88, label %while.body
while.cond7.preheader: ; preds = %while.body
%2 = trunc i64 %indvars.iv.next to i32
%3 = add nsw i32 %2, 1
%cmp8145 = icmp sgt i32 %add, 0
%cmp10146 = icmp slt i32 %3, %conv
%4 = select i1 %cmp8145, i1 %cmp10146, i1 false
br i1 %4, label %while.cond13.preheader.preheader, label %if.end88
while.cond13.preheader.preheader: ; preds = %while.cond7.preheader
%sext = shl i64 %call, 32
%5 = ashr exact i64 %sext, 32
br label %while.cond13.preheader
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%6 = phi i8 [ %7, %while.body ], [ %1, %entry ]
%n.0127 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%conv1 = sext i8 %6 to i32
%mul = mul nsw i32 %n.0127, 10
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %indvars.iv.next
%7 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp.not = icmp eq i8 %7, 10
br i1 %cmp.not, label %while.cond7.preheader, label %while.body, !llvm.loop !10
while.cond7: ; preds = %while.end72
%inc82 = add nuw nsw i32 %j.0147, 1
%i.1 = add nsw i32 %i.6.lcssa, 1
%cmp8 = icmp slt i32 %inc82, %add
%cmp10 = icmp slt i32 %i.1, %conv
%8 = select i1 %cmp8, i1 %cmp10, i1 false
br i1 %8, label %while.cond13.preheader, label %if.end88, !llvm.loop !12
while.cond13.preheader: ; preds = %while.cond13.preheader.preheader, %while.cond7
%i.1148 = phi i32 [ %i.1, %while.cond7 ], [ %3, %while.cond13.preheader.preheader ]
%j.0147 = phi i32 [ %inc82, %while.cond7 ], [ 0, %while.cond13.preheader.preheader ]
%9 = sext i32 %i.1148 to i64
br label %while.cond13
while.cond13: ; preds = %while.cond13, %while.cond13.preheader
%indvars.iv149 = phi i64 [ %indvars.iv.next150, %while.cond13 ], [ %9, %while.cond13.preheader ]
%arrayidx15 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %indvars.iv149
%10 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%cmp17.not = icmp eq i8 %10, 32
%indvars.iv.next150 = add i64 %indvars.iv149, 1
br i1 %cmp17.not, label %while.end21, label %while.cond13, !llvm.loop !13
while.end21: ; preds = %while.cond13
%11 = trunc i64 %indvars.iv149 to i32
%inc22 = add nsw i32 %11, 1
%idxprom23 = sext i32 %inc22 to i64
%arrayidx24 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %idxprom23
%12 = load i8, ptr %arrayidx24, align 1, !tbaa !9
%cmp26 = icmp eq i8 %12, 45
%inc28 = add nsw i32 %11, 2
%spec.select = select i1 %cmp26, i32 %inc28, i32 %inc22
%idxprom30129 = sext i32 %spec.select to i64
%arrayidx31130 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %idxprom30129
%13 = load i8, ptr %arrayidx31130, align 1, !tbaa !9
%cmp33.not131 = icmp eq i8 %13, 32
br i1 %cmp33.not131, label %while.end43, label %while.body35
while.body35: ; preds = %while.end21, %while.body35
%indvars.iv152 = phi i64 [ %indvars.iv.next153, %while.body35 ], [ %idxprom30129, %while.end21 ]
%14 = phi i8 [ %15, %while.body35 ], [ %13, %while.end21 ]
%temp1.0133 = phi i32 [ %add41, %while.body35 ], [ 0, %while.end21 ]
%conv32 = sext i8 %14 to i32
%mul36 = mul nsw i32 %temp1.0133, 10
%sub40 = add i32 %mul36, -48
%add41 = add i32 %sub40, %conv32
%indvars.iv.next153 = add i64 %indvars.iv152, 1
%arrayidx31 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %indvars.iv.next153
%15 = load i8, ptr %arrayidx31, align 1, !tbaa !9
%cmp33.not = icmp eq i8 %15, 32
br i1 %cmp33.not, label %while.end43.loopexit, label %while.body35, !llvm.loop !14
while.end43.loopexit: ; preds = %while.body35
%16 = trunc i64 %indvars.iv.next153 to i32
br label %while.end43
while.end43: ; preds = %while.end43.loopexit, %while.end21
%i.4.lcssa = phi i32 [ %spec.select, %while.end21 ], [ %16, %while.end43.loopexit ]
%temp1.0.lcssa = phi i32 [ 0, %while.end21 ], [ %add41, %while.end43.loopexit ]
%inc44 = add nsw i32 %i.4.lcssa, 1
%17 = sub nsw i32 0, %temp1.0.lcssa
%mul45 = select i1 %cmp26, i32 %17, i32 %temp1.0.lcssa
%idxprom46 = sext i32 %inc44 to i64
%arrayidx47 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %idxprom46
%18 = load i8, ptr %arrayidx47, align 1, !tbaa !9
%cmp49 = icmp eq i8 %18, 45
%inc52 = add nsw i32 %i.4.lcssa, 2
%spec.select121 = select i1 %cmp49, i32 %inc52, i32 %inc44
%idxprom55136 = sext i32 %spec.select121 to i64
%arrayidx56137 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %idxprom55136
%19 = load i8, ptr %arrayidx56137, align 1, !tbaa !9
%cmp58138 = icmp ne i8 %19, 10
%cmp61139 = icmp slt i32 %spec.select121, %conv
%20 = and i1 %cmp61139, %cmp58138
br i1 %20, label %while.body64, label %while.end72
while.body64: ; preds = %while.end43, %while.body64
%indvars.iv154 = phi i64 [ %indvars.iv.next155, %while.body64 ], [ %idxprom55136, %while.end43 ]
%21 = phi i8 [ %22, %while.body64 ], [ %19, %while.end43 ]
%temp2.0141 = phi i32 [ %add70, %while.body64 ], [ 0, %while.end43 ]
%conv57 = sext i8 %21 to i32
%mul65 = mul nsw i32 %temp2.0141, 10
%sub69 = add i32 %mul65, -48
%add70 = add i32 %sub69, %conv57
%indvars.iv.next155 = add nsw i64 %indvars.iv154, 1
%arrayidx56 = getelementptr inbounds [65536 x i8], ptr %buffer, i64 0, i64 %indvars.iv.next155
%22 = load i8, ptr %arrayidx56, align 1, !tbaa !9
%cmp58 = icmp ne i8 %22, 10
%cmp61 = icmp slt i64 %indvars.iv.next155, %5
%23 = and i1 %cmp61, %cmp58
br i1 %23, label %while.body64, label %while.end72.loopexit, !llvm.loop !15
while.end72.loopexit: ; preds = %while.body64
%24 = trunc i64 %indvars.iv.next155 to i32
br label %while.end72
while.end72: ; preds = %while.end72.loopexit, %while.end43
%i.6.lcssa = phi i32 [ %spec.select121, %while.end43 ], [ %24, %while.end72.loopexit ]
%temp2.0.lcssa = phi i32 [ 0, %while.end43 ], [ %add70, %while.end72.loopexit ]
%cmp75 = icmp sgt i32 %mul45, 2399
%25 = sub nsw i32 0, %temp2.0.lcssa
%mul74 = select i1 %cmp49, i32 %25, i32 %temp2.0.lcssa
%cmp77 = icmp slt i32 %mul45, %mul74
%or.cond = select i1 %cmp75, i1 %cmp77, i1 false
br i1 %or.cond, label %if.end88, label %while.cond7
if.end88: ; preds = %while.cond7, %while.end72, %while.cond7.preheader, %entry
%str.sink = phi ptr [ @str.2, %entry ], [ @str.2, %while.cond7.preheader ], [ @str, %while.end72 ], [ @str.2, %while.cond7 ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 65536, ptr nonnull %buffer) #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 i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
|
#include<stdio.h>
int nei[200005], dist[200005], q[600005], qs, qe, n;
int main(){
int i, j;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", nei+i);
nei[i]--;
dist[i] = n+1;
}
qs = 0;
qe = 1;
q[0] = 0;
dist[0] = 0;
while(qe>qs){
i = q[qs++];
j = i-1;
if(j>=0 && j<n && dist[i]+1<dist[j]){
dist[j] = dist[i]+1;
q[qe++] = j;
}
j = i+1;
if(j>=0 && j<n && dist[i]+1<dist[j]){
dist[j] = dist[i]+1;
q[qe++] = j;
}
j = nei[i];
if(j>=0 && j<n && dist[i]+1<dist[j]){
dist[j] = dist[i]+1;
q[qe++] = j;
}
}
for(i=0;i<n;i++)
printf("%d ", dist[i]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@nei = dso_local global [200005 x i32] zeroinitializer, align 16
@dist = dso_local local_unnamed_addr global [200005 x i32] zeroinitializer, align 16
@qs = dso_local local_unnamed_addr global i32 0, align 4
@qe = dso_local local_unnamed_addr global i32 0, align 4
@q = dso_local local_unnamed_addr global [600005 x i32] zeroinitializer, align 16
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4
%cmp111 = icmp sgt i32 %0, 0
br i1 %cmp111, label %for.body, label %while.body.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr @nei, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%1 = load i32, ptr %add.ptr, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %add.ptr, align 4, !tbaa !5
%2 = load i32, ptr @n, align 4
%add = add nsw i32 %2, 1
%arrayidx3 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %indvars.iv
store i32 %add, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %while.body.preheader, !llvm.loop !9
while.body.preheader: ; preds = %for.body, %entry
%4 = phi i32 [ %0, %entry ], [ %2, %for.body ]
store i32 0, ptr @qs, align 4, !tbaa !5
store i32 1, ptr @qe, align 4, !tbaa !5
store i32 0, ptr @q, align 16, !tbaa !5
store i32 0, ptr @dist, align 16, !tbaa !5
br label %while.body
for.cond68.preheader: ; preds = %if.end67
%5 = trunc i64 %indvars.iv.next126 to i32
store i32 %5, ptr @qs, align 4, !tbaa !5
%cmp69121 = icmp sgt i32 %4, 0
br i1 %cmp69121, label %for.body70, label %for.end76
while.body: ; preds = %while.body.preheader, %if.end67
%indvars.iv125 = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next126, %if.end67 ]
%inc64114120 = phi i32 [ 1, %while.body.preheader ], [ %inc64115, %if.end67 ]
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%arrayidx7 = getelementptr inbounds [600005 x i32], ptr @q, i64 0, i64 %indvars.iv125
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp8 = icmp slt i32 %6, 1
%cmp9.not = icmp sgt i32 %6, %4
%or.cond = or i1 %cmp8, %cmp9.not
br i1 %or.cond, label %if.end, label %land.lhs.true10
land.lhs.true10: ; preds = %while.body
%idxprom11 = zext i32 %6 to i64
%arrayidx12 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %idxprom11
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%add13 = add nsw i32 %7, 1
%idxprom14 = zext i32 %sub to i64
%arrayidx15 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %idxprom14
%8 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp slt i32 %add13, %8
br i1 %cmp16, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true10
store i32 %add13, ptr %arrayidx15, align 4, !tbaa !5
%inc22 = add nsw i32 %inc64114120, 1
store i32 %inc22, ptr @qe, align 4, !tbaa !5
%idxprom23 = sext i32 %inc64114120 to i64
%arrayidx24 = getelementptr inbounds [600005 x i32], ptr @q, i64 0, i64 %idxprom23
store i32 %sub, ptr %arrayidx24, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true10, %while.body
%inc64113 = phi i32 [ %inc22, %if.then ], [ %inc64114120, %land.lhs.true10 ], [ %inc64114120, %while.body ]
%add25 = add nsw i32 %6, 1
%cmp26 = icmp sgt i32 %6, -2
%cmp28 = icmp slt i32 %add25, %4
%or.cond109 = select i1 %cmp26, i1 %cmp28, i1 false
%idxprom30 = sext i32 %6 to i64
br i1 %or.cond109, label %land.lhs.true29, label %if.end45
land.lhs.true29: ; preds = %if.end
%arrayidx31 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %idxprom30
%9 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%add32 = add nsw i32 %9, 1
%idxprom33 = zext i32 %add25 to i64
%arrayidx34 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %idxprom33
%10 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%cmp35 = icmp slt i32 %add32, %10
br i1 %cmp35, label %if.then36, label %if.end45
if.then36: ; preds = %land.lhs.true29
store i32 %add32, ptr %arrayidx34, align 4, !tbaa !5
%inc42 = add nsw i32 %inc64113, 1
store i32 %inc42, ptr @qe, align 4, !tbaa !5
%idxprom43 = sext i32 %inc64113 to i64
%arrayidx44 = getelementptr inbounds [600005 x i32], ptr @q, i64 0, i64 %idxprom43
store i32 %add25, ptr %arrayidx44, align 4, !tbaa !5
br label %if.end45
if.end45: ; preds = %if.end, %if.then36, %land.lhs.true29
%inc64116 = phi i32 [ %inc42, %if.then36 ], [ %inc64113, %land.lhs.true29 ], [ %inc64113, %if.end ]
%arrayidx47 = getelementptr inbounds [200005 x i32], ptr @nei, i64 0, i64 %idxprom30
%11 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%cmp48 = icmp sgt i32 %11, -1
%cmp50 = icmp slt i32 %11, %4
%or.cond110 = and i1 %cmp48, %cmp50
br i1 %or.cond110, label %land.lhs.true51, label %if.end67
land.lhs.true51: ; preds = %if.end45
%arrayidx53 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %idxprom30
%12 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%add54 = add nsw i32 %12, 1
%idxprom55 = zext i32 %11 to i64
%arrayidx56 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %idxprom55
%13 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%cmp57 = icmp slt i32 %add54, %13
br i1 %cmp57, label %if.then58, label %if.end67
if.then58: ; preds = %land.lhs.true51
store i32 %add54, ptr %arrayidx56, align 4, !tbaa !5
%inc64 = add nsw i32 %inc64116, 1
store i32 %inc64, ptr @qe, align 4, !tbaa !5
%idxprom65 = sext i32 %inc64116 to i64
%arrayidx66 = getelementptr inbounds [600005 x i32], ptr @q, i64 0, i64 %idxprom65
store i32 %11, ptr %arrayidx66, align 4, !tbaa !5
br label %if.end67
if.end67: ; preds = %if.then58, %land.lhs.true51, %if.end45
%inc64115 = phi i32 [ %inc64, %if.then58 ], [ %inc64116, %land.lhs.true51 ], [ %inc64116, %if.end45 ]
%14 = sext i32 %inc64115 to i64
%cmp4 = icmp slt i64 %indvars.iv.next126, %14
br i1 %cmp4, label %while.body, label %for.cond68.preheader, !llvm.loop !11
for.body70: ; preds = %for.cond68.preheader, %for.body70
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.body70 ], [ 0, %for.cond68.preheader ]
%arrayidx72 = getelementptr inbounds [200005 x i32], ptr @dist, i64 0, i64 %indvars.iv128
%15 = load i32, ptr %arrayidx72, align 4, !tbaa !5
%call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
%16 = load i32, ptr @n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp69 = icmp slt i64 %indvars.iv.next129, %17
br i1 %cmp69, label %for.body70, label %for.end76, !llvm.loop !12
for.end76: ; preds = %for.body70, %for.cond68.preheader
%putchar = tail call i32 @putchar(i32 10)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h> // printf(), fgets()
#include <stdlib.h> // qsort()
#define N 5
int
cmp_func(const void *l_, const void *r_)
{
const int* l = (const int*) l_;
const int* r = (const int*) r_;
if (*l > *r)
return -1;
if (*l < *r)
return 1;
return 0;
}
int
main(int argc, char** argv)
{
int a[N];
int i;
for (i = 0; i < N; ++i)
scanf("%d", &a[i]);
qsort(a, N, sizeof(int), cmp_func);
for (i = 0; i < N; ++i)
printf("%d%c", a[i], (i != N - 1) ? ' ' : '\n');
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238460/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238460/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_func(ptr nocapture noundef readonly %l_, ptr nocapture noundef readonly %r_) #0 {
entry:
%0 = load i32, ptr %l_, align 4, !tbaa !5
%1 = load i32, ptr %r_, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp slt i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%a = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %a) #5
%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)
call void @qsort(ptr noundef nonnull %a, i64 noundef 5, i64 noundef 4, ptr noundef nonnull @cmp_func) #5
%0 = load i32, ptr %a, align 16, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0, i32 noundef 32)
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%call7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef 32)
%2 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%call7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef 32)
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%call7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3, i32 noundef 32)
%4 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%call7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4, i32 noundef 10)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, 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 = { 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 #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>
#define max(a,b) ((a)>(b)?(a):(b))
int arr[1010];
int main() {
int m, n, i, j;
scanf("%d", &n);
for (i = 1; i <= n; i++) scanf("%d", &arr[i]);
int maxn = 0;
int cur = 0;
arr[0] = 0, arr[n + 1] = 1001;
n++;
cur = 1;
for (i = 1; i <= n; i++) {
if (arr[i] == arr[i - 1] + 1) cur++;
else {
cur = 1;
continue;
}
if (maxn < cur) maxn = cur;
}
maxn -= 2;
printf("%d\n", max(0, maxn));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23854/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23854/source.c"
target datalayout = "e-m:e-p270: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
@arr = dso_local global [1010 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() 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.not35 = icmp slt i32 %0, 1
br i1 %cmp.not35, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1010 x i32], ptr @arr, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 0, ptr @arr, align 16, !tbaa !5
%add = add nsw i32 %.lcssa, 1
%idxprom2 = sext i32 %add to i64
%arrayidx3 = getelementptr inbounds [1010 x i32], ptr @arr, i64 0, i64 %idxprom2
store i32 1001, ptr %arrayidx3, align 4, !tbaa !5
store i32 %add, ptr %n, align 4, !tbaa !5
%cmp6.not37 = icmp slt i32 %.lcssa, 0
br i1 %cmp6.not37, label %for.end20, label %for.body7.preheader
for.body7.preheader: ; preds = %for.end
%.pre = load i32, ptr @arr, align 16, !tbaa !5
%3 = add nuw i32 %.lcssa, 1
%4 = zext i32 %3 to i64
%xtraiter = and i64 %4, 1
%5 = icmp eq i32 %.lcssa, 0
br i1 %5, label %for.end20.loopexit.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %4, 4294967294
br label %for.body7
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%6 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %8, %for.body7 ]
%indvars.iv44 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next45.1, %for.body7 ]
%cur.040 = phi i32 [ 1, %for.body7.preheader.new ], [ %cur.1.1, %for.body7 ]
%maxn.039 = phi i32 [ 0, %for.body7.preheader.new ], [ %maxn.1.1, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ]
%arrayidx9 = getelementptr inbounds [1010 x i32], ptr @arr, i64 0, i64 %indvars.iv44
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add12 = add nsw i32 %6, 1
%cmp13 = icmp eq i32 %7, %add12
%inc14 = add nsw i32 %cur.040, 1
%cmp15.not = icmp sgt i32 %maxn.039, %cur.040
%spec.select = select i1 %cmp15.not, i32 %maxn.039, i32 %inc14
%maxn.1 = select i1 %cmp13, i32 %spec.select, i32 %maxn.039
%cur.1 = select i1 %cmp13, i32 %inc14, i32 1
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%arrayidx9.1 = getelementptr inbounds [1010 x i32], ptr @arr, i64 0, i64 %indvars.iv.next45
%8 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%add12.1 = add nsw i32 %7, 1
%cmp13.1 = icmp eq i32 %8, %add12.1
%inc14.1 = add nsw i32 %cur.1, 1
%cmp15.not.1 = icmp sgt i32 %maxn.1, %cur.1
%spec.select.1 = select i1 %cmp15.not.1, i32 %maxn.1, i32 %inc14.1
%maxn.1.1 = select i1 %cmp13.1, i32 %spec.select.1, i32 %maxn.1
%cur.1.1 = select i1 %cmp13.1, i32 %inc14.1, i32 1
%indvars.iv.next45.1 = add nuw nsw i64 %indvars.iv44, 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.end20.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11
for.end20.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%maxn.1.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %maxn.1.1, %for.body7 ]
%.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %8, %for.body7 ]
%indvars.iv44.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next45.1, %for.body7 ]
%cur.040.unr = phi i32 [ 1, %for.body7.preheader ], [ %cur.1.1, %for.body7 ]
%maxn.039.unr = phi i32 [ 0, %for.body7.preheader ], [ %maxn.1.1, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.body7.epil
for.body7.epil: ; preds = %for.end20.loopexit.unr-lcssa
%arrayidx9.epil = getelementptr inbounds [1010 x i32], ptr @arr, i64 0, i64 %indvars.iv44.unr
%9 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
%add12.epil = add nsw i32 %.unr, 1
%cmp13.epil = icmp eq i32 %9, %add12.epil
%inc14.epil = add nsw i32 %cur.040.unr, 1
%cmp15.not.epil = icmp sgt i32 %maxn.039.unr, %cur.040.unr
%spec.select.epil = select i1 %cmp15.not.epil, i32 %maxn.039.unr, i32 %inc14.epil
%maxn.1.epil = select i1 %cmp13.epil, i32 %spec.select.epil, i32 %maxn.039.unr
br label %for.end20
for.end20: ; preds = %for.body7.epil, %for.end20.loopexit.unr-lcssa, %for.end
%maxn.0.lcssa = phi i32 [ 0, %for.end ], [ %maxn.1.lcssa.ph, %for.end20.loopexit.unr-lcssa ], [ %maxn.1.epil, %for.body7.epil ]
%10 = call i32 @llvm.smax.i32(i32 %maxn.0.lcssa, i32 2)
%cond = add nsw i32 %10, -2
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int in[5], i, j, swap;
for (i = 0; i < 5; i++) {
scanf("%d", &in[i]);
}
for (i = 0; i < 5; i++) {
for (j = 0; j < 5; j++) {
if (in[i] > in[j]) {
swap = in[i];
in[i] = in[j];
in[j] = swap;
}
}
}
for (i = 0; i < 4; i++) {
printf("%d ", in[i]);
}
printf("%d\n", in[4]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238626/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238626/source.c"
target datalayout = "e-m:e-p270: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.inc20:
%in = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %in) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %in, 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 %in, 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 %in, 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 %in, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%0 = load i32, ptr %in, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp11.1 = icmp sgt i32 %0, %1
br i1 %cmp11.1, label %if.then.1, label %for.inc20.1
if.then.1: ; preds = %for.inc20
store i32 %1, ptr %in, align 16, !tbaa !5
store i32 %0, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.inc20
%2 = phi i32 [ %0, %if.then.1 ], [ %1, %for.inc20 ]
%3 = phi i32 [ %1, %if.then.1 ], [ %0, %for.inc20 ]
%4 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp11.2 = icmp sgt i32 %3, %4
br i1 %cmp11.2, label %if.then.2, label %for.inc20.2
if.then.2: ; preds = %for.inc20.1
store i32 %4, ptr %in, align 16, !tbaa !5
store i32 %3, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.2
for.inc20.2: ; preds = %if.then.2, %for.inc20.1
%5 = phi i32 [ %3, %if.then.2 ], [ %4, %for.inc20.1 ]
%6 = phi i32 [ %4, %if.then.2 ], [ %3, %for.inc20.1 ]
%7 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp11.3 = icmp sgt i32 %6, %7
br i1 %cmp11.3, label %if.then.3, label %for.inc20.3
if.then.3: ; preds = %for.inc20.2
store i32 %7, ptr %in, align 16, !tbaa !5
store i32 %6, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.3
for.inc20.3: ; preds = %if.then.3, %for.inc20.2
%8 = phi i32 [ %6, %if.then.3 ], [ %7, %for.inc20.2 ]
%9 = phi i32 [ %7, %if.then.3 ], [ %6, %for.inc20.2 ]
%10 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%cmp11.4 = icmp sgt i32 %9, %10
br i1 %cmp11.4, label %if.then.4, label %for.inc20.4
if.then.4: ; preds = %for.inc20.3
store i32 %10, ptr %in, align 16, !tbaa !5
store i32 %9, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc20.4
for.inc20.4: ; preds = %if.then.4, %for.inc20.3
%11 = phi i32 [ %9, %if.then.4 ], [ %10, %for.inc20.3 ]
%12 = phi i32 [ %10, %if.then.4 ], [ %9, %for.inc20.3 ]
%cmp11.159 = icmp sgt i32 %2, %12
br i1 %cmp11.159, label %if.then.160, label %for.inc20.1.1
if.then.160: ; preds = %for.inc20.4
store i32 %12, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %2, ptr %in, align 16, !tbaa !5
br label %for.inc20.1.1
for.inc20.1.1: ; preds = %for.inc20.4, %if.then.160
%13 = phi i32 [ %2, %if.then.160 ], [ %12, %for.inc20.4 ]
%14 = phi i32 [ %12, %if.then.160 ], [ %2, %for.inc20.4 ]
%cmp11.2.1 = icmp sgt i32 %14, %5
br i1 %cmp11.2.1, label %if.then.2.1, label %for.inc20.2.1
if.then.2.1: ; preds = %for.inc20.1.1
store i32 %5, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %14, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.2.1
for.inc20.2.1: ; preds = %if.then.2.1, %for.inc20.1.1
%15 = phi i32 [ %14, %if.then.2.1 ], [ %5, %for.inc20.1.1 ]
%16 = phi i32 [ %5, %if.then.2.1 ], [ %14, %for.inc20.1.1 ]
%cmp11.3.1 = icmp sgt i32 %16, %8
br i1 %cmp11.3.1, label %if.then.3.1, label %for.inc20.3.1
if.then.3.1: ; preds = %for.inc20.2.1
store i32 %8, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %16, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.3.1
for.inc20.3.1: ; preds = %if.then.3.1, %for.inc20.2.1
%17 = phi i32 [ %16, %if.then.3.1 ], [ %8, %for.inc20.2.1 ]
%18 = phi i32 [ %8, %if.then.3.1 ], [ %16, %for.inc20.2.1 ]
%cmp11.4.1 = icmp sgt i32 %18, %11
br i1 %cmp11.4.1, label %if.then.4.1, label %for.inc20.4.1
if.then.4.1: ; preds = %for.inc20.3.1
store i32 %11, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %18, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc20.4.1
for.inc20.4.1: ; preds = %if.then.4.1, %for.inc20.3.1
%19 = phi i32 [ %18, %if.then.4.1 ], [ %11, %for.inc20.3.1 ]
%20 = phi i32 [ %11, %if.then.4.1 ], [ %18, %for.inc20.3.1 ]
%cmp11.262 = icmp sgt i32 %15, %13
br i1 %cmp11.262, label %if.then.263, label %for.inc20.264
if.then.263: ; preds = %for.inc20.4.1
store i32 %13, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %15, ptr %in, align 16, !tbaa !5
br label %for.inc20.264
for.inc20.264: ; preds = %if.then.263, %for.inc20.4.1
%21 = phi i32 [ %15, %if.then.263 ], [ %13, %for.inc20.4.1 ]
%22 = phi i32 [ %13, %if.then.263 ], [ %15, %for.inc20.4.1 ]
%cmp11.1.2 = icmp sgt i32 %22, %20
br i1 %cmp11.1.2, label %if.then.1.2, label %for.inc20.2.2
if.then.1.2: ; preds = %for.inc20.264
store i32 %20, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %22, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc20.2.2
for.inc20.2.2: ; preds = %for.inc20.264, %if.then.1.2
%23 = phi i32 [ %22, %if.then.1.2 ], [ %20, %for.inc20.264 ]
%24 = phi i32 [ %20, %if.then.1.2 ], [ %22, %for.inc20.264 ]
%cmp11.3.2 = icmp sgt i32 %24, %17
br i1 %cmp11.3.2, label %if.then.3.2, label %for.inc20.3.2
if.then.3.2: ; preds = %for.inc20.2.2
store i32 %17, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %24, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.3.2
for.inc20.3.2: ; preds = %if.then.3.2, %for.inc20.2.2
%25 = phi i32 [ %24, %if.then.3.2 ], [ %17, %for.inc20.2.2 ]
%26 = phi i32 [ %17, %if.then.3.2 ], [ %24, %for.inc20.2.2 ]
%cmp11.4.2 = icmp sgt i32 %26, %19
br i1 %cmp11.4.2, label %if.then.4.2, label %for.inc20.4.2
if.then.4.2: ; preds = %for.inc20.3.2
store i32 %19, ptr %arrayidx.2, align 8, !tbaa !5
store i32 %26, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc20.4.2
for.inc20.4.2: ; preds = %if.then.4.2, %for.inc20.3.2
%27 = phi i32 [ %26, %if.then.4.2 ], [ %19, %for.inc20.3.2 ]
%28 = phi i32 [ %19, %if.then.4.2 ], [ %26, %for.inc20.3.2 ]
%cmp11.365 = icmp sgt i32 %25, %21
br i1 %cmp11.365, label %if.then.366, label %for.inc20.367
if.then.366: ; preds = %for.inc20.4.2
store i32 %21, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %25, ptr %in, align 16, !tbaa !5
br label %for.inc20.367
for.inc20.367: ; preds = %if.then.366, %for.inc20.4.2
%29 = phi i32 [ %25, %if.then.366 ], [ %21, %for.inc20.4.2 ]
%30 = phi i32 [ %21, %if.then.366 ], [ %25, %for.inc20.4.2 ]
%cmp11.1.3 = icmp sgt i32 %30, %23
br i1 %cmp11.1.3, label %if.then.1.3, label %for.inc20.1.3
if.then.1.3: ; preds = %for.inc20.367
store i32 %23, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %30, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc20.1.3
for.inc20.1.3: ; preds = %if.then.1.3, %for.inc20.367
%31 = phi i32 [ %30, %if.then.1.3 ], [ %23, %for.inc20.367 ]
%32 = phi i32 [ %23, %if.then.1.3 ], [ %30, %for.inc20.367 ]
%cmp11.2.3 = icmp sgt i32 %32, %28
br i1 %cmp11.2.3, label %if.then.2.3, label %for.inc20.3.3
if.then.2.3: ; preds = %for.inc20.1.3
store i32 %28, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %32, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.3.3
for.inc20.3.3: ; preds = %for.inc20.1.3, %if.then.2.3
%33 = phi i32 [ %32, %if.then.2.3 ], [ %28, %for.inc20.1.3 ]
%34 = phi i32 [ %28, %if.then.2.3 ], [ %32, %for.inc20.1.3 ]
%cmp11.4.3 = icmp sgt i32 %34, %27
br i1 %cmp11.4.3, label %if.then.4.3, label %for.inc20.4.3
if.then.4.3: ; preds = %for.inc20.3.3
store i32 %27, ptr %arrayidx.3, align 4, !tbaa !5
store i32 %34, ptr %arrayidx.4, align 16, !tbaa !5
br label %for.inc20.4.3
for.inc20.4.3: ; preds = %if.then.4.3, %for.inc20.3.3
%35 = phi i32 [ %27, %if.then.4.3 ], [ %34, %for.inc20.3.3 ]
%36 = phi i32 [ %34, %if.then.4.3 ], [ %27, %for.inc20.3.3 ]
%cmp11.468 = icmp sgt i32 %36, %29
br i1 %cmp11.468, label %if.then.469, label %for.inc20.470
if.then.469: ; preds = %for.inc20.4.3
store i32 %29, ptr %arrayidx.4, align 16, !tbaa !5
store i32 %36, ptr %in, align 16, !tbaa !5
br label %for.inc20.470
for.inc20.470: ; preds = %if.then.469, %for.inc20.4.3
%37 = phi i32 [ %36, %if.then.469 ], [ %29, %for.inc20.4.3 ]
%38 = phi i32 [ %29, %if.then.469 ], [ %36, %for.inc20.4.3 ]
%cmp11.1.4 = icmp sgt i32 %38, %31
br i1 %cmp11.1.4, label %if.then.1.4, label %for.inc20.1.4
if.then.1.4: ; preds = %for.inc20.470
store i32 %31, ptr %arrayidx.4, align 16, !tbaa !5
store i32 %38, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc20.1.4
for.inc20.1.4: ; preds = %if.then.1.4, %for.inc20.470
%39 = phi i32 [ %31, %if.then.1.4 ], [ %38, %for.inc20.470 ]
%cmp11.2.4 = icmp sgt i32 %39, %33
br i1 %cmp11.2.4, label %if.then.2.4, label %for.inc20.2.4
if.then.2.4: ; preds = %for.inc20.1.4
store i32 %33, ptr %arrayidx.4, align 16, !tbaa !5
store i32 %39, ptr %arrayidx.2, align 8, !tbaa !5
br label %for.inc20.2.4
for.inc20.2.4: ; preds = %if.then.2.4, %for.inc20.1.4
%40 = phi i32 [ %33, %if.then.2.4 ], [ %39, %for.inc20.1.4 ]
%cmp11.3.4 = icmp sgt i32 %40, %35
br i1 %cmp11.3.4, label %if.then.3.4, label %for.inc20.4.4
if.then.3.4: ; preds = %for.inc20.2.4
store i32 %35, ptr %arrayidx.4, align 16, !tbaa !5
store i32 %40, ptr %arrayidx.3, align 4, !tbaa !5
br label %for.inc20.4.4
for.inc20.4.4: ; preds = %for.inc20.2.4, %if.then.3.4
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %37)
%41 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%call31.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %41)
%42 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%call31.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %42)
%43 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%call31.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %43)
%44 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %44)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %in) #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 A[101];
int main(){
int t,n,i,j,a,k;
scanf("%d",&n);
for(a=0;a<n;a++)
scanf("%d",&A[a]);
int max=0;
for(i=0;i<n;i++){
if(A[i]==1001-n+i){
max=n-1-i;
break;
}
}
for(j=n-1;j>=0;j--){
if(A[j]==j+1)
{ if(max<j)
max=j;
break;
}
}
int count =0;
for(k=1;k<=n;k++){
if(A[k]==A[k-1]+1){
count++;
}
else if(A[k]!=A[k-1]+1 || k ==n){
if(count>max+1){
max=count-1;
}
count=0;
}
}
printf("%d\n",max);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23867/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23867/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@A = dso_local global [101 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() 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
%cmp85 = icmp sgt i32 %0, 0
br i1 %cmp85, label %for.body, label %for.cond2.preheader.for.end12_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp387 = icmp sgt i32 %1, 0
br i1 %cmp387, label %for.body4.lr.ph, label %for.cond2.preheader.for.end12_crit_edge
for.cond2.preheader.for.end12_crit_edge: ; preds = %entry, %for.cond2.preheader
%.lcssa115 = phi i32 [ %1, %for.cond2.preheader ], [ %0, %entry ]
%.pre111 = zext i32 %.lcssa115 to i64
br label %for.end12
for.body4.lr.ph: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.lr.ph, %for.inc10
%indvars.iv98 = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next99, %for.inc10 ]
%arrayidx6 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv98
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%4 = trunc i64 %indvars.iv98 to i32
%reass.sub94 = sub i32 %4, %1
%add = add i32 %reass.sub94, 1001
%cmp7 = icmp eq i32 %3, %add
br i1 %cmp7, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%5 = xor i32 %4, -1
%sub9 = add i32 %1, %5
br label %for.end12
for.inc10: ; preds = %for.body4
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%exitcond.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count
br i1 %exitcond.not, label %for.end12, label %for.body4, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.cond2.preheader.for.end12_crit_edge, %if.then
%.lcssa114 = phi i32 [ %.lcssa115, %for.cond2.preheader.for.end12_crit_edge ], [ %1, %if.then ], [ %1, %for.inc10 ]
%.pre-phi = phi i64 [ %.pre111, %for.cond2.preheader.for.end12_crit_edge ], [ %wide.trip.count, %if.then ], [ %wide.trip.count, %for.inc10 ]
%max.0 = phi i32 [ 0, %for.cond2.preheader.for.end12_crit_edge ], [ %sub9, %if.then ], [ 0, %for.inc10 ]
br label %for.cond14
for.cond14: ; preds = %for.body16, %for.end12
%indvars.iv101 = phi i64 [ %7, %for.body16 ], [ %.pre-phi, %for.end12 ]
%6 = trunc i64 %indvars.iv101 to i32
%cmp15 = icmp sgt i32 %6, 0
br i1 %cmp15, label %for.body16, label %for.end27
for.body16: ; preds = %for.cond14
%7 = add nsw i64 %indvars.iv101, -1
%arrayidx18 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %7
%8 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%9 = zext i32 %8 to i64
%cmp20 = icmp eq i64 %indvars.iv101, %9
br i1 %cmp20, label %if.then21, label %for.cond14, !llvm.loop !12
if.then21: ; preds = %for.body16
%10 = trunc i64 %7 to i32
%spec.select = call i32 @llvm.smax.i32(i32 %max.0, i32 %10)
br label %for.end27
for.end27: ; preds = %for.cond14, %if.then21
%max.1 = phi i32 [ %spec.select, %if.then21 ], [ %max.0, %for.cond14 ]
%cmp29.not89 = icmp slt i32 %.lcssa114, 1
br i1 %cmp29.not89, label %for.end58, label %for.body30.preheader
for.body30.preheader: ; preds = %for.end27
%11 = add i32 %.lcssa114, 1
%wide.trip.count109 = zext i32 %11 to i64
%.pre = load i32, ptr @A, align 16, !tbaa !5
%12 = add nsw i64 %wide.trip.count109, -1
%xtraiter = and i64 %12, 1
%13 = icmp eq i32 %11, 2
br i1 %13, label %for.end58.loopexit.unr-lcssa, label %for.body30.preheader.new
for.body30.preheader.new: ; preds = %for.body30.preheader
%unroll_iter = and i64 %12, -2
br label %for.body30
for.body30: ; preds = %for.inc56.1, %for.body30.preheader.new
%14 = phi i32 [ %.pre, %for.body30.preheader.new ], [ %16, %for.inc56.1 ]
%indvars.iv105 = phi i64 [ 1, %for.body30.preheader.new ], [ %indvars.iv.next106.1, %for.inc56.1 ]
%count.092 = phi i32 [ 0, %for.body30.preheader.new ], [ %count.1.1, %for.inc56.1 ]
%max.291 = phi i32 [ %max.1, %for.body30.preheader.new ], [ %max.4.1, %for.inc56.1 ]
%niter = phi i64 [ 0, %for.body30.preheader.new ], [ %niter.next.1, %for.inc56.1 ]
%arrayidx32 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv105
%15 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%add36 = add nsw i32 %14, 1
%cmp37 = icmp eq i32 %15, %add36
br i1 %cmp37, label %if.then38, label %if.then48
if.then38: ; preds = %for.body30
%inc39 = add nsw i32 %count.092, 1
br label %for.inc56
if.then48: ; preds = %for.body30
%add49 = add nsw i32 %max.291, 1
%cmp50 = icmp sgt i32 %count.092, %add49
%sub52 = add nsw i32 %count.092, -1
%spec.select82 = select i1 %cmp50, i32 %sub52, i32 %max.291
br label %for.inc56
for.inc56: ; preds = %if.then38, %if.then48
%max.4 = phi i32 [ %max.291, %if.then38 ], [ %spec.select82, %if.then48 ]
%count.1 = phi i32 [ %inc39, %if.then38 ], [ 0, %if.then48 ]
%indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
%arrayidx32.1 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv.next106
%16 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5
%add36.1 = add nsw i32 %15, 1
%cmp37.1 = icmp eq i32 %16, %add36.1
br i1 %cmp37.1, label %if.then38.1, label %if.then48.1
if.then48.1: ; preds = %for.inc56
%add49.1 = add nsw i32 %max.4, 1
%cmp50.1 = icmp sgt i32 %count.1, %add49.1
%sub52.1 = add nsw i32 %count.1, -1
%spec.select82.1 = select i1 %cmp50.1, i32 %sub52.1, i32 %max.4
br label %for.inc56.1
if.then38.1: ; preds = %for.inc56
%inc39.1 = add nsw i32 %count.1, 1
br label %for.inc56.1
for.inc56.1: ; preds = %if.then38.1, %if.then48.1
%max.4.1 = phi i32 [ %max.4, %if.then38.1 ], [ %spec.select82.1, %if.then48.1 ]
%count.1.1 = phi i32 [ %inc39.1, %if.then38.1 ], [ 0, %if.then48.1 ]
%indvars.iv.next106.1 = add nuw nsw i64 %indvars.iv105, 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.end58.loopexit.unr-lcssa, label %for.body30, !llvm.loop !13
for.end58.loopexit.unr-lcssa: ; preds = %for.inc56.1, %for.body30.preheader
%max.4.lcssa.ph = phi i32 [ undef, %for.body30.preheader ], [ %max.4.1, %for.inc56.1 ]
%.unr = phi i32 [ %.pre, %for.body30.preheader ], [ %16, %for.inc56.1 ]
%indvars.iv105.unr = phi i64 [ 1, %for.body30.preheader ], [ %indvars.iv.next106.1, %for.inc56.1 ]
%count.092.unr = phi i32 [ 0, %for.body30.preheader ], [ %count.1.1, %for.inc56.1 ]
%max.291.unr = phi i32 [ %max.1, %for.body30.preheader ], [ %max.4.1, %for.inc56.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end58, label %for.body30.epil
for.body30.epil: ; preds = %for.end58.loopexit.unr-lcssa
%arrayidx32.epil = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv105.unr
%17 = load i32, ptr %arrayidx32.epil, align 4, !tbaa !5
%add36.epil = add nsw i32 %.unr, 1
%cmp37.epil = icmp eq i32 %17, %add36.epil
%add49.epil = add nsw i32 %max.291.unr, 1
%cmp50.epil = icmp sgt i32 %count.092.unr, %add49.epil
%sub52.epil = add nsw i32 %count.092.unr, -1
%spec.select82.epil = select i1 %cmp50.epil, i32 %sub52.epil, i32 %max.291.unr
%max.4.epil = select i1 %cmp37.epil, i32 %max.291.unr, i32 %spec.select82.epil
br label %for.end58
for.end58: ; preds = %for.body30.epil, %for.end58.loopexit.unr-lcssa, %for.end27
%max.2.lcssa = phi i32 [ %max.1, %for.end27 ], [ %max.4.lcssa.ph, %for.end58.loopexit.unr-lcssa ], [ %max.4.epil, %for.body30.epil ]
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.2.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int n[5];
int i,j,t;
scanf("%d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4]);
for(i=0;i<5;i++){
for(j=1;j+i<5;j++){
if(n[j]>n[j-1]){
t=n[j];
n[j]=n[j-1];
n[j-1]=t;
}
}
}
printf("%d %d %d %d %d\n",n[0],n[1],n[2],n[3],n[4]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238712/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238712/source.c"
target datalayout = "e-m:e-p270: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 [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.body7.preheader:
%n = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %n) #3
%arrayidx1 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [5 x i32], ptr %n, i64 0, i64 4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4)
%0 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%1 = load i32, ptr %n, align 16, !tbaa !5
%cmp11 = icmp sgt i32 %0, %1
br i1 %cmp11, label %if.then, label %for.inc
if.then: ; preds = %for.body7.preheader
store i32 %1, ptr %arrayidx1, align 4, !tbaa !5
store i32 %0, ptr %n, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body7.preheader, %if.then
%2 = phi i32 [ %0, %for.body7.preheader ], [ %1, %if.then ]
%3 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%cmp11.155 = icmp sgt i32 %3, %2
br i1 %cmp11.155, label %if.then.157, label %for.inc.158
if.then.157: ; preds = %for.inc
store i32 %2, ptr %arrayidx2, align 8, !tbaa !5
store i32 %3, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.158
for.inc.158: ; preds = %if.then.157, %for.inc
%4 = phi i32 [ %2, %if.then.157 ], [ %3, %for.inc ]
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp11.260 = icmp sgt i32 %5, %4
br i1 %cmp11.260, label %if.then.262, label %for.inc.263
if.then.262: ; preds = %for.inc.158
store i32 %4, ptr %arrayidx3, align 4, !tbaa !5
store i32 %5, ptr %arrayidx2, align 8, !tbaa !5
br label %for.inc.263
for.inc.263: ; preds = %if.then.262, %for.inc.158
%6 = phi i32 [ %4, %if.then.262 ], [ %5, %for.inc.158 ]
%7 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%cmp11.365 = icmp sgt i32 %7, %6
br i1 %cmp11.365, label %if.then.367, label %for.body7.preheader.1
if.then.367: ; preds = %for.inc.263
store i32 %6, ptr %arrayidx4, align 16, !tbaa !5
store i32 %7, ptr %arrayidx3, align 4, !tbaa !5
br label %for.body7.preheader.1
for.body7.preheader.1: ; preds = %if.then.367, %for.inc.263
%8 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%9 = load i32, ptr %n, align 16, !tbaa !5
%cmp11.1 = icmp sgt i32 %8, %9
br i1 %cmp11.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.body7.preheader.1
store i32 %9, ptr %arrayidx1, align 4, !tbaa !5
store i32 %8, ptr %n, align 16, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.body7.preheader.1
%10 = phi i32 [ %9, %if.then.1 ], [ %8, %for.body7.preheader.1 ]
%11 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%cmp11.1.1 = icmp sgt i32 %11, %10
br i1 %cmp11.1.1, label %if.then.1.1, label %for.inc.1.1
if.then.1.1: ; preds = %for.inc.1
store i32 %10, ptr %arrayidx2, align 8, !tbaa !5
store i32 %11, ptr %arrayidx1, align 4, !tbaa !5
br label %for.inc.1.1
for.inc.1.1: ; preds = %if.then.1.1, %for.inc.1
%12 = phi i32 [ %10, %if.then.1.1 ], [ %11, %for.inc.1 ]
%13 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp11.1.2 = icmp sgt i32 %13, %12
br i1 %cmp11.1.2, label %if.then.1.2, label %for.body7.preheader.2
if.then.1.2: ; preds = %for.inc.1.1
store i32 %12, ptr %arrayidx3, align 4, !tbaa !5
store i32 %13, ptr %arrayidx2, align 8, !tbaa !5
br label %for.body7.preheader.2
for.body7.preheader.2: ; preds = %if.then.1.2, %for.inc.1.1
%14 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%15 = load i32, ptr %n, align 16, !tbaa !5
%cmp11.2 = icmp sgt i32 %14, %15
br i1 %cmp11.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.body7.preheader.2
store i32 %15, ptr %arrayidx1, align 4, !tbaa !5
store i32 %14, ptr %n, align 16, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.body7.preheader.2
%16 = phi i32 [ %15, %if.then.2 ], [ %14, %for.body7.preheader.2 ]
%17 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%cmp11.2.1 = icmp sgt i32 %17, %16
br i1 %cmp11.2.1, label %if.then.2.1, label %for.body7.preheader.3
if.then.2.1: ; preds = %for.inc.2
store i32 %16, ptr %arrayidx2, align 8, !tbaa !5
store i32 %17, ptr %arrayidx1, align 4, !tbaa !5
br label %for.body7.preheader.3
for.body7.preheader.3: ; preds = %if.then.2.1, %for.inc.2
%18 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%19 = load i32, ptr %n, align 16, !tbaa !5
%cmp11.3 = icmp sgt i32 %18, %19
br i1 %cmp11.3, label %if.then.3, label %for.inc22.4
if.then.3: ; preds = %for.body7.preheader.3
store i32 %19, ptr %arrayidx1, align 4, !tbaa !5
store i32 %18, ptr %n, align 16, !tbaa !5
br label %for.inc22.4
for.inc22.4: ; preds = %if.then.3, %for.body7.preheader.3
%20 = load i32, ptr %n, align 16, !tbaa !5
%21 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%23 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%24 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %20, i32 noundef %21, i32 noundef %22, i32 noundef %23, i32 noundef %24)
call void @llvm.lifetime.end.p0(i64 20, 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"}
|
//set many funcs template
//Ver.20180717
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
void shuffledget(int x[],int n){
srand(time(0));
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
//bitset(ull)
unsigned long long bset[524288]={0};
int check(int x){
if((bset[x/64]&(1ull<<(x%64))) == 0){return 0;}
return 1;
}
void setand(int x,unsigned long long set){
bset[x/64]&=(set<<(x%64));
if(x%64!=0){
bset[(x/64)+1]&=(set>>(64-(x%64)));
}
}
void setor(int x,unsigned long long set){
bset[x/64]|=(set<<(x%64));
if(x%64!=0){
bset[(x/64)+1]|=(set>>(64-(x%64)));
}
}
unsigned long long pick(int x){
unsigned long long r=0;
r+=(bset[x/64]>>(x%64));
if(x%64!=0){
r+=(bset[(x/64)+1]<<(64-x%64));
}
return r;
}
int main(void){
int i,j,n,m,k,a[524288],b,c,h,w,r=0,l,t;
unsigned long long mem;
double d;
char s[524288];
scanf("%d",&n);
bset[0]=1;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
r+=a[i];
for(j=32*i;j>=0;j--){
mem=pick(64*j);
setor(64*j+a[i],mem);
}
}
r=ceil(r,2);
for(i=r;i<inf;i++){
if(check(i)==1){
printf("%d\n",i);
return 0;
}
}
//shuffledget(a,n);
//qsort(a,n,sizeof(int),sortfncsj);
printf("-1\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238763/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@bset = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16
@.str.1 = 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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !16
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !17
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !17
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !22
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #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) #16
ret i32 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #17
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #17
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #17
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !34
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !35
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !36
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #17
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #10 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !25
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !37
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !38
%1 = load i32, ptr %b, align 4, !tbaa !38
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @check(i32 noundef %x) local_unnamed_addr #11 {
entry:
%div = sdiv i32 %x, 64
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !29
%rem = srem i32 %x, 64
%sh_prom = zext i32 %rem to i64
%shl = shl nuw i64 1, %sh_prom
%and = and i64 %0, %shl
%cmp = icmp ne i64 %and, 0
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setand(i32 noundef %x, i64 noundef %set) local_unnamed_addr #12 {
entry:
%rem = srem i32 %x, 64
%sh_prom = zext i32 %rem to i64
%shl = shl i64 %set, %sh_prom
%div = sdiv i32 %x, 64
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !29
%and = and i64 %0, %shl
store i64 %and, ptr %arrayidx, align 8, !tbaa !29
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i32 64, %rem
%sh_prom3 = zext i32 %sub to i64
%shr = lshr i64 %set, %sh_prom3
%add = add nsw i32 %div, 1
%idxprom5 = sext i32 %add to i64
%arrayidx6 = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom5
%1 = load i64, ptr %arrayidx6, align 8, !tbaa !29
%and7 = and i64 %1, %shr
store i64 %and7, ptr %arrayidx6, align 8, !tbaa !29
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @setor(i32 noundef %x, i64 noundef %set) local_unnamed_addr #12 {
entry:
%rem = srem i32 %x, 64
%sh_prom = zext i32 %rem to i64
%shl = shl i64 %set, %sh_prom
%div = sdiv i32 %x, 64
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !29
%or = or i64 %0, %shl
store i64 %or, ptr %arrayidx, align 8, !tbaa !29
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i32 64, %rem
%sh_prom3 = zext i32 %sub to i64
%shr = lshr i64 %set, %sh_prom3
%add = add nsw i32 %div, 1
%idxprom5 = sext i32 %add to i64
%arrayidx6 = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom5
%1 = load i64, ptr %arrayidx6, align 8, !tbaa !29
%or7 = or i64 %1, %shr
store i64 %or7, ptr %arrayidx6, align 8, !tbaa !29
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @pick(i32 noundef %x) local_unnamed_addr #11 {
entry:
%div = sdiv i32 %x, 64
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom
%0 = load i64, ptr %arrayidx, align 8, !tbaa !29
%rem = srem i32 %x, 64
%sh_prom = zext i32 %rem to i64
%shr = lshr i64 %0, %sh_prom
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%add3 = add nsw i32 %div, 1
%idxprom4 = sext i32 %add3 to i64
%arrayidx5 = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom4
%1 = load i64, ptr %arrayidx5, align 8, !tbaa !29
%sub = sub nsw i32 64, %rem
%sh_prom7 = zext i32 %sub to i64
%shl = shl i64 %1, %sh_prom7
%add8 = add i64 %shl, %shr
br label %if.end
if.end: ; preds = %if.then, %entry
%r.0 = phi i64 [ %add8, %if.then ], [ %shr, %entry ]
ret i64 %r.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #13 {
entry:
%n = alloca i32, align 4
%a = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #17
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %a) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
store i64 1, ptr @bset, align 16, !tbaa !29
%0 = load i32, ptr %n, align 4, !tbaa !25
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %entry, %for.inc13
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.inc13 ], [ 0, %entry ]
%indvars.iv = phi i32 [ %indvars.iv.next, %for.inc13 ], [ 0, %entry ]
%r.077 = phi i32 [ %add, %for.inc13 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %a, i64 0, i64 %indvars.iv85
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !25
%add = add nsw i32 %1, %r.077
%2 = sext i32 %indvars.iv to i64
br label %for.body6
for.body6: ; preds = %for.body6.preheader, %setor.exit
%indvars.iv82 = phi i64 [ %2, %for.body6.preheader ], [ %indvars.iv.next83, %setor.exit ]
%3 = trunc i64 %indvars.iv82 to i32
%mul7 = shl nsw i32 %3, 6
%arrayidx.i = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %indvars.iv82
%4 = load i64, ptr %arrayidx.i, align 8, !tbaa !29
%add12 = add nsw i32 %mul7, %1
%rem.i55 = srem i32 %add12, 64
%sh_prom.i56 = zext i32 %rem.i55 to i64
%shl.i = shl i64 %4, %sh_prom.i56
%div.i57 = sdiv i32 %add12, 64
%idxprom.i58 = sext i32 %div.i57 to i64
%arrayidx.i59 = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom.i58
%5 = load i64, ptr %arrayidx.i59, align 8, !tbaa !29
%or.i = or i64 %5, %shl.i
store i64 %or.i, ptr %arrayidx.i59, align 8, !tbaa !29
%cmp.not.i60 = icmp eq i32 %rem.i55, 0
br i1 %cmp.not.i60, label %setor.exit, label %if.then.i61
if.then.i61: ; preds = %for.body6
%sub.i62 = sub nsw i32 64, %rem.i55
%sh_prom3.i = zext i32 %sub.i62 to i64
%shr.i = lshr i64 %4, %sh_prom3.i
%add.i = add nsw i32 %div.i57, 1
%idxprom5.i = sext i32 %add.i to i64
%arrayidx6.i = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom5.i
%6 = load i64, ptr %arrayidx6.i, align 8, !tbaa !29
%or7.i = or i64 %6, %shr.i
store i64 %or7.i, ptr %arrayidx6.i, align 8, !tbaa !29
br label %setor.exit
setor.exit: ; preds = %for.body6, %if.then.i61
%indvars.iv.next83 = add nsw i64 %indvars.iv82, -1
%cmp5 = icmp sgt i64 %indvars.iv82, 0
br i1 %cmp5, label %for.body6, label %for.inc13, !llvm.loop !40
for.inc13: ; preds = %setor.exit
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%7 = load i32, ptr %n, align 4, !tbaa !25
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next86, %8
%indvars.iv.next = add i32 %indvars.iv, 32
br i1 %cmp, label %for.body6.preheader, label %for.end14, !llvm.loop !41
for.end14: ; preds = %for.inc13, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.inc13 ]
%9 = and i32 %r.0.lcssa, 1
%div.i64 = sdiv i32 %r.0.lcssa, 2
%retval.0.i = add nsw i32 %div.i64, %9
%cmp1779 = icmp slt i32 %retval.0.i, 1072114514
br i1 %cmp1779, label %for.body18, label %for.end24
for.body18: ; preds = %for.end14, %for.inc22
%i.180 = phi i32 [ %inc23, %for.inc22 ], [ %retval.0.i, %for.end14 ]
%div.i66 = sdiv i32 %i.180, 64
%idxprom.i67 = sext i32 %div.i66 to i64
%arrayidx.i68 = getelementptr inbounds [524288 x i64], ptr @bset, i64 0, i64 %idxprom.i67
%10 = load i64, ptr %arrayidx.i68, align 8, !tbaa !29
%rem.i69 = srem i32 %i.180, 64
%sh_prom.i70 = zext i32 %rem.i69 to i64
%shl.i71 = shl nuw i64 1, %sh_prom.i70
%and.i = and i64 %10, %shl.i71
%cmp.i72.not = icmp eq i64 %and.i, 0
br i1 %cmp.i72.not, label %for.inc22, label %if.then
if.then: ; preds = %for.body18
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.180)
br label %cleanup
for.inc22: ; preds = %for.body18
%inc23 = add i32 %i.180, 1
%exitcond.not = icmp eq i32 %inc23, 1072114514
br i1 %exitcond.not, label %for.end24, label %for.body18, !llvm.loop !42
for.end24: ; preds = %for.inc22, %for.end14
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %for.end24, %if.then
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %a) #17
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #15
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { 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 #12 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nofree nounwind }
attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #16 = { nounwind willreturn memory(read) }
attributes #17 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = distinct !{!33, !6, !9, !10}
!34 = distinct !{!34, !6, !10, !9}
!35 = distinct !{!35, !6}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = !{!39, !26, i64 0}
!39 = !{!"", !26, i64 0, !26, i64 4}
!40 = distinct !{!40, !6}
!41 = distinct !{!41, !6}
!42 = distinct !{!42, !6}
|
#include <stdio.h>
int main(void) {
int prevsuuretu[12];
int suuretu[12];
int bunpu[12];
int suuzi[12];
int hyoulength;
int length;
int i;
int kaisuu;
int j;
while(1) {
scanf("%d",&length);
if(length==0)break;
for(i=0;i<length;i++) {
scanf("%d",&suuretu[i]);
prevsuuretu[i]=suuretu[i];
}
kaisuu=0;
while(1) {
for(i=0;i<12;i++)bunpu[i]=0;
hyoulength=0;
for(i=0;i<length;i++) {
for(j=0;j<hyoulength;j++) {
if(suuzi[j]==suuretu[i]) {
bunpu[j]++;
break;
}
}
if(j>=hyoulength) {
suuzi[hyoulength]=suuretu[i];
bunpu[hyoulength]=1;
hyoulength++;
}
}
for(i=0;i<length;i++) {
for(j=0;j<hyoulength;j++) {
if(suuzi[j]==suuretu[i]) {
suuretu[i]=bunpu[j];
break;
}
}
}
for(i=0;i<length;i++) {
if(suuretu[i]!=prevsuuretu[i])break;
}
if(i>=length)break;
for(i=0;i<length;i++)prevsuuretu[i]=suuretu[i];
kaisuu++;
}
printf("%d\n",kaisuu);
for(i=0;i<length;i++) {
printf(i?" %d":"%d",suuretu[i]);
}
puts("");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238806/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238806/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%prevsuuretu = alloca [12 x i32], align 16
%suuretu = alloca [12 x i32], align 16
%bunpu = alloca [12 x i32], align 16
%suuzi = alloca [12 x i32], align 16
%length = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %prevsuuretu) #6
call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %suuretu) #6
call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %bunpu) #6
call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %suuzi) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %length) #6
%call175 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %length)
%0 = load i32, ptr %length, align 4, !tbaa !5
%cmp176 = icmp eq i32 %0, 0
br i1 %cmp176, label %while.end110, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end108
%1 = phi i32 [ %21, %for.end108 ], [ %0, %entry ]
%cmp1153 = icmp sgt i32 %1, 0
br i1 %cmp1153, label %for.body, label %while.cond7.preheader
while.cond7.preheader: ; preds = %for.body, %for.cond.preheader
%.lcssa = phi i32 [ %1, %for.cond.preheader ], [ %5, %for.body ]
%cmp18158 = icmp sgt i32 %.lcssa, 0
%2 = zext i32 %.lcssa to i64
%3 = shl nuw nsw i64 %2, 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %bunpu, i8 0, i64 48, i1 false), !tbaa !5
br i1 %cmp18158, label %for.cond20.preheader.preheader, label %while.end
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [12 x i32], ptr %suuretu, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [12 x i32], ptr %prevsuuretu, i64 0, i64 %indvars.iv
store i32 %4, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %length, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp1, label %for.body, label %while.cond7.preheader, !llvm.loop !9
for.cond20.preheader.preheader: ; preds = %while.cond7.preheader, %for.end97
%kaisuu.0231 = phi i32 [ %inc98, %for.end97 ], [ 0, %while.cond7.preheader ]
br label %for.cond20.preheader
for.cond49.preheader: ; preds = %for.inc46
br i1 %cmp18158, label %for.cond52.preheader.lr.ph, label %while.end
for.cond52.preheader.lr.ph: ; preds = %for.cond49.preheader
%cmp53162 = icmp sgt i32 %hyoulength.1, 0
br i1 %cmp53162, label %for.cond52.preheader.us.preheader, label %for.body74.preheader
for.cond52.preheader.us.preheader: ; preds = %for.cond52.preheader.lr.ph
%wide.trip.count199 = zext i32 %hyoulength.1 to i64
br label %for.cond52.preheader.us
for.cond52.preheader.us: ; preds = %for.cond52.preheader.us.preheader, %for.inc69.us
%indvars.iv201 = phi i64 [ 0, %for.cond52.preheader.us.preheader ], [ %indvars.iv.next202, %for.inc69.us ]
%arrayidx58.us = getelementptr inbounds [12 x i32], ptr %suuretu, i64 0, i64 %indvars.iv201
%7 = load i32, ptr %arrayidx58.us, align 4, !tbaa !5
br label %for.body54.us
for.cond52.us: ; preds = %for.body54.us
%indvars.iv.next197 = add nuw nsw i64 %indvars.iv196, 1
%exitcond200.not = icmp eq i64 %indvars.iv.next197, %wide.trip.count199
br i1 %exitcond200.not, label %for.inc69.us, label %for.body54.us, !llvm.loop !11
for.body54.us: ; preds = %for.cond52.preheader.us, %for.cond52.us
%indvars.iv196 = phi i64 [ 0, %for.cond52.preheader.us ], [ %indvars.iv.next197, %for.cond52.us ]
%arrayidx56.us = getelementptr inbounds [12 x i32], ptr %suuzi, i64 0, i64 %indvars.iv196
%8 = load i32, ptr %arrayidx56.us, align 4, !tbaa !5
%cmp59.us = icmp eq i32 %8, %7
br i1 %cmp59.us, label %if.then60.us, label %for.cond52.us
if.then60.us: ; preds = %for.body54.us
%arrayidx62.us = getelementptr inbounds [12 x i32], ptr %bunpu, i64 0, i64 %indvars.iv196
%9 = load i32, ptr %arrayidx62.us, align 4, !tbaa !5
store i32 %9, ptr %arrayidx58.us, align 4, !tbaa !5
br label %for.inc69.us
for.inc69.us: ; preds = %for.cond52.us, %if.then60.us
%indvars.iv.next202 = add nuw nsw i64 %indvars.iv201, 1
%exitcond205.not = icmp eq i64 %indvars.iv.next202, %2
br i1 %exitcond205.not, label %for.cond72.preheader, label %for.cond52.preheader.us, !llvm.loop !12
for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.inc46
%indvars.iv191 = phi i64 [ %indvars.iv.next192, %for.inc46 ], [ 0, %for.cond20.preheader.preheader ]
%hyoulength.0159 = phi i32 [ %hyoulength.1, %for.inc46 ], [ 0, %for.cond20.preheader.preheader ]
%cmp21156 = icmp sgt i32 %hyoulength.0159, 0
%arrayidx26 = getelementptr inbounds [12 x i32], ptr %suuretu, i64 0, i64 %indvars.iv191
%10 = load i32, ptr %arrayidx26, align 4, !tbaa !5
br i1 %cmp21156, label %for.body22.lr.ph, label %if.then37
for.body22.lr.ph: ; preds = %for.cond20.preheader
%wide.trip.count = zext i32 %hyoulength.0159 to i64
br label %for.body22
for.cond20: ; preds = %for.body22
%indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
%exitcond.not = icmp eq i64 %indvars.iv.next189, %wide.trip.count
br i1 %exitcond.not, label %if.then37, label %for.body22, !llvm.loop !13
for.body22: ; preds = %for.body22.lr.ph, %for.cond20
%indvars.iv188 = phi i64 [ 0, %for.body22.lr.ph ], [ %indvars.iv.next189, %for.cond20 ]
%arrayidx24 = getelementptr inbounds [12 x i32], ptr %suuzi, i64 0, i64 %indvars.iv188
%11 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp27 = icmp eq i32 %11, %10
br i1 %cmp27, label %for.end35.thread, label %for.cond20
for.end35.thread: ; preds = %for.body22
%arrayidx30 = getelementptr inbounds [12 x i32], ptr %bunpu, i64 0, i64 %indvars.iv188
%12 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%inc31 = add nsw i32 %12, 1
store i32 %inc31, ptr %arrayidx30, align 4, !tbaa !5
br label %for.inc46
if.then37: ; preds = %for.cond20, %for.cond20.preheader
%idxprom40 = sext i32 %hyoulength.0159 to i64
%arrayidx41 = getelementptr inbounds [12 x i32], ptr %suuzi, i64 0, i64 %idxprom40
store i32 %10, ptr %arrayidx41, align 4, !tbaa !5
%arrayidx43 = getelementptr inbounds [12 x i32], ptr %bunpu, i64 0, i64 %idxprom40
store i32 1, ptr %arrayidx43, align 4, !tbaa !5
%inc44 = add nsw i32 %hyoulength.0159, 1
br label %for.inc46
for.inc46: ; preds = %for.end35.thread, %if.then37
%hyoulength.1 = phi i32 [ %inc44, %if.then37 ], [ %hyoulength.0159, %for.end35.thread ]
%indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
%exitcond195.not = icmp eq i64 %indvars.iv.next192, %2
br i1 %exitcond195.not, label %for.cond49.preheader, label %for.cond20.preheader, !llvm.loop !14
for.cond72.preheader: ; preds = %for.inc69.us
br i1 %cmp18158, label %for.body74.preheader, label %while.end
for.body74.preheader: ; preds = %for.cond52.preheader.lr.ph, %for.cond72.preheader
br label %for.body74
for.cond72: ; preds = %for.body74
%indvars.iv.next207 = add nuw nsw i64 %indvars.iv206, 1
%exitcond210.not = icmp eq i64 %indvars.iv.next207, %2
br i1 %exitcond210.not, label %while.end, label %for.body74, !llvm.loop !15
for.body74: ; preds = %for.body74.preheader, %for.cond72
%indvars.iv206 = phi i64 [ %indvars.iv.next207, %for.cond72 ], [ 0, %for.body74.preheader ]
%arrayidx76 = getelementptr inbounds [12 x i32], ptr %suuretu, i64 0, i64 %indvars.iv206
%13 = load i32, ptr %arrayidx76, align 4, !tbaa !5
%arrayidx78 = getelementptr inbounds [12 x i32], ptr %prevsuuretu, i64 0, i64 %indvars.iv206
%14 = load i32, ptr %arrayidx78, align 4, !tbaa !5
%cmp79.not = icmp eq i32 %13, %14
br i1 %cmp79.not, label %for.cond72, label %for.end97
for.end97: ; preds = %for.body74
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %prevsuuretu, ptr nonnull align 16 %suuretu, i64 %3, i1 false), !tbaa !5
%inc98 = add nuw nsw i32 %kaisuu.0231, 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %bunpu, i8 0, i64 48, i1 false), !tbaa !5
br i1 %cmp18158, label %for.cond20.preheader.preheader, label %while.end
while.end: ; preds = %for.cond72.preheader, %for.cond49.preheader, %for.end97, %for.cond72, %while.cond7.preheader
%kaisuu.0183 = phi i32 [ 0, %while.cond7.preheader ], [ %kaisuu.0231, %for.cond72 ], [ 0, %for.end97 ], [ 0, %for.cond49.preheader ], [ 0, %for.cond72.preheader ]
%call99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %kaisuu.0183)
%15 = load i32, ptr %length, align 4, !tbaa !5
%cmp101173 = icmp sgt i32 %15, 0
br i1 %cmp101173, label %for.body102.preheader, label %for.end108
for.body102.preheader: ; preds = %while.end
%16 = load i32, ptr %suuretu, align 16, !tbaa !5
%call105.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
%17 = load i32, ptr %length, align 4, !tbaa !5
%cmp101.peel = icmp sgt i32 %17, 1
br i1 %cmp101.peel, label %for.body102, label %for.end108
for.body102: ; preds = %for.body102.preheader, %for.body102
%indvars.iv214 = phi i64 [ %indvars.iv.next215, %for.body102 ], [ 1, %for.body102.preheader ]
%arrayidx104 = getelementptr inbounds [12 x i32], ptr %suuretu, i64 0, i64 %indvars.iv214
%18 = load i32, ptr %arrayidx104, align 4, !tbaa !5
%call105 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%indvars.iv.next215 = add nuw nsw i64 %indvars.iv214, 1
%19 = load i32, ptr %length, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp101 = icmp slt i64 %indvars.iv.next215, %20
br i1 %cmp101, label %for.body102, label %for.end108, !llvm.loop !16
for.end108: ; preds = %for.body102, %for.body102.preheader, %while.end
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %length)
%21 = load i32, ptr %length, align 4, !tbaa !5
%cmp = icmp eq i32 %21, 0
br i1 %cmp, label %while.end110, label %for.cond.preheader
while.end110: ; preds = %for.end108, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %length) #6
call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %suuzi) #6
call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %bunpu) #6
call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %suuretu) #6
call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %prevsuuretu) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree 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
; Function Attrs: 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
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
long ll[10000]={0},rr[10000]={0},hash[200000]={0};
int main()
{
long L,b,f,n,i,j,tot=0,st,flag,o,sum,w,op,ask;
scanf("%ld %ld %ld\n",&L,&b,&f);
scanf("%ld\n",&n);
for(i=1;i<=n;i++)
{
scanf("%ld %ld\n",&ask,&op);
if(ask==1)
{
st=1; flag=0;
while(1)
{
o=st;
for(st++;st<=L;st++)
if(hash[st]!=hash[st-1])
break;
if(hash[o]==0)
{
sum=(st<=L?f:0);
w=(o>1?b:0);
if(sum+w+op<=st-o)
{
printf("%ld\n",o+w-1);
for(j=0;j<op;j++)
hash[j+o+w]=1;
ll[i]=o+w; rr[i]=o+w+op-1;
flag=1;
break;
}
}
if(st==L+1)
break;
}
if(!flag)
printf("-1\n");
}
else
for(j=ll[op];j<=rr[op];j++)
hash[j]=0;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@ll = dso_local local_unnamed_addr global [10000 x i64] zeroinitializer, align 16
@rr = dso_local local_unnamed_addr global [10000 x i64] zeroinitializer, align 16
@hash = dso_local local_unnamed_addr global [200000 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [13 x i8] c"%ld %ld %ld\0A\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"%ld %ld\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:
%L = alloca i64, align 8
%b = alloca i64, align 8
%f = alloca i64, align 8
%n = alloca i64, align 8
%op = alloca i64, align 8
%ask = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %L) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %op) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ask) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %b, ptr noundef nonnull %f)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not96 = icmp slt i64 %0, 1
br i1 %cmp.not96, label %for.end63, label %for.body
for.body: ; preds = %entry, %for.inc61
%i.097 = phi i64 [ %inc62, %for.inc61 ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %ask, ptr noundef nonnull %op)
%1 = load i64, ptr %ask, align 8, !tbaa !5
%cmp3 = icmp eq i64 %1, 1
br i1 %cmp3, label %while.cond.preheader, label %if.else
while.cond.preheader: ; preds = %for.body
%2 = load i64, ptr %L, align 8, !tbaa !5
%3 = load i64, ptr %f, align 8
%4 = load i64, ptr %b, align 8
%5 = load i64, ptr %op, align 8
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %if.end43
%st.0 = phi i64 [ %st.1.lcssa, %if.end43 ], [ 1, %while.cond.preheader ]
%smax = call i64 @llvm.smax.i64(i64 %st.0, i64 %2)
%6 = add i64 %smax, 1
br label %for.cond4
for.cond4: ; preds = %for.body6, %while.cond
%st.1.in = phi i64 [ %st.0, %while.cond ], [ %st.1, %for.body6 ]
%exitcond.not = icmp eq i64 %st.1.in, %smax
br i1 %exitcond.not, label %for.end, label %for.body6
for.body6: ; preds = %for.cond4
%st.1 = add i64 %st.1.in, 1
%arrayidx = getelementptr inbounds [200000 x i64], ptr @hash, i64 0, i64 %st.1
%7 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx7 = getelementptr inbounds [200000 x i64], ptr @hash, i64 0, i64 %st.1.in
%8 = load i64, ptr %arrayidx7, align 8, !tbaa !5
%cmp8.not = icmp eq i64 %7, %8
br i1 %cmp8.not, label %for.cond4, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6, %for.cond4
%st.1.in.lcssa = phi i64 [ %st.1.in, %for.body6 ], [ %smax, %for.cond4 ]
%st.1.lcssa = phi i64 [ %st.1, %for.body6 ], [ %6, %for.cond4 ]
%arrayidx11 = getelementptr inbounds [200000 x i64], ptr @hash, i64 0, i64 %st.0
%9 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%cmp12 = icmp eq i64 %9, 0
br i1 %cmp12, label %if.then13, label %if.end43
if.then13: ; preds = %for.end
%cmp5.not.not.le = icmp slt i64 %st.1.in, %2
%cond = select i1 %cmp5.not.not.le, i64 %3, i64 0
%cmp15 = icmp sgt i64 %st.0, 1
%cond19 = select i1 %cmp15, i64 %4, i64 0
%add = add nsw i64 %cond19, %cond
%add20 = add nsw i64 %add, %5
%sub21 = sub nsw i64 %st.1.lcssa, %st.0
%cmp22.not = icmp sgt i64 %add20, %sub21
br i1 %cmp22.not, label %if.end43, label %if.then23
if.then23: ; preds = %if.then13
%add24 = add i64 %cond19, %st.0
%sub25 = add i64 %add24, -1
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub25)
%10 = load i64, ptr %op, align 8, !tbaa !5
%cmp2894 = icmp sgt i64 %10, 0
br i1 %cmp2894, label %for.body29.preheader, label %for.end35
for.body29.preheader: ; preds = %if.then23
%min.iters.check = icmp ult i64 %10, 4
br i1 %min.iters.check, label %for.body29.preheader104, label %vector.ph
vector.ph: ; preds = %for.body29.preheader
%n.vec = and i64 %10, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%11 = add i64 %add24, %index
%12 = getelementptr inbounds [200000 x i64], ptr @hash, i64 0, i64 %11
store <2 x i64> <i64 1, i64 1>, ptr %12, align 8, !tbaa !5
%13 = getelementptr inbounds i64, ptr %12, i64 2
store <2 x i64> <i64 1, i64 1>, ptr %13, align 8, !tbaa !5
%index.next = add nuw i64 %index, 4
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %10, %n.vec
br i1 %cmp.n, label %for.end35, label %for.body29.preheader104
for.body29.preheader104: ; preds = %for.body29.preheader, %middle.block
%j.095.ph = phi i64 [ 0, %for.body29.preheader ], [ %n.vec, %middle.block ]
br label %for.body29
for.body29: ; preds = %for.body29.preheader104, %for.body29
%j.095 = phi i64 [ %inc34, %for.body29 ], [ %j.095.ph, %for.body29.preheader104 ]
%add31 = add i64 %add24, %j.095
%arrayidx32 = getelementptr inbounds [200000 x i64], ptr @hash, i64 0, i64 %add31
store i64 1, ptr %arrayidx32, align 8, !tbaa !5
%inc34 = add nuw nsw i64 %j.095, 1
%exitcond99.not = icmp eq i64 %inc34, %10
br i1 %exitcond99.not, label %for.end35, label %for.body29, !llvm.loop !14
for.end35: ; preds = %for.body29, %middle.block, %if.then23
%arrayidx37 = getelementptr inbounds [10000 x i64], ptr @ll, i64 0, i64 %i.097
store i64 %add24, ptr %arrayidx37, align 8, !tbaa !5
%sub40 = add i64 %sub25, %10
%arrayidx41 = getelementptr inbounds [10000 x i64], ptr @rr, i64 0, i64 %i.097
store i64 %sub40, ptr %arrayidx41, align 8, !tbaa !5
br label %for.inc61
if.end43: ; preds = %if.then13, %for.end
%cmp45 = icmp eq i64 %st.1.in.lcssa, %2
br i1 %cmp45, label %if.then48, label %while.cond
if.then48: ; preds = %if.end43
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc61
if.else: ; preds = %for.body
%15 = load i64, ptr %op, align 8, !tbaa !5
%arrayidx51 = getelementptr inbounds [10000 x i64], ptr @ll, i64 0, i64 %15
%16 = load i64, ptr %arrayidx51, align 8, !tbaa !5
%arrayidx53 = getelementptr inbounds [10000 x i64], ptr @rr, i64 0, i64 %15
%17 = load i64, ptr %arrayidx53, align 8, !tbaa !5
%cmp54.not92 = icmp sgt i64 %16, %17
br i1 %cmp54.not92, label %for.inc61, label %for.body55.preheader
for.body55.preheader: ; preds = %if.else
%18 = shl i64 %16, 3
%scevgep = getelementptr i8, ptr @hash, i64 %18
%19 = add i64 %17, 1
%20 = sub i64 %19, %16
%21 = shl nuw i64 %20, 3
call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %21, i1 false), !tbaa !5
br label %for.inc61
for.inc61: ; preds = %for.body55.preheader, %if.else, %for.end35, %if.then48
%inc62 = add nuw nsw i64 %i.097, 1
%22 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.097, %22
br i1 %cmp.not.not, label %for.body, label %for.end63, !llvm.loop !15
for.end63: ; preds = %for.inc61, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ask) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %op) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %L) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
int x,y;
scanf("%d %d", &x,&y);
if(x % y == 0){
printf("-1");
return 0;
}
else{
int i;
for(i=2;i<1000000000;i++){
if( (x*i) % y != 0){
printf("%d", x*i);
return 0;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238893/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238893/source.c"
target datalayout = "e-m:e-p270: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 %for.body
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup9
for.cond: ; preds = %for.body
%inc = or i32 %i.014, 1
%mul.1 = mul nsw i32 %inc, %0
%rem3.1 = srem i32 %mul.1, %1
%cmp4.not.1 = icmp eq i32 %rem3.1, 0
br i1 %cmp4.not.1, label %for.cond.1, label %if.then5
for.cond.1: ; preds = %for.cond
%inc.1 = add nuw nsw i32 %i.014, 2
%exitcond.1 = icmp eq i32 %inc.1, 1000000000
br i1 %exitcond.1, label %cleanup9, label %for.body, !llvm.loop !9
for.body: ; preds = %entry, %for.cond.1
%i.014 = phi i32 [ %inc.1, %for.cond.1 ], [ 2, %entry ]
%mul = mul nsw i32 %i.014, %0
%rem3 = srem i32 %mul, %1
%cmp4.not = icmp eq i32 %rem3, 0
br i1 %cmp4.not, label %for.cond, label %if.then5
if.then5: ; preds = %for.cond, %for.body
%mul.lcssa = phi i32 [ %mul, %for.body ], [ %mul.1, %for.cond ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul.lcssa)
br label %cleanup9
cleanup9: ; preds = %for.cond.1, %if.then5, %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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int h1, h2, m1, m2, k;
scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
int ans = (m2-m1)+((h2-h1)*60)-k;
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238943/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238943/source.c"
target datalayout = "e-m:e-p270: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 %m2, 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 %h1, align 4, !tbaa !5
%sub1 = sub nsw i32 %2, %3
%mul = mul nsw i32 %sub1, 60
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = add i32 %1, %4
%6 = sub i32 %0, %5
%sub2 = add i32 %6, %mul
%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 %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(){
int x , y, n,k, m,count=0,z;
scanf("%d %d %d %d %d",&x,&y,&n,&m,&k);
z=n-x;
count=z*60;
count+=m-y;
count-=k;
printf("%d",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_238994/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_238994/source.c"
target datalayout = "e-m:e-p270: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:
%x = alloca i32, align 4
%y = alloca i32, align 4
%n = alloca i32, align 4
%k = alloca i32, align 4
%m = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%mul = mul nsw i32 %sub, 60
%2 = load i32, ptr %m, align 4, !tbaa !5
%3 = load i32, ptr %y, align 4, !tbaa !5
%4 = load i32, ptr %k, align 4, !tbaa !5
%.neg7 = add i32 %mul, %2
%5 = add i32 %3, %4
%sub2 = sub i32 %.neg7, %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 %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
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 up_h, up_m, gt_h, gt_m, stu_m, all_m;
scanf("%d %d %d %d %d", &up_h, &up_m, >_h, >_m, &stu_m);
all_m = ((gt_h - up_h)*60)+(gt_m - up_m);
printf("%d",all_m-stu_m);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239043/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239043/source.c"
target datalayout = "e-m:e-p270: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:
%up_h = alloca i32, align 4
%up_m = alloca i32, align 4
%gt_h = alloca i32, align 4
%gt_m = alloca i32, align 4
%stu_m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %up_h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %up_m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %gt_h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %gt_m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %stu_m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %up_h, ptr noundef nonnull %up_m, ptr noundef nonnull %gt_h, ptr noundef nonnull %gt_m, ptr noundef nonnull %stu_m)
%0 = load i32, ptr %gt_h, align 4, !tbaa !5
%1 = load i32, ptr %up_h, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%mul = mul nsw i32 %sub, 60
%2 = load i32, ptr %gt_m, align 4, !tbaa !5
%3 = load i32, ptr %up_m, align 4, !tbaa !5
%4 = load i32, ptr %stu_m, 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 %stu_m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %gt_m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %gt_h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %up_m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %up_h) #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);
printf("%d\n", 60 * h2 + m2 - 60 * h1 - m1 - k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239087/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239087/source.c"
target datalayout = "e-m:e-p270: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
%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 %m2, align 4, !tbaa !5
%2 = load i32, ptr %h1, align 4, !tbaa !5
%3 = load i32, ptr %m1, 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
%sub = sub i32 %1, %5
%sub3 = add i32 %sub, %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 %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<math.h>
double x[20],y[20];
double d(int a,int b){
double ans;
ans=sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
return ans;
}
double tri(int f,int s,int t){
double sum,da=d(f,s),db=d(s,t),dc=d(t,f);
double S;
S=(da+db+dc)/2;
sum=sqrt(S*(S-da)*(S-db)*(S-dc));
return sum;
}
int main(){
int n,i,f,s,t;
double d,ans=0;
for(i=0;scanf("%lf,%lf",&x[i],&y[i])!=EOF;i++);
n=i;
for(f=0,s=1,t=2;t!=n;s++,t++){
ans+=tri(f,s,t);
}
printf("%f\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239144/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239144/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@x = dso_local global [20 x double] zeroinitializer, align 16
@y = dso_local global [20 x double] zeroinitializer, align 16
@.str = private unnamed_addr constant [8 x i8] c"%lf,%lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local double @d(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %idxprom
%0 = load double, ptr %arrayidx, align 8, !tbaa !5
%idxprom1 = sext i32 %b to i64
%arrayidx2 = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %idxprom1
%1 = load double, ptr %arrayidx2, align 8, !tbaa !5
%sub = fsub double %0, %1
%arrayidx9 = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %idxprom
%2 = load double, ptr %arrayidx9, align 8, !tbaa !5
%arrayidx11 = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %idxprom1
%3 = load double, ptr %arrayidx11, align 8, !tbaa !5
%sub12 = fsub double %2, %3
%mul18 = fmul double %sub12, %sub12
%4 = tail call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul18)
%sqrt = tail call double @llvm.sqrt.f64(double %4)
ret double %sqrt
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local double @tri(i32 noundef %f, i32 noundef %s, i32 noundef %t) local_unnamed_addr #3 {
entry:
%idxprom.i = sext i32 %f to i64
%arrayidx.i = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %idxprom.i
%0 = load double, ptr %arrayidx.i, align 8, !tbaa !5
%idxprom1.i = sext i32 %s to i64
%arrayidx2.i = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %idxprom1.i
%1 = load double, ptr %arrayidx2.i, align 8, !tbaa !5
%sub.i = fsub double %0, %1
%arrayidx9.i = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %idxprom.i
%2 = load double, ptr %arrayidx9.i, align 8, !tbaa !5
%arrayidx11.i = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %idxprom1.i
%3 = load double, ptr %arrayidx11.i, align 8, !tbaa !5
%sub12.i = fsub double %2, %3
%mul18.i = fmul double %sub12.i, %sub12.i
%4 = tail call double @llvm.fmuladd.f64(double %sub.i, double %sub.i, double %mul18.i)
%sqrt.i = tail call double @llvm.sqrt.f64(double %4)
%idxprom1.i20 = sext i32 %t to i64
%arrayidx2.i21 = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %idxprom1.i20
%5 = load double, ptr %arrayidx2.i21, align 8, !tbaa !5
%arrayidx11.i24 = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %idxprom1.i20
%6 = load double, ptr %arrayidx11.i24, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %5, i64 0
%8 = insertelement <2 x double> %7, double %1, i64 1
%9 = insertelement <2 x double> poison, double %0, i64 0
%10 = insertelement <2 x double> %9, double %5, i64 1
%11 = fsub <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %6, i64 0
%13 = insertelement <2 x double> %12, double %3, i64 1
%14 = insertelement <2 x double> poison, double %2, i64 0
%15 = insertelement <2 x double> %14, double %6, i64 1
%16 = fsub <2 x double> %13, %15
%17 = fmul <2 x double> %16, %16
%18 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %11, <2 x double> %17)
%19 = tail call <2 x double> @llvm.sqrt.v2f64(<2 x double> %18)
%20 = extractelement <2 x double> %19, i64 1
%add = fadd double %sqrt.i, %20
%21 = extractelement <2 x double> %19, i64 0
%add3 = fadd double %21, %add
%div = fmul double %add3, 5.000000e-01
%sub = fsub double %div, %sqrt.i
%mul = fmul double %div, %sub
%22 = insertelement <2 x double> poison, double %div, 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
%mul5 = fmul double %25, %mul
%26 = extractelement <2 x double> %24, i64 0
%mul7 = fmul double %26, %mul5
%call8 = tail call double @sqrt(double noundef %mul7) #7
ret double %call8
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %indvars.iv
%call = tail 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
br i1 %cmp.not, label %for.cond3.preheader, label %for.cond, !llvm.loop !9
for.cond3.preheader: ; preds = %for.cond
%0 = and i64 %indvars.iv, 4294967295
%cmp4.not19 = icmp eq i64 %0, 2
br i1 %cmp4.not19, label %for.end10, label %for.body5.preheader
for.body5.preheader: ; preds = %for.cond3.preheader
%1 = and i64 %indvars.iv, 4294967295
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv26 = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next27, %for.body5 ]
%indvars.iv24 = phi i64 [ 2, %for.body5.preheader ], [ %indvars.iv.next25, %for.body5 ]
%ans.022 = phi double [ 0.000000e+00, %for.body5.preheader ], [ %add, %for.body5 ]
%2 = load double, ptr @x, align 16, !tbaa !5
%arrayidx2.i.i = getelementptr inbounds [20 x double], ptr @x, i64 0, i64 %indvars.iv26
%3 = load double, ptr @y, align 16, !tbaa !5
%arrayidx11.i.i = getelementptr inbounds [20 x double], ptr @y, i64 0, i64 %indvars.iv26
%4 = load <2 x double>, ptr %arrayidx2.i.i, align 8, !tbaa !5
%5 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%6 = extractelement <2 x double> %4, i64 0
%sub.i.i = fsub double %2, %6
%7 = load <2 x double>, ptr %arrayidx11.i.i, align 8, !tbaa !5
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%9 = extractelement <2 x double> %7, i64 0
%sub12.i.i = fsub double %3, %9
%mul18.i.i = fmul double %sub12.i.i, %sub12.i.i
%10 = tail call double @llvm.fmuladd.f64(double %sub.i.i, double %sub.i.i, double %mul18.i.i)
%sqrt.i.i = tail call double @llvm.sqrt.f64(double %10)
%11 = insertelement <2 x double> %4, double %2, i64 0
%12 = fsub <2 x double> %5, %11
%13 = insertelement <2 x double> %7, double %3, i64 0
%14 = fsub <2 x double> %8, %13
%15 = fmul <2 x double> %14, %14
%16 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %12, <2 x double> %15)
%17 = tail call <2 x double> @llvm.sqrt.v2f64(<2 x double> %16)
%18 = extractelement <2 x double> %17, i64 1
%add.i = fadd double %sqrt.i.i, %18
%19 = extractelement <2 x double> %17, i64 0
%add3.i = fadd double %19, %add.i
%div.i = fmul double %add3.i, 5.000000e-01
%sub.i = fsub double %div.i, %sqrt.i.i
%mul.i = fmul double %div.i, %sub.i
%20 = insertelement <2 x double> poison, double %div.i, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = fsub <2 x double> %21, %17
%23 = extractelement <2 x double> %22, i64 1
%mul5.i = fmul double %23, %mul.i
%24 = extractelement <2 x double> %22, i64 0
%mul7.i = fmul double %24, %mul5.i
%call8.i = tail call double @sqrt(double noundef %mul7.i) #7
%add = fadd double %ans.022, %call8.i
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
%cmp4.not = icmp eq i64 %indvars.iv.next25, %1
br i1 %cmp4.not, label %for.end10, label %for.body5, !llvm.loop !11
for.end10: ; preds = %for.body5, %for.cond3.preheader
%ans.0.lcssa = phi double [ 0.000000e+00, %for.cond3.preheader ], [ %add, %for.body5 ]
%call11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %ans.0.lcssa)
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 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: write, inaccessiblemem: 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 #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"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define N 20
int main(){
int i,n=0;
double dx[N],dy[N];
double x,y,sum=0;
while (scanf("%lf,%lf",&dx[n],&dy[n])!=EOF)
n++;
dx[n]=dx[0];
dy[n]=dy[0];
for (i=0;i<n;i++)
sum+=(dx[i]-dx[i+1])*(dy[i]+dy[i+1]);
printf("%f\n",sum/2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239201/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239201/source.c"
target datalayout = "e-m:e-p270: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 [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%dx = alloca [20 x double], align 16
%dy = alloca [20 x double], align 16
call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %dx) #4
call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %dy) #4
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv40 = phi i32 [ %indvars.iv.next41, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x double], ptr %dx, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [20 x double], ptr %dy, i64 0, 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.next41 = add nuw i32 %indvars.iv40, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !5
while.end: ; preds = %while.cond
%0 = load double, ptr %dx, align 16, !tbaa !7
store double %0, ptr %arrayidx, align 8, !tbaa !7
%1 = load double, ptr %dy, align 16, !tbaa !7
store double %1, ptr %arrayidx2, align 8, !tbaa !7
%2 = and i64 %indvars.iv, 4294967295
%cmp933.not = icmp eq i64 %2, 0
br i1 %cmp933.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %indvars.iv40 to i64
%.pre = load double, ptr %dx, align 16, !tbaa !7
%.pre42 = load double, ptr %dy, align 16, !tbaa !7
%xtraiter = and i64 %wide.trip.count, 1
%3 = icmp eq i32 %indvars.iv40, 1
br i1 %3, 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
%4 = phi double [ %.pre42, %for.body.preheader.new ], [ %10, %for.body ]
%5 = phi double [ %.pre, %for.body.preheader.new ], [ %9, %for.body ]
%indvars.iv37 = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next38.1, %for.body ]
%sum.035 = phi double [ 0.000000e+00, %for.body.preheader.new ], [ %11, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%indvars.iv.next38 = or i64 %indvars.iv37, 1
%arrayidx13 = getelementptr inbounds [20 x double], ptr %dx, i64 0, i64 %indvars.iv.next38
%6 = load double, ptr %arrayidx13, align 8, !tbaa !7
%sub = fsub double %5, %6
%arrayidx18 = getelementptr inbounds [20 x double], ptr %dy, i64 0, i64 %indvars.iv.next38
%7 = load double, ptr %arrayidx18, align 8, !tbaa !7
%add19 = fadd double %4, %7
%8 = call double @llvm.fmuladd.f64(double %sub, double %add19, double %sum.035)
%indvars.iv.next38.1 = add nuw nsw i64 %indvars.iv37, 2
%arrayidx13.1 = getelementptr inbounds [20 x double], ptr %dx, i64 0, i64 %indvars.iv.next38.1
%9 = load double, ptr %arrayidx13.1, align 16, !tbaa !7
%sub.1 = fsub double %6, %9
%arrayidx18.1 = getelementptr inbounds [20 x double], ptr %dy, i64 0, i64 %indvars.iv.next38.1
%10 = load double, ptr %arrayidx18.1, align 16, !tbaa !7
%add19.1 = fadd double %7, %10
%11 = call double @llvm.fmuladd.f64(double %sub.1, double %add19.1, double %8)
%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.loopexit, label %for.body, !llvm.loop !11
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.body
%12 = add nuw nsw i64 %indvars.iv37, 3
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %11, %for.end.loopexit.unr-lcssa.loopexit ]
%.unr = phi double [ %.pre42, %for.body.preheader ], [ %10, %for.end.loopexit.unr-lcssa.loopexit ]
%.unr43 = phi double [ %.pre, %for.body.preheader ], [ %9, %for.end.loopexit.unr-lcssa.loopexit ]
%indvars.iv37.unr = phi i64 [ 1, %for.body.preheader ], [ %12, %for.end.loopexit.unr-lcssa.loopexit ]
%sum.035.unr = phi double [ 0.000000e+00, %for.body.preheader ], [ %11, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx13.epil = getelementptr inbounds [20 x double], ptr %dx, i64 0, i64 %indvars.iv37.unr
%13 = load double, ptr %arrayidx13.epil, align 8, !tbaa !7
%sub.epil = fsub double %.unr43, %13
%arrayidx18.epil = getelementptr inbounds [20 x double], ptr %dy, i64 0, i64 %indvars.iv37.unr
%14 = load double, ptr %arrayidx18.epil, align 8, !tbaa !7
%add19.epil = fadd double %.unr, %14
%15 = call double @llvm.fmuladd.f64(double %sub.epil, double %add19.epil, double %sum.035.unr)
br label %for.end.loopexit
for.end.loopexit: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%.lcssa = phi double [ %.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %15, %for.body.epil ]
%16 = fmul double %.lcssa, 5.000000e-01
br label %for.end
for.end: ; preds = %for.end.loopexit, %while.end
%sum.0.lcssa = phi double [ 0.000000e+00, %while.end ], [ %16, %for.end.loopexit ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %dy) #4
call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %dx) #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>
int main()
{
int N;
int X;
int price;
scanf("%d\n", &N);
X = N / 1.08;
while (price < N)
{
price = X * 1.08;
X++;
}
X--;
if (price >= (N + 1))
printf(":(\n");
else
printf("%d\n", X);
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239245/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239245/source.c"
target datalayout = "e-m:e-p270: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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
if.end:
%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
%conv = sitofp i32 %0 to double
%div = fdiv double %conv, 1.080000e+00
%conv1 = fptosi double %div to i32
%dec = add nsw i32 %conv1, -1
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %dec)
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(){
double N,M,X;
scanf("%lf", &N);
X = ceil(N / 1.08);
M = floor(1.08 * X);
if(M == N){
printf("%.0lf", X);
}else{
printf(":(");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239302/source.c"
target datalayout = "e-m:e-p270: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 [6 x i8] c"%.0lf\00", align 1
@.str.2 = 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) #4
%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)
%mul = fmul double %1, 1.080000e+00
%2 = call double @llvm.floor.f64(double %mul)
%cmp = fcmp oeq double %2, %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, double noundef %1)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
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: 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
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#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 INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
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);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
int a,b;
int main(){
scanf("%d",&a);
rep(i,0,50000){
if(i*108/100==a){
printf("%d",i);
return 0;
}
}
printf(":(");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239346/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c":(\00", align 1
@b = dso_local local_unnamed_addr global i32 0, align 4
; 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) #0 {
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) #0 {
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 #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #5
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #5
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @pom(i64 noundef %a, i64 noundef %n, i32 noundef %m) local_unnamed_addr #3 {
entry:
%conv = sext i32 %m to i64
%tobool.not16 = icmp eq i64 %n, 0
br i1 %tobool.not16, label %for.end, label %for.body
for.body: ; preds = %entry, %cond.end
%mul4.pn = phi i64 [ %mul4, %cond.end ], [ %a, %entry ]
%x.018 = phi i64 [ %x.1, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %div, %cond.end ], [ %n, %entry ]
%a.addr.019 = srem i64 %mul4.pn, %conv
%and = and i64 %n.addr.017, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %cond.end, label %cond.true
cond.true: ; preds = %for.body
%mul = mul nsw i64 %a.addr.019, %x.018
%rem3 = srem i64 %mul, %conv
br label %cond.end
cond.end: ; preds = %for.body, %cond.true
%x.1 = phi i64 [ %rem3, %cond.true ], [ %x.018, %for.body ]
%mul4 = mul nsw i64 %a.addr.019, %a.addr.019
%div = sdiv i64 %n.addr.017, 2
%n.addr.017.off = add i64 %n.addr.017, 1
%tobool.not = icmp ult i64 %n.addr.017.off, 3
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %cond.end, %entry
%x.0.lcssa = phi i64 [ 1, %entry ], [ %x.1, %cond.end ]
ret i64 %x.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
%0 = load i32, ptr @a, align 4, !tbaa !11
br label %for.body
for.body: ; preds = %for.inc.1, %entry
%i.013 = phi i64 [ 0, %entry ], [ %inc.1, %for.inc.1 ]
%1 = trunc i64 %i.013 to i32
%div.lhs.trunc = mul nuw nsw i32 %1, 108
%div11 = udiv i32 %div.lhs.trunc, 100
%cmp1 = icmp eq i32 %div11, %0
br i1 %cmp1, label %cleanup, label %for.inc
for.inc: ; preds = %for.body
%inc = or i64 %i.013, 1
%2 = trunc i64 %inc to i32
%div.lhs.trunc.1 = mul nuw nsw i32 %2, 108
%div11.1 = udiv i32 %div.lhs.trunc.1, 100
%cmp1.1 = icmp eq i32 %div11.1, %0
br i1 %cmp1.1, label %cleanup, label %for.inc.1
for.inc.1: ; preds = %for.inc
%inc.1 = add nuw nsw i64 %i.013, 2
%exitcond.not.1 = icmp eq i64 %inc.1, 50000
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !13
cleanup: ; preds = %for.inc, %for.body
%i.013.lcssa = phi i64 [ %i.013, %for.body ], [ %inc, %for.inc ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %i.013.lcssa)
br label %return
for.end: ; preds = %for.inc.1
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %return
return: ; preds = %cleanup, %for.end
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(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int i,j,k,n,m,l,x,y,route[2][21][21];
int main(){
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(i!=j)route[0][i][j]=999999999;
}
}
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d,%d,%d,%d",&j,&k,&x,&y);
route[0][j-1][k-1]=x;
route[0][k-1][j-1]=y;
}
for(l=1;pow(2.0,l-1)<n-1;l++){
for(i=0;i<n;i++){
for(j=0;j<n;j++){
route[l%2][i][j]=route[(l+1)%2][i][j];
for(k=0;k<n;k++){
if(route[l%2][i][j]>route[(l+1)%2][i][k]+route[(l+1)%2][k][j]){
route[l%2][i][j]=route[(l+1)%2][i][k]+route[(l+1)%2][k][j];
}
}
}
}
}
l=(l-1)%2;
scanf("%d,%d,%d,%d",&x,&y,&j,&k);
printf("%d\n",j-k-route[l][x-1][y-1]-route[l][y-1][x-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239397/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239397/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local global i32 0, align 4
@route = dso_local local_unnamed_addr global [2 x [21 x [21 x i32]]] zeroinitializer, align 16
@m = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [12 x i8] c"%d,%d,%d,%d\00", align 1
@k = dso_local global i32 0, align 4
@x = dso_local global i32 0, align 4
@y = dso_local global i32 0, align 4
@l = dso_local local_unnamed_addr global i32 0, align 4
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp164 = icmp sgt i32 %0, 0
br i1 %cmp164, label %for.cond1.preheader.us.preheader, label %for.end9
for.cond1.preheader.us.preheader: ; preds = %entry
%wide.trip.count192 = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count192, 1
%1 = icmp eq i32 %0, 1
%unroll_iter = and i64 %wide.trip.count192, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc7_crit_edge.us
%indvars.iv189 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next190, %for.cond1.for.inc7_crit_edge.us ]
br i1 %1, label %for.cond1.for.inc7_crit_edge.us.unr-lcssa, label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.inc.us.1
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.us.1 ], [ 0, %for.cond1.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc.us.1 ], [ 0, %for.cond1.preheader.us ]
%cmp4.not.us = icmp eq i64 %indvars.iv189, %indvars.iv
br i1 %cmp4.not.us, label %for.inc.us, label %if.then.us
if.then.us: ; preds = %for.body3.us
%arrayidx6.us = getelementptr inbounds [21 x [21 x i32]], ptr @route, i64 0, i64 %indvars.iv189, i64 %indvars.iv
store i32 999999999, ptr %arrayidx6.us, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.then.us, %for.body3.us
%indvars.iv.next = or i64 %indvars.iv, 1
%cmp4.not.us.1 = icmp eq i64 %indvars.iv189, %indvars.iv.next
br i1 %cmp4.not.us.1, label %for.inc.us.1, label %if.then.us.1
if.then.us.1: ; preds = %for.inc.us
%arrayidx6.us.1 = getelementptr inbounds [21 x [21 x i32]], ptr @route, i64 0, i64 %indvars.iv189, i64 %indvars.iv.next
store i32 999999999, ptr %arrayidx6.us.1, align 4, !tbaa !5
br label %for.inc.us.1
for.inc.us.1: ; preds = %if.then.us.1, %for.inc.us
%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.cond1.for.inc7_crit_edge.us.unr-lcssa, label %for.body3.us, !llvm.loop !9
for.cond1.for.inc7_crit_edge.us.unr-lcssa: ; preds = %for.inc.us.1, %for.cond1.preheader.us
%indvars.iv.unr = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next.1, %for.inc.us.1 ]
%cmp4.not.us.epil = icmp eq i64 %indvars.iv189, %indvars.iv.unr
%or.cond = select i1 %lcmp.mod.not, i1 true, i1 %cmp4.not.us.epil
br i1 %or.cond, label %for.cond1.for.inc7_crit_edge.us, label %if.then.us.epil
if.then.us.epil: ; preds = %for.cond1.for.inc7_crit_edge.us.unr-lcssa
%arrayidx6.us.epil = getelementptr inbounds [21 x [21 x i32]], ptr @route, i64 0, i64 %indvars.iv189, i64 %indvars.iv.unr
store i32 999999999, ptr %arrayidx6.us.epil, align 4, !tbaa !5
br label %for.cond1.for.inc7_crit_edge.us
for.cond1.for.inc7_crit_edge.us: ; preds = %if.then.us.epil, %for.cond1.for.inc7_crit_edge.us.unr-lcssa
%indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1
%exitcond193.not = icmp eq i64 %indvars.iv.next190, %wide.trip.count192
br i1 %exitcond193.not, label %for.cond.for.end9_crit_edge, label %for.cond1.preheader.us, !llvm.loop !11
for.cond.for.end9_crit_edge: ; preds = %for.cond1.for.inc7_crit_edge.us
store i32 %0, ptr @j, align 4, !tbaa !5
br label %for.end9
for.end9: ; preds = %for.cond.for.end9_crit_edge, %entry
%storemerge.lcssa = phi i32 [ %0, %for.cond.for.end9_crit_edge ], [ 0, %entry ]
store i32 %storemerge.lcssa, ptr @i, align 4, !tbaa !5
%call10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
store i32 0, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @m, align 4, !tbaa !5
%cmp12168 = icmp sgt i32 %2, 0
br i1 %cmp12168, label %for.body13, label %for.cond29.preheader
for.cond29.preheader: ; preds = %for.body13, %for.end9
store i32 1, ptr @l, align 4, !tbaa !5
%ldexp184 = tail call double @ldexp(double 1.000000e+00, i32 0) #3
%3 = load i32, ptr @n, align 4, !tbaa !5
%sub32185 = add nsw i32 %3, -1
%conv33186 = sitofp i32 %sub32185 to double
%cmp34187 = fcmp olt double %ldexp184, %conv33186
br i1 %cmp34187, label %for.cond37.preheader, label %for.end125
for.body13: ; preds = %for.end9, %for.body13
%call14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @j, ptr noundef nonnull @k, ptr noundef nonnull @x, ptr noundef nonnull @y)
%4 = load i32, ptr @x, align 4, !tbaa !5
%5 = load i32, ptr @j, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%idxprom15 = sext i32 %sub to i64
%6 = load i32, ptr @k, align 4, !tbaa !5
%sub17 = add nsw i32 %6, -1
%idxprom18 = sext i32 %sub17 to i64
%arrayidx19 = getelementptr inbounds [21 x [21 x i32]], ptr @route, i64 0, i64 %idxprom15, i64 %idxprom18
store i32 %4, ptr %arrayidx19, align 4, !tbaa !5
%7 = load i32, ptr @y, align 4, !tbaa !5
%arrayidx25 = getelementptr inbounds [21 x [21 x i32]], ptr @route, i64 0, i64 %idxprom18, i64 %idxprom15
store i32 %7, ptr %arrayidx25, align 4, !tbaa !5
%8 = load i32, ptr @i, align 4, !tbaa !5
%inc27 = add nsw i32 %8, 1
store i32 %inc27, ptr @i, align 4, !tbaa !5
%9 = load i32, ptr @m, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc27, %9
br i1 %cmp12, label %for.body13, label %for.cond29.preheader, !llvm.loop !12
for.cond37.preheader: ; preds = %for.cond29.preheader, %for.inc123
%10 = phi i32 [ %19, %for.inc123 ], [ %3, %for.cond29.preheader ]
%cmp38179 = icmp sgt i32 %10, 0
%.pre = load i32, ptr @l, align 4
%add = add nsw i32 %.pre, 1
br i1 %cmp38179, label %for.cond41.preheader.lr.ph, label %for.inc123
for.cond41.preheader.lr.ph: ; preds = %for.cond37.preheader
%rem = srem i32 %add, 2
%idxprom45 = sext i32 %rem to i64
%rem51 = srem i32 %.pre, 2
%idxprom52 = sext i32 %rem51 to i64
%wide.trip.count207 = zext i32 %10 to i64
%xtraiter210 = and i64 %wide.trip.count207, 1
%11 = icmp eq i32 %10, 1
%unroll_iter212 = and i64 %wide.trip.count207, 4294967294
%lcmp.mod211.not = icmp eq i64 %xtraiter210, 0
br label %for.cond41.preheader.us
for.cond41.preheader.us: ; preds = %for.cond41.for.inc120_crit_edge.split.us.us, %for.cond41.preheader.lr.ph
%indvars.iv204 = phi i64 [ %indvars.iv.next205, %for.cond41.for.inc120_crit_edge.split.us.us ], [ 0, %for.cond41.preheader.lr.ph ]
br label %for.body44.us.us
for.body44.us.us: ; preds = %for.cond58.for.inc117_crit_edge.us.us, %for.cond41.preheader.us
%indvars.iv199 = phi i64 [ %indvars.iv.next200, %for.cond58.for.inc117_crit_edge.us.us ], [ 0, %for.cond41.preheader.us ]
%arrayidx50.us.us = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv204, i64 %indvars.iv199
%12 = load i32, ptr %arrayidx50.us.us, align 4, !tbaa !5
%arrayidx57.us.us = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom52, i64 %indvars.iv204, i64 %indvars.iv199
store i32 %12, ptr %arrayidx57.us.us, align 4, !tbaa !5
br i1 %11, label %for.cond58.for.inc117_crit_edge.us.us.unr-lcssa, label %for.body61.us.us
for.body61.us.us: ; preds = %for.body44.us.us, %for.inc114.us.us.1
%indvars.iv194 = phi i64 [ %indvars.iv.next195.1, %for.inc114.us.us.1 ], [ 0, %for.body44.us.us ]
%add85172.us.us = phi i32 [ %add85171.us.us.1, %for.inc114.us.us.1 ], [ %12, %for.body44.us.us ]
%niter213 = phi i64 [ %niter213.next.1, %for.inc114.us.us.1 ], [ 0, %for.body44.us.us ]
%arrayidx76.us.us = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv204, i64 %indvars.iv194
%13 = load i32, ptr %arrayidx76.us.us, align 4, !tbaa !5
%arrayidx84.us.us = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv194, i64 %indvars.iv199
%14 = load i32, ptr %arrayidx84.us.us, align 4, !tbaa !5
%add85.us.us = add nsw i32 %14, %13
%cmp86.us.us = icmp sgt i32 %add85172.us.us, %add85.us.us
br i1 %cmp86.us.us, label %if.then88.us.us, label %for.inc114.us.us
if.then88.us.us: ; preds = %for.body61.us.us
store i32 %add85.us.us, ptr %arrayidx57.us.us, align 4, !tbaa !5
br label %for.inc114.us.us
for.inc114.us.us: ; preds = %if.then88.us.us, %for.body61.us.us
%add85171.us.us = phi i32 [ %add85172.us.us, %for.body61.us.us ], [ %add85.us.us, %if.then88.us.us ]
%indvars.iv.next195 = or i64 %indvars.iv194, 1
%arrayidx76.us.us.1 = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv204, i64 %indvars.iv.next195
%15 = load i32, ptr %arrayidx76.us.us.1, align 4, !tbaa !5
%arrayidx84.us.us.1 = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv.next195, i64 %indvars.iv199
%16 = load i32, ptr %arrayidx84.us.us.1, align 4, !tbaa !5
%add85.us.us.1 = add nsw i32 %16, %15
%cmp86.us.us.1 = icmp sgt i32 %add85171.us.us, %add85.us.us.1
br i1 %cmp86.us.us.1, label %if.then88.us.us.1, label %for.inc114.us.us.1
if.then88.us.us.1: ; preds = %for.inc114.us.us
store i32 %add85.us.us.1, ptr %arrayidx57.us.us, align 4, !tbaa !5
br label %for.inc114.us.us.1
for.inc114.us.us.1: ; preds = %if.then88.us.us.1, %for.inc114.us.us
%add85171.us.us.1 = phi i32 [ %add85171.us.us, %for.inc114.us.us ], [ %add85.us.us.1, %if.then88.us.us.1 ]
%indvars.iv.next195.1 = add nuw nsw i64 %indvars.iv194, 2
%niter213.next.1 = add i64 %niter213, 2
%niter213.ncmp.1 = icmp eq i64 %niter213.next.1, %unroll_iter212
br i1 %niter213.ncmp.1, label %for.cond58.for.inc117_crit_edge.us.us.unr-lcssa, label %for.body61.us.us, !llvm.loop !13
for.cond58.for.inc117_crit_edge.us.us.unr-lcssa: ; preds = %for.inc114.us.us.1, %for.body44.us.us
%indvars.iv194.unr = phi i64 [ 0, %for.body44.us.us ], [ %indvars.iv.next195.1, %for.inc114.us.us.1 ]
%add85172.us.us.unr = phi i32 [ %12, %for.body44.us.us ], [ %add85171.us.us.1, %for.inc114.us.us.1 ]
br i1 %lcmp.mod211.not, label %for.cond58.for.inc117_crit_edge.us.us, label %for.body61.us.us.epil
for.body61.us.us.epil: ; preds = %for.cond58.for.inc117_crit_edge.us.us.unr-lcssa
%arrayidx76.us.us.epil = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv204, i64 %indvars.iv194.unr
%17 = load i32, ptr %arrayidx76.us.us.epil, align 4, !tbaa !5
%arrayidx84.us.us.epil = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom45, i64 %indvars.iv194.unr, i64 %indvars.iv199
%18 = load i32, ptr %arrayidx84.us.us.epil, align 4, !tbaa !5
%add85.us.us.epil = add nsw i32 %18, %17
%cmp86.us.us.epil = icmp sgt i32 %add85172.us.us.unr, %add85.us.us.epil
br i1 %cmp86.us.us.epil, label %if.then88.us.us.epil, label %for.cond58.for.inc117_crit_edge.us.us
if.then88.us.us.epil: ; preds = %for.body61.us.us.epil
store i32 %add85.us.us.epil, ptr %arrayidx57.us.us, align 4, !tbaa !5
br label %for.cond58.for.inc117_crit_edge.us.us
for.cond58.for.inc117_crit_edge.us.us: ; preds = %for.body61.us.us.epil, %if.then88.us.us.epil, %for.cond58.for.inc117_crit_edge.us.us.unr-lcssa
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%exitcond203.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count207
br i1 %exitcond203.not, label %for.cond41.for.inc120_crit_edge.split.us.us, label %for.body44.us.us, !llvm.loop !14
for.cond41.for.inc120_crit_edge.split.us.us: ; preds = %for.cond58.for.inc117_crit_edge.us.us
%indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
%exitcond208.not = icmp eq i64 %indvars.iv.next205, %wide.trip.count207
br i1 %exitcond208.not, label %for.cond37.for.inc123_crit_edge.split.us, label %for.cond41.preheader.us, !llvm.loop !15
for.cond37.for.inc123_crit_edge.split.us: ; preds = %for.cond41.for.inc120_crit_edge.split.us.us
store i32 %10, ptr @k, align 4, !tbaa !5
store i32 %10, ptr @j, align 4, !tbaa !5
br label %for.inc123
for.inc123: ; preds = %for.cond37.preheader, %for.cond37.for.inc123_crit_edge.split.us
%storemerge154.lcssa = phi i32 [ %10, %for.cond37.for.inc123_crit_edge.split.us ], [ 0, %for.cond37.preheader ]
store i32 %storemerge154.lcssa, ptr @i, align 4, !tbaa !5
store i32 %add, ptr @l, align 4, !tbaa !5
%ldexp = tail call double @ldexp(double 1.000000e+00, i32 %.pre) #3
%19 = load i32, ptr @n, align 4, !tbaa !5
%sub32 = add nsw i32 %19, -1
%conv33 = sitofp i32 %sub32 to double
%cmp34 = fcmp olt double %ldexp, %conv33
br i1 %cmp34, label %for.cond37.preheader, label %for.end125, !llvm.loop !16
for.end125: ; preds = %for.inc123, %for.cond29.preheader
%20 = load i32, ptr @l, align 4, !tbaa !5
%sub126 = add nsw i32 %20, -1
%rem127 = srem i32 %sub126, 2
store i32 %rem127, ptr @l, align 4, !tbaa !5
%call128 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x, ptr noundef nonnull @y, ptr noundef nonnull @j, ptr noundef nonnull @k)
%21 = load i32, ptr @j, align 4, !tbaa !5
%22 = load i32, ptr @k, align 4, !tbaa !5
%23 = load i32, ptr @l, align 4, !tbaa !5
%idxprom130 = sext i32 %23 to i64
%24 = load i32, ptr @x, align 4, !tbaa !5
%sub132 = add nsw i32 %24, -1
%idxprom133 = sext i32 %sub132 to i64
%25 = load i32, ptr @y, align 4, !tbaa !5
%sub135 = add nsw i32 %25, -1
%idxprom136 = sext i32 %sub135 to i64
%arrayidx137 = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom130, i64 %idxprom133, i64 %idxprom136
%26 = load i32, ptr %arrayidx137, align 4, !tbaa !5
%arrayidx146 = getelementptr inbounds [2 x [21 x [21 x i32]]], ptr @route, i64 0, i64 %idxprom130, i64 %idxprom136, i64 %idxprom133
%27 = load i32, ptr %arrayidx146, align 4, !tbaa !5
%28 = add i32 %22, %26
%29 = add i32 %28, %27
%sub147 = sub i32 %21, %29
%call148 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub147)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree willreturn }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d",&a);
b=a/3600;
c=a%3600/60;
d=a%3600%60;
printf("%d:%d:%d\n",b,c,d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239447/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239447/source.c"
target datalayout = "e-m:e-p270: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:
%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
%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 %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int S,h,m,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_239490/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239490/source.c"
target datalayout = "e-m:e-p270: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"}
|
#include<stdio.h>
int main(void){
int S,h,m,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_239540/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239540/source.c"
target datalayout = "e-m:e-p270: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"}
|
#include <stdio.h>
int main(void)
{
int t, sec, min, hour;
scanf("%d", &t);
sec = t % 60;
t = (t - sec) / 60;
min = t % 60;
hour = (t - min) / 60;
printf("%d:%d:%d\n", hour, min, sec);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239584/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239584/source.c"
target datalayout = "e-m:e-p270: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:
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%rem = srem i32 %0, 60
%div = sdiv i32 %0, 60
store i32 %div, ptr %t, align 4, !tbaa !5
%rem1 = srem i32 %div, 60
%div3 = sdiv i32 %0, 3600
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div3, i32 noundef %rem1, i32 noundef %rem)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int h,m,s;
scanf("%d",&s);
h=s/3600;
s=s%3600;
m=s/60;
s=s%60;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239627/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239627/source.c"
target datalayout = "e-m:e-p270: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
%div14 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div14 to i32
%rem25 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem25 to i32
store i32 %rem2.sext, ptr %s, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.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(void){
int S;
scanf("%d",&S);
printf("%d:%d:%d\n",S/3600,(S/60)%60,S%60);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239670/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239670/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %0, 60
%rem = srem i32 %div1, 60
%rem2 = srem i32 %0, 60
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %rem, i32 noundef %rem2)
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;
m = (S - h*3600)/60;
s = S - h*3600 -m* 60;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239713/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239713/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %sub, 60
%mul4.neg = mul nsw i32 %div1, -60
%sub5 = add i32 %mul4.neg, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub5)
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(void)
{
int S,a,b,c,d;
scanf("%d",&S);
a=S/3600;
b=S%3600;
c=b/60;
d=b%60;
printf("%d:%d:%d\n",a,c,d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239757/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239757/source.c"
target datalayout = "e-m:e-p270: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
%rem26 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem26 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.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>
#include <string.h>
#include <stdbool.h>
#define MAX 4010
#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
int S[4010][4010];
void Generate(){
int i, j;
S[0][0] = 1;
for (i = 1; i < MAX; i++){
S[i][0] = 0;
for (j = 1; j <= i; j++){
S[i][j] = ( ((long long)S[i - 1][j] * j) + S[i - 1][j - 1]) % MOD;
}
}
}
int F(int n){
int k;
long long x, res = 0;
for (k = 1; k <= n; k++){
x = S[n][k];
res = (res + (x * k)) % MOD;
}
return res;
}
int main(){
Generate();
int n;
while (scanf("%d", &n) != EOF){
printf("%d\n", F(n));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23980/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23980/source.c"
target datalayout = "e-m:e-p270: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 [4010 x [4010 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Generate() local_unnamed_addr #0 {
entry:
store i32 1, ptr @S, align 16, !tbaa !5
br label %for.body
for.body: ; preds = %entry, %for.inc22
%indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.inc22 ]
%indvars.iv44 = phi i64 [ 1, %entry ], [ %indvars.iv.next45, %for.inc22 ]
%arrayidx = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44
store i32 0, ptr %arrayidx, align 8, !tbaa !5
%0 = add nsw i64 %indvars.iv44, -1
%arrayidx15.phi.trans.insert = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %0, i64 0
%.pre = load i32, ptr %arrayidx15.phi.trans.insert, align 8, !tbaa !5
%xtraiter = and i64 %indvars.iv44, 1
%1 = icmp eq i64 %indvar, 0
br i1 %1, label %for.inc22.unr-lcssa, label %for.body.new
for.body.new: ; preds = %for.body
%unroll_iter = and i64 %indvars.iv44, 9223372036854775806
br label %for.body4
for.body4: ; preds = %for.body4, %for.body.new
%2 = phi i32 [ %.pre, %for.body.new ], [ %4, %for.body4 ]
%indvars.iv = phi i64 [ 1, %for.body.new ], [ %indvars.iv.next.1, %for.body4 ]
%niter = phi i64 [ 0, %for.body.new ], [ %niter.next.1, %for.body4 ]
%arrayidx8 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%conv = sext i32 %3 to i64
%mul = mul nsw i64 %indvars.iv, %conv
%conv16 = sext i32 %2 to i64
%add = add nsw i64 %mul, %conv16
%rem = srem i64 %add, 1000000007
%conv17 = trunc i64 %rem to i32
%arrayidx21 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44, i64 %indvars.iv
store i32 %conv17, ptr %arrayidx21, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx8.1 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %0, i64 %indvars.iv.next
%4 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%conv.1 = sext i32 %4 to i64
%mul.1 = mul nsw i64 %indvars.iv.next, %conv.1
%conv16.1 = sext i32 %3 to i64
%add.1 = add nsw i64 %mul.1, %conv16.1
%rem.1 = srem i64 %add.1, 1000000007
%conv17.1 = trunc i64 %rem.1 to i32
%arrayidx21.1 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44, i64 %indvars.iv.next
store i32 %conv17.1, ptr %arrayidx21.1, align 4, !tbaa !5
%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.inc22.unr-lcssa, label %for.body4, !llvm.loop !9
for.inc22.unr-lcssa: ; preds = %for.body4, %for.body
%.unr = phi i32 [ %.pre, %for.body ], [ %4, %for.body4 ]
%indvars.iv.unr = phi i64 [ 1, %for.body ], [ %indvars.iv.next.1, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc22, label %for.body4.epil
for.body4.epil: ; preds = %for.inc22.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %0, i64 %indvars.iv.unr
%5 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%conv.epil = sext i32 %5 to i64
%mul.epil = mul nsw i64 %indvars.iv.unr, %conv.epil
%conv16.epil = sext i32 %.unr to i64
%add.epil = add nsw i64 %mul.epil, %conv16.epil
%rem.epil = srem i64 %add.epil, 1000000007
%conv17.epil = trunc i64 %rem.epil to i32
%arrayidx21.epil = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44, i64 %indvars.iv.unr
store i32 %conv17.epil, ptr %arrayidx21.epil, align 4, !tbaa !5
br label %for.inc22
for.inc22: ; preds = %for.inc22.unr-lcssa, %for.body4.epil
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next45, 4010
%indvar.next = add i64 %indvar, 1
br i1 %exitcond50.not, label %for.end24, label %for.body, !llvm.loop !11
for.end24: ; preds = %for.inc22
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @F(i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp.not10 = icmp slt i32 %n, 1
br i1 %cmp.not10, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%idxprom = zext i32 %n to i64
%0 = zext i32 %n to i64
%xtraiter = and i64 %0, 1
%1 = icmp eq i32 %n, 1
br i1 %1, 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 %0, 4294967294
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%indvars.iv = phi i64 [ 1, %for.body.lr.ph.new ], [ %indvars.iv.next.1, %for.body ]
%res.012 = phi i64 [ 0, %for.body.lr.ph.new ], [ %rem.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%arrayidx2 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %idxprom, i64 %indvars.iv
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%conv = sext i32 %2 to i64
%mul = mul nsw i64 %indvars.iv, %conv
%add = add nsw i64 %mul, %res.012
%rem = srem i64 %add, 1000000007
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2.1 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %idxprom, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5
%conv.1 = sext i32 %3 to i64
%mul.1 = mul nsw i64 %indvars.iv.next, %conv.1
%add.1 = add nsw i64 %mul.1, %rem
%rem.1 = srem i64 %add.1, 1000000007
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !12
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%rem.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %rem.1, %for.body ]
%indvars.iv.unr = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next.1, %for.body ]
%res.012.unr = phi i64 [ 0, %for.body.lr.ph ], [ %rem.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx2.epil = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %idxprom, i64 %indvars.iv.unr
%4 = load i32, ptr %arrayidx2.epil, align 4, !tbaa !5
%conv.epil = sext i32 %4 to i64
%mul.epil = mul nsw i64 %indvars.iv.unr, %conv.epil
%add.epil = add nsw i64 %mul.epil, %res.012.unr
%rem.epil = srem i64 %add.epil, 1000000007
br label %for.end.loopexit
for.end.loopexit: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%rem.lcssa = phi i64 [ %rem.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ]
%5 = trunc i64 %rem.lcssa to i32
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%res.0.lcssa = phi i32 [ 0, %entry ], [ %5, %for.end.loopexit ]
ret i32 %res.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
store i32 1, ptr @S, align 16, !tbaa !5
br label %for.body.i
for.body.i: ; preds = %for.inc22.i, %entry
%indvar = phi i64 [ %indvar.next, %for.inc22.i ], [ 0, %entry ]
%indvars.iv44.i = phi i64 [ %indvars.iv.next45.i, %for.inc22.i ], [ 1, %entry ]
%0 = add i64 %indvar, 1
%arrayidx.i = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44.i
store i32 0, ptr %arrayidx.i, align 8, !tbaa !5
%1 = add nsw i64 %indvars.iv44.i, -1
%arrayidx15.phi.trans.insert.i = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %1, i64 0
%.pre.i = load i32, ptr %arrayidx15.phi.trans.insert.i, align 8, !tbaa !5
%xtraiter = and i64 %0, 1
%2 = icmp eq i64 %indvar, 0
br i1 %2, label %for.inc22.i.unr-lcssa, label %for.body.i.new
for.body.i.new: ; preds = %for.body.i
%unroll_iter = and i64 %0, -2
br label %for.body4.i
for.body4.i: ; preds = %for.body4.i, %for.body.i.new
%3 = phi i32 [ %.pre.i, %for.body.i.new ], [ %5, %for.body4.i ]
%indvars.iv.i = phi i64 [ 1, %for.body.i.new ], [ %indvars.iv.next.i.1, %for.body4.i ]
%niter = phi i64 [ 0, %for.body.i.new ], [ %niter.next.1, %for.body4.i ]
%arrayidx8.i = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %1, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx8.i, align 4, !tbaa !5
%conv.i = sext i32 %4 to i64
%mul.i = mul nsw i64 %indvars.iv.i, %conv.i
%conv16.i = sext i32 %3 to i64
%add.i = add nsw i64 %mul.i, %conv16.i
%rem.i = srem i64 %add.i, 1000000007
%conv17.i = trunc i64 %rem.i to i32
%arrayidx21.i = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44.i, i64 %indvars.iv.i
store i32 %conv17.i, ptr %arrayidx21.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx8.i.1 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %1, i64 %indvars.iv.next.i
%5 = load i32, ptr %arrayidx8.i.1, align 4, !tbaa !5
%conv.i.1 = sext i32 %5 to i64
%mul.i.1 = mul nsw i64 %indvars.iv.next.i, %conv.i.1
%conv16.i.1 = sext i32 %4 to i64
%add.i.1 = add nsw i64 %mul.i.1, %conv16.i.1
%rem.i.1 = srem i64 %add.i.1, 1000000007
%conv17.i.1 = trunc i64 %rem.i.1 to i32
%arrayidx21.i.1 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44.i, i64 %indvars.iv.next.i
store i32 %conv17.i.1, ptr %arrayidx21.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add nuw i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.inc22.i.unr-lcssa, label %for.body4.i, !llvm.loop !9
for.inc22.i.unr-lcssa: ; preds = %for.body4.i, %for.body.i
%.unr = phi i32 [ %.pre.i, %for.body.i ], [ %5, %for.body4.i ]
%indvars.iv.i.unr = phi i64 [ 1, %for.body.i ], [ %indvars.iv.next.i.1, %for.body4.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc22.i, label %for.body4.i.epil
for.body4.i.epil: ; preds = %for.inc22.i.unr-lcssa
%arrayidx8.i.epil = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %1, i64 %indvars.iv.i.unr
%6 = load i32, ptr %arrayidx8.i.epil, align 4, !tbaa !5
%conv.i.epil = sext i32 %6 to i64
%mul.i.epil = mul nsw i64 %indvars.iv.i.unr, %conv.i.epil
%conv16.i.epil = sext i32 %.unr to i64
%add.i.epil = add nsw i64 %mul.i.epil, %conv16.i.epil
%rem.i.epil = srem i64 %add.i.epil, 1000000007
%conv17.i.epil = trunc i64 %rem.i.epil to i32
%arrayidx21.i.epil = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %indvars.iv44.i, i64 %indvars.iv.i.unr
store i32 %conv17.i.epil, ptr %arrayidx21.i.epil, align 4, !tbaa !5
br label %for.inc22.i
for.inc22.i: ; preds = %for.inc22.i.unr-lcssa, %for.body4.i.epil
%indvars.iv.next45.i = add nuw nsw i64 %indvars.iv44.i, 1
%exitcond50.not.i = icmp eq i64 %indvars.iv.next45.i, 4010
%indvar.next = add i64 %indvar, 1
br i1 %exitcond50.not.i, label %Generate.exit, label %for.body.i, !llvm.loop !11
Generate.exit: ; preds = %for.inc22.i
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end, label %while.body
while.body: ; preds = %Generate.exit, %F.exit
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not10.i = icmp slt i32 %7, 1
br i1 %cmp.not10.i, label %F.exit, label %for.body.lr.ph.i
for.body.lr.ph.i: ; preds = %while.body
%idxprom.i = zext i32 %7 to i64
%8 = zext i32 %7 to i64
%xtraiter13 = and i64 %8, 1
%9 = icmp eq i32 %7, 1
br i1 %9, label %for.end.loopexit.i.unr-lcssa, label %for.body.lr.ph.i.new
for.body.lr.ph.i.new: ; preds = %for.body.lr.ph.i
%unroll_iter16 = and i64 %8, 4294967294
br label %for.body.i3
for.body.i3: ; preds = %for.body.i3, %for.body.lr.ph.i.new
%indvars.iv.i4 = phi i64 [ 1, %for.body.lr.ph.i.new ], [ %indvars.iv.next.i9.1, %for.body.i3 ]
%res.012.i = phi i64 [ 0, %for.body.lr.ph.i.new ], [ %rem.i8.1, %for.body.i3 ]
%niter17 = phi i64 [ 0, %for.body.lr.ph.i.new ], [ %niter17.next.1, %for.body.i3 ]
%arrayidx2.i = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %idxprom.i, i64 %indvars.iv.i4
%10 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%conv.i5 = sext i32 %10 to i64
%mul.i6 = mul nsw i64 %indvars.iv.i4, %conv.i5
%add.i7 = add nsw i64 %mul.i6, %res.012.i
%rem.i8 = srem i64 %add.i7, 1000000007
%indvars.iv.next.i9 = add nuw nsw i64 %indvars.iv.i4, 1
%arrayidx2.i.1 = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %idxprom.i, i64 %indvars.iv.next.i9
%11 = load i32, ptr %arrayidx2.i.1, align 4, !tbaa !5
%conv.i5.1 = sext i32 %11 to i64
%mul.i6.1 = mul nsw i64 %indvars.iv.next.i9, %conv.i5.1
%add.i7.1 = add nsw i64 %mul.i6.1, %rem.i8
%rem.i8.1 = srem i64 %add.i7.1, 1000000007
%indvars.iv.next.i9.1 = add nuw nsw i64 %indvars.iv.i4, 2
%niter17.next.1 = add nuw i64 %niter17, 2
%niter17.ncmp.1 = icmp eq i64 %niter17.next.1, %unroll_iter16
br i1 %niter17.ncmp.1, label %for.end.loopexit.i.unr-lcssa, label %for.body.i3, !llvm.loop !12
for.end.loopexit.i.unr-lcssa: ; preds = %for.body.i3, %for.body.lr.ph.i
%rem.i8.lcssa.ph = phi i64 [ undef, %for.body.lr.ph.i ], [ %rem.i8.1, %for.body.i3 ]
%indvars.iv.i4.unr = phi i64 [ 1, %for.body.lr.ph.i ], [ %indvars.iv.next.i9.1, %for.body.i3 ]
%res.012.i.unr = phi i64 [ 0, %for.body.lr.ph.i ], [ %rem.i8.1, %for.body.i3 ]
%lcmp.mod14.not = icmp eq i64 %xtraiter13, 0
br i1 %lcmp.mod14.not, label %for.end.loopexit.i, label %for.body.i3.epil
for.body.i3.epil: ; preds = %for.end.loopexit.i.unr-lcssa
%arrayidx2.i.epil = getelementptr inbounds [4010 x [4010 x i32]], ptr @S, i64 0, i64 %idxprom.i, i64 %indvars.iv.i4.unr
%12 = load i32, ptr %arrayidx2.i.epil, align 4, !tbaa !5
%conv.i5.epil = sext i32 %12 to i64
%mul.i6.epil = mul nsw i64 %indvars.iv.i4.unr, %conv.i5.epil
%add.i7.epil = add nsw i64 %mul.i6.epil, %res.012.i.unr
%rem.i8.epil = srem i64 %add.i7.epil, 1000000007
br label %for.end.loopexit.i
for.end.loopexit.i: ; preds = %for.end.loopexit.i.unr-lcssa, %for.body.i3.epil
%rem.i8.lcssa = phi i64 [ %rem.i8.lcssa.ph, %for.end.loopexit.i.unr-lcssa ], [ %rem.i8.epil, %for.body.i3.epil ]
%13 = trunc i64 %rem.i8.lcssa to i32
br label %F.exit
F.exit: ; preds = %while.body, %for.end.loopexit.i
%res.0.lcssa.i = phi i32 [ 0, %while.body ], [ %13, %for.end.loopexit.i ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.0.lcssa.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %F.exit, %Generate.exit
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 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int S,mm,ss;
scanf("%d",&S);
if(S>=0 && S<86400)
{
ss= S % 60;
S /=60;
mm = S % 60;
S /=60;
printf("%d:%d:%d\n",S,mm,ss);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239843/source.c"
target datalayout = "e-m:e-p270: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
%or.cond = icmp ult i32 %0, 86400
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%rem = urem i32 %0, 60
%div = udiv i32 %0, 60
%rem2.lhs.trunc = trunc i32 %div to i16
%rem25 = urem i16 %rem2.lhs.trunc, 60
%rem2.zext = zext i16 %rem25 to i32
%div3 = udiv i32 %0, 3600
store i32 %div3, ptr %S, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div3, i32 noundef %rem2.zext, i32 noundef %rem)
br label %if.end
if.end: ; preds = %if.then, %entry
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(void){
int S, h, m, s;
scanf("%d", &S);
h = S/3600;
m = (S-3600*h)/60;
s = S-3600*h-60*m;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239887/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %sub, 60
%mul4.neg = mul nsw i32 %div1, -60
%sub5 = add i32 %mul4.neg, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub5)
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()
{
long long int t;
scanf("%lld",&t);
while(t--){
long long int n;
scanf("%lld",&n);
long long int arr[n+1],pro[n+1],max=0;
for(int i=0;i<n;i++){
scanf("%lld",&arr[i]);
if(i > 0){
pro[i] = arr[i]*arr[i-1];
if(pro[i] > max){
max=pro[i];
}
}
}
printf("%lld\n",max);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_23993/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_23993/source.c"
target datalayout = "e-m:e-p270: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:
%t = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec36 = add nsw i64 %0, -1
store i64 %dec36, ptr %t, align 8, !tbaa !5
%tobool.not37 = icmp eq i64 %0, 0
br i1 %tobool.not37, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %1, 1
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp32 = icmp sgt i64 %3, 0
br i1 %cmp32, label %for.inc.peel, label %for.cond.cleanup
for.inc.peel: ; preds = %while.body
%call5.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vla)
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp.peel = icmp sgt i64 %4, 1
br i1 %cmp.peel, label %for.inc, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %for.inc.peel, %while.body
%max.0.lcssa = phi i64 [ 0, %while.body ], [ 0, %for.inc.peel ], [ %spec.select, %for.inc ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %max.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
%5 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %5, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
for.inc: ; preds = %for.inc.peel, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ]
%max.033 = phi i64 [ %spec.select, %for.inc ], [ 0, %for.inc.peel ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%7 = add nuw i64 %indvars.iv, 4294967295
%idxprom10 = and i64 %7, 4294967295
%arrayidx11 = getelementptr inbounds i64, ptr %vla, i64 %idxprom10
%8 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%mul = mul nsw i64 %8, %6
%spec.select = call i64 @llvm.smax.i64(i64 %mul, i64 %max.033)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %9, %indvars.iv.next
br i1 %cmp, label %for.inc, label %for.cond.cleanup, !llvm.loop !11
while.end: ; preds = %for.cond.cleanup, %entry
call void @llvm.lifetime.end.p0(i64 8, 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
int main()
{
int s,h,m,i;
int S;
scanf("%d",&S);
i=S%3600;
s=i%60;
m=(i-s)/60;
h=(S-m*60-s)/3600;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_239973/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_239973/source.c"
target datalayout = "e-m:e-p270: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
%rem = srem i32 %0, 3600
%rem1.lhs.trunc = trunc i32 %rem to i16
%rem110 = srem i16 %rem1.lhs.trunc, 60
%rem1.sext = sext i16 %rem110 to i32
%div11 = sdiv i16 %rem1.lhs.trunc, 60
%div.sext = sext i16 %div11 to i32
%mul.neg = mul nsw i32 %div.sext, -60
%sub2 = sub i32 %0, %rem1.sext
%sub3 = add i32 %sub2, %mul.neg
%div4 = sdiv i32 %sub3, 3600
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div4, i32 noundef %div.sext, i32 noundef %rem1.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(void)
{
char str[10];
int second;
fgets(str, sizeof(str), stdin);
sscanf(str, "%d", &second);
printf("%d:", second / 3600 );
printf("%d:", second % 3600 / 60 );
printf("%d", second % 60);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240014/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240014/source.c"
target datalayout = "e-m:e-p270: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 [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:
%str = alloca [10 x i8], align 1
%second = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %str) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %second) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 10, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %str, ptr noundef nonnull @.str, ptr noundef nonnull %second) #4
%1 = load i32, ptr %second, align 4, !tbaa !9
%div = sdiv i32 %1, 3600
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
%2 = load i32, ptr %second, align 4, !tbaa !9
%rem = srem i32 %2, 3600
%div4.lhs.trunc = trunc i32 %rem to i16
%div49 = sdiv i16 %div4.lhs.trunc, 60
%div4.sext = sext i16 %div49 to i32
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div4.sext)
%3 = load i32, ptr %second, align 4, !tbaa !9
%rem6 = srem i32 %3, 60
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %rem6)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %second) #4
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include<stdio.h>
int main(){
int time;
scanf("%d",&time);
int h = time/3600;
int ha = time%3600;
int m = ha/60;
int s= ha%60;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240058/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240058/source.c"
target datalayout = "e-m:e-p270: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:
%time = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %time) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %time)
%0 = load i32, ptr %time, 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
%rem26 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem26 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.sext)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %time) #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 s,m,h,x;
scanf("%d",&x);
h=x/3600;
m=(x-(h*3600))/60;
s=(x-(h*3600+m*60));
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240100/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240100/source.c"
target datalayout = "e-m:e-p270: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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%mul.neg = mul nsw i32 %div, -3600
%sub = add i32 %mul.neg, %0
%div1 = sdiv i32 %sub, 60
%mul3.neg = mul nsw i32 %div1, -60
%sub4 = add i32 %sub, %mul3.neg
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int time, hour, minute, second;
scanf("%d", &time);
hour = time / (60 * 60);
minute = (time % 3600) / 60;
second = time % 60;
printf("%d:%d:%d\n", hour, minute, second);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240144/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240144/source.c"
target datalayout = "e-m:e-p270: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:
%time = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %time) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %time)
%0 = load i32, ptr %time, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%rem = srem i32 %0, 3600
%div1.lhs.trunc = trunc i32 %rem to i16
%div14 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div14 to i32
%rem2 = srem i32 %0, 60
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %time) #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=0,b=0,c,i;
scanf("%d",&c);
for(i=0;i<24;i++){
if(c>=3600){
c-=3600;
a+=1;
}
}
for(i=0;i<60;i++){
if(c>=60){
c-=60;
b+=1;
}
}
printf("%d:%d:%d\n",a,b,c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240188/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240188/source.c"
target datalayout = "e-m:e-p270: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:
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %c.promoted, 3599
br i1 %cmp1, label %for.inc, label %for.inc.23
for.inc: ; preds = %entry
%sub = add nsw i32 %c.promoted, -3600
store i32 %sub, ptr %c, align 4, !tbaa !5
%cmp1.1 = icmp ugt i32 %sub, 3599
br i1 %cmp1.1, label %for.inc.1, label %for.inc.23
for.inc.1: ; preds = %for.inc
%sub.1 = add nsw i32 %c.promoted, -7200
store i32 %sub.1, ptr %c, align 4, !tbaa !5
%cmp1.2 = icmp ugt i32 %sub.1, 3599
br i1 %cmp1.2, label %for.inc.2, label %for.inc.23
for.inc.2: ; preds = %for.inc.1
%sub.2 = add nsw i32 %c.promoted, -10800
store i32 %sub.2, ptr %c, align 4, !tbaa !5
%cmp1.3 = icmp ugt i32 %sub.2, 3599
br i1 %cmp1.3, label %for.inc.3, label %for.inc.23
for.inc.3: ; preds = %for.inc.2
%sub.3 = add nsw i32 %c.promoted, -14400
store i32 %sub.3, ptr %c, align 4, !tbaa !5
%cmp1.4 = icmp ugt i32 %sub.3, 3599
br i1 %cmp1.4, label %for.inc.4, label %for.inc.23
for.inc.4: ; preds = %for.inc.3
%sub.4 = add nsw i32 %c.promoted, -18000
store i32 %sub.4, ptr %c, align 4, !tbaa !5
%cmp1.5 = icmp ugt i32 %sub.4, 3599
br i1 %cmp1.5, label %for.inc.5, label %for.inc.23
for.inc.5: ; preds = %for.inc.4
%sub.5 = add nsw i32 %c.promoted, -21600
store i32 %sub.5, ptr %c, align 4, !tbaa !5
%cmp1.6 = icmp ugt i32 %sub.5, 3599
br i1 %cmp1.6, label %for.inc.6, label %for.inc.23
for.inc.6: ; preds = %for.inc.5
%sub.6 = add nsw i32 %c.promoted, -25200
store i32 %sub.6, ptr %c, align 4, !tbaa !5
%cmp1.7 = icmp ugt i32 %sub.6, 3599
br i1 %cmp1.7, label %for.inc.7, label %for.inc.23
for.inc.7: ; preds = %for.inc.6
%sub.7 = add nsw i32 %c.promoted, -28800
store i32 %sub.7, ptr %c, align 4, !tbaa !5
%cmp1.8 = icmp ugt i32 %sub.7, 3599
br i1 %cmp1.8, label %for.inc.8, label %for.inc.23
for.inc.8: ; preds = %for.inc.7
%sub.8 = add nsw i32 %c.promoted, -32400
store i32 %sub.8, ptr %c, align 4, !tbaa !5
%cmp1.9 = icmp ugt i32 %sub.8, 3599
br i1 %cmp1.9, label %for.inc.9, label %for.inc.23
for.inc.9: ; preds = %for.inc.8
%sub.9 = add nsw i32 %c.promoted, -36000
store i32 %sub.9, ptr %c, align 4, !tbaa !5
%cmp1.10 = icmp ugt i32 %sub.9, 3599
br i1 %cmp1.10, label %for.inc.10, label %for.inc.23
for.inc.10: ; preds = %for.inc.9
%sub.10 = add nsw i32 %c.promoted, -39600
store i32 %sub.10, ptr %c, align 4, !tbaa !5
%cmp1.11 = icmp ugt i32 %sub.10, 3599
br i1 %cmp1.11, label %for.inc.11, label %for.inc.23
for.inc.11: ; preds = %for.inc.10
%sub.11 = add nsw i32 %c.promoted, -43200
store i32 %sub.11, ptr %c, align 4, !tbaa !5
%cmp1.12 = icmp ugt i32 %sub.11, 3599
br i1 %cmp1.12, label %for.inc.12, label %for.inc.23
for.inc.12: ; preds = %for.inc.11
%sub.12 = add nsw i32 %c.promoted, -46800
store i32 %sub.12, ptr %c, align 4, !tbaa !5
%cmp1.13 = icmp ugt i32 %sub.12, 3599
br i1 %cmp1.13, label %for.inc.13, label %for.inc.23
for.inc.13: ; preds = %for.inc.12
%sub.13 = add nsw i32 %c.promoted, -50400
store i32 %sub.13, ptr %c, align 4, !tbaa !5
%cmp1.14 = icmp ugt i32 %sub.13, 3599
br i1 %cmp1.14, label %for.inc.14, label %for.inc.23
for.inc.14: ; preds = %for.inc.13
%sub.14 = add nsw i32 %c.promoted, -54000
store i32 %sub.14, ptr %c, align 4, !tbaa !5
%cmp1.15 = icmp ugt i32 %sub.14, 3599
br i1 %cmp1.15, label %for.inc.15, label %for.inc.23
for.inc.15: ; preds = %for.inc.14
%sub.15 = add nsw i32 %c.promoted, -57600
store i32 %sub.15, ptr %c, align 4, !tbaa !5
%cmp1.16 = icmp ugt i32 %sub.15, 3599
br i1 %cmp1.16, label %for.inc.16, label %for.inc.23
for.inc.16: ; preds = %for.inc.15
%sub.16 = add nsw i32 %c.promoted, -61200
store i32 %sub.16, ptr %c, align 4, !tbaa !5
%cmp1.17 = icmp ugt i32 %sub.16, 3599
br i1 %cmp1.17, label %for.inc.17, label %for.inc.23
for.inc.17: ; preds = %for.inc.16
%sub.17 = add nsw i32 %c.promoted, -64800
store i32 %sub.17, ptr %c, align 4, !tbaa !5
%cmp1.18 = icmp ugt i32 %sub.17, 3599
br i1 %cmp1.18, label %for.inc.18, label %for.inc.23
for.inc.18: ; preds = %for.inc.17
%sub.18 = add nsw i32 %c.promoted, -68400
store i32 %sub.18, ptr %c, align 4, !tbaa !5
%cmp1.19 = icmp ugt i32 %sub.18, 3599
br i1 %cmp1.19, label %for.inc.19, label %for.inc.23
for.inc.19: ; preds = %for.inc.18
%sub.19 = add nsw i32 %c.promoted, -72000
store i32 %sub.19, ptr %c, align 4, !tbaa !5
%cmp1.20 = icmp ugt i32 %sub.19, 3599
br i1 %cmp1.20, label %for.inc.20, label %for.inc.23
for.inc.20: ; preds = %for.inc.19
%sub.20 = add nsw i32 %c.promoted, -75600
store i32 %sub.20, ptr %c, align 4, !tbaa !5
%cmp1.21 = icmp ugt i32 %sub.20, 3599
br i1 %cmp1.21, label %for.inc.21, label %for.inc.23
for.inc.21: ; preds = %for.inc.20
%sub.21 = add nsw i32 %c.promoted, -79200
store i32 %sub.21, ptr %c, align 4, !tbaa !5
%cmp1.22 = icmp ugt i32 %sub.21, 3599
br i1 %cmp1.22, label %for.inc.22, label %for.inc.23
for.inc.22: ; preds = %for.inc.21
%sub.22 = add nsw i32 %c.promoted, -82800
store i32 %sub.22, ptr %c, align 4, !tbaa !5
%cmp1.23 = icmp ugt i32 %sub.22, 3599
br i1 %cmp1.23, label %if.then.23, label %for.inc.23
if.then.23: ; preds = %for.inc.22
%sub.23 = add nsw i32 %c.promoted, -86400
store i32 %sub.23, ptr %c, align 4, !tbaa !5
br label %for.inc.23
for.inc.23: ; preds = %entry, %for.inc, %for.inc.1, %for.inc.2, %for.inc.3, %for.inc.4, %for.inc.5, %for.inc.6, %for.inc.7, %for.inc.8, %for.inc.9, %for.inc.10, %for.inc.11, %for.inc.12, %for.inc.13, %for.inc.14, %for.inc.15, %for.inc.16, %for.inc.17, %for.inc.18, %for.inc.19, %for.inc.20, %for.inc.21, %if.then.23, %for.inc.22
%c.promoted25 = phi i32 [ %sub.23, %if.then.23 ], [ %sub.22, %for.inc.22 ], [ %sub.21, %for.inc.21 ], [ %sub.20, %for.inc.20 ], [ %sub.19, %for.inc.19 ], [ %sub.18, %for.inc.18 ], [ %sub.17, %for.inc.17 ], [ %sub.16, %for.inc.16 ], [ %sub.15, %for.inc.15 ], [ %sub.14, %for.inc.14 ], [ %sub.13, %for.inc.13 ], [ %sub.12, %for.inc.12 ], [ %sub.11, %for.inc.11 ], [ %sub.10, %for.inc.10 ], [ %sub.9, %for.inc.9 ], [ %sub.8, %for.inc.8 ], [ %sub.7, %for.inc.7 ], [ %sub.6, %for.inc.6 ], [ %sub.5, %for.inc.5 ], [ %sub.4, %for.inc.4 ], [ %sub.3, %for.inc.3 ], [ %sub.2, %for.inc.2 ], [ %sub.1, %for.inc.1 ], [ %sub, %for.inc ], [ %c.promoted, %entry ]
%a.1.23 = phi i32 [ 24, %if.then.23 ], [ 23, %for.inc.22 ], [ 22, %for.inc.21 ], [ 21, %for.inc.20 ], [ 20, %for.inc.19 ], [ 19, %for.inc.18 ], [ 18, %for.inc.17 ], [ 17, %for.inc.16 ], [ 16, %for.inc.15 ], [ 15, %for.inc.14 ], [ 14, %for.inc.13 ], [ 13, %for.inc.12 ], [ 12, %for.inc.11 ], [ 11, %for.inc.10 ], [ 10, %for.inc.9 ], [ 9, %for.inc.8 ], [ 8, %for.inc.7 ], [ 7, %for.inc.6 ], [ 6, %for.inc.5 ], [ 5, %for.inc.4 ], [ 4, %for.inc.3 ], [ 3, %for.inc.2 ], [ 2, %for.inc.1 ], [ 1, %for.inc ], [ 0, %entry ]
br label %for.body4
for.body4: ; preds = %14, %for.inc.23
%i.130 = phi i32 [ 0, %for.inc.23 ], [ %inc11.2, %14 ]
%b.029 = phi i32 [ 0, %for.inc.23 ], [ %b.1.2, %14 ]
%sub72728 = phi i32 [ %c.promoted25, %for.inc.23 ], [ %7, %14 ]
%cmp5 = icmp sgt i32 %sub72728, 59
%sub7 = add nsw i32 %sub72728, -60
%add8 = add nsw i32 %b.029, 1
%0 = select i1 %cmp5, i32 %sub7, i32 %sub72728
%b.1 = select i1 %cmp5, i32 %add8, i32 %b.029
%cmp5.1 = icmp sgt i32 %0, 59
%sub7.1 = add nsw i32 %0, -60
%add8.1 = add nsw i32 %b.1, 1
%1 = select i1 %cmp5.1, i32 %sub7.1, i32 %0
%b.1.1 = select i1 %cmp5.1, i32 %add8.1, i32 %b.1
%2 = xor i1 %cmp5, true
%3 = xor i1 %cmp5.1, true
%4 = xor i1 %2, true
%5 = xor i1 %3, true
%6 = or i1 %4, %5
%cmp5.2 = icmp sgt i32 %1, 59
%sub7.2 = add nsw i32 %1, -60
%add8.2 = add nsw i32 %b.1.1, 1
%7 = select i1 %cmp5.2, i32 %sub7.2, i32 %1
%b.1.2 = select i1 %cmp5.2, i32 %add8.2, i32 %b.1.1
%8 = xor i1 %6, true
%9 = xor i1 %cmp5.2, true
%10 = xor i1 %8, true
%11 = xor i1 %9, true
%12 = or i1 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %for.body4
store i32 %7, ptr %c, align 4, !tbaa !5
br label %14
14: ; preds = %for.body4, %13
%inc11.2 = add nuw nsw i32 %i.130, 3
%exitcond.not.2 = icmp eq i32 %inc11.2, 60
br i1 %exitcond.not.2, label %for.end12, label %for.body4, !llvm.loop !9
for.end12: ; preds = %14
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.1.23, i32 noundef %b.1.2, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #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)
{
long x;
scanf("%ld", &x);
printf("%d:%d:%d\n", x/3600, (x/60)%60, x%60);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240238/source.c"
target datalayout = "e-m:e-p270: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 [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:
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8, !tbaa !5
%div = sdiv i64 %0, 3600
%div1 = sdiv i64 %0, 60
%rem = srem i64 %div1, 60
%rem2 = srem i64 %0, 60
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div, i64 noundef %rem, i64 noundef %rem2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int s;
scanf("%d", &s);
printf("%d:%d:%d\n", s/3600, s/60%60, s%60);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240281/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240281/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %0, 60
%rem = srem i32 %div1, 60
%rem2 = srem i32 %0, 60
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %rem, i32 noundef %rem2)
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(void)
{
int S;
int h,m,s;
int s1;
scanf("%d", &S);
while(1){
if(0<=S && 86400>S){
h=S/3600;
s1=S-h*3600;
m=s1/60;
s=s1-m*60;
break;
}else{
scanf("%d", &S);
continue;
}
}
printf("%d:%d:%d\n", h , m , s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240331/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240331/source.c"
target datalayout = "e-m:e-p270: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
%or.cond10 = icmp ult i32 %0, 86400
br i1 %or.cond10, label %if.then, label %if.else
if.then: ; preds = %if.else, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %if.else ]
%div = udiv i32 %.lcssa, 3600
%mul.neg = mul nsw i32 %div, -3600
%sub = add nsw i32 %mul.neg, %.lcssa
%div2 = sdiv i32 %sub, 60
%mul3.neg = mul nsw i32 %div2, -60
%sub4 = add nsw i32 %mul3.neg, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div2, i32 noundef %sub4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %S) #3
ret i32 0
if.else: ; preds = %entry, %if.else
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%1 = load i32, ptr %S, align 4
%or.cond = icmp ult i32 %1, 86400
br i1 %or.cond, label %if.then, label %if.else
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
int S,h,m,s;
scanf("%d",&S);
h=S/3600;
m=(S/60)-(h*60);
s=S%60;
printf("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240375/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %0, 60
%mul.neg = mul nsw i32 %div, -60
%sub = add nsw i32 %mul.neg, %div1
%rem = srem i32 %0, 60
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %sub, 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 S,h,m,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_240418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240418/source.c"
target datalayout = "e-m:e-p270: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"}
|
#include <stdio.h>
int main(){
int hours, minites, seconds;
int time;
scanf("%d", &time);
for (hours = 0; time >= 60*60; hours++) {
time -= 60*60;
}
for (minites = 0; time >= 60; minites++) {
time -= 60;
}
seconds = time;
printf("%d:%d:%d\n", hours, minites, seconds);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240461/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240461/source.c"
target datalayout = "e-m:e-p270: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:
%time = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %time) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %time)
%.pr = load i32, ptr %time, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %.pr, 3599
br i1 %cmp13, label %for.body.preheader, label %for.cond1thread-pre-split
for.body.preheader: ; preds = %entry
%0 = add nsw i32 %.pr, -3600
%1 = add nuw i32 %.pr, 3599
%smin = call i32 @llvm.smin.i32(i32 %.pr, i32 7199)
%2 = sub nuw i32 %1, %smin
%3 = udiv i32 %2, 3600
%.neg = mul nsw i32 %3, -3600
%4 = add nsw i32 %.neg, %0
%5 = add nuw nsw i32 %3, 1
store i32 %4, ptr %time, align 4, !tbaa !5
br label %for.cond1thread-pre-split
for.cond1thread-pre-split: ; preds = %for.body.preheader, %entry
%.pr12 = phi i32 [ %4, %for.body.preheader ], [ %.pr, %entry ]
%hours.0.lcssa = phi i32 [ %5, %for.body.preheader ], [ 0, %entry ]
%cmp215 = icmp sgt i32 %.pr12, 59
br i1 %cmp215, label %for.body3.preheader, label %for.end7
for.body3.preheader: ; preds = %for.cond1thread-pre-split
%6 = add nsw i32 %.pr12, -60
%7 = add nuw nsw i32 %.pr12, 59
%smin19 = call i32 @llvm.smin.i32(i32 %.pr12, i32 119)
%8 = sub nuw nsw i32 %7, %smin19
%9 = udiv i32 %8, 60
%.neg21 = mul nsw i32 %9, -60
%10 = add nsw i32 %.neg21, %6
%11 = add nuw nsw i32 %9, 1
store i32 %10, ptr %time, align 4, !tbaa !5
br label %for.end7
for.end7: ; preds = %for.body3.preheader, %for.cond1thread-pre-split
%.lcssa = phi i32 [ %10, %for.body3.preheader ], [ %.pr12, %for.cond1thread-pre-split ]
%minites.0.lcssa = phi i32 [ %11, %for.body3.preheader ], [ 0, %for.cond1thread-pre-split ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %hours.0.lcssa, i32 noundef %minites.0.lcssa, i32 noundef %.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %time) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
printf("%d:%d:%d\n",a/3600,(a-(a/3600)*3600)/60,a-(((a/3600)*3600)+((a-(a/3600)*3600)/60)*60));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240511/source.c"
target datalayout = "e-m:e-p270: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:
%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
%div = sdiv i32 %0, 3600
%mul.neg = mul nsw i32 %div, -3600
%sub = add i32 %mul.neg, %0
%div2 = sdiv i32 %sub, 60
%mul9.neg = mul nsw i32 %div2, -60
%sub10 = add i32 %sub, %mul9.neg
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div2, i32 noundef %sub10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int S, h, m, s;
scanf("%d", &S);
h = S/3600;
m = (S-h*3600)/60;
s = S-h*3600-m*60;
printf("%d:%d:%d\n", h, m, s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240555/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %sub, 60
%mul4.neg = mul nsw i32 %div1, -60
%sub5 = add i32 %mul4.neg, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub5)
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(void)
{
int data;
int h, m, s;
scanf("%d", &data);
h = data / 3600;
data = data % 3600;
m = data / 60;
s = data % 60;
printf("%d:%d:%d\n", h, m, s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240599/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240599/source.c"
target datalayout = "e-m:e-p270: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:
%data = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %data) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%0 = load i32, ptr %data, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%rem = srem i32 %0, 3600
store i32 %rem, ptr %data, 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
%rem25 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem25 to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.sext)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %data) #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;
scanf ("%d", &s);
int m;
int h;
h = s/60/60;
m = (s-h*60*60)/60;
s = s-h*60*60-m*60;
printf ("%d:%d:%d\n",h,m,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240641/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %0, 3600
%mul2.neg = mul nsw i32 %div1, -3600
%sub = add i32 %mul2.neg, %0
%div3 = sdiv i32 %sub, 60
%mul7.neg = mul nsw i32 %div3, -60
%sub8 = add i32 %mul7.neg, %sub
store i32 %sub8, ptr %s, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div1, i32 noundef %div3, i32 noundef %sub8)
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(void){
int a,b,c;
scanf("%d",&a);
printf("%d:%d:%d\n",a/3600,a%3600/60,a%3600%60);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240685/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240685/source.c"
target datalayout = "e-m:e-p270: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:
%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
%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 %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 S;
int h, m, 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_240728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240728/source.c"
target datalayout = "e-m:e-p270: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"}
|
#include<stdio.h>
int main(void)
{
int S, h, m, s;
scanf("%d", &S);
h = S / 3600;
S = S % 3600;
m = S / 60;
S = S % 60;
s = S;
printf("%d:%d:%d\n", h, m, s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240779/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240779/source.c"
target datalayout = "e-m:e-p270: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
%div14 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div14 to i32
%rem25 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem25 to i32
store i32 %rem2.sext, ptr %S, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.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,sec;
scanf("%d",&s);
h = s/3600;
m = (s%3600)/60;
sec = (s%3600)%60;
printf("%d:%d:%d\n",h,m,sec);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240829/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240829/source.c"
target datalayout = "e-m:e-p270: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"}
|
#include <stdio.h>
int main(void)
{
int $S$,$h$,$m$,$s$;
scanf("%d",&$S$);
$h$ = $S$ / 3600;
$m$ = ($S$ - ($h$ * 3600))/60;
$s$ = ($S$ - ($h$ * 3600 + $m$ * 60));
printf("%d:%d:%d\n",$h$,$m$,$s$);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240872/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240872/source.c"
target datalayout = "e-m:e-p270: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
%div1 = sdiv i32 %sub, 60
%mul3.neg = mul nsw i32 %div1, -60
%sub4 = add i32 %sub, %mul3.neg
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub4)
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(void)
{
int sec;
int h;
int m;
int s;
scanf("%d", &sec);
h = sec / 3600;
m = (sec - h * 3600) / 60;
s = sec - h * 3600 - m * 60;
printf("%d:%d:%d\n", h, m, s);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240922/source.c"
target datalayout = "e-m:e-p270: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:
%sec = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sec) #3
%call = 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
%mul.neg = mul nsw i32 %div, -3600
%sub = add i32 %mul.neg, %0
%div1 = sdiv i32 %sub, 60
%mul4.neg = mul nsw i32 %div1, -60
%sub5 = add i32 %mul4.neg, %sub
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1, i32 noundef %sub5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sec) #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 S,h,m,s;
scanf("%d",&S);
if("0<=S<86400"){
s=S%60;
m=(S-s)%3600/60;
h=(S-s-60*m)/3600;
printf("%d:%d:%d\n",h,m,s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_240966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_240966/source.c"
target datalayout = "e-m:e-p270: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 [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
%rem = srem i32 %0, 60
%sub = sub nsw i32 %0, %rem
%rem1 = srem i32 %sub, 3600
%div.lhs.trunc = trunc i32 %rem1 to i16
%div9 = sdiv i16 %div.lhs.trunc, 60
%div.sext = sext i16 %div9 to i32
%mul.neg = mul nsw i32 %div.sext, -60
%sub3 = add i32 %mul.neg, %sub
%div4 = sdiv i32 %sub3, 3600
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div4, i32 noundef %div.sext, 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(void){
int S,h,m,s;
int minute;
scanf("%d",&S);
if(0>S||86400<=S)
printf("Too Large\n");
minute = S/60;
h = minute / 60;
m = minute % 60;
s = S % 60;
printf("%d:%d:%d\n",h,m,s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_241015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_241015/source.c"
target datalayout = "e-m:e-p270: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 [10 x i8] c"%d:%d:%d\0A\00", align 1
@str = private unnamed_addr constant [10 x i8] c"Too Large\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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i32, ptr %S, align 4
%or.cond = icmp ugt i32 %0, 86399
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr %S, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %entry, %if.then
%1 = phi i32 [ %0, %entry ], [ %.pre, %if.then ]
%div = sdiv i32 %1, 60
%div3 = sdiv i32 %1, 3600
%rem = srem i32 %div, 60
%rem4 = srem i32 %1, 60
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div3, i32 noundef %rem, i32 noundef %rem4)
call void @llvm.lifetime.end.p0(i64 4, 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: 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(void) {
int a, h, m, s;
scanf("%d\n", &a);
s = a % 60;
a = (a - s) / 60;
m = a % 60;
a = (a - m) / 60;
h = a;
printf("%d:%d:%d\n", h, m, s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_241066/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_241066/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [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:
%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
%rem = srem i32 %0, 60
%div = sdiv i32 %0, 60
%rem1 = srem i32 %div, 60
%div3 = sdiv i32 %0, 3600
store i32 %div3, ptr %a, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div3, i32 noundef %rem1, i32 noundef %rem)
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 s, m, h;
scanf("%d", &s);
h = s / 3600;
s = s % 3600;
m = s / 60;
s = s % 60;
printf("%d:%d:%d\n", h, m, s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_241109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_241109/source.c"
target datalayout = "e-m:e-p270: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
%div14 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div14 to i32
%rem25 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem25 to i32
store i32 %rem2.sext, ptr %s, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.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(void)
{
int v,h,t,s;
scanf("%d",&v);
h = v / 3600;
v = v % 3600;
t = v / 60;
v = v % 60;
s = v ;
printf("%d:%d:%d\n", h, t, s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_241152/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_241152/source.c"
target datalayout = "e-m:e-p270: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:
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%0 = load i32, ptr %v, align 4, !tbaa !5
%div = sdiv i32 %0, 3600
%rem = srem i32 %0, 3600
%div1.lhs.trunc = trunc i32 %rem to i16
%div14 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div14 to i32
%rem25 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem25 to i32
store i32 %rem2.sext, ptr %v, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %rem2.sext)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #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"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.