Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b) {
return (int)*(char*)a - *(char*)b;
}
int main() {
int tc;
char s[100001];
scanf("%d", &tc);
while(tc--) {
int n, k, l = 0, p = 0, i;
char r[100001] = {0};
scanf("%d %d %s", &n, &k, s);
qsort(s, n, sizeof(char), cmp);
if(s[0] == s[k - 1]) {
r[l++] = s[0];
if(k < n && s[k] == s[n - 1])
for(i = k; i < n; i += k)
r[l++] = s[i];
else for(i = k; i < n; i++)
r[l++] = s[i];
} else
r[l++] = s[k - 1];
printf("%s\n", r);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2102/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2102/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %s\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !5
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%tc = alloca i32, align 4
%s = alloca [100001 x i8], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
%r = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tc) #8
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tc)
%0 = load i32, ptr %tc, align 4, !tbaa !8
%dec67 = add nsw i32 %0, -1
store i32 %dec67, ptr %tc, align 4, !tbaa !8
%tobool.not68 = icmp eq i32 %0, 0
br i1 %tobool.not68, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%scevgep = getelementptr inbounds i8, ptr %r, i64 1
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end48
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %r) #8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(100001) %r, i8 0, i64 100001, i1 false)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k, ptr noundef nonnull %s)
%1 = load i32, ptr %n, align 4, !tbaa !8
%conv = sext i32 %1 to i64
call void @qsort(ptr noundef nonnull %s, i64 noundef %conv, i64 noundef 1, ptr noundef nonnull @cmp) #8
%2 = load i8, ptr %s, align 16, !tbaa !5
%3 = load i32, ptr %k, align 4, !tbaa !8
%sub = add nsw i32 %3, -1
%idxprom = sext i32 %sub to i64
%arrayidx4 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom
%4 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp = icmp eq i8 %2, %4
br i1 %cmp, label %if.then, label %if.else41
if.then: ; preds = %while.body
store i8 %2, ptr %r, align 16, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !8
%cmp10 = icmp slt i32 %3, %5
br i1 %cmp10, label %land.lhs.true, label %if.end48
land.lhs.true: ; preds = %if.then
%idxprom12 = sext i32 %3 to i64
%arrayidx13 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom12
%6 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%sub15 = add nsw i32 %5, -1
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom16
%7 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%cmp19 = icmp eq i8 %6, %7
br i1 %cmp19, label %for.body.preheader, label %for.body32.preheader
for.body.preheader: ; preds = %land.lhs.true
%8 = sext i32 %5 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv76 = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next77, %for.body ]
%indvars.iv = phi i64 [ %idxprom12, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx25 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv
%9 = load i8, ptr %arrayidx25, align 1, !tbaa !5
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%arrayidx28 = getelementptr inbounds [100001 x i8], ptr %r, i64 0, i64 %indvars.iv76
store i8 %9, ptr %arrayidx28, align 1, !tbaa !5
%indvars.iv.next = add i64 %indvars.iv, %idxprom12
%cmp22 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp22, label %for.body, label %if.end48, !llvm.loop !10
for.body32.preheader: ; preds = %land.lhs.true
%10 = sext i32 %3 to i64
%scevgep70 = getelementptr i8, ptr %s, i64 %10
%11 = xor i32 %3, -1
%12 = add i32 %5, %11
%13 = zext i32 %12 to i64
%14 = add nuw nsw i64 %13, 1
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, ptr noundef nonnull align 1 dereferenceable(1) %scevgep70, i64 %14, i1 false), !tbaa !5
br label %if.end48
if.else41: ; preds = %while.body
store i8 %4, ptr %r, align 16, !tbaa !5
br label %if.end48
if.end48: ; preds = %for.body, %if.then, %for.body32.preheader, %if.else41
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %r)
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %r) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
%15 = load i32, ptr %tc, align 4, !tbaa !8
%dec = add nsw i32 %15, -1
store i32 %dec, ptr %tc, align 4, !tbaa !8
%tobool.not = icmp eq i32 %15, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end48, %entry
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tc) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; 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) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char const *argv[]) {
int n,k;
scanf("%d %d\n", &n ,&k);
char s[50];
scanf("%s",s);
char c = *(s+k-1);
*(s+k-1) = c - ('A'-'a');
printf("%s", s);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210242/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210242/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A\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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [50 x i8], align 16
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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %s) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%idx.ext = sext i32 %0 to i64
%add.ptr = getelementptr inbounds i8, ptr %s, i64 %idx.ext
%add.ptr3 = getelementptr inbounds i8, ptr %add.ptr, i64 -1
%1 = load i8, ptr %add.ptr3, align 1, !tbaa !9
%sub = add i8 %1, 32
store i8 %sub, ptr %add.ptr3, align 1, !tbaa !9
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %s) #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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(void){
int N,K,i;
char S[50];
scanf("%d %d",&N,&K);
for(i=0;i<N;i++){
scanf("%s",&S[i]);
if(i==K-1)
S[i]=S[i]+32;
}
for(i=0;i<N;i++)
printf("%c",S[i]);
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210293/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210293/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%S = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, label %for.body, label %for.end18
for.cond8.preheader: ; preds = %for.inc
%1 = icmp sgt i32 %5, 0
br i1 %1, label %for.body11, label %for.end18
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i8], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%3 = zext i32 %sub to i64
%cmp2 = icmp eq i64 %indvars.iv, %3
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.body
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %4, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !10
for.body11: ; preds = %for.cond8.preheader, %for.body11
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body11 ], [ 0, %for.cond8.preheader ]
%arrayidx13 = getelementptr inbounds [50 x i8], ptr %S, i64 0, i64 %indvars.iv32
%7 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%conv14 = sext i8 %7 to i32
%putchar = call i32 @putchar(i32 %conv14)
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%8 = load i32, ptr %N, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp9 = icmp slt i64 %indvars.iv.next33, %9
br i1 %cmp9, label %for.body11, label %for.end18, !llvm.loop !12
for.end18: ; preds = %for.body11, %entry, %for.cond8.preheader
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(void){
int n, k;
char s[51];
scanf("%d %d", &n, &k);
scanf("%s", s);
s[k-1] += ('a' - 'A');
printf("%s", s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210336/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210336/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [51 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 51, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 51, ptr nonnull %s) #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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(void) {
// your code goes here
int n;
scanf("%d",&n);
int a[n+1],i,c=0,s,k=0;
a[0]=0;
for(i=1;i<=n;i++){
scanf("%d",&a[i]);
s = a[i]-a[i-1];
// printf("%d\n",s);
if(s>k){
c+=s-k;
k=0;
}else{
s = 0-s;
k+=s;
// printf("%d\n",k);
}
}
printf("%d",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21038/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21038/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
store i32 0, ptr %vla, align 16, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not24 = icmp slt i32 %3, 1
br i1 %cmp.not24, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%invariant.gep = getelementptr i32, ptr %vla, i64 -1
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%k.027 = phi i32 [ 0, %for.body.preheader ], [ %k.1, %for.body ]
%c.026 = phi i32 [ 0, %for.body.preheader ], [ %c.1, %for.body ]
%arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%4 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%5 = load i32, ptr %gep, align 4, !tbaa !5
%sub7 = sub nsw i32 %4, %5
%cmp8 = icmp sgt i32 %sub7, %k.027
%sub9 = sub nsw i32 %sub7, %k.027
%add12 = sub i32 %k.027, %sub7
%add10 = select i1 %cmp8, i32 %sub9, i32 0
%c.1 = add nsw i32 %add10, %c.026
%k.1 = select i1 %cmp8, i32 0, i32 %add12
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %c.1, %for.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %c.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int N, K;
scanf("%d %d", &N, &K);
char S[128];
scanf("%s", S);
S[K-1] += ('a' - 'A');
printf("%s\n", S);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210422/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210422/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
%S = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %S) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %S)
%0 = load i32, ptr %K, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [128 x i8], ptr %S, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%add = add i8 %1, 32
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %S)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include <stdio.h>
const int STD = 1000000007;
int main(void)
{
int s;
int i, j;
int df[2001] = {0};
scanf("%d", &s);
df[0] = 0;
df[1] = 0;
df[2] = 0;
df[3] = 1;
df[4] = 1;
df[5] = 1;
for (i = 6; i <= s; i++)
{
df[i] = 1;
for (j = i - 3; j >= 3; j--)
{
df[i] = (df[i] + df[j]) % STD;
}
}
printf("%d\n", df[s]);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210466/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210466/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@STD = dso_local local_unnamed_addr constant i32 1000000007, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%df = alloca [2001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 8004, ptr nonnull %df) #4
%0 = getelementptr inbounds i8, ptr %df, i64 16
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8004) %0, i8 0, i64 7988, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
store <4 x i32> <i32 0, i32 0, i32 0, i32 1>, ptr %df, align 16, !tbaa !5
%arrayidx4 = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 4
store i32 1, ptr %arrayidx4, align 16, !tbaa !5
%arrayidx5 = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 5
store i32 1, ptr %arrayidx5, align 4, !tbaa !5
%1 = load i32, ptr %s, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %1, 6
br i1 %cmp.not31, label %for.end17, label %for.body.preheader
for.body.preheader: ; preds = %entry
%2 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %2 to i64
br label %for.body9.lr.ph
for.body9.lr.ph: ; preds = %for.inc16, %for.body.preheader
%indvar = phi i64 [ %indvar.next, %for.inc16 ], [ 0, %for.body.preheader ]
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.inc16 ], [ 6, %for.body.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc16 ], [ 3, %for.body.preheader ]
%3 = add i64 %indvar, 1
%arrayidx6 = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 %indvars.iv36
store i32 1, ptr %arrayidx6, align 4, !tbaa !5
%xtraiter = and i64 %3, 1
%4 = icmp eq i64 %indvar, 0
br i1 %4, label %for.inc16.unr-lcssa, label %for.body9.lr.ph.new
for.body9.lr.ph.new: ; preds = %for.body9.lr.ph
%unroll_iter = and i64 %3, -2
br label %for.body9
for.body9: ; preds = %for.body9, %for.body9.lr.ph.new
%indvars.iv33 = phi i64 [ %indvars.iv, %for.body9.lr.ph.new ], [ %indvars.iv.next34.1, %for.body9 ]
%rem30 = phi i32 [ 1, %for.body9.lr.ph.new ], [ %rem.1, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.lr.ph.new ], [ %niter.next.1, %for.body9 ]
%arrayidx13 = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 %indvars.iv33
%5 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%add = add nsw i32 %5, %rem30
%rem = srem i32 %add, 1000000007
store i32 %rem, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next34 = add nsw i64 %indvars.iv33, -1
%arrayidx13.1 = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 %indvars.iv.next34
%6 = load i32, ptr %arrayidx13.1, align 4, !tbaa !5
%add.1 = add nsw i32 %6, %rem
%rem.1 = srem i32 %add.1, 1000000007
store i32 %rem.1, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next34.1 = add nsw i64 %indvars.iv33, -2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1.not, label %for.inc16.unr-lcssa, label %for.body9, !llvm.loop !9
for.inc16.unr-lcssa: ; preds = %for.body9, %for.body9.lr.ph
%indvars.iv33.unr = phi i64 [ %indvars.iv, %for.body9.lr.ph ], [ %indvars.iv.next34.1, %for.body9 ]
%rem30.unr = phi i32 [ 1, %for.body9.lr.ph ], [ %rem.1, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc16, label %for.body9.epil
for.body9.epil: ; preds = %for.inc16.unr-lcssa
%arrayidx13.epil = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 %indvars.iv33.unr
%7 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %7, %rem30.unr
%rem.epil = srem i32 %add.epil, 1000000007
store i32 %rem.epil, ptr %arrayidx6, align 4, !tbaa !5
br label %for.inc16
for.inc16: ; preds = %for.inc16.unr-lcssa, %for.body9.epil
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count
%indvar.next = add i64 %indvar, 1
br i1 %exitcond.not, label %for.end17, label %for.body9.lr.ph, !llvm.loop !11
for.end17: ; preds = %for.inc16, %entry
%idxprom18 = sext i32 %1 to i64
%arrayidx19 = getelementptr inbounds [2001 x i32], ptr %df, i64 0, i64 %idxprom18
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 8004, ptr nonnull %df) #4
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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define REP(i,a,b) for (i=(a); i<(b); ++i)
#define rep(i,n) REP(i,0,n)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define EPS 1e-12
double a[101][101];
double memo[101][101][101];
int b[101];
double solve(int n, int m, int k, int p)
{
double res;
int i, j;
if (m == 1) return 1;
if (memo[p][m][k] > 0) return memo[p][m][k];
res = 0;
rep(i, n) res = MAX(res, solve(n, m-1, p, i) * a[p][i]);
return memo[p][m][k] = res;
}
int main(void)
{
int n, m, i, j, k;
double res;
while (scanf("%d%d",&n,&m),n|m) {
rep(i, n) b[i] = 0;
rep(i, 101) rep(j, 101) rep(k, 101) memo[i][j][k] = 0;
rep(i, n) rep(j, n) {
scanf("%lf", &a[i][j]);
if (a[i][b[i]] < a[i][j]) b[i] = j;
}
res = 0;
rep(i, n) rep(j, n) res = MAX(res, solve(n, m, i, j));
printf("%.2f\n", res);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210509/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210509/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@memo = dso_local local_unnamed_addr global [101 x [101 x [101 x double]]] zeroinitializer, align 16
@a = dso_local global [101 x [101 x double]] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@b = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%.2f\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local double @solve(i32 noundef %n, i32 noundef %m, i32 noundef %k, i32 noundef %p) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %m, 1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %p to i64
%idxprom1 = sext i32 %m to i64
%idxprom3 = sext i32 %k to i64
%arrayidx4 = getelementptr inbounds [101 x [101 x [101 x double]]], ptr @memo, i64 0, i64 %idxprom, i64 %idxprom1, i64 %idxprom3
%0 = load double, ptr %arrayidx4, align 8, !tbaa !5
%cmp5 = fcmp ogt double %0, 0.000000e+00
br i1 %cmp5, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%cmp1457 = icmp sgt i32 %n, 0
br i1 %cmp1457, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%sub = add nsw i32 %m, -1
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %cond.end
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %cond.end ]
%res.058 = phi double [ 0.000000e+00, %for.body.lr.ph ], [ %cond, %cond.end ]
%1 = trunc i64 %indvars.iv to i32
%call = tail call double @solve(i32 noundef %n, i32 noundef %sub, i32 noundef %p, i32 noundef %1)
%arrayidx18 = getelementptr inbounds [101 x [101 x double]], ptr @a, i64 0, i64 %idxprom, i64 %indvars.iv
%2 = load double, ptr %arrayidx18, align 8, !tbaa !5
%mul = fmul double %call, %2
%cmp19 = fcmp ogt double %res.058, %mul
br i1 %cmp19, label %cond.end, label %cond.false
cond.false: ; preds = %for.body
%call21 = tail call double @solve(i32 noundef %n, i32 noundef %sub, i32 noundef %p, i32 noundef %1)
%3 = load double, ptr %arrayidx18, align 8, !tbaa !5
%mul26 = fmul double %call21, %3
br label %cond.end
cond.end: ; preds = %for.body, %cond.false
%cond = phi double [ %mul26, %cond.false ], [ %res.058, %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 !9
for.end: ; preds = %cond.end, %for.cond.preheader
%res.0.lcssa = phi double [ 0.000000e+00, %for.cond.preheader ], [ %cond, %cond.end ]
store double %res.0.lcssa, ptr %arrayidx4, align 8, !tbaa !5
br label %cleanup
cleanup: ; preds = %if.end, %entry, %for.end
%retval.0 = phi double [ %res.0.lcssa, %for.end ], [ 1.000000e+00, %entry ], [ %0, %if.end ]
ret double %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call118 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !11
%1 = load i32, ptr %m, align 4, !tbaa !11
%or119 = or i32 %1, %0
%tobool.not120 = icmp eq i32 %or119, 0
br i1 %tobool.not120, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end69
%2 = phi i32 [ %20, %for.end69 ], [ %0, %entry ]
%cmp102 = icmp sgt i32 %2, 0
br i1 %cmp102, label %for.cond28.preheader.preheader, label %for.cond55.preheader.thread
for.cond55.preheader.thread: ; preds = %for.cond.preheader
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8242408) @memo, i8 0, i64 8242408, i1 false), !tbaa !5
br label %for.end69
for.cond28.preheader.preheader: ; preds = %for.cond.preheader
%3 = zext i32 %2 to i64
%4 = shl nuw nsw i64 %3, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @b, i8 0, i64 %4, i1 false), !tbaa !11
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8242408) @memo, i8 0, i64 8242408, i1 false), !tbaa !5
br label %for.cond28.preheader
for.cond55.preheader: ; preds = %for.inc52
%cmp56114 = icmp sgt i32 %12, 0
br i1 %cmp56114, label %for.cond58.preheader, label %for.end69
for.cond28.preheader: ; preds = %for.cond28.preheader.preheader, %for.inc52
%5 = phi i32 [ %2, %for.cond28.preheader.preheader ], [ %12, %for.inc52 ]
%indvars.iv131 = phi i64 [ 0, %for.cond28.preheader.preheader ], [ %indvars.iv.next132, %for.inc52 ]
%cmp29107 = icmp sgt i32 %5, 0
br i1 %cmp29107, label %for.body30.lr.ph, label %for.cond28.preheader.for.inc52_crit_edge
for.cond28.preheader.for.inc52_crit_edge: ; preds = %for.cond28.preheader
%.pre = sext i32 %5 to i64
br label %for.inc52
for.body30.lr.ph: ; preds = %for.cond28.preheader
%arrayidx39 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv131
br label %for.body30
for.body30: ; preds = %for.body30.lr.ph, %for.inc49
%indvars.iv = phi i64 [ 0, %for.body30.lr.ph ], [ %indvars.iv.next, %for.inc49 ]
%arrayidx34 = getelementptr inbounds [101 x [101 x double]], ptr @a, i64 0, i64 %indvars.iv131, i64 %indvars.iv
%call35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx34)
%6 = load i32, ptr %arrayidx39, align 4, !tbaa !11
%idxprom40 = sext i32 %6 to i64
%arrayidx41 = getelementptr inbounds [101 x [101 x double]], ptr @a, i64 0, i64 %indvars.iv131, i64 %idxprom40
%7 = load double, ptr %arrayidx41, align 8, !tbaa !5
%8 = load double, ptr %arrayidx34, align 8, !tbaa !5
%cmp46 = fcmp olt double %7, %8
br i1 %cmp46, label %if.then, label %for.inc49
if.then: ; preds = %for.body30
%9 = trunc i64 %indvars.iv to i32
store i32 %9, ptr %arrayidx39, align 4, !tbaa !11
br label %for.inc49
for.inc49: ; preds = %for.body30, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !11
%11 = sext i32 %10 to i64
%cmp29 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp29, label %for.body30, label %for.inc52, !llvm.loop !13
for.inc52: ; preds = %for.inc49, %for.cond28.preheader.for.inc52_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond28.preheader.for.inc52_crit_edge ], [ %11, %for.inc49 ]
%12 = phi i32 [ %5, %for.cond28.preheader.for.inc52_crit_edge ], [ %10, %for.inc49 ]
%indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
%cmp26 = icmp slt i64 %indvars.iv.next132, %.pre-phi
br i1 %cmp26, label %for.cond28.preheader, label %for.cond55.preheader, !llvm.loop !14
for.cond58.preheader: ; preds = %for.cond55.preheader, %for.inc67
%13 = phi i32 [ %19, %for.inc67 ], [ %12, %for.cond55.preheader ]
%res.0116 = phi double [ %res.1.lcssa, %for.inc67 ], [ 0.000000e+00, %for.cond55.preheader ]
%i.3115 = phi i32 [ %inc68, %for.inc67 ], [ 0, %for.cond55.preheader ]
%cmp59111 = icmp sgt i32 %13, 0
br i1 %cmp59111, label %for.body60, label %for.inc67
for.body60: ; preds = %for.cond58.preheader, %cond.end
%14 = phi i32 [ %18, %cond.end ], [ %13, %for.cond58.preheader ]
%res.1113 = phi double [ %cond, %cond.end ], [ %res.0116, %for.cond58.preheader ]
%j.2112 = phi i32 [ %inc65, %cond.end ], [ 0, %for.cond58.preheader ]
%15 = load i32, ptr %m, align 4, !tbaa !11
%call61 = call double @solve(i32 noundef %14, i32 noundef %15, i32 noundef %i.3115, i32 noundef %j.2112)
%cmp62 = fcmp ogt double %res.1113, %call61
br i1 %cmp62, label %cond.end, label %cond.false
cond.false: ; preds = %for.body60
%16 = load i32, ptr %n, align 4, !tbaa !11
%17 = load i32, ptr %m, align 4, !tbaa !11
%call63 = call double @solve(i32 noundef %16, i32 noundef %17, i32 noundef %i.3115, i32 noundef %j.2112)
br label %cond.end
cond.end: ; preds = %for.body60, %cond.false
%cond = phi double [ %call63, %cond.false ], [ %res.1113, %for.body60 ]
%inc65 = add nuw nsw i32 %j.2112, 1
%18 = load i32, ptr %n, align 4, !tbaa !11
%cmp59 = icmp slt i32 %inc65, %18
br i1 %cmp59, label %for.body60, label %for.inc67, !llvm.loop !16
for.inc67: ; preds = %cond.end, %for.cond58.preheader
%19 = phi i32 [ %13, %for.cond58.preheader ], [ %18, %cond.end ]
%res.1.lcssa = phi double [ %res.0116, %for.cond58.preheader ], [ %cond, %cond.end ]
%inc68 = add nuw nsw i32 %i.3115, 1
%cmp56 = icmp slt i32 %inc68, %19
br i1 %cmp56, label %for.cond58.preheader, label %for.end69, !llvm.loop !17
for.end69: ; preds = %for.inc67, %for.cond55.preheader.thread, %for.cond55.preheader
%res.0.lcssa = phi double [ 0.000000e+00, %for.cond55.preheader ], [ 0.000000e+00, %for.cond55.preheader.thread ], [ %res.1.lcssa, %for.inc67 ]
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %res.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%20 = load i32, ptr %n, align 4, !tbaa !11
%21 = load i32, ptr %m, align 4, !tbaa !11
%or = or i32 %21, %20
%tobool.not = icmp eq i32 %or, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !18
while.end: ; preds = %for.end69, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree 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 = !{!"double", !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}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<time.h>
#define ll long long
#define lli long long int
#define pf printf
#define sf scanf
#define nl printf("\n")
#define pfx printf("x")
int main()
{
lli n,i,a[100100],b[100100];
scanf("%I64d",&n);
for(i=1;i<=n;i++)
{
sf("%I64d",&a[i]);
}
a[0]=0;
b[n]=0;
for(i=n-1;i>=1;i--)
{
b[i]=b[i+1]+a[i+1]-a[i];
if(b[i]<0)
b[i]=0;
}
b[0]=a[1]+b[1];
printf("%I64d",b[0]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%I64d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [100100 x i64], align 16
%b = alloca [100100 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800800, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 800800, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not35 = icmp slt i64 %0, 1
br i1 %cmp.not35, label %for.end.thread, label %for.body
for.end.thread: ; preds = %entry
store i64 0, ptr %a, align 16, !tbaa !5
%arrayidx341 = getelementptr inbounds [100100 x i64], ptr %b, i64 0, i64 %0
store i64 0, ptr %arrayidx341, align 8, !tbaa !5
br label %for.end18
for.body: ; preds = %entry, %for.body
%i.036 = phi i64 [ %inc, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100100 x i64], ptr %a, i64 0, i64 %i.036
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.036, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.036, %1
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
store i64 0, ptr %a, align 16, !tbaa !5
%arrayidx3 = getelementptr inbounds [100100 x i64], ptr %b, i64 0, i64 %1
store i64 0, ptr %arrayidx3, align 8, !tbaa !5
%cmp537 = icmp sgt i64 %1, 1
br i1 %cmp537, label %for.body6.preheader, label %for.end18
for.body6.preheader: ; preds = %for.end
%arrayidx9.phi.trans.insert = getelementptr inbounds [100100 x i64], ptr %a, i64 0, i64 %1
%.pre = load i64, ptr %arrayidx9.phi.trans.insert, align 8, !tbaa !5
br label %for.body6
for.body6: ; preds = %for.body6.preheader, %for.body6
%2 = phi i64 [ %4, %for.body6 ], [ %.pre, %for.body6.preheader ]
%3 = phi i64 [ %spec.select, %for.body6 ], [ 0, %for.body6.preheader ]
%i.1.in38 = phi i64 [ %i.1, %for.body6 ], [ %1, %for.body6.preheader ]
%i.1 = add nsw i64 %i.1.in38, -1
%add10 = add nsw i64 %2, %3
%arrayidx11 = getelementptr inbounds [100100 x i64], ptr %a, i64 0, i64 %i.1
%4 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%sub12 = sub i64 %add10, %4
%arrayidx13 = getelementptr inbounds [100100 x i64], ptr %b, i64 0, i64 %i.1
%spec.select = call i64 @llvm.smax.i64(i64 %sub12, i64 0)
store i64 %spec.select, ptr %arrayidx13, align 8, !tbaa !5
%cmp5 = icmp ugt i64 %i.1.in38, 2
br i1 %cmp5, label %for.body6, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.body6, %for.end.thread, %for.end
%arrayidx19 = getelementptr inbounds [100100 x i64], ptr %a, i64 0, i64 1
%5 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%arrayidx20 = getelementptr inbounds [100100 x i64], ptr %b, i64 0, i64 1
%6 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%add21 = add nsw i64 %6, %5
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %add21)
call void @llvm.lifetime.end.p0(i64 800800, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 800800, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long 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>
int main() {
int n,s;
scanf("%d %d", &n, &s);
s*=100;
int i, money;
int x,y, sweets, ans=-1;
for (i=0; i<n; i++) {
money =s;
scanf("%d %d",&x, &y);
x = (x*100)+y;
if (money>=x) {
money-=x;
sweets = money%100;
if (sweets>ans) ans = sweets;
}
}
// if (ans==0) printf("-1\n");
// else
printf ("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21061/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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 %n, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4, !tbaa !5
%mul = mul nsw i32 %0, 100
store i32 %mul, ptr %s, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %1, 0
br i1 %cmp13, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%ans.015 = phi i32 [ %ans.1, %for.inc ], [ -1, %entry ]
%i.014 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%2 = load i32, ptr %s, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%3 = load i32, ptr %x, align 4, !tbaa !5
%mul2 = mul nsw i32 %3, 100
%4 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %mul2, %4
store i32 %add, ptr %x, align 4, !tbaa !5
%cmp3.not = icmp slt i32 %2, %add
br i1 %cmp3.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%sub = sub nsw i32 %2, %add
%rem = srem i32 %sub, 100
%spec.select = call i32 @llvm.smax.i32(i32 %rem, i32 %ans.015)
br label %for.inc
for.inc: ; preds = %if.then, %for.body
%ans.1 = phi i32 [ %ans.015, %for.body ], [ %spec.select, %if.then ]
%inc = add nuw nsw i32 %i.014, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%ans.0.lcssa = phi i32 [ -1, %entry ], [ %ans.1, %for.inc ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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"}
|
/* ex5_4
kt125*/
#include<stdio.h>
#include<string.h>
int main(void){
int count = 0, ans=0;
char str[11], *ptr;
scanf("%s", &str[0]);
//'A','G','C','T'の全てを'X'に置き換える。
for(int i= 0; i< strlen(str);i++){
if(str[i] == 'A' || str[i] == 'C' ||
str[i] == 'G' || str[i] == 'T'){
str[i] = 'X';
}
}
ptr = str; //strの先頭アドレスをptrに渡す
//連続する'X'の最大数ansを求める
while(*ptr){
if( *ptr == 'X'){
count++;
if(ans < count) ans = count;
}else{ //'X'以外の文字が出たらcountをリセット
count = 0;
}
ptr++;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210653/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210653/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%char0 = load i8, ptr %str, align 1
%cmp50.not = icmp eq i8 %char0, 0
br i1 %cmp50.not, label %while.cond.preheader, label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx3 = getelementptr inbounds [11 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx3, align 1, !tbaa !5
switch i8 %0, label %for.inc [
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
store i8 88, ptr %arrayidx3, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #5
%cmp = icmp ugt i64 %call1, %indvars.iv.next
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !8
while.cond.preheader: ; preds = %for.inc, %entry
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %if.end36
%count.0 = phi i32 [ %count.1, %if.end36 ], [ 0, %while.cond.preheader ]
%ans.0 = phi i32 [ %ans.1, %if.end36 ], [ 0, %while.cond.preheader ]
%ptr.0 = phi ptr [ %incdec.ptr, %if.end36 ], [ %str, %while.cond.preheader ]
%1 = load i8, ptr %ptr.0, align 1, !tbaa !5
switch i8 %1, label %if.end36 [
i8 0, label %while.end
i8 88, label %if.then30
]
if.then30: ; preds = %while.cond
%inc31 = add nsw i32 %count.0, 1
%cmp32.not = icmp sgt i32 %ans.0, %count.0
%spec.select = select i1 %cmp32.not, i32 %ans.0, i32 %inc31
br label %if.end36
if.end36: ; preds = %if.then30, %while.cond
%count.1 = phi i32 [ %inc31, %if.then30 ], [ 0, %while.cond ]
%ans.1 = phi i32 [ %spec.select, %if.then30 ], [ %ans.0, %while.cond ]
%incdec.ptr = getelementptr inbounds i8, ptr %ptr.0, i64 1
br label %while.cond, !llvm.loop !10
while.end: ; preds = %while.cond
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <string.h>
int main(){
char s[11];int i,a=0,l=0;
scanf("%s",s);
for(i=0;i<strlen(s);i++){
if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C'){l++;a=(a<l?l:a);}
else l=0;
}
printf("%d",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210697/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210697/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp37.not = icmp eq i64 %call2, 0
br i1 %cmp37.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %call2, 1
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 %call2, -2
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%l.040 = phi i32 [ 0, %for.body.preheader.new ], [ %l.1.1, %for.inc.1 ]
%a.039 = phi i32 [ 0, %for.body.preheader.new ], [ %a.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %for.inc [
i8 65, label %if.then
i8 84, label %if.then
i8 71, label %if.then
i8 67, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i32 %l.040, 1
%cond = call i32 @llvm.smax.i32(i32 %a.039, i32 %inc)
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%a.1 = phi i32 [ %cond, %if.then ], [ %a.039, %for.body ]
%l.1 = phi i32 [ %inc, %if.then ], [ 0, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %for.inc.1 [
i8 65, label %if.then.1
i8 84, label %if.then.1
i8 71, label %if.then.1
i8 67, label %if.then.1
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i32 %l.1, 1
%cond.1 = call i32 @llvm.smax.i32(i32 %a.1, i32 %inc.1)
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%a.1.1 = phi i32 [ %cond.1, %if.then.1 ], [ %a.1, %for.inc ]
%l.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ 0, %for.inc ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.inc.1
%3 = add nsw i32 %l.1.1, 1
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%a.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %a.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.end.loopexit.unr-lcssa.loopexit ]
%l.040.unr = phi i32 [ 1, %for.body.preheader ], [ %3, %for.end.loopexit.unr-lcssa.loopexit ]
%a.039.unr = phi i32 [ 0, %for.body.preheader ], [ %a.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%4 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %4, label %for.end [
i8 65, label %if.then.epil
i8 84, label %if.then.epil
i8 71, label %if.then.epil
i8 67, label %if.then.epil
]
if.then.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%cond.epil = call i32 @llvm.smax.i32(i32 %a.039.unr, i32 %l.040.unr)
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %if.then.epil, %for.body.epil, %entry
%a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %cond.epil, %if.then.epil ], [ %a.039.unr, %for.body.epil ]
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0.lcssa)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int i,n,s;
scanf("%d", &n);
scanf("%d", &s);
int d,c,max=-1;
int flag=0;
for(i=0;i<n;i++)
{
scanf("%d",&d);
scanf("%d",&c);
if(c==0 && d<=s)
{
if(max<0)
max=0;
flag=1;
}
else if(d+1<=s)
{
if(max<100-c)
max=100-c;
flag=1;
}
}
if(flag==0)
printf("-1\n");
else
printf("%d\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21074/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21074/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%s = alloca i32, align 4
%d = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %if.then17
for.body: ; preds = %entry, %for.inc
%flag.028 = phi i32 [ %flag.1, %for.inc ], [ 0, %entry ]
%max.027 = phi i32 [ %max.2, %for.inc ], [ -1, %entry ]
%i.026 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp4 = icmp ne i32 %1, 0
%.pre = load i32, ptr %d, align 4, !tbaa !5
%.pre30 = load i32, ptr %s, align 4, !tbaa !5
%cmp5.not = icmp sgt i32 %.pre, %.pre30
%or.cond = select i1 %cmp4, i1 true, i1 %cmp5.not
br i1 %or.cond, label %if.else, label %if.then
if.then: ; preds = %for.body
%spec.store.select = call i32 @llvm.smax.i32(i32 %max.027, i32 0)
br label %for.inc
if.else: ; preds = %for.body
%cmp8.not.not = icmp slt i32 %.pre, %.pre30
br i1 %cmp8.not.not, label %if.then9, label %for.inc
if.then9: ; preds = %if.else
%sub = sub nsw i32 100, %1
%spec.select = call i32 @llvm.smax.i32(i32 %max.027, i32 %sub)
br label %for.inc
for.inc: ; preds = %if.then, %if.then9, %if.else
%max.2 = phi i32 [ %spec.store.select, %if.then ], [ %spec.select, %if.then9 ], [ %max.027, %if.else ]
%flag.1 = phi i32 [ 1, %if.then ], [ 1, %if.then9 ], [ %flag.028, %if.else ]
%inc = add nuw nsw i32 %i.026, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%3 = icmp eq i32 %flag.1, 0
br i1 %3, label %if.then17, label %if.else19
if.then17: ; preds = %entry, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end21
if.else19: ; preds = %for.end
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.2)
br label %if.end21
if.end21: ; preds = %if.else19, %if.then17
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int length(const char s[])
{
int i,j=0,len=0,count=0,max=0;
while(s[len])
len++;
for(i=0;i<len;i++){
if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
count++;
j=count;
}else{
if(max<j){
j=count;
max=j;
}
count=0;
}
}
if(max<j)
max=j;
return max;
}
int main(void){
char str[10];
scanf("%s",str);
printf("%d\n",length(str));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210783/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210783/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @length(ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv62 = phi i32 [ %indvars.iv.next63, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool.not = icmp eq i8 %0, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next63 = add i32 %indvars.iv62, 1
br i1 %tobool.not, label %for.cond.preheader, label %while.cond, !llvm.loop !8
for.cond.preheader: ; preds = %while.cond
%1 = and i64 %indvars.iv, 4294967295
%cmp52.not = icmp eq i64 %1, 0
br i1 %cmp52.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %indvars.iv62 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %indvars.iv62, 1
br i1 %2, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv59 = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next60.1, %for.inc.1 ]
%max.056 = phi i32 [ 0, %for.body.preheader.new ], [ %max.2.1, %for.inc.1 ]
%count.055 = phi i32 [ 0, %for.body.preheader.new ], [ %count.1.1, %for.inc.1 ]
%j.054 = phi i32 [ 0, %for.body.preheader.new ], [ %j.2.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx2 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv59
%3 = load i8, ptr %arrayidx2, align 1, !tbaa !5
switch i8 %3, label %if.else [
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%inc22 = add nsw i32 %count.055, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp23 = icmp slt i32 %max.056, %j.054
%spec.select = select i1 %cmp23, i32 %count.055, i32 %j.054
%spec.select50 = select i1 %cmp23, i32 %count.055, i32 %max.056
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%j.2 = phi i32 [ %inc22, %if.then ], [ %spec.select, %if.else ]
%count.1 = phi i32 [ %inc22, %if.then ], [ 0, %if.else ]
%max.2 = phi i32 [ %max.056, %if.then ], [ %spec.select50, %if.else ]
%indvars.iv.next60 = or i64 %indvars.iv59, 1
%arrayidx2.1 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.next60
%4 = load i8, ptr %arrayidx2.1, align 1, !tbaa !5
switch i8 %4, label %if.else.1 [
i8 65, label %if.then.1
i8 67, label %if.then.1
i8 71, label %if.then.1
i8 84, label %if.then.1
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc22.1 = add nsw i32 %count.1, 1
br label %for.inc.1
if.else.1: ; preds = %for.inc
%cmp23.1 = icmp slt i32 %max.2, %j.2
%spec.select.1 = select i1 %cmp23.1, i32 %count.1, i32 %j.2
%spec.select50.1 = select i1 %cmp23.1, i32 %count.1, i32 %max.2
br label %for.inc.1
for.inc.1: ; preds = %if.else.1, %if.then.1
%j.2.1 = phi i32 [ %inc22.1, %if.then.1 ], [ %spec.select.1, %if.else.1 ]
%count.1.1 = phi i32 [ %inc22.1, %if.then.1 ], [ 0, %if.else.1 ]
%max.2.1 = phi i32 [ %max.2, %if.then.1 ], [ %spec.select50.1, %if.else.1 ]
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59, 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 !10
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%j.2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %j.2.1, %for.inc.1 ]
%max.2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %max.2.1, %for.inc.1 ]
%indvars.iv59.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next60.1, %for.inc.1 ]
%max.056.unr = phi i32 [ 0, %for.body.preheader ], [ %max.2.1, %for.inc.1 ]
%count.055.unr = phi i32 [ 0, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%j.054.unr = phi i32 [ 0, %for.body.preheader ], [ %j.2.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx2.epil = getelementptr inbounds i8, ptr %s, i64 %indvars.iv59.unr
%5 = load i8, ptr %arrayidx2.epil, align 1, !tbaa !5
switch i8 %5, label %if.else.epil [
i8 65, label %if.then.epil
i8 67, label %if.then.epil
i8 71, label %if.then.epil
i8 84, label %if.then.epil
]
if.then.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%inc22.epil = add nsw i32 %count.055.unr, 1
br label %for.end
if.else.epil: ; preds = %for.body.epil
%cmp23.epil = icmp slt i32 %max.056.unr, %j.054.unr
%spec.select.epil = select i1 %cmp23.epil, i32 %count.055.unr, i32 %j.054.unr
%spec.select50.epil = select i1 %cmp23.epil, i32 %count.055.unr, i32 %max.056.unr
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %if.else.epil, %if.then.epil, %for.cond.preheader
%j.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %j.2.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %inc22.epil, %if.then.epil ], [ %spec.select.epil, %if.else.epil ]
%max.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %max.2.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %max.056.unr, %if.then.epil ], [ %spec.select50.epil, %if.else.epil ]
%spec.select51 = tail call i32 @llvm.smax.i32(i32 %max.0.lcssa, i32 %j.0.lcssa)
ret i32 %spec.select51
}
; 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:
%str = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %str) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %entry
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %entry ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i
%0 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%tobool.not.i = icmp eq i8 %0, 0
%indvars.iv.next.i = add i64 %indvars.iv.i, 1
br i1 %tobool.not.i, label %for.cond.preheader.i, label %while.cond.i, !llvm.loop !8
for.cond.preheader.i: ; preds = %while.cond.i
%1 = and i64 %indvars.iv.i, 4294967295
%cmp52.not.i = icmp eq i64 %1, 0
br i1 %cmp52.not.i, label %length.exit, label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.cond.preheader.i
%wide.trip.count.i = and i64 %indvars.iv.i, 4294967295
%xtraiter = and i64 %indvars.iv.i, 1
%2 = icmp eq i64 %wide.trip.count.i, 1
br i1 %2, label %length.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = sub nsw i64 %wide.trip.count.i, %xtraiter
br label %for.body.i
for.body.i: ; preds = %for.inc.i.1, %for.body.preheader.i.new
%indvars.iv59.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next60.i.1, %for.inc.i.1 ]
%max.056.i = phi i32 [ 0, %for.body.preheader.i.new ], [ %max.2.i.1, %for.inc.i.1 ]
%count.055.i = phi i32 [ 0, %for.body.preheader.i.new ], [ %count.1.i.1, %for.inc.i.1 ]
%j.054.i = phi i32 [ 0, %for.body.preheader.i.new ], [ %j.2.i.1, %for.inc.i.1 ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.1, %for.inc.i.1 ]
%arrayidx2.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv59.i
%3 = load i8, ptr %arrayidx2.i, align 1, !tbaa !5
switch i8 %3, label %if.else.i [
i8 65, label %if.then.i
i8 67, label %if.then.i
i8 71, label %if.then.i
i8 84, label %if.then.i
]
if.then.i: ; preds = %for.body.i, %for.body.i, %for.body.i, %for.body.i
%inc22.i = add nsw i32 %count.055.i, 1
br label %for.inc.i
if.else.i: ; preds = %for.body.i
%cmp23.i = icmp slt i32 %max.056.i, %j.054.i
%spec.select.i = select i1 %cmp23.i, i32 %count.055.i, i32 %j.054.i
%spec.select50.i = select i1 %cmp23.i, i32 %count.055.i, i32 %max.056.i
br label %for.inc.i
for.inc.i: ; preds = %if.else.i, %if.then.i
%j.2.i = phi i32 [ %inc22.i, %if.then.i ], [ %spec.select.i, %if.else.i ]
%count.1.i = phi i32 [ %inc22.i, %if.then.i ], [ 0, %if.else.i ]
%max.2.i = phi i32 [ %max.056.i, %if.then.i ], [ %spec.select50.i, %if.else.i ]
%indvars.iv.next60.i = or i64 %indvars.iv59.i, 1
%arrayidx2.i.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next60.i
%4 = load i8, ptr %arrayidx2.i.1, align 1, !tbaa !5
switch i8 %4, label %if.else.i.1 [
i8 65, label %if.then.i.1
i8 67, label %if.then.i.1
i8 71, label %if.then.i.1
i8 84, label %if.then.i.1
]
if.then.i.1: ; preds = %for.inc.i, %for.inc.i, %for.inc.i, %for.inc.i
%inc22.i.1 = add nsw i32 %count.1.i, 1
br label %for.inc.i.1
if.else.i.1: ; preds = %for.inc.i
%cmp23.i.1 = icmp slt i32 %max.2.i, %j.2.i
%spec.select.i.1 = select i1 %cmp23.i.1, i32 %count.1.i, i32 %j.2.i
%spec.select50.i.1 = select i1 %cmp23.i.1, i32 %count.1.i, i32 %max.2.i
br label %for.inc.i.1
for.inc.i.1: ; preds = %if.else.i.1, %if.then.i.1
%j.2.i.1 = phi i32 [ %inc22.i.1, %if.then.i.1 ], [ %spec.select.i.1, %if.else.i.1 ]
%count.1.i.1 = phi i32 [ %inc22.i.1, %if.then.i.1 ], [ 0, %if.else.i.1 ]
%max.2.i.1 = phi i32 [ %max.2.i, %if.then.i.1 ], [ %spec.select50.i.1, %if.else.i.1 ]
%indvars.iv.next60.i.1 = add nuw nsw i64 %indvars.iv59.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 %length.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !10
length.exit.loopexit.unr-lcssa: ; preds = %for.inc.i.1, %for.body.preheader.i
%j.2.i.lcssa.ph = phi i32 [ undef, %for.body.preheader.i ], [ %j.2.i.1, %for.inc.i.1 ]
%max.2.i.lcssa.ph = phi i32 [ undef, %for.body.preheader.i ], [ %max.2.i.1, %for.inc.i.1 ]
%indvars.iv59.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next60.i.1, %for.inc.i.1 ]
%max.056.i.unr = phi i32 [ 0, %for.body.preheader.i ], [ %max.2.i.1, %for.inc.i.1 ]
%count.055.i.unr = phi i32 [ 0, %for.body.preheader.i ], [ %count.1.i.1, %for.inc.i.1 ]
%j.054.i.unr = phi i32 [ 0, %for.body.preheader.i ], [ %j.2.i.1, %for.inc.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %length.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %length.exit.loopexit.unr-lcssa
%arrayidx2.i.epil = getelementptr inbounds i8, ptr %str, i64 %indvars.iv59.i.unr
%5 = load i8, ptr %arrayidx2.i.epil, align 1, !tbaa !5
switch i8 %5, label %if.else.i.epil [
i8 65, label %if.then.i.epil
i8 67, label %if.then.i.epil
i8 71, label %if.then.i.epil
i8 84, label %if.then.i.epil
]
if.then.i.epil: ; preds = %for.body.i.epil, %for.body.i.epil, %for.body.i.epil, %for.body.i.epil
%inc22.i.epil = add nsw i32 %count.055.i.unr, 1
br label %length.exit
if.else.i.epil: ; preds = %for.body.i.epil
%cmp23.i.epil = icmp slt i32 %max.056.i.unr, %j.054.i.unr
%spec.select.i.epil = select i1 %cmp23.i.epil, i32 %count.055.i.unr, i32 %j.054.i.unr
%spec.select50.i.epil = select i1 %cmp23.i.epil, i32 %count.055.i.unr, i32 %max.056.i.unr
br label %length.exit
length.exit: ; preds = %length.exit.loopexit.unr-lcssa, %if.else.i.epil, %if.then.i.epil, %for.cond.preheader.i
%j.0.lcssa.i = phi i32 [ 0, %for.cond.preheader.i ], [ %j.2.i.lcssa.ph, %length.exit.loopexit.unr-lcssa ], [ %inc22.i.epil, %if.then.i.epil ], [ %spec.select.i.epil, %if.else.i.epil ]
%max.0.lcssa.i = phi i32 [ 0, %for.cond.preheader.i ], [ %max.2.i.lcssa.ph, %length.exit.loopexit.unr-lcssa ], [ %max.056.i.unr, %if.then.i.epil ], [ %spec.select50.i.epil, %if.else.i.epil ]
%spec.select51.i = call i32 @llvm.smax.i32(i32 %max.0.lcssa.i, i32 %j.0.lcssa.i)
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select51.i)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %str) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#if 0
cat <<EOF >mistaken-paste
#endif
// thx Ebi-chan!
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 20000000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 1048576
#ifdef __cplusplus
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <array>
using std::queue;
using std::priority_queue;
using std::stack;
using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
using std::string;
using std::get;
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> l, pair<T, U> r) {
return pair<T, U>(l.first + r.first, l.second + r.second);
}
#endif
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
typedef struct {
double a;
double b;
} hwreal;
ull n, m;
ull h, w;
ull k;
ull q;
sll va, vb, vc, vd, ve, vf;
ull ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)
#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right
#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1
// int32_t pullcomp (const void *left, const void *right) {
// ull l = *(ull*)left;
// ull r = *(ull*)right;
// if (l < r) {
// return -1;
// }
// if (l > r) {
// return +1;
// }
// return 0;
// }
BEGCMP(pullcomp){
DEFLR(ull);
CMPRET(l, r);
return 0;
}
BEGCMP(prevcomp){
DEFLR(sll);
CMPRET(r, l);
return 0;
}
BEGCMP(psllcomp){
DEFLR(sll);
CMPRET(l, r);
return 0;
}
BEGCMP(pcharcomp){
DEFLR(char);
CMPRET(l, r);
return 0;
}
BEGCMP(pdoublecomp){
DEFLR(double);
CMPRET(l, r);
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
BEGCMP(phwllABcomp){
DEFLR(hwll);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
BEGCMP(phwllREVcomp){
DEFLR(hwll);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
return 0;
}
BEGCMP(ptriplecomp){
DEFLR(hwllc);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(ptripleREVcomp){
DEFLR(hwllc);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(ptripleCABcomp){
DEFLR(hwllc);
CMPRET(l.c, r.c);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
BEGCMP(phwrealcomp){
DEFLR(hwreal);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
int32_t pquadcomp (const void *left, const void *right) {
linell l = *(linell*)left;
linell r = *(linell*)right;
sll ac = phwllABcomp(&(l.a), &(r.a));
if (ac) return ac;
sll bc = phwllABcomp(&(l.b), &(r.b));
if (bc) return bc;
return 0;
}
int32_t pfracomp (const void *left, const void *right) {
hwllc l = *(hwllc*)left;
hwllc r = *(hwllc*)right;
CMPRET(l.a * r.b, l.b * r.a);
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
sll a[N_MAX + 5];
// ull a[N_MAX + 5];
// sll a[3001][3001];
sll b[N_MAX + 5];
// ull b[N_MAX + 5];
// sll b[3001][3001];
sll c[N_MAX + 5];
sll d[N_MAX + 5];
sll e[N_MAX * 4];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
char u[N_MAX + 1];
hwll xy[N_MAX * 2 + 5];
hwllc tup[N_MAX + 5];
// sll table[3005][3005];
hwll gin[N_MAX];
// here we go
ull solve () {
sll i, j, ki, li;
// ull result = 0;
sll result = 0;
double dresult = 0;
// ull maybe = 0;
sll maybe = 0;
// ull sum = 0;
sll sum = 0;
sll item;
sll *dpcell;
n = strlen(s);
sum = 0;
for (i = 0; i < n; i++) {
switch (s[i]) {
case 'A':
case 'T':
case 'G':
case 'C':
result = smax(result, ++sum);
break;
default:
sum = 0;
break;
}
}
printf("%lld\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
puts("YES");
// puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("First");
return 0;
fail:
puts("NO");
// puts("No");
// puts("0");
// puts("-1");
// puts("-1 -1 -1");
// puts("Second");
return 1;
}
int32_t main (int argc, char *argv[]) {
int32_t i, j;
n = 5;
m = 0;
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &n, &m);
// scanf("%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
// scanf("%llu", &q);
// scanf("%lld%lld", &va, &vb, &vc, &vd);
// va--;
// vb--;
// scanf("%llu%llu", &ua, &ub, &uc, &ud, &ue);
scanf("%s", s);
// scanf("%s", t);
// scanf("%s", u);
// scanf("%llu", &k);
// scanf("%lld", &m);
// for (i = 0; i < n; i++) {
// scanf("%lld", &a[i]);
// // scanf("%lld", &d[i]);
// }
// scanf("%llu", &q);
for (i = 0; i < 0; i++) {
// scanf("%lld%lld", &xy[i].a, &xy[i].b);
// scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c);
// scanf("%lld", &c[i]);
scanf("%lld", &a[i]);
// scanf("%lld", &b[i]);
// scanf("%lld", &c[i]);
// scanf("%lld", &d[i]);
// a[i]--;
// b[i]--;
// c[i]--;
// d[i]--;
// xy[i].a--;
// xy[i].b--;
// tup[i].a--;
// tup[i].b--;
}
// for (i = 0; i < n; i++) {
// // scanf("%lld%lld", &a[i], &b[i]);
// scanf("%lld", &b[i]);
// // a[i]--;
// // b[i]--;
// // scanf("%lld", &d[i]);
// // scanf("%lld", &e[i]);
// // d[i]--;
// }
// for (i = 0; i < q; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// scanf("%lld", &c[i]);
// // xy[i].a--;
// // xy[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < m; j++) {
// scanf("%lld", &table[i][j]);
// // table[i][j]--;
// }
// }
// for (i = 0; i < h; i++) {
// scanf("%s", s[i]);
// }
// scanf("%llu", &q);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210826/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210826/source.c"
target datalayout = "e-m:e-p270: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.hwll = type { i64, i64 }
%struct.hwllc = type { i64, i64, i64 }
@s = dso_local global [1048577 x i8] zeroinitializer, align 16
@n = dso_local local_unnamed_addr global i64 0, align 8
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@m = dso_local local_unnamed_addr global i64 0, align 8
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@a = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@q = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@ve = dso_local local_unnamed_addr global i64 0, align 8
@vf = dso_local local_unnamed_addr global i64 0, align 8
@ua = dso_local local_unnamed_addr global i64 0, align 8
@ub = dso_local local_unnamed_addr global i64 0, align 8
@uc = dso_local local_unnamed_addr global i64 0, align 8
@ud = dso_local local_unnamed_addr global i64 0, align 8
@ue = dso_local local_unnamed_addr global i64 0, align 8
@uf = dso_local local_unnamed_addr global i64 0, align 8
@vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@b = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@e = dso_local local_unnamed_addr global [4194304 x i64] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [1048577 x i8] zeroinitializer, align 16
@u = dso_local local_unnamed_addr global [1048577 x i8] zeroinitializer, align 16
@xy = dso_local local_unnamed_addr global [2097157 x %struct.hwll] zeroinitializer, align 16
@tup = dso_local local_unnamed_addr global [1048581 x %struct.hwllc] zeroinitializer, align 16
@gin = dso_local local_unnamed_addr global [1048576 x %struct.hwll] zeroinitializer, align 16
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 {
entry:
%cmp4 = icmp eq i64 %y, 0
br i1 %cmp4, label %return, label %if.else
if.else: ; preds = %entry, %if.else
%y.tr6 = phi i64 [ %rem, %if.else ], [ %y, %entry ]
%x.tr5 = phi i64 [ %y.tr6, %if.else ], [ %x, %entry ]
%rem = urem i64 %x.tr5, %y.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.else, %entry
%x.tr.lcssa = phi i64 [ %x, %entry ], [ %y.tr6, %if.else ]
ret i64 %x.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%tobool.not12 = icmp eq i64 %x, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.015, %a.addr.014
%rem = urem i64 %mul, %modulo
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ]
%div11 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.014, %a.addr.014
%rem3 = urem i64 %mul2, %modulo
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%sub = add i64 %modulo, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ]
%x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %x.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul i64 %a.addr.014.i, %result.015.i
%rem.i = urem i64 %mul.i, %modulo
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ]
%div11.i = lshr i64 %x.addr.013.i, 1
%mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = urem i64 %mul2.i, %modulo
%tobool.not.i = icmp ult i64 %x.addr.013.i, 2
br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5
bitpow.exit: ; preds = %if.end.i, %entry
%result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ]
%mul = mul i64 %result.0.lcssa.i, %a
%rem = urem i64 %mul, %modulo
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not = icmp ult i64 %a, %b
%sub = sub i64 %a, %b
%sub1 = sub i64 %b, %a
%retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 {
entry:
%tobool.not6 = icmp eq i64 %n, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ]
%0 = trunc i64 %n.addr.07 to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %result.08
%div5 = lshr i64 %n.addr.07, 1
%tobool.not = icmp ult i64 %n.addr.07, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7
while.end: ; preds = %while.body, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
ret i32 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext 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 @prevcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %1, %0
%cmp1 = icmp sgt i64 %1, %0
%. = zext 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 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = zext 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 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %left, align 1, !tbaa !12
%1 = load i8, ptr %right, align 1, !tbaa !12
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp sgt i8 %0, %1
%. = zext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load double, ptr %left, align 8, !tbaa !13
%1 = load double, ptr %right, align 8, !tbaa !13
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp ogt double %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %left, align 8, !tbaa !15
%1 = load ptr, ptr %right, align 8, !tbaa !15
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #9
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptripleREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptripleCABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwrealcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load double, ptr %left, align 8, !tbaa.struct !20
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load double, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !21
%r.sroa.0.0.copyload = load double, ptr %right, align 8, !tbaa.struct !20
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load double, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !21
%cmp = fcmp olt double %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = fcmp ogt double %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = fcmp olt double %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = fcmp ogt double %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pquadcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !22
%l.sroa.4.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.4.0.copyload = load i64, ptr %l.sroa.4.0.left.sroa_idx, align 8, !tbaa.struct !19
%l.sroa.5.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0.left.sroa_idx, align 8, !tbaa.struct !17
%l.sroa.6.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 24
%l.sroa.6.0.copyload = load i64, ptr %l.sroa.6.0.left.sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !22
%r.sroa.4.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.4.0.copyload = load i64, ptr %r.sroa.4.0.right.sroa_idx, align 8, !tbaa.struct !19
%r.sroa.5.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0.right.sroa_idx, align 8, !tbaa.struct !17
%r.sroa.6.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 24
%r.sroa.6.0.copyload = load i64, ptr %r.sroa.6.0.right.sroa_idx, align 8, !tbaa.struct !18
%cmp.i = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp.i, label %cleanup10, label %if.end.i
if.end.i: ; preds = %entry
%cmp4.i = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4.i, label %cleanup10, label %if.end6.i
if.end6.i: ; preds = %if.end.i
%cmp8.i = icmp slt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp8.i, label %cleanup10, label %phwllABcomp.exit
phwllABcomp.exit: ; preds = %if.end6.i
%cmp13.i.not = icmp sgt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp13.i.not, label %cleanup10, label %if.end
if.end: ; preds = %phwllABcomp.exit
%cmp.i21 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp.i21, label %cleanup10, label %if.end.i22
if.end.i22: ; preds = %if.end
%cmp4.i23 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4.i23, label %cleanup10, label %if.end6.i24
if.end6.i24: ; preds = %if.end.i22
%cmp8.i25 = icmp slt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
br i1 %cmp8.i25, label %cleanup10, label %if.end10.i26
if.end10.i26: ; preds = %if.end6.i24
%cmp13.i27 = icmp sgt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
%..i28 = zext i1 %cmp13.i27 to i32
br label %cleanup10
cleanup10: ; preds = %if.end10.i26, %if.end6.i24, %if.end.i22, %if.end, %if.end6.i, %if.end.i, %entry, %phwllABcomp.exit
%retval.1 = phi i32 [ 1, %phwllABcomp.exit ], [ -1, %if.end6.i ], [ 1, %if.end.i ], [ -1, %entry ], [ -1, %if.end ], [ 1, %if.end.i22 ], [ -1, %if.end6.i24 ], [ %..i28, %if.end10.i26 ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pfracomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%mul = mul nsw i64 %r.sroa.5.0.copyload, %l.sroa.0.0.copyload
%mul3 = mul nsw i64 %r.sroa.0.0.copyload, %l.sroa.5.0.copyload
%cmp = icmp slt i64 %mul, %mul3
%cmp10 = icmp sgt i64 %mul, %mul3
%. = zext i1 %cmp10 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp sle i64 %left, %x
%cmp1 = icmp sle i64 %x, %right
%0 = and i1 %cmp, %cmp1
ret i1 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %left, %x
%cmp1.not = icmp sgt i64 %x, %right
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%cmp2 = icmp sge i64 %left, %x
%cmp3 = icmp sge i64 %x, %right
%0 = and i1 %cmp2, %cmp3
br label %lor.end
lor.end: ; preds = %entry, %lor.rhs
%1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ]
ret i1 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #6 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #9
store i64 %call, ptr @n, align 8, !tbaa !8
%cmp18.not = icmp eq i64 %call, 0
br i1 %cmp18.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
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 %call, -2
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%i.021 = phi i64 [ 0, %for.body.preheader.new ], [ %inc2.1, %for.inc.1 ]
%result.020 = phi i64 [ 0, %for.body.preheader.new ], [ %result.1.1, %for.inc.1 ]
%sum.019 = phi i64 [ 0, %for.body.preheader.new ], [ %sum.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %i.021
%1 = load i8, ptr %arrayidx, align 2, !tbaa !12
%conv = sext i8 %1 to i32
switch i32 %conv, label %for.inc [
i32 65, label %sw.bb
i32 84, label %sw.bb
i32 71, label %sw.bb
i32 67, label %sw.bb
]
sw.bb: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i64 %sum.019, 1
%cond.i = tail call i64 @llvm.smax.i64(i64 %result.020, i64 %inc)
br label %for.inc
for.inc: ; preds = %for.body, %sw.bb
%sum.1 = phi i64 [ %inc, %sw.bb ], [ 0, %for.body ]
%result.1 = phi i64 [ %cond.i, %sw.bb ], [ %result.020, %for.body ]
%inc2 = or i64 %i.021, 1
%arrayidx.1 = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %inc2
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !12
%conv.1 = sext i8 %2 to i32
switch i32 %conv.1, label %for.inc.1 [
i32 65, label %sw.bb.1
i32 84, label %sw.bb.1
i32 71, label %sw.bb.1
i32 67, label %sw.bb.1
]
sw.bb.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i64 %sum.1, 1
%cond.i.1 = tail call i64 @llvm.smax.i64(i64 %result.1, i64 %inc.1)
br label %for.inc.1
for.inc.1: ; preds = %sw.bb.1, %for.inc
%sum.1.1 = phi i64 [ %inc.1, %sw.bb.1 ], [ 0, %for.inc ]
%result.1.1 = phi i64 [ %cond.i.1, %sw.bb.1 ], [ %result.1, %for.inc ]
%inc2.1 = add nuw nsw i64 %i.021, 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.loopexit, label %for.body, !llvm.loop !23
for.end.loopexit.unr-lcssa.loopexit: ; preds = %for.inc.1
%3 = add nsw i64 %sum.1.1, 1
br label %for.end.loopexit.unr-lcssa
for.end.loopexit.unr-lcssa: ; preds = %for.end.loopexit.unr-lcssa.loopexit, %for.body.preheader
%result.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %result.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%i.021.unr = phi i64 [ 0, %for.body.preheader ], [ %inc2.1, %for.end.loopexit.unr-lcssa.loopexit ]
%result.020.unr = phi i64 [ 0, %for.body.preheader ], [ %result.1.1, %for.end.loopexit.unr-lcssa.loopexit ]
%sum.019.unr = phi i64 [ 1, %for.body.preheader ], [ %3, %for.end.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %i.021.unr
%4 = load i8, ptr %arrayidx.epil, align 1, !tbaa !12
%conv.epil = sext i8 %4 to i32
switch i32 %conv.epil, label %for.end [
i32 65, label %sw.bb.epil
i32 84, label %sw.bb.epil
i32 71, label %sw.bb.epil
i32 67, label %sw.bb.epil
]
sw.bb.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%cond.i.epil = tail call i64 @llvm.smax.i64(i64 %result.020.unr, i64 %sum.019.unr)
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %sw.bb.epil, %for.body.epil, %entry
%result.0.lcssa = phi i64 [ 0, %entry ], [ %result.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %cond.i.epil, %sw.bb.epil ], [ %result.020.unr, %for.body.epil ]
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.0.lcssa)
ret i64 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #6 {
entry:
store i64 5, ptr @n, align 8, !tbaa !8
store i64 0, ptr @m, align 8, !tbaa !8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @s)
%call.i = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #9
store i64 %call.i, ptr @n, align 8, !tbaa !8
%cmp18.not.i = icmp eq i64 %call.i, 0
br i1 %cmp18.not.i, label %solve.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %call.i, 1
%0 = icmp eq i64 %call.i, 1
br i1 %0, label %solve.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %call.i, -2
br label %for.body.i
for.body.i: ; preds = %for.inc.i.1, %for.body.i.preheader.new
%i.021.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %inc2.i.1, %for.inc.i.1 ]
%result.020.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %result.1.i.1, %for.inc.i.1 ]
%sum.019.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %sum.1.i.1, %for.inc.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.inc.i.1 ]
%arrayidx.i = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %i.021.i
%1 = load i8, ptr %arrayidx.i, align 2, !tbaa !12
%conv.i = sext i8 %1 to i32
switch i32 %conv.i, label %for.inc.i [
i32 65, label %sw.bb.i
i32 84, label %sw.bb.i
i32 71, label %sw.bb.i
i32 67, label %sw.bb.i
]
sw.bb.i: ; preds = %for.body.i, %for.body.i, %for.body.i, %for.body.i
%inc.i = add nsw i64 %sum.019.i, 1
%cond.i.i = tail call i64 @llvm.smax.i64(i64 %result.020.i, i64 %inc.i)
br label %for.inc.i
for.inc.i: ; preds = %sw.bb.i, %for.body.i
%sum.1.i = phi i64 [ %inc.i, %sw.bb.i ], [ 0, %for.body.i ]
%result.1.i = phi i64 [ %cond.i.i, %sw.bb.i ], [ %result.020.i, %for.body.i ]
%inc2.i = or i64 %i.021.i, 1
%arrayidx.i.1 = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %inc2.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !12
%conv.i.1 = sext i8 %2 to i32
switch i32 %conv.i.1, label %for.inc.i.1 [
i32 65, label %sw.bb.i.1
i32 84, label %sw.bb.i.1
i32 71, label %sw.bb.i.1
i32 67, label %sw.bb.i.1
]
sw.bb.i.1: ; preds = %for.inc.i, %for.inc.i, %for.inc.i, %for.inc.i
%inc.i.1 = add nsw i64 %sum.1.i, 1
%cond.i.i.1 = tail call i64 @llvm.smax.i64(i64 %result.1.i, i64 %inc.i.1)
br label %for.inc.i.1
for.inc.i.1: ; preds = %sw.bb.i.1, %for.inc.i
%sum.1.i.1 = phi i64 [ %inc.i.1, %sw.bb.i.1 ], [ 0, %for.inc.i ]
%result.1.i.1 = phi i64 [ %cond.i.i.1, %sw.bb.i.1 ], [ %result.1.i, %for.inc.i ]
%inc2.i.1 = add nuw nsw i64 %i.021.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 %solve.exit.loopexit.unr-lcssa.loopexit, label %for.body.i, !llvm.loop !23
solve.exit.loopexit.unr-lcssa.loopexit: ; preds = %for.inc.i.1
%3 = add nsw i64 %sum.1.i.1, 1
br label %solve.exit.loopexit.unr-lcssa
solve.exit.loopexit.unr-lcssa: ; preds = %solve.exit.loopexit.unr-lcssa.loopexit, %for.body.i.preheader
%result.1.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %result.1.i.1, %solve.exit.loopexit.unr-lcssa.loopexit ]
%i.021.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %inc2.i.1, %solve.exit.loopexit.unr-lcssa.loopexit ]
%result.020.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %result.1.i.1, %solve.exit.loopexit.unr-lcssa.loopexit ]
%sum.019.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %3, %solve.exit.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %solve.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %solve.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %i.021.i.unr
%4 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !12
%conv.i.epil = sext i8 %4 to i32
switch i32 %conv.i.epil, label %solve.exit [
i32 65, label %sw.bb.i.epil
i32 84, label %sw.bb.i.epil
i32 71, label %sw.bb.i.epil
i32 67, label %sw.bb.i.epil
]
sw.bb.i.epil: ; preds = %for.body.i.epil, %for.body.i.epil, %for.body.i.epil, %for.body.i.epil
%cond.i.i.epil = tail call i64 @llvm.smax.i64(i64 %result.020.i.unr, i64 %sum.019.i.unr)
br label %solve.exit
solve.exit: ; preds = %solve.exit.loopexit.unr-lcssa, %sw.bb.i.epil, %for.body.i.epil, %entry
%result.0.lcssa.i = phi i64 [ 0, %entry ], [ %result.1.i.lcssa.ph, %solve.exit.loopexit.unr-lcssa ], [ %cond.i.i.epil, %sw.bb.i.epil ], [ %result.020.i.unr, %for.body.i.epil ]
%call3.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %result.0.lcssa.i)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #8
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 norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8}
!18 = !{i64 0, i64 8, !8}
!19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8}
!20 = !{i64 0, i64 8, !13, i64 8, i64 8, !13}
!21 = !{i64 0, i64 8, !13}
!22 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !8}
!23 = distinct !{!23, !6}
|
#include<stdio.h>
int main()
{
long int n,dollar,energy,i;
scanf("%ld",&n);
long int a[n+1];
a[0]=0;
for(i=1;i<=n;i++)
scanf("%ld",&a[i]);
energy=0;
dollar=a[1]-0;
//printf("%ld %ld\n",dollar,energy);
for(i=1;i<n;i++)
{
if(a[i+1]>a[i])
{
if(energy>=(a[i+1]-a[i]))
energy=energy-(a[i+1]-a[i]);
else
{
dollar=dollar+(a[i+1]-a[i])-energy;
energy=0;
}
}
if(a[i+1]<=a[i])
energy=energy+a[i]-a[i+1];
}
printf("%ld\n",dollar);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21087/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21087/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %0, 1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
store i64 0, ptr %vla, align 16, !tbaa !5
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not67 = icmp sgt i64 %2, 0
call void @llvm.assume(i1 %cmp.not67)
br label %for.body
for.body: ; preds = %entry, %for.body
%i.068 = phi i64 [ %inc, %for.body ], [ 1, %entry ]
%arrayidx1 = getelementptr inbounds i64, ptr %vla, i64 %i.068
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%inc = add nuw nsw i64 %i.068, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.068, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%arrayidx3.phi.trans.insert = getelementptr inbounds i64, ptr %vla, i64 1
%.pre = load i64, ptr %arrayidx3.phi.trans.insert, align 8, !tbaa !5
%cmp569 = icmp sgt i64 %3, 1
br i1 %cmp569, label %for.body6, label %for.end42
for.body6: ; preds = %for.end, %if.end28
%4 = phi i64 [ %5, %if.end28 ], [ %.pre, %for.end ]
%dollar.072 = phi i64 [ %dollar.1, %if.end28 ], [ %.pre, %for.end ]
%i.171 = phi i64 [ %add7, %if.end28 ], [ 1, %for.end ]
%energy.070 = phi i64 [ %energy.2, %if.end28 ], [ 0, %for.end ]
%add7 = add nuw nsw i64 %i.171, 1
%arrayidx8 = getelementptr inbounds i64, ptr %vla, i64 %add7
%5 = load i64, ptr %arrayidx8, align 8, !tbaa !5
%cmp10 = icmp sgt i64 %5, %4
br i1 %cmp10, label %if.then, label %if.end28
if.then: ; preds = %for.body6
%sub14 = sub nsw i64 %5, %4
%cmp15.not = icmp slt i64 %energy.070, %sub14
br i1 %cmp15.not, label %if.else, label %if.then16
if.then16: ; preds = %if.then
%sub21 = sub nsw i64 %energy.070, %sub14
br label %if.end28
if.else: ; preds = %if.then
%add26 = sub i64 %dollar.072, %energy.070
%sub27 = add i64 %add26, %sub14
br label %if.end28
if.end28: ; preds = %if.then16, %if.else, %for.body6
%energy.1 = phi i64 [ %sub21, %if.then16 ], [ 0, %if.else ], [ %energy.070, %for.body6 ]
%dollar.1 = phi i64 [ %dollar.072, %if.then16 ], [ %sub27, %if.else ], [ %dollar.072, %for.body6 ]
%add35 = sub i64 %4, %5
%sub38 = select i1 %cmp10, i64 0, i64 %add35
%energy.2 = add i64 %energy.1, %sub38
%exitcond.not = icmp eq i64 %add7, %3
br i1 %exitcond.not, label %for.end42, label %for.body6, !llvm.loop !11
for.end42: ; preds = %if.end28, %for.end
%dollar.0.lcssa = phi i64 [ %.pre, %for.end ], [ %dollar.1, %if.end28 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %dollar.0.lcssa)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
int main(void) {
char S[11];
int i, count = 0, ans = 0;
scanf("%s", &S);
for (i = 0; i < 11; ++i) {
switch (S[i]) {
case'A':
case'G':
case'C':
case'T':
++count;
break;
default:
if (count > ans) {
ans = count;
count = 0;
}
else {
ans = ans;
count = 0;
}
break;
}
}
printf("%d", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210912/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210912/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 1, !tbaa !5
%conv = sext i8 %0 to i32
switch i32 %conv, label %sw.default [
i32 65, label %for.inc
i32 71, label %for.inc
i32 67, label %for.inc
i32 84, label %for.inc
]
sw.default: ; preds = %entry
br label %for.inc
for.inc: ; preds = %entry, %entry, %entry, %entry, %sw.default
%count.1 = phi i32 [ 0, %sw.default ], [ 1, %entry ], [ 1, %entry ], [ 1, %entry ], [ 1, %entry ]
%arrayidx.1 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%conv.1 = sext i8 %1 to i32
switch i32 %conv.1, label %for.inc.1 [
i32 65, label %sw.bb.1
i32 71, label %sw.bb.1
i32 67, label %sw.bb.1
i32 84, label %sw.bb.1
]
sw.bb.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nuw nsw i32 %count.1, 1
br label %for.inc.1
for.inc.1: ; preds = %for.inc, %sw.bb.1
%count.1.1 = phi i32 [ %inc.1, %sw.bb.1 ], [ 0, %for.inc ]
%ans.1.1 = phi i32 [ 0, %sw.bb.1 ], [ %count.1, %for.inc ]
%arrayidx.2 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%conv.2 = sext i8 %2 to i32
switch i32 %conv.2, label %sw.default.2 [
i32 65, label %sw.bb.2
i32 71, label %sw.bb.2
i32 67, label %sw.bb.2
i32 84, label %sw.bb.2
]
sw.bb.2: ; preds = %for.inc.1, %for.inc.1, %for.inc.1, %for.inc.1
%inc.2 = add nuw nsw i32 %count.1.1, 1
br label %for.inc.2
sw.default.2: ; preds = %for.inc.1
%count.0.ans.0.2 = call i32 @llvm.smax.i32(i32 %count.1.1, i32 %ans.1.1)
br label %for.inc.2
for.inc.2: ; preds = %sw.default.2, %sw.bb.2
%count.1.2 = phi i32 [ %inc.2, %sw.bb.2 ], [ 0, %sw.default.2 ]
%ans.1.2 = phi i32 [ %ans.1.1, %sw.bb.2 ], [ %count.0.ans.0.2, %sw.default.2 ]
%arrayidx.3 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%conv.3 = sext i8 %3 to i32
switch i32 %conv.3, label %sw.default.3 [
i32 65, label %sw.bb.3
i32 71, label %sw.bb.3
i32 67, label %sw.bb.3
i32 84, label %sw.bb.3
]
sw.bb.3: ; preds = %for.inc.2, %for.inc.2, %for.inc.2, %for.inc.2
%inc.3 = add nuw nsw i32 %count.1.2, 1
br label %for.inc.3
sw.default.3: ; preds = %for.inc.2
%count.0.ans.0.3 = call i32 @llvm.smax.i32(i32 %count.1.2, i32 %ans.1.2)
br label %for.inc.3
for.inc.3: ; preds = %sw.default.3, %sw.bb.3
%count.1.3 = phi i32 [ %inc.3, %sw.bb.3 ], [ 0, %sw.default.3 ]
%ans.1.3 = phi i32 [ %ans.1.2, %sw.bb.3 ], [ %count.0.ans.0.3, %sw.default.3 ]
%arrayidx.4 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 4
%4 = load i8, ptr %arrayidx.4, align 1, !tbaa !5
%conv.4 = sext i8 %4 to i32
switch i32 %conv.4, label %sw.default.4 [
i32 65, label %sw.bb.4
i32 71, label %sw.bb.4
i32 67, label %sw.bb.4
i32 84, label %sw.bb.4
]
sw.bb.4: ; preds = %for.inc.3, %for.inc.3, %for.inc.3, %for.inc.3
%inc.4 = add nuw nsw i32 %count.1.3, 1
br label %for.inc.4
sw.default.4: ; preds = %for.inc.3
%count.0.ans.0.4 = call i32 @llvm.smax.i32(i32 %count.1.3, i32 %ans.1.3)
br label %for.inc.4
for.inc.4: ; preds = %sw.default.4, %sw.bb.4
%count.1.4 = phi i32 [ %inc.4, %sw.bb.4 ], [ 0, %sw.default.4 ]
%ans.1.4 = phi i32 [ %ans.1.3, %sw.bb.4 ], [ %count.0.ans.0.4, %sw.default.4 ]
%arrayidx.5 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 5
%5 = load i8, ptr %arrayidx.5, align 1, !tbaa !5
%conv.5 = sext i8 %5 to i32
switch i32 %conv.5, label %sw.default.5 [
i32 65, label %sw.bb.5
i32 71, label %sw.bb.5
i32 67, label %sw.bb.5
i32 84, label %sw.bb.5
]
sw.bb.5: ; preds = %for.inc.4, %for.inc.4, %for.inc.4, %for.inc.4
%inc.5 = add nuw nsw i32 %count.1.4, 1
br label %for.inc.5
sw.default.5: ; preds = %for.inc.4
%count.0.ans.0.5 = call i32 @llvm.smax.i32(i32 %count.1.4, i32 %ans.1.4)
br label %for.inc.5
for.inc.5: ; preds = %sw.default.5, %sw.bb.5
%count.1.5 = phi i32 [ %inc.5, %sw.bb.5 ], [ 0, %sw.default.5 ]
%ans.1.5 = phi i32 [ %ans.1.4, %sw.bb.5 ], [ %count.0.ans.0.5, %sw.default.5 ]
%arrayidx.6 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 6
%6 = load i8, ptr %arrayidx.6, align 1, !tbaa !5
%conv.6 = sext i8 %6 to i32
switch i32 %conv.6, label %sw.default.6 [
i32 65, label %sw.bb.6
i32 71, label %sw.bb.6
i32 67, label %sw.bb.6
i32 84, label %sw.bb.6
]
sw.bb.6: ; preds = %for.inc.5, %for.inc.5, %for.inc.5, %for.inc.5
%inc.6 = add nuw nsw i32 %count.1.5, 1
br label %for.inc.6
sw.default.6: ; preds = %for.inc.5
%count.0.ans.0.6 = call i32 @llvm.smax.i32(i32 %count.1.5, i32 %ans.1.5)
br label %for.inc.6
for.inc.6: ; preds = %sw.default.6, %sw.bb.6
%count.1.6 = phi i32 [ %inc.6, %sw.bb.6 ], [ 0, %sw.default.6 ]
%ans.1.6 = phi i32 [ %ans.1.5, %sw.bb.6 ], [ %count.0.ans.0.6, %sw.default.6 ]
%arrayidx.7 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 7
%7 = load i8, ptr %arrayidx.7, align 1, !tbaa !5
%conv.7 = sext i8 %7 to i32
switch i32 %conv.7, label %sw.default.7 [
i32 65, label %sw.bb.7
i32 71, label %sw.bb.7
i32 67, label %sw.bb.7
i32 84, label %sw.bb.7
]
sw.bb.7: ; preds = %for.inc.6, %for.inc.6, %for.inc.6, %for.inc.6
%inc.7 = add nuw nsw i32 %count.1.6, 1
br label %for.inc.7
sw.default.7: ; preds = %for.inc.6
%count.0.ans.0.7 = call i32 @llvm.smax.i32(i32 %count.1.6, i32 %ans.1.6)
br label %for.inc.7
for.inc.7: ; preds = %sw.default.7, %sw.bb.7
%count.1.7 = phi i32 [ %inc.7, %sw.bb.7 ], [ 0, %sw.default.7 ]
%ans.1.7 = phi i32 [ %ans.1.6, %sw.bb.7 ], [ %count.0.ans.0.7, %sw.default.7 ]
%arrayidx.8 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 8
%8 = load i8, ptr %arrayidx.8, align 1, !tbaa !5
%conv.8 = sext i8 %8 to i32
switch i32 %conv.8, label %sw.default.8 [
i32 65, label %sw.bb.8
i32 71, label %sw.bb.8
i32 67, label %sw.bb.8
i32 84, label %sw.bb.8
]
sw.bb.8: ; preds = %for.inc.7, %for.inc.7, %for.inc.7, %for.inc.7
%inc.8 = add nuw nsw i32 %count.1.7, 1
br label %for.inc.8
sw.default.8: ; preds = %for.inc.7
%count.0.ans.0.8 = call i32 @llvm.smax.i32(i32 %count.1.7, i32 %ans.1.7)
br label %for.inc.8
for.inc.8: ; preds = %sw.default.8, %sw.bb.8
%count.1.8 = phi i32 [ %inc.8, %sw.bb.8 ], [ 0, %sw.default.8 ]
%ans.1.8 = phi i32 [ %ans.1.7, %sw.bb.8 ], [ %count.0.ans.0.8, %sw.default.8 ]
%arrayidx.9 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 9
%9 = load i8, ptr %arrayidx.9, align 1, !tbaa !5
%conv.9 = sext i8 %9 to i32
switch i32 %conv.9, label %sw.default.9 [
i32 65, label %sw.bb.9
i32 71, label %sw.bb.9
i32 67, label %sw.bb.9
i32 84, label %sw.bb.9
]
sw.bb.9: ; preds = %for.inc.8, %for.inc.8, %for.inc.8, %for.inc.8
%inc.9 = add nuw nsw i32 %count.1.8, 1
br label %for.inc.9
sw.default.9: ; preds = %for.inc.8
%count.0.ans.0.9 = call i32 @llvm.smax.i32(i32 %count.1.8, i32 %ans.1.8)
br label %for.inc.9
for.inc.9: ; preds = %sw.default.9, %sw.bb.9
%count.1.9 = phi i32 [ %inc.9, %sw.bb.9 ], [ 0, %sw.default.9 ]
%ans.1.9 = phi i32 [ %ans.1.8, %sw.bb.9 ], [ %count.0.ans.0.9, %sw.default.9 ]
%arrayidx.10 = getelementptr inbounds [11 x i8], ptr %S, i64 0, i64 10
%10 = load i8, ptr %arrayidx.10, align 1, !tbaa !5
%conv.10 = sext i8 %10 to i32
switch i32 %conv.10, label %sw.default.10 [
i32 65, label %for.inc.10
i32 71, label %for.inc.10
i32 67, label %for.inc.10
i32 84, label %for.inc.10
]
sw.default.10: ; preds = %for.inc.9
%count.0.ans.0.10 = call i32 @llvm.smax.i32(i32 %count.1.9, i32 %ans.1.9)
br label %for.inc.10
for.inc.10: ; preds = %for.inc.9, %for.inc.9, %for.inc.9, %for.inc.9, %sw.default.10
%ans.1.10 = phi i32 [ %count.0.ans.0.10, %sw.default.10 ], [ %ans.1.9, %for.inc.9 ], [ %ans.1.9, %for.inc.9 ], [ %ans.1.9, %for.inc.9 ], [ %ans.1.9, %for.inc.9 ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1.10)
call void @llvm.lifetime.end.p0(i64 11, 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: 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char b[11];
int i = 0,max = 0,coun = 0;
scanf("%s",&b);
for(i = 0;i < strlen(b) + 1;i++)
{
if(b[i] == 'A'|| b[i] == 'C'|| b[i] == 'G'|| b[i] == 'T')
coun++;
else{
if(coun >= max){
max = coun;
coun = 0;
}
}
}
printf("%d\n",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_210956/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_210956/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%b = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %b) #6
%cmp38.not = icmp eq i64 %call1, -1
br i1 %cmp38.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add i64 %call1, 1
%xtraiter = and i64 %0, 1
%1 = icmp eq i64 %call1, 0
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, -2
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%coun.041 = phi i32 [ 0, %for.body.preheader.new ], [ %coun.1.1, %for.inc.1 ]
%max.040 = phi i32 [ 0, %for.body.preheader.new ], [ %max.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [11 x i8], ptr %b, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %2, label %if.else [
i8 65, label %if.then
i8 67, label %if.then
i8 71, label %if.then
i8 84, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i32 %coun.041, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp23.not = icmp slt i32 %coun.041, %max.040
%spec.select = call i32 @llvm.smax.i32(i32 %coun.041, i32 %max.040)
%spec.select37 = select i1 %cmp23.not, i32 %coun.041, i32 0
br label %for.inc
for.inc: ; preds = %if.else, %if.then
%max.1 = phi i32 [ %max.040, %if.then ], [ %spec.select, %if.else ]
%coun.1 = phi i32 [ %inc, %if.then ], [ %spec.select37, %if.else ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [11 x i8], ptr %b, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %3, label %if.else.1 [
i8 65, label %if.then.1
i8 67, label %if.then.1
i8 71, label %if.then.1
i8 84, label %if.then.1
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i32 %coun.1, 1
br label %for.inc.1
if.else.1: ; preds = %for.inc
%cmp23.not.1 = icmp slt i32 %coun.1, %max.1
%spec.select.1 = call i32 @llvm.smax.i32(i32 %coun.1, i32 %max.1)
%spec.select37.1 = select i1 %cmp23.not.1, i32 %coun.1, i32 0
br label %for.inc.1
for.inc.1: ; preds = %if.else.1, %if.then.1
%max.1.1 = phi i32 [ %max.1, %if.then.1 ], [ %spec.select.1, %if.else.1 ]
%coun.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %spec.select37.1, %if.else.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%max.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %max.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%coun.041.unr = phi i32 [ 0, %for.body.preheader ], [ %coun.1.1, %for.inc.1 ]
%max.040.unr = phi i32 [ 0, %for.body.preheader ], [ %max.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [11 x i8], ptr %b, i64 0, i64 %indvars.iv.unr
%4 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %4, label %if.else.epil [
i8 65, label %for.end
i8 67, label %for.end
i8 71, label %for.end
i8 84, label %for.end
]
if.else.epil: ; preds = %for.body.epil
%spec.select.epil = call i32 @llvm.smax.i32(i32 %coun.041.unr, i32 %max.040.unr)
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil, %if.else.epil, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %max.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %if.else.epil ], [ %max.040.unr, %for.body.epil ], [ %max.040.unr, %for.body.epil ], [ %max.040.unr, %for.body.epil ], [ %max.040.unr, %for.body.epil ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %b) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main()
{
int i,flag1=0,flag2=0;
char s[12];
scanf("%s",s);
for(i=0;i<strlen(s);i++)
{
if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')
{
flag1++;
if(flag1>flag2)
flag2=flag1;
}
else
flag1=0;
}
printf("%d",flag2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211012/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [12 x i8], align 1
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%cmp38.not = icmp eq i64 %call2, 0
br i1 %cmp38.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %call2, 1
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 %call2, -2
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%flag2.041 = phi i32 [ 0, %for.body.preheader.new ], [ %flag2.1.1, %for.inc.1 ]
%flag1.040 = phi i32 [ 0, %for.body.preheader.new ], [ %flag1.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %1, label %for.inc [
i8 65, label %if.then
i8 84, label %if.then
i8 67, label %if.then
i8 71, label %if.then
]
if.then: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i32 %flag1.040, 1
%cmp24.not = icmp slt i32 %flag1.040, %flag2.041
%spec.select = select i1 %cmp24.not, i32 %flag2.041, i32 %inc
br label %for.inc
for.inc: ; preds = %if.then, %for.body
%flag1.1 = phi i32 [ %inc, %if.then ], [ 0, %for.body ]
%flag2.1 = phi i32 [ %spec.select, %if.then ], [ %flag2.041, %for.body ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %2, label %for.inc.1 [
i8 65, label %if.then.1
i8 84, label %if.then.1
i8 67, label %if.then.1
i8 71, label %if.then.1
]
if.then.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i32 %flag1.1, 1
%cmp24.not.1 = icmp slt i32 %flag1.1, %flag2.1
%spec.select.1 = select i1 %cmp24.not.1, i32 %flag2.1, i32 %inc.1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%flag1.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ 0, %for.inc ]
%flag2.1.1 = phi i32 [ %spec.select.1, %if.then.1 ], [ %flag2.1, %for.inc ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%flag2.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %flag2.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%flag2.041.unr = phi i32 [ 0, %for.body.preheader ], [ %flag2.1.1, %for.inc.1 ]
%flag1.040.unr = phi i32 [ 0, %for.body.preheader ], [ %flag1.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
switch i8 %3, label %for.end [
i8 65, label %if.then.epil
i8 84, label %if.then.epil
i8 67, label %if.then.epil
i8 71, label %if.then.epil
]
if.then.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%inc.epil = add nsw i32 %flag1.040.unr, 1
%cmp24.not.epil = icmp slt i32 %flag1.040.unr, %flag2.041.unr
%spec.select.epil = select i1 %cmp24.not.epil, i32 %flag2.041.unr, i32 %inc.epil
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %if.then.epil, %for.body.epil, %entry
%flag2.0.lcssa = phi i32 [ 0, %entry ], [ %flag2.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %if.then.epil ], [ %flag2.041.unr, %for.body.epil ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %flag2.0.lcssa)
call void @llvm.lifetime.end.p0(i64 12, 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define REP(i,n) for(i=0;i<n;i++)
int iin() {
int i;
scanf("%d", &i);
return i;
}
long long llin() {
long long i;
scanf("%lld", &i);
return i;
}
double din() {
double i;
scanf("%lf", &i);
return i;
}
char cin() {
char c;
scanf("%c", &c);
return c;
}
void stin(char *s) {
scanf("%s", s);
}
void iout(int i) {
printf("%d\n", i);
}
void llout(long long i) {
printf("%lld\n", i);
}
void dout(double i) {
printf("%lf\n", i);
}
void cout(char c) {
printf("%c\n", c);
}
void stout(char *s) {
printf("%s\n", s);
}
int main() {
char S[10];
int i, max = 0, count = 0;
stin(S);
REP(i, strlen(S)) {
if (S[i] != 'A' && S[i] != 'C' && S[i] != 'G' &&S[i] != 'T') {
if (max < count) max = count;
count = 0;
continue;
}
count++;
}
if (max < count) max = count;
iout(max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c"%c\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @iin() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #6
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @din() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #6
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local signext i8 @cin() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !13
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #6
ret i8 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @stin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @iout(i32 noundef %i) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %i)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @llout(i64 noundef %i) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %i)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dout(double noundef %i) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, double noundef %i)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @cout(i8 noundef signext %c) local_unnamed_addr #0 {
entry:
%conv = sext i8 %c to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %conv)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @stout(ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #6
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %S)
%call = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %S) #7
%cmp45.not = icmp eq i64 %call, 0
br i1 %cmp45.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call, 1
%0 = icmp eq i64 %call, 1
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 %call, -2
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%count.048 = phi i32 [ 0, %for.body.preheader.new ], [ %count.1.1, %for.inc.1 ]
%max.047 = phi i32 [ 0, %for.body.preheader.new ], [ %max.2.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !13
switch i8 %1, label %if.then [
i8 65, label %if.end26
i8 67, label %if.end26
i8 71, label %if.end26
i8 84, label %if.end26
]
if.then: ; preds = %for.body
%spec.select = call i32 @llvm.smax.i32(i32 %max.047, i32 %count.048)
br label %for.inc
if.end26: ; preds = %for.body, %for.body, %for.body, %for.body
%inc = add nsw i32 %count.048, 1
br label %for.inc
for.inc: ; preds = %if.end26, %if.then
%max.2 = phi i32 [ %spec.select, %if.then ], [ %max.047, %if.end26 ]
%count.1 = phi i32 [ 0, %if.then ], [ %inc, %if.end26 ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !13
switch i8 %2, label %if.then.1 [
i8 65, label %if.end26.1
i8 67, label %if.end26.1
i8 71, label %if.end26.1
i8 84, label %if.end26.1
]
if.end26.1: ; preds = %for.inc, %for.inc, %for.inc, %for.inc
%inc.1 = add nsw i32 %count.1, 1
br label %for.inc.1
if.then.1: ; preds = %for.inc
%spec.select.1 = call i32 @llvm.smax.i32(i32 %max.2, i32 %count.1)
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.end26.1
%max.2.1 = phi i32 [ %spec.select.1, %if.then.1 ], [ %max.2, %if.end26.1 ]
%count.1.1 = phi i32 [ 0, %if.then.1 ], [ %inc.1, %if.end26.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !14
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%max.2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %max.2.1, %for.inc.1 ]
%count.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%count.048.unr = phi i32 [ 0, %for.body.preheader ], [ %count.1.1, %for.inc.1 ]
%max.047.unr = phi i32 [ 0, %for.body.preheader ], [ %max.2.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [10 x i8], ptr %S, i64 0, i64 %indvars.iv.unr
%3 = load i8, ptr %arrayidx.epil, align 1, !tbaa !13
switch i8 %3, label %if.then.epil [
i8 65, label %if.end26.epil
i8 67, label %if.end26.epil
i8 71, label %if.end26.epil
i8 84, label %if.end26.epil
]
if.end26.epil: ; preds = %for.body.epil, %for.body.epil, %for.body.epil, %for.body.epil
%inc.epil = add nsw i32 %count.048.unr, 1
br label %for.end
if.then.epil: ; preds = %for.body.epil
%spec.select.epil = call i32 @llvm.smax.i32(i32 %max.047.unr, i32 %count.048.unr)
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %if.then.epil, %if.end26.epil, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %max.2.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %spec.select.epil, %if.then.epil ], [ %max.047.unr, %if.end26.epil ]
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ 0, %if.then.epil ], [ %inc.epil, %if.end26.epil ]
%spec.select43 = call i32 @llvm.smax.i32(i32 %max.0.lcssa, i32 %count.0.lcssa)
%call.i44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %spec.select43)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #6
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
|
/* Coached by rainboy */
#include <stdio.h>
#include <string.h>
#define N 100000
#define V 100000
int max(int a, int b) {
return a > b ? a : b;
}
int main() {
static int vv[N], kk[V + 1], mm1[2], mm2[2];
int n, i, max1, max2, v_, v, r;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &vv[i]);
for (r = 0; r < 2; r++) {
memset(kk, 0, sizeof kk);
for (i = r; i < n; i += 2)
kk[vv[i]]++;
max1 = max2 = 0;
v_ = -1;
for (v = 0; v <= V; v++)
if (max1 < kk[v]) {
max2 = max1;
max1 = kk[v];
v_ = v;
} else if (max2 < kk[v])
max2 = kk[v];
mm1[r] = max1;
mm2[r] = max2;
vv[r] = v_;
}
printf("%d\n", n - (vv[0] != vv[1] ? mm1[0] + mm1[1] : max(mm1[0] + mm2[1], mm1[1] + mm2[0])));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211106/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211106/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@main.vv = internal global [100000 x i32] zeroinitializer, align 16
@main.kk = internal 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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body, label %for.cond2.preheader.thread
for.cond2.preheader.thread: ; preds = %entry
%.pre = sext i32 %0 to i64
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) @main.kk, i8 0, i64 400004, i1 false)
br label %for.cond15.preheader
for.cond2.preheader: ; preds = %for.body
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) @main.kk, i8 0, i64 400004, i1 false)
%cmp669 = icmp sgt i32 %5, 0
br i1 %cmp669, label %for.body7.preheader, label %for.cond15.preheader
for.body7.preheader: ; preds = %for.cond2.preheader
%1 = add nsw i64 %6, -1
%2 = lshr i64 %1, 1
%3 = add nuw i64 %2, 1
%xtraiter = and i64 %3, 1
%4 = icmp ult i32 %5, 3
br i1 %4, label %for.cond15.preheader.loopexit.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %3, -2
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond15.preheader.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%indvars.iv80.unr = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next81.1100, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body7.epil
for.body7.epil: ; preds = %for.cond15.preheader.loopexit.unr-lcssa
%arrayidx9.epil = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv80.unr
%7 = load i32, ptr %arrayidx9.epil, align 8, !tbaa !5
%idxprom10.epil = sext i32 %7 to i64
%arrayidx11.epil = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %idxprom10.epil
%8 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%inc12.epil = add nsw i32 %8, 1
store i32 %inc12.epil, ptr %arrayidx11.epil, align 4, !tbaa !5
br label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.body7.epil, %for.cond15.preheader.loopexit.unr-lcssa, %for.cond2.preheader.thread, %for.cond2.preheader
%.lcssa91 = phi i32 [ %0, %for.cond2.preheader.thread ], [ %5, %for.cond2.preheader ], [ %5, %for.cond15.preheader.loopexit.unr-lcssa ], [ %5, %for.body7.epil ]
%.pre-phi90 = phi i64 [ %.pre, %for.cond2.preheader.thread ], [ %6, %for.cond2.preheader ], [ %6, %for.cond15.preheader.loopexit.unr-lcssa ], [ %6, %for.body7.epil ]
br label %for.body17
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%indvars.iv80 = phi i64 [ 0, %for.body7.preheader.new ], [ %indvars.iv.next81.1100, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ]
%arrayidx9 = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv80
%9 = load i32, ptr %arrayidx9, align 16, !tbaa !5
%idxprom10 = sext i32 %9 to i64
%arrayidx11 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %idxprom10
%10 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%inc12 = add nsw i32 %10, 1
store i32 %inc12, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next81 = or i64 %indvars.iv80, 2
%arrayidx9.196 = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv.next81
%11 = load i32, ptr %arrayidx9.196, align 8, !tbaa !5
%idxprom10.197 = sext i32 %11 to i64
%arrayidx11.198 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %idxprom10.197
%12 = load i32, ptr %arrayidx11.198, align 4, !tbaa !5
%inc12.199 = add nsw i32 %12, 1
store i32 %inc12.199, ptr %arrayidx11.198, align 4, !tbaa !5
%indvars.iv.next81.1100 = add nuw nsw i64 %indvars.iv80, 4
%niter.next.1 = add nuw nsw i64 %niter, 2
%niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1.not, label %for.cond15.preheader.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11
for.body17: ; preds = %for.body17.1114, %for.cond15.preheader
%indvars.iv83 = phi i64 [ 0, %for.cond15.preheader ], [ %indvars.iv.next84.1113, %for.body17.1114 ]
%v_.073 = phi i32 [ -1, %for.cond15.preheader ], [ %v_.1.1112, %for.body17.1114 ]
%max2.072 = phi i32 [ 0, %for.cond15.preheader ], [ %max2.1.1111, %for.body17.1114 ]
%max1.071 = phi i32 [ 0, %for.cond15.preheader ], [ %max1.1.1110, %for.body17.1114 ]
%arrayidx19 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %indvars.iv83
%13 = load i32, ptr %arrayidx19, align 8, !tbaa !5
%cmp20 = icmp slt i32 %max1.071, %13
%spec.select = call i32 @llvm.smax.i32(i32 %max2.072, i32 %13)
%max1.1 = call i32 @llvm.smax.i32(i32 %max1.071, i32 %13)
%max2.1 = select i1 %cmp20, i32 %max1.071, i32 %spec.select
%14 = trunc i64 %indvars.iv83 to i32
%v_.1 = select i1 %cmp20, i32 %14, i32 %v_.073
%indvars.iv.next84 = or i64 %indvars.iv83, 1
%exitcond.not = icmp eq i64 %indvars.iv.next84, 100001
br i1 %exitcond.not, label %for.end32, label %for.body17.1114, !llvm.loop !12
for.body17.1114: ; preds = %for.body17
%arrayidx19.1107 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %indvars.iv.next84
%15 = load i32, ptr %arrayidx19.1107, align 4, !tbaa !5
%cmp20.1108 = icmp slt i32 %max1.1, %15
%spec.select.1109 = call i32 @llvm.smax.i32(i32 %max2.1, i32 %15)
%max1.1.1110 = call i32 @llvm.smax.i32(i32 %max1.1, i32 %15)
%max2.1.1111 = select i1 %cmp20.1108, i32 %max1.1, i32 %spec.select.1109
%16 = trunc i64 %indvars.iv.next84 to i32
%v_.1.1112 = select i1 %cmp20.1108, i32 %16, i32 %v_.1
%indvars.iv.next84.1113 = add nuw nsw i64 %indvars.iv83, 2
br label %for.body17
for.end32: ; preds = %for.body17
store i32 %v_.1, ptr @main.vv, align 16, !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) @main.kk, i8 0, i64 400004, i1 false)
%cmp669.1 = icmp sgt i64 %.pre-phi90, 1
br i1 %cmp669.1, label %for.body7.1.preheader, label %for.body17.1.preheader
for.body7.1.preheader: ; preds = %for.end32
%17 = add nsw i64 %.pre-phi90, -2
%18 = lshr i64 %17, 1
%19 = add nuw i64 %18, 1
%xtraiter115 = and i64 %19, 1
%20 = icmp ult i64 %17, 2
br i1 %20, label %for.body17.1.preheader.loopexit.unr-lcssa, label %for.body7.1.preheader.new
for.body7.1.preheader.new: ; preds = %for.body7.1.preheader
%unroll_iter117 = and i64 %19, -2
br label %for.body7.1
for.body7.1: ; preds = %for.body7.1, %for.body7.1.preheader.new
%indvars.iv80.1 = phi i64 [ 1, %for.body7.1.preheader.new ], [ %indvars.iv.next81.1.1, %for.body7.1 ]
%niter118 = phi i64 [ 0, %for.body7.1.preheader.new ], [ %niter118.next.1, %for.body7.1 ]
%arrayidx9.1 = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv80.1
%21 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%idxprom10.1 = sext i32 %21 to i64
%arrayidx11.1 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %idxprom10.1
%22 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%inc12.1 = add nsw i32 %22, 1
store i32 %inc12.1, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next81.1 = add nuw nsw i64 %indvars.iv80.1, 2
%arrayidx9.1.1 = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv.next81.1
%23 = load i32, ptr %arrayidx9.1.1, align 4, !tbaa !5
%idxprom10.1.1 = sext i32 %23 to i64
%arrayidx11.1.1 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %idxprom10.1.1
%24 = load i32, ptr %arrayidx11.1.1, align 4, !tbaa !5
%inc12.1.1 = add nsw i32 %24, 1
store i32 %inc12.1.1, ptr %arrayidx11.1.1, align 4, !tbaa !5
%indvars.iv.next81.1.1 = add nuw nsw i64 %indvars.iv80.1, 4
%niter118.next.1 = add nuw i64 %niter118, 2
%niter118.ncmp.1.not = icmp eq i64 %niter118.next.1, %unroll_iter117
br i1 %niter118.ncmp.1.not, label %for.body17.1.preheader.loopexit.unr-lcssa, label %for.body7.1, !llvm.loop !11
for.body17.1.preheader.loopexit.unr-lcssa: ; preds = %for.body7.1, %for.body7.1.preheader
%indvars.iv80.1.unr = phi i64 [ 1, %for.body7.1.preheader ], [ %indvars.iv.next81.1.1, %for.body7.1 ]
%lcmp.mod116.not = icmp eq i64 %xtraiter115, 0
br i1 %lcmp.mod116.not, label %for.body17.1.preheader, label %for.body7.1.epil
for.body7.1.epil: ; preds = %for.body17.1.preheader.loopexit.unr-lcssa
%arrayidx9.1.epil = getelementptr inbounds [100000 x i32], ptr @main.vv, i64 0, i64 %indvars.iv80.1.unr
%25 = load i32, ptr %arrayidx9.1.epil, align 4, !tbaa !5
%idxprom10.1.epil = sext i32 %25 to i64
%arrayidx11.1.epil = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %idxprom10.1.epil
%26 = load i32, ptr %arrayidx11.1.epil, align 4, !tbaa !5
%inc12.1.epil = add nsw i32 %26, 1
store i32 %inc12.1.epil, ptr %arrayidx11.1.epil, align 4, !tbaa !5
br label %for.body17.1.preheader
for.body17.1.preheader: ; preds = %for.body7.1.epil, %for.body17.1.preheader.loopexit.unr-lcssa, %for.end32
br label %for.body17.1
for.body17.1: ; preds = %for.body17.1.1, %for.body17.1.preheader
%indvars.iv83.1 = phi i64 [ 0, %for.body17.1.preheader ], [ %indvars.iv.next84.1.1, %for.body17.1.1 ]
%v_.073.1 = phi i32 [ -1, %for.body17.1.preheader ], [ %v_.1.1.1, %for.body17.1.1 ]
%max2.072.1 = phi i32 [ 0, %for.body17.1.preheader ], [ %max2.1.1.1, %for.body17.1.1 ]
%max1.071.1 = phi i32 [ 0, %for.body17.1.preheader ], [ %max1.1.1.1, %for.body17.1.1 ]
%arrayidx19.1 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %indvars.iv83.1
%27 = load i32, ptr %arrayidx19.1, align 8, !tbaa !5
%cmp20.1 = icmp slt i32 %max1.071.1, %27
%spec.select.1 = call i32 @llvm.smax.i32(i32 %max2.072.1, i32 %27)
%max1.1.1 = call i32 @llvm.smax.i32(i32 %max1.071.1, i32 %27)
%max2.1.1 = select i1 %cmp20.1, i32 %max1.071.1, i32 %spec.select.1
%28 = trunc i64 %indvars.iv83.1 to i32
%v_.1.1 = select i1 %cmp20.1, i32 %28, i32 %v_.073.1
%indvars.iv.next84.1 = or i64 %indvars.iv83.1, 1
%exitcond.1.not = icmp eq i64 %indvars.iv.next84.1, 100001
br i1 %exitcond.1.not, label %for.end32.1, label %for.body17.1.1, !llvm.loop !12
for.body17.1.1: ; preds = %for.body17.1
%arrayidx19.1.1 = getelementptr inbounds [100001 x i32], ptr @main.kk, i64 0, i64 %indvars.iv.next84.1
%29 = load i32, ptr %arrayidx19.1.1, align 4, !tbaa !5
%cmp20.1.1 = icmp slt i32 %max1.1.1, %29
%spec.select.1.1 = call i32 @llvm.smax.i32(i32 %max2.1.1, i32 %29)
%max1.1.1.1 = call i32 @llvm.smax.i32(i32 %max1.1.1, i32 %29)
%max2.1.1.1 = select i1 %cmp20.1.1, i32 %max1.1.1, i32 %spec.select.1.1
%30 = trunc i64 %indvars.iv.next84.1 to i32
%v_.1.1.1 = select i1 %cmp20.1.1, i32 %30, i32 %v_.1.1
%indvars.iv.next84.1.1 = add nuw nsw i64 %indvars.iv83.1, 2
br label %for.body17.1
for.end32.1: ; preds = %for.body17.1
store i32 %v_.1.1, ptr getelementptr inbounds ([100000 x i32], ptr @main.vv, i64 0, i64 1), align 4, !tbaa !5
%cmp42.not = icmp eq i32 %v_.1, %v_.1.1
br i1 %cmp42.not, label %cond.false, label %cond.true
cond.true: ; preds = %for.end32.1
%add43 = add nuw nsw i32 %max1.1.1, %max1.1
br label %cond.end
cond.false: ; preds = %for.end32.1
%add44 = add nuw nsw i32 %max2.1.1, %max1.1
%add45 = add nuw nsw i32 %max2.1, %max1.1.1
%cond.i = call i32 @llvm.smax.i32(i32 %add44, i32 %add45)
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i32 [ %add43, %cond.true ], [ %cond.i, %cond.false ]
%sub = sub nsw i32 %.lcssa91, %cond
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(){
int i,j;
int l;
int n;
int p[100000];
int max1=0;
int max2=0;
int max11,max22=0;
int maxnum1;
int maxnum2;
int maxnum11;
int maxnum22;
int a,b=0;
for(i=0; i<100000; i++){
p[i]=0;
}
scanf("%d",&n);
int v[n];
for(i=0; i<=n-1; i++){
scanf("%d ",&v[i]);
}
for(i=0; i<=n-1; i++){
if(i%2==0){
l = v[i];
p[l]++;
}
}
for(i=0; i<100000; i++){
if(p[i]>max1){
max1 = p[i];
maxnum1 = i;
}
}
for(i=0; i<100000; i++){
if(p[i]>max11 && i!=maxnum1){
max11 = p[i];
maxnum11 = i;
}
}
//printf("%d\n",maxnum1);
for(i=0; i<100000; i++){
p[i]=0;
}
for(i=0; i<=n-1; i++){
if(i%2==1){
l = v[i];
p[l]++;
}
}
for(i=0; i<100000; i++){
if(p[i]>max2){
max2 = p[i];
maxnum2 = i;
}
}
for(i=0; i<100000; i++){
if(p[i]>max22 && i!=maxnum2){
max22 = p[i];
maxnum22 = i;
}
}
if(maxnum1!=maxnum2){
for(i=0; i<=n-1; i++){
if(i%2==0){
if(v[i]!=maxnum1){
a++;
}
}else if(i%2==1){
if(v[i]!=maxnum2){
b++;
}
}
}
}
if(maxnum1==maxnum2){
if(max1+max22>=max2+max11){
for(i=0; i<=n-1; i++){
if(i%2==0){
if(v[i]!=maxnum1){
a++;
}
}else if(i%2==1){
if(v[i]!=maxnum22){
b++;
}
}
}
}else if(max1+max22<max2+max11){
for(i=0; i<=n-1; i++){
if(i%2==0){
if(v[i]!=maxnum11){
a++;
}
}else if(i%2==1){
if(v[i]!=maxnum2){
b++;
}
}
}
}
}
//printf("%d\n",a);
printf("%d\n",a+b);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211157/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211157/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %p) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %p, i8 0, i64 400000, 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
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp2.not.not301 = icmp sgt i32 %3, 0
br i1 %cmp2.not.not301, label %for.body3, label %for.cond23.preheader
for.cond10.preheader: ; preds = %for.body3
%cmp12.not.not303 = icmp sgt i32 %5, 0
br i1 %cmp12.not.not303, label %for.body13.preheader, label %for.cond23.preheader
for.body13.preheader: ; preds = %for.cond10.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %5, 1
br i1 %4, label %for.cond23.preheader.loopexit.unr-lcssa, label %for.body13.preheader.new
for.body13.preheader.new: ; preds = %for.body13.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body13
for.body3: ; preds = %entry, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp2.not.not = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp2.not.not, label %for.body3, label %for.cond10.preheader, !llvm.loop !9
for.cond23.preheader.loopexit.unr-lcssa: ; preds = %for.body13, %for.body13.preheader
%indvars.iv342.unr = phi i64 [ 0, %for.body13.preheader ], [ %indvars.iv.next343.1, %for.body13 ]
%lcmp.mod.not = icmp ne i64 %xtraiter, 0
%rem384.epil = and i64 %indvars.iv342.unr, 1
%cmp14.epil = icmp eq i64 %rem384.epil, 0
%or.cond424 = select i1 %lcmp.mod.not, i1 %cmp14.epil, i1 false
br i1 %or.cond424, label %if.then.epil, label %for.cond23.preheader
if.then.epil: ; preds = %for.cond23.preheader.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv342.unr
%7 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%idxprom17.epil = sext i32 %7 to i64
%arrayidx18.epil = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %idxprom17.epil
%8 = load i32, ptr %arrayidx18.epil, align 4, !tbaa !5
%inc19.epil = add nsw i32 %8, 1
store i32 %inc19.epil, ptr %arrayidx18.epil, align 4, !tbaa !5
br label %for.cond23.preheader
for.cond23.preheader: ; preds = %for.cond23.preheader.loopexit.unr-lcssa, %if.then.epil, %entry, %for.cond10.preheader
%cmp12.not.not303392 = phi i1 [ false, %for.cond10.preheader ], [ false, %entry ], [ %cmp12.not.not303, %if.then.epil ], [ %cmp12.not.not303, %for.cond23.preheader.loopexit.unr-lcssa ]
%.lcssa391 = phi i32 [ %5, %for.cond10.preheader ], [ %3, %entry ], [ %5, %if.then.epil ], [ %5, %for.cond23.preheader.loopexit.unr-lcssa ]
br label %for.body25
for.body13: ; preds = %for.body13, %for.body13.preheader.new
%indvars.iv342 = phi i64 [ 0, %for.body13.preheader.new ], [ %indvars.iv.next343.1, %for.body13 ]
%niter = phi i64 [ 0, %for.body13.preheader.new ], [ %niter.next.1, %for.body13 ]
%arrayidx16 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv342
%9 = load i32, ptr %arrayidx16, align 8, !tbaa !5
%idxprom17 = sext i32 %9 to i64
%arrayidx18 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %idxprom17
%10 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%inc19 = add nsw i32 %10, 1
store i32 %inc19, ptr %arrayidx18, align 4, !tbaa !5
%indvars.iv.next343.1 = add nuw nsw i64 %indvars.iv342, 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.cond23.preheader.loopexit.unr-lcssa, label %for.body13, !llvm.loop !11
for.cond36.preheader: ; preds = %for.body25
%11 = zext i32 %spec.select285.3 to i64
br label %for.body38
for.body25: ; preds = %for.body25, %for.cond23.preheader
%indvars.iv345 = phi i64 [ 0, %for.cond23.preheader ], [ %indvars.iv.next346.3, %for.body25 ]
%maxnum1.0306 = phi i32 [ undef, %for.cond23.preheader ], [ %spec.select285.3, %for.body25 ]
%max1.0305 = phi i32 [ 0, %for.cond23.preheader ], [ %spec.select.3, %for.body25 ]
%arrayidx27 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv345
%12 = load i32, ptr %arrayidx27, align 16, !tbaa !5
%cmp28 = icmp sgt i32 %12, %max1.0305
%spec.select = call i32 @llvm.smax.i32(i32 %12, i32 %max1.0305)
%13 = trunc i64 %indvars.iv345 to i32
%spec.select285 = select i1 %cmp28, i32 %13, i32 %maxnum1.0306
%indvars.iv.next346 = or i64 %indvars.iv345, 1
%arrayidx27.1 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next346
%14 = load i32, ptr %arrayidx27.1, align 4, !tbaa !5
%cmp28.1 = icmp sgt i32 %14, %spec.select
%spec.select.1 = call i32 @llvm.smax.i32(i32 %14, i32 %spec.select)
%15 = trunc i64 %indvars.iv.next346 to i32
%spec.select285.1 = select i1 %cmp28.1, i32 %15, i32 %spec.select285
%indvars.iv.next346.1 = or i64 %indvars.iv345, 2
%arrayidx27.2 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next346.1
%16 = load i32, ptr %arrayidx27.2, align 8, !tbaa !5
%cmp28.2 = icmp sgt i32 %16, %spec.select.1
%spec.select.2 = call i32 @llvm.smax.i32(i32 %16, i32 %spec.select.1)
%17 = trunc i64 %indvars.iv.next346.1 to i32
%spec.select285.2 = select i1 %cmp28.2, i32 %17, i32 %spec.select285.1
%indvars.iv.next346.2 = or i64 %indvars.iv345, 3
%arrayidx27.3 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next346.2
%18 = load i32, ptr %arrayidx27.3, align 4, !tbaa !5
%cmp28.3 = icmp sgt i32 %18, %spec.select.2
%spec.select.3 = call i32 @llvm.smax.i32(i32 %18, i32 %spec.select.2)
%19 = trunc i64 %indvars.iv.next346.2 to i32
%spec.select285.3 = select i1 %cmp28.3, i32 %19, i32 %spec.select285.2
%indvars.iv.next346.3 = add nuw nsw i64 %indvars.iv345, 4
%exitcond348.not.3 = icmp eq i64 %indvars.iv.next346.3, 100000
br i1 %exitcond348.not.3, label %for.cond36.preheader, label %for.body25, !llvm.loop !12
for.cond50.preheader: ; preds = %for.body38
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %p, i8 0, i64 400000, i1 false), !tbaa !5
br i1 %cmp12.not.not303392, label %for.body61.preheader, label %for.body76.preheader
for.body76.preheader.loopexit.unr-lcssa: ; preds = %for.body61, %for.body61.preheader
%indvars.iv356.unr = phi i64 [ 0, %for.body61.preheader ], [ %indvars.iv.next357.1, %for.body61 ]
%lcmp.mod400.not = icmp eq i64 %xtraiter399, 0
%rem62385.epil = and i64 %indvars.iv356.unr, 1
%cmp63.not.epil = icmp eq i64 %rem62385.epil, 0
%or.cond425 = select i1 %lcmp.mod400.not, i1 true, i1 %cmp63.not.epil
br i1 %or.cond425, label %for.body76.preheader, label %if.then64.epil
if.then64.epil: ; preds = %for.body76.preheader.loopexit.unr-lcssa
%arrayidx66.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv356.unr
%20 = load i32, ptr %arrayidx66.epil, align 4, !tbaa !5
%idxprom67.epil = sext i32 %20 to i64
%arrayidx68.epil = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %idxprom67.epil
%21 = load i32, ptr %arrayidx68.epil, align 4, !tbaa !5
%inc69.epil = add nsw i32 %21, 1
store i32 %inc69.epil, ptr %arrayidx68.epil, align 4, !tbaa !5
br label %for.body76.preheader
for.body76.preheader: ; preds = %for.body76.preheader.loopexit.unr-lcssa, %if.then64.epil, %for.cond50.preheader
br label %for.body76
for.body38: ; preds = %for.body38, %for.cond36.preheader
%indvars.iv349 = phi i64 [ 0, %for.cond36.preheader ], [ %indvars.iv.next350.1, %for.body38 ]
%maxnum11.0309 = phi i32 [ undef, %for.cond36.preheader ], [ %maxnum11.1.1, %for.body38 ]
%max11.0308 = phi i32 [ undef, %for.cond36.preheader ], [ %max11.1.1, %for.body38 ]
%arrayidx40 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv349
%22 = load i32, ptr %arrayidx40, align 8, !tbaa !5
%cmp41 = icmp sle i32 %22, %max11.0308
%cmp42.not = icmp eq i64 %indvars.iv349, %11
%or.cond = select i1 %cmp41, i1 true, i1 %cmp42.not
%max11.1 = select i1 %or.cond, i32 %max11.0308, i32 %22
%23 = trunc i64 %indvars.iv349 to i32
%maxnum11.1 = select i1 %or.cond, i32 %maxnum11.0309, i32 %23
%indvars.iv.next350 = or i64 %indvars.iv349, 1
%arrayidx40.1 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next350
%24 = load i32, ptr %arrayidx40.1, align 4, !tbaa !5
%cmp41.1 = icmp sle i32 %24, %max11.1
%cmp42.not.1 = icmp eq i64 %indvars.iv.next350, %11
%or.cond.1 = select i1 %cmp41.1, i1 true, i1 %cmp42.not.1
%max11.1.1 = select i1 %or.cond.1, i32 %max11.1, i32 %24
%25 = trunc i64 %indvars.iv.next350 to i32
%maxnum11.1.1 = select i1 %or.cond.1, i32 %maxnum11.1, i32 %25
%indvars.iv.next350.1 = add nuw nsw i64 %indvars.iv349, 2
%exitcond352.not.1 = icmp eq i64 %indvars.iv.next350.1, 100000
br i1 %exitcond352.not.1, label %for.cond50.preheader, label %for.body38, !llvm.loop !13
for.body61.preheader: ; preds = %for.cond50.preheader
%wide.trip.count359 = zext i32 %.lcssa391 to i64
%xtraiter399 = and i64 %wide.trip.count359, 1
%26 = icmp eq i32 %.lcssa391, 1
br i1 %26, label %for.body76.preheader.loopexit.unr-lcssa, label %for.body61.preheader.new
for.body61.preheader.new: ; preds = %for.body61.preheader
%unroll_iter401 = and i64 %wide.trip.count359, 4294967294
br label %for.body61
for.body61: ; preds = %for.body61, %for.body61.preheader.new
%indvars.iv356 = phi i64 [ 0, %for.body61.preheader.new ], [ %indvars.iv.next357.1, %for.body61 ]
%niter402 = phi i64 [ 0, %for.body61.preheader.new ], [ %niter402.next.1, %for.body61 ]
%indvars.iv.next357 = or i64 %indvars.iv356, 1
%arrayidx66.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next357
%27 = load i32, ptr %arrayidx66.1, align 4, !tbaa !5
%idxprom67.1 = sext i32 %27 to i64
%arrayidx68.1 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %idxprom67.1
%28 = load i32, ptr %arrayidx68.1, align 4, !tbaa !5
%inc69.1 = add nsw i32 %28, 1
store i32 %inc69.1, ptr %arrayidx68.1, align 4, !tbaa !5
%indvars.iv.next357.1 = add nuw nsw i64 %indvars.iv356, 2
%niter402.next.1 = add i64 %niter402, 2
%niter402.ncmp.1 = icmp eq i64 %niter402.next.1, %unroll_iter401
br i1 %niter402.ncmp.1, label %for.body76.preheader.loopexit.unr-lcssa, label %for.body61, !llvm.loop !14
for.cond87.preheader: ; preds = %for.body76
%29 = zext i32 %spec.select287.3 to i64
br label %for.body89
for.body76: ; preds = %for.body76, %for.body76.preheader
%indvars.iv361 = phi i64 [ 0, %for.body76.preheader ], [ %indvars.iv.next362.3, %for.body76 ]
%maxnum2.0315 = phi i32 [ undef, %for.body76.preheader ], [ %spec.select287.3, %for.body76 ]
%max2.0314 = phi i32 [ 0, %for.body76.preheader ], [ %spec.select286.3, %for.body76 ]
%arrayidx78 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv361
%30 = load i32, ptr %arrayidx78, align 16, !tbaa !5
%cmp79 = icmp sgt i32 %30, %max2.0314
%spec.select286 = call i32 @llvm.smax.i32(i32 %30, i32 %max2.0314)
%31 = trunc i64 %indvars.iv361 to i32
%spec.select287 = select i1 %cmp79, i32 %31, i32 %maxnum2.0315
%indvars.iv.next362 = or i64 %indvars.iv361, 1
%arrayidx78.1 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next362
%32 = load i32, ptr %arrayidx78.1, align 4, !tbaa !5
%cmp79.1 = icmp sgt i32 %32, %spec.select286
%spec.select286.1 = call i32 @llvm.smax.i32(i32 %32, i32 %spec.select286)
%33 = trunc i64 %indvars.iv.next362 to i32
%spec.select287.1 = select i1 %cmp79.1, i32 %33, i32 %spec.select287
%indvars.iv.next362.1 = or i64 %indvars.iv361, 2
%arrayidx78.2 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next362.1
%34 = load i32, ptr %arrayidx78.2, align 8, !tbaa !5
%cmp79.2 = icmp sgt i32 %34, %spec.select286.1
%spec.select286.2 = call i32 @llvm.smax.i32(i32 %34, i32 %spec.select286.1)
%35 = trunc i64 %indvars.iv.next362.1 to i32
%spec.select287.2 = select i1 %cmp79.2, i32 %35, i32 %spec.select287.1
%indvars.iv.next362.2 = or i64 %indvars.iv361, 3
%arrayidx78.3 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next362.2
%36 = load i32, ptr %arrayidx78.3, align 4, !tbaa !5
%cmp79.3 = icmp sgt i32 %36, %spec.select286.2
%spec.select286.3 = call i32 @llvm.smax.i32(i32 %36, i32 %spec.select286.2)
%37 = trunc i64 %indvars.iv.next362.2 to i32
%spec.select287.3 = select i1 %cmp79.3, i32 %37, i32 %spec.select287.2
%indvars.iv.next362.3 = add nuw nsw i64 %indvars.iv361, 4
%exitcond364.not.3 = icmp eq i64 %indvars.iv.next362.3, 100000
br i1 %exitcond364.not.3, label %for.cond87.preheader, label %for.body76, !llvm.loop !15
for.body89: ; preds = %for.body89, %for.cond87.preheader
%indvars.iv365 = phi i64 [ 0, %for.cond87.preheader ], [ %indvars.iv.next366.1, %for.body89 ]
%maxnum22.0318 = phi i32 [ undef, %for.cond87.preheader ], [ %maxnum22.1.1, %for.body89 ]
%max22.0317 = phi i32 [ 0, %for.cond87.preheader ], [ %max22.1.1, %for.body89 ]
%arrayidx91 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv365
%38 = load i32, ptr %arrayidx91, align 8, !tbaa !5
%cmp92 = icmp sle i32 %38, %max22.0317
%cmp94.not = icmp eq i64 %indvars.iv365, %29
%or.cond288 = select i1 %cmp92, i1 true, i1 %cmp94.not
%max22.1 = select i1 %or.cond288, i32 %max22.0317, i32 %38
%39 = trunc i64 %indvars.iv365 to i32
%maxnum22.1 = select i1 %or.cond288, i32 %maxnum22.0318, i32 %39
%indvars.iv.next366 = or i64 %indvars.iv365, 1
%arrayidx91.1 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv.next366
%40 = load i32, ptr %arrayidx91.1, align 4, !tbaa !5
%cmp92.1 = icmp sle i32 %40, %max22.1
%cmp94.not.1 = icmp eq i64 %indvars.iv.next366, %29
%or.cond288.1 = select i1 %cmp92.1, i1 true, i1 %cmp94.not.1
%max22.1.1 = select i1 %or.cond288.1, i32 %max22.1, i32 %40
%41 = trunc i64 %indvars.iv.next366 to i32
%maxnum22.1.1 = select i1 %or.cond288.1, i32 %maxnum22.1, i32 %41
%indvars.iv.next366.1 = add nuw nsw i64 %indvars.iv365, 2
%exitcond368.not.1 = icmp eq i64 %indvars.iv.next366.1, 100000
br i1 %exitcond368.not.1, label %for.end101, label %for.body89, !llvm.loop !16
for.end101: ; preds = %for.body89
%cmp102.not = icmp eq i32 %spec.select285.3, %spec.select287.3
br i1 %cmp102.not, label %if.then133, label %for.cond104.preheader
for.cond104.preheader: ; preds = %for.end101
br i1 %cmp12.not.not303392, label %for.body107.preheader, label %if.end200
for.body107.preheader: ; preds = %for.cond104.preheader
%wide.trip.count372 = zext i32 %.lcssa391 to i64
%xtraiter403 = and i64 %wide.trip.count372, 1
%42 = icmp eq i32 %.lcssa391, 1
br i1 %42, label %if.end200.loopexit398.unr-lcssa, label %for.body107.preheader.new
for.body107.preheader.new: ; preds = %for.body107.preheader
%unroll_iter407 = and i64 %wide.trip.count372, 4294967294
br label %for.body107
for.body107: ; preds = %for.body107, %for.body107.preheader.new
%indvars.iv369 = phi i64 [ 0, %for.body107.preheader.new ], [ %indvars.iv.next370.1, %for.body107 ]
%b.0322 = phi i32 [ 0, %for.body107.preheader.new ], [ %spec.select290.1, %for.body107 ]
%a.0321 = phi i32 [ undef, %for.body107.preheader.new ], [ %spec.select289, %for.body107 ]
%niter408 = phi i64 [ 0, %for.body107.preheader.new ], [ %niter408.next.1, %for.body107 ]
%arrayidx112 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv369
%43 = load i32, ptr %arrayidx112, align 8, !tbaa !5
%cmp113.not = icmp ne i32 %43, %spec.select285.3
%inc115 = zext i1 %cmp113.not to i32
%spec.select289 = add nsw i32 %a.0321, %inc115
%indvars.iv.next370 = or i64 %indvars.iv369, 1
%arrayidx112.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next370
%44 = load i32, ptr %arrayidx112.1, align 4, !tbaa !5
%cmp122.not.1 = icmp ne i32 %44, %spec.select287.3
%inc124.1 = zext i1 %cmp122.not.1 to i32
%spec.select290.1 = add nsw i32 %b.0322, %inc124.1
%indvars.iv.next370.1 = add nuw nsw i64 %indvars.iv369, 2
%niter408.next.1 = add i64 %niter408, 2
%niter408.ncmp.1 = icmp eq i64 %niter408.next.1, %unroll_iter407
br i1 %niter408.ncmp.1, label %if.end200.loopexit398.unr-lcssa, label %for.body107, !llvm.loop !17
if.then133: ; preds = %for.end101
%add = add nuw nsw i32 %max22.1.1, %spec.select.3
%add134 = add nsw i32 %spec.select286.3, %max11.1.1
%cmp135.not = icmp slt i32 %add, %add134
br i1 %cmp135.not, label %for.cond170.preheader, label %for.cond137.preheader
for.cond137.preheader: ; preds = %if.then133
br i1 %cmp12.not.not303392, label %for.body140.preheader, label %if.end200
for.body140.preheader: ; preds = %for.cond137.preheader
%wide.trip.count377 = zext i32 %.lcssa391 to i64
%xtraiter409 = and i64 %wide.trip.count377, 1
%45 = icmp eq i32 %.lcssa391, 1
br i1 %45, label %if.end200.loopexit397.unr-lcssa, label %for.body140.preheader.new
for.body140.preheader.new: ; preds = %for.body140.preheader
%unroll_iter413 = and i64 %wide.trip.count377, 4294967294
br label %for.body140
for.cond170.preheader: ; preds = %if.then133
br i1 %cmp12.not.not303392, label %for.body173.preheader, label %if.end200
for.body173.preheader: ; preds = %for.cond170.preheader
%wide.trip.count382 = zext i32 %.lcssa391 to i64
%xtraiter415 = and i64 %wide.trip.count382, 1
%46 = icmp eq i32 %.lcssa391, 1
br i1 %46, label %if.end200.loopexit.unr-lcssa, label %for.body173.preheader.new
for.body173.preheader.new: ; preds = %for.body173.preheader
%unroll_iter419 = and i64 %wide.trip.count382, 4294967294
br label %for.body173
for.body140: ; preds = %for.body140, %for.body140.preheader.new
%indvars.iv374 = phi i64 [ 0, %for.body140.preheader.new ], [ %indvars.iv.next375.1, %for.body140 ]
%b.3328 = phi i32 [ 0, %for.body140.preheader.new ], [ %spec.select292.1, %for.body140 ]
%a.3327 = phi i32 [ undef, %for.body140.preheader.new ], [ %spec.select291, %for.body140 ]
%niter414 = phi i64 [ 0, %for.body140.preheader.new ], [ %niter414.next.1, %for.body140 ]
%arrayidx145 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv374
%47 = load i32, ptr %arrayidx145, align 8, !tbaa !5
%cmp146.not = icmp ne i32 %47, %spec.select285.3
%inc148 = zext i1 %cmp146.not to i32
%spec.select291 = add nsw i32 %a.3327, %inc148
%indvars.iv.next375 = or i64 %indvars.iv374, 1
%arrayidx145.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next375
%48 = load i32, ptr %arrayidx145.1, align 4, !tbaa !5
%cmp156.not.1 = icmp ne i32 %48, %maxnum22.1.1
%inc158.1 = zext i1 %cmp156.not.1 to i32
%spec.select292.1 = add nsw i32 %b.3328, %inc158.1
%indvars.iv.next375.1 = add nuw nsw i64 %indvars.iv374, 2
%niter414.next.1 = add i64 %niter414, 2
%niter414.ncmp.1 = icmp eq i64 %niter414.next.1, %unroll_iter413
br i1 %niter414.ncmp.1, label %if.end200.loopexit397.unr-lcssa, label %for.body140, !llvm.loop !18
for.body173: ; preds = %for.body173, %for.body173.preheader.new
%indvars.iv379 = phi i64 [ 0, %for.body173.preheader.new ], [ %indvars.iv.next380.1, %for.body173 ]
%b.5334 = phi i32 [ 0, %for.body173.preheader.new ], [ %spec.select294.1, %for.body173 ]
%a.5333 = phi i32 [ undef, %for.body173.preheader.new ], [ %spec.select293, %for.body173 ]
%niter420 = phi i64 [ 0, %for.body173.preheader.new ], [ %niter420.next.1, %for.body173 ]
%arrayidx178 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv379
%49 = load i32, ptr %arrayidx178, align 8, !tbaa !5
%cmp179.not = icmp ne i32 %49, %maxnum11.1.1
%inc181 = zext i1 %cmp179.not to i32
%spec.select293 = add nsw i32 %a.5333, %inc181
%indvars.iv.next380 = or i64 %indvars.iv379, 1
%arrayidx178.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next380
%50 = load i32, ptr %arrayidx178.1, align 4, !tbaa !5
%cmp189.not.1 = icmp ne i32 %50, %spec.select287.3
%inc191.1 = zext i1 %cmp189.not.1 to i32
%spec.select294.1 = add nsw i32 %b.5334, %inc191.1
%indvars.iv.next380.1 = add nuw nsw i64 %indvars.iv379, 2
%niter420.next.1 = add i64 %niter420, 2
%niter420.ncmp.1 = icmp eq i64 %niter420.next.1, %unroll_iter419
br i1 %niter420.ncmp.1, label %if.end200.loopexit.unr-lcssa, label %for.body173, !llvm.loop !19
if.end200.loopexit.unr-lcssa: ; preds = %for.body173, %for.body173.preheader
%b.6.lcssa.ph = phi i32 [ undef, %for.body173.preheader ], [ %spec.select294.1, %for.body173 ]
%indvars.iv379.unr = phi i64 [ 0, %for.body173.preheader ], [ %indvars.iv.next380.1, %for.body173 ]
%b.5334.unr = phi i32 [ 0, %for.body173.preheader ], [ %spec.select294.1, %for.body173 ]
%a.5333.unr = phi i32 [ undef, %for.body173.preheader ], [ %spec.select293, %for.body173 ]
%lcmp.mod416.not = icmp eq i64 %xtraiter415, 0
br i1 %lcmp.mod416.not, label %if.end200, label %for.body173.epil
for.body173.epil: ; preds = %if.end200.loopexit.unr-lcssa
%rem174388.epil = and i64 %indvars.iv379.unr, 1
%cmp175.epil = icmp eq i64 %rem174388.epil, 0
%arrayidx178.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv379.unr
%51 = load i32, ptr %arrayidx178.epil, align 4, !tbaa !5
br i1 %cmp175.epil, label %if.then176.epil, label %if.then186.epil
if.then186.epil: ; preds = %for.body173.epil
%cmp189.not.epil = icmp ne i32 %51, %spec.select287.3
%inc191.epil = zext i1 %cmp189.not.epil to i32
%spec.select294.epil = add nsw i32 %b.5334.unr, %inc191.epil
br label %if.end200
if.then176.epil: ; preds = %for.body173.epil
%cmp179.not.epil = icmp ne i32 %51, %maxnum11.1.1
%inc181.epil = zext i1 %cmp179.not.epil to i32
%spec.select293.epil = add nsw i32 %a.5333.unr, %inc181.epil
br label %if.end200
if.end200.loopexit397.unr-lcssa: ; preds = %for.body140, %for.body140.preheader
%b.4.lcssa.ph = phi i32 [ undef, %for.body140.preheader ], [ %spec.select292.1, %for.body140 ]
%indvars.iv374.unr = phi i64 [ 0, %for.body140.preheader ], [ %indvars.iv.next375.1, %for.body140 ]
%b.3328.unr = phi i32 [ 0, %for.body140.preheader ], [ %spec.select292.1, %for.body140 ]
%a.3327.unr = phi i32 [ undef, %for.body140.preheader ], [ %spec.select291, %for.body140 ]
%lcmp.mod410.not = icmp eq i64 %xtraiter409, 0
br i1 %lcmp.mod410.not, label %if.end200, label %for.body140.epil
for.body140.epil: ; preds = %if.end200.loopexit397.unr-lcssa
%rem141387.epil = and i64 %indvars.iv374.unr, 1
%cmp142.epil = icmp eq i64 %rem141387.epil, 0
%arrayidx145.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv374.unr
%52 = load i32, ptr %arrayidx145.epil, align 4, !tbaa !5
br i1 %cmp142.epil, label %if.then143.epil, label %if.then153.epil
if.then153.epil: ; preds = %for.body140.epil
%cmp156.not.epil = icmp ne i32 %52, %maxnum22.1.1
%inc158.epil = zext i1 %cmp156.not.epil to i32
%spec.select292.epil = add nsw i32 %b.3328.unr, %inc158.epil
br label %if.end200
if.then143.epil: ; preds = %for.body140.epil
%cmp146.not.epil = icmp ne i32 %52, %spec.select285.3
%inc148.epil = zext i1 %cmp146.not.epil to i32
%spec.select291.epil = add nsw i32 %a.3327.unr, %inc148.epil
br label %if.end200
if.end200.loopexit398.unr-lcssa: ; preds = %for.body107, %for.body107.preheader
%b.1.lcssa.ph = phi i32 [ undef, %for.body107.preheader ], [ %spec.select290.1, %for.body107 ]
%indvars.iv369.unr = phi i64 [ 0, %for.body107.preheader ], [ %indvars.iv.next370.1, %for.body107 ]
%b.0322.unr = phi i32 [ 0, %for.body107.preheader ], [ %spec.select290.1, %for.body107 ]
%a.0321.unr = phi i32 [ undef, %for.body107.preheader ], [ %spec.select289, %for.body107 ]
%lcmp.mod404.not = icmp eq i64 %xtraiter403, 0
br i1 %lcmp.mod404.not, label %if.end200, label %for.body107.epil
for.body107.epil: ; preds = %if.end200.loopexit398.unr-lcssa
%rem108386.epil = and i64 %indvars.iv369.unr, 1
%cmp109.epil = icmp eq i64 %rem108386.epil, 0
%arrayidx112.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv369.unr
%53 = load i32, ptr %arrayidx112.epil, align 4, !tbaa !5
br i1 %cmp109.epil, label %if.then110.epil, label %if.then119.epil
if.then119.epil: ; preds = %for.body107.epil
%cmp122.not.epil = icmp ne i32 %53, %spec.select287.3
%inc124.epil = zext i1 %cmp122.not.epil to i32
%spec.select290.epil = add nsw i32 %b.0322.unr, %inc124.epil
br label %if.end200
if.then110.epil: ; preds = %for.body107.epil
%cmp113.not.epil = icmp ne i32 %53, %spec.select285.3
%inc115.epil = zext i1 %cmp113.not.epil to i32
%spec.select289.epil = add nsw i32 %a.0321.unr, %inc115.epil
br label %if.end200
if.end200: ; preds = %if.end200.loopexit398.unr-lcssa, %if.then110.epil, %if.then119.epil, %if.end200.loopexit397.unr-lcssa, %if.then143.epil, %if.then153.epil, %if.end200.loopexit.unr-lcssa, %if.then176.epil, %if.then186.epil, %for.cond104.preheader, %for.cond137.preheader, %for.cond170.preheader
%a.7 = phi i32 [ undef, %for.cond170.preheader ], [ undef, %for.cond137.preheader ], [ undef, %for.cond104.preheader ], [ %a.5333.unr, %if.end200.loopexit.unr-lcssa ], [ %spec.select293.epil, %if.then176.epil ], [ %a.5333.unr, %if.then186.epil ], [ %a.3327.unr, %if.end200.loopexit397.unr-lcssa ], [ %spec.select291.epil, %if.then143.epil ], [ %a.3327.unr, %if.then153.epil ], [ %a.0321.unr, %if.end200.loopexit398.unr-lcssa ], [ %spec.select289.epil, %if.then110.epil ], [ %a.0321.unr, %if.then119.epil ]
%b.7 = phi i32 [ 0, %for.cond170.preheader ], [ 0, %for.cond137.preheader ], [ 0, %for.cond104.preheader ], [ %b.6.lcssa.ph, %if.end200.loopexit.unr-lcssa ], [ %b.5334.unr, %if.then176.epil ], [ %spec.select294.epil, %if.then186.epil ], [ %b.4.lcssa.ph, %if.end200.loopexit397.unr-lcssa ], [ %b.3328.unr, %if.then143.epil ], [ %spec.select292.epil, %if.then153.epil ], [ %b.1.lcssa.ph, %if.end200.loopexit398.unr-lcssa ], [ %b.0322.unr, %if.then110.epil ], [ %spec.select290.epil, %if.then119.epil ]
%add201 = add nsw i32 %b.7, %a.7
%call202 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add201)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include<stdio.h>
int main()
{
int n,s;
scanf("%d %d",&n,&s);
int x[n],y[n],i,j,temp,f=0;
for(i=0;i<n;i++)
scanf("%d%d",&x[i],&y[i]);
for(i=0;i<n;i++)
for(j=0;j<n-1;j++)
{
if(y[j]>y[j+1])
{
temp=y[j];
y[j]=y[j+1];
y[j+1]=temp;
temp=x[j];
x[j]=x[j+1];
x[j+1]=temp;
}
}
for(i=0;i<n;i++)
{
if((x[i]<s)&&(y[i]!=0))
{
printf("%d",100-y[i]);
f=1;
break;
}
}
if(f==0)
{
for(i=0;i<n;i++)
if((x[i]<=s)&&(y[i]==0))
{
printf("0");
f=1;
break;
}
}
if(f==0)
printf("-1");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = 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
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp113 = icmp sgt i32 %3, 0
br i1 %cmp113, label %for.body, label %if.then80
for.cond5.preheader: ; preds = %for.body
%cmp6117 = icmp sgt i32 %18, 0
br i1 %cmp6117, label %for.cond8.preheader.lr.ph, label %if.then80
for.cond8.preheader.lr.ph: ; preds = %for.cond5.preheader
%cmp9115.not = icmp eq i32 %18, 1
br i1 %cmp9115.not, label %for.body44.lr.ph, label %for.cond8.preheader.us.preheader
for.cond8.preheader.us.preheader: ; preds = %for.cond8.preheader.lr.ph
%sub = add i32 %18, -1
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %sub, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%invariant.gep = getelementptr i32, ptr %vla1, i64 1
br label %for.cond8.preheader.us
for.cond8.preheader.us: ; preds = %for.cond8.preheader.us.preheader, %for.cond8.for.inc39_crit_edge.us
%i.1118.us = phi i32 [ %inc40.us, %for.cond8.for.inc39_crit_edge.us ], [ 0, %for.cond8.preheader.us.preheader ]
%.pre = load i32, ptr %vla1, align 16, !tbaa !5
br i1 %5, label %for.cond8.for.inc39_crit_edge.us.unr-lcssa, label %for.body10.us
for.body10.us: ; preds = %for.cond8.preheader.us, %for.inc36.us.1
%6 = phi i32 [ %14, %for.inc36.us.1 ], [ %.pre, %for.cond8.preheader.us ]
%indvars.iv126 = phi i64 [ %indvars.iv.next127.1, %for.inc36.us.1 ], [ 0, %for.cond8.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc36.us.1 ], [ 0, %for.cond8.preheader.us ]
%indvars.iv.next127 = or i64 %indvars.iv126, 1
%arrayidx14.us = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next127
%7 = load i32, ptr %arrayidx14.us, align 4, !tbaa !5
%cmp15.us = icmp sgt i32 %6, %7
br i1 %cmp15.us, label %if.then.us, label %for.inc36.us
if.then.us: ; preds = %for.body10.us
%arrayidx12.us = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv126
store i32 %7, ptr %arrayidx12.us, align 8, !tbaa !5
store i32 %6, ptr %arrayidx14.us, align 4, !tbaa !5
%arrayidx27.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv126
%8 = load <2 x i32>, ptr %arrayidx27.us, align 8, !tbaa !5
%9 = shufflevector <2 x i32> %8, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %9, ptr %arrayidx27.us, align 8, !tbaa !5
br label %for.inc36.us
for.inc36.us: ; preds = %if.then.us, %for.body10.us
%10 = phi i32 [ %6, %if.then.us ], [ %7, %for.body10.us ]
%indvars.iv.next127.1 = add nuw nsw i64 %indvars.iv126, 2
%arrayidx14.us.1 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next127.1
%11 = load i32, ptr %arrayidx14.us.1, align 8, !tbaa !5
%cmp15.us.1 = icmp sgt i32 %10, %11
br i1 %cmp15.us.1, label %if.then.us.1, label %for.inc36.us.1
if.then.us.1: ; preds = %for.inc36.us
%arrayidx12.us.1 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next127
store i32 %11, ptr %arrayidx12.us.1, align 4, !tbaa !5
store i32 %10, ptr %arrayidx14.us.1, align 8, !tbaa !5
%arrayidx27.us.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next127
%12 = load <2 x i32>, ptr %arrayidx27.us.1, align 4, !tbaa !5
%13 = shufflevector <2 x i32> %12, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %13, ptr %arrayidx27.us.1, align 4, !tbaa !5
br label %for.inc36.us.1
for.inc36.us.1: ; preds = %if.then.us.1, %for.inc36.us
%14 = phi i32 [ %10, %if.then.us.1 ], [ %11, %for.inc36.us ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond8.for.inc39_crit_edge.us.unr-lcssa, label %for.body10.us, !llvm.loop !9
for.cond8.for.inc39_crit_edge.us.unr-lcssa: ; preds = %for.inc36.us.1, %for.cond8.preheader.us
%.unr = phi i32 [ %.pre, %for.cond8.preheader.us ], [ %14, %for.inc36.us.1 ]
%indvars.iv126.unr = phi i64 [ 0, %for.cond8.preheader.us ], [ %indvars.iv.next127.1, %for.inc36.us.1 ]
br i1 %lcmp.mod.not, label %for.cond8.for.inc39_crit_edge.us, label %for.body10.us.epil
for.body10.us.epil: ; preds = %for.cond8.for.inc39_crit_edge.us.unr-lcssa
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv126.unr
%15 = load i32, ptr %gep, align 4, !tbaa !5
%cmp15.us.epil = icmp sgt i32 %.unr, %15
br i1 %cmp15.us.epil, label %if.then.us.epil, label %for.cond8.for.inc39_crit_edge.us
if.then.us.epil: ; preds = %for.body10.us.epil
%arrayidx12.us.epil = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv126.unr
store i32 %15, ptr %arrayidx12.us.epil, align 4, !tbaa !5
store i32 %.unr, ptr %gep, align 4, !tbaa !5
%arrayidx27.us.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv126.unr
%16 = load <2 x i32>, ptr %arrayidx27.us.epil, align 4, !tbaa !5
%17 = shufflevector <2 x i32> %16, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
store <2 x i32> %17, ptr %arrayidx27.us.epil, align 4, !tbaa !5
br label %for.cond8.for.inc39_crit_edge.us
for.cond8.for.inc39_crit_edge.us: ; preds = %for.body10.us.epil, %if.then.us.epil, %for.cond8.for.inc39_crit_edge.us.unr-lcssa
%inc40.us = add nuw nsw i32 %i.1118.us, 1
%exitcond129.not = icmp eq i32 %inc40.us, %18
br i1 %exitcond129.not, label %for.cond42.preheader, label %for.cond8.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp = icmp slt i64 %indvars.iv.next, %19
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !12
for.cond42.preheader: ; preds = %for.cond8.for.inc39_crit_edge.us
br i1 %cmp6117, label %for.body44.lr.ph, label %if.then80
for.body44.lr.ph: ; preds = %for.cond8.preheader.lr.ph, %for.cond42.preheader
%20 = phi i32 [ %18, %for.cond42.preheader ], [ 1, %for.cond8.preheader.lr.ph ]
%21 = load i32, ptr %s, align 4, !tbaa !5
%wide.trip.count133 = zext i32 %20 to i64
br label %for.body44
for.body64.lr.ph: ; preds = %for.inc57
%22 = load i32, ptr %s, align 4, !tbaa !5
%wide.trip.count138 = zext i32 %20 to i64
br label %for.body64
for.body44: ; preds = %for.body44.lr.ph, %for.inc57
%indvars.iv130 = phi i64 [ 0, %for.body44.lr.ph ], [ %indvars.iv.next131, %for.inc57 ]
%arrayidx46 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv130
%23 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%cmp47 = icmp slt i32 %23, %21
br i1 %cmp47, label %land.lhs.true, label %for.inc57
land.lhs.true: ; preds = %for.body44
%arrayidx49 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv130
%24 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%cmp50.not = icmp eq i32 %24, 0
br i1 %cmp50.not, label %for.inc57, label %if.then51
if.then51: ; preds = %land.lhs.true
%sub54 = sub nsw i32 100, %24
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub54)
br label %if.end82
for.inc57: ; preds = %for.body44, %land.lhs.true
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%exitcond134.not = icmp eq i64 %indvars.iv.next131, %wide.trip.count133
br i1 %exitcond134.not, label %for.body64.lr.ph, label %for.body44, !llvm.loop !13
for.body64: ; preds = %for.body64.lr.ph, %for.inc75
%indvars.iv135 = phi i64 [ 0, %for.body64.lr.ph ], [ %indvars.iv.next136, %for.inc75 ]
%arrayidx66 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv135
%25 = load i32, ptr %arrayidx66, align 4, !tbaa !5
%cmp67.not = icmp sgt i32 %25, %22
br i1 %cmp67.not, label %for.inc75, label %land.lhs.true68
land.lhs.true68: ; preds = %for.body64
%arrayidx70 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv135
%26 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%cmp71 = icmp eq i32 %26, 0
br i1 %cmp71, label %if.then72, label %for.inc75
if.then72: ; preds = %land.lhs.true68
%putchar = call i32 @putchar(i32 48)
br label %if.end82
for.inc75: ; preds = %for.body64, %land.lhs.true68
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%exitcond139.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count138
br i1 %exitcond139.not, label %if.then80, label %for.body64, !llvm.loop !14
if.then80: ; preds = %for.inc75, %entry, %for.cond5.preheader, %for.cond42.preheader
%call81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
br label %if.end82
if.end82: ; preds = %if.then51, %if.then72, %if.then80
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(void)
{
int n,k;
scanf("%d%d",&n,&k);
if((n + 1) / 2 >= k)
{
puts("YES");
}
else
{
puts("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not = icmp slt i32 %div, %1
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call2 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
// Your code here!
int N,K,num=0;
scanf("%d %d",&N,&K);
if(N%2==0){
if(N/2>=K){
printf("YES\n");
}else{
printf("NO\n");
}
}else{
if((N+1)/2>=K){
printf("YES\n");
}else{
printf("NO\n");
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211287/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211287/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %if.then, label %if.else5
if.then: ; preds = %entry
%div = sdiv i32 %0, 2
%2 = load i32, ptr %K, align 4, !tbaa !5
%cmp1.not = icmp slt i32 %div, %2
%str.4.str.5 = select i1 %cmp1.not, ptr @str.4, ptr @str.5
br label %if.end13
if.else5: ; preds = %entry
%add = add nsw i32 %0, 1
%div6 = sdiv i32 %add, 2
%3 = load i32, ptr %K, align 4, !tbaa !5
%cmp7.not = icmp slt i32 %div6, %3
%str.str.3 = select i1 %cmp7.not, ptr @str.4, ptr @str.5
br label %if.end13
if.end13: ; preds = %if.else5, %if.then
%str.3.sink = phi ptr [ %str.4.str.5, %if.then ], [ %str.str.3, %if.else5 ]
%puts14 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
long long int gcd(long long int a,long long int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
int main()
{
long long int t;
scanf("%lld",&t);
while(t--)
{
long long int n,ans;
scanf("%lld",&n);
ans=gcd(n,100);
ans=(100/ans);
printf("%lld\n",ans);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21133/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21133/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i64 %b, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%t = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec5 = add nsw i64 %0, -1
store i64 %dec5, ptr %t, align 8, !tbaa !5
%tobool.not6 = icmp eq i64 %0, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %gcd.exit
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.end.i, %while.body
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ 100, %while.body ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %1, %while.body ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i
%div = sdiv i64 100, %b.tr6.i
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
%2 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %2, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %gcd.exit, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int points[101];
int main(){
int n, i, j;
scanf("%d", &n);
for(i = 0;i < n * (n - 1) / 2;i++){
int ai, bi, ci, di;
scanf("%d%d%d%d", &ai, &bi, &ci, &di);
if(ci == di){
points[ai]++;
points[bi]++;
}
else if(ci > di){
points[ai] += 3;
}
else{
points[bi] += 3;
}
}
for(i = 1;i <= n;i++){
int res = 1;
for(j = 1;j <= n;j++){
if(points[j] > points[i])res++;
}
printf("%d\n", res);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@points = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%ai = alloca i32, align 4
%bi = alloca i32, align 4
%ci = alloca i32, align 4
%di = 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
%sub45 = add nsw i32 %0, -1
%mul46 = mul nsw i32 %sub45, %0
%cmp48 = icmp sgt i32 %mul46, 1
br i1 %cmp48, label %for.body, label %for.cond16.preheader
for.cond16.preheader: ; preds = %if.end14, %entry
%1 = phi i32 [ %0, %entry ], [ %7, %if.end14 ]
%cmp17.not53 = icmp slt i32 %1, 1
br i1 %cmp17.not53, label %for.end36, label %for.cond19.preheader
for.body: ; preds = %entry, %if.end14
%i.049 = phi i32 [ %inc15, %if.end14 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ai) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %bi) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ci) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %di) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %ai, ptr noundef nonnull %bi, ptr noundef nonnull %ci, ptr noundef nonnull %di)
%2 = load i32, ptr %ci, align 4, !tbaa !5
%3 = load i32, ptr %di, align 4, !tbaa !5
%cmp2 = icmp eq i32 %2, %3
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%4 = load i32, ptr %ai, align 4, !tbaa !5
%idxprom = sext i32 %4 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @points, i64 0, i64 %idxprom
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %5, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
br label %if.end14
if.else: ; preds = %for.body
%cmp6 = icmp sgt i32 %2, %3
%ai.bi = select i1 %cmp6, ptr %ai, ptr %bi
br label %if.end14
if.end14: ; preds = %if.else, %if.then
%.sink.in = phi ptr [ %bi, %if.then ], [ %ai.bi, %if.else ]
%.sink59 = phi i32 [ 1, %if.then ], [ 3, %if.else ]
%.sink = load i32, ptr %.sink.in, align 4, !tbaa !5
%idxprom8 = sext i32 %.sink to i64
%arrayidx9 = getelementptr inbounds [101 x i32], ptr @points, i64 0, i64 %idxprom8
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add = add nsw i32 %6, %.sink59
store i32 %add, ptr %arrayidx9, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %di) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ci) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %bi) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ai) #4
%inc15 = add nuw nsw i32 %i.049, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%mul = mul nsw i32 %sub, %7
%div = sdiv i32 %mul, 2
%cmp = icmp slt i32 %inc15, %div
br i1 %cmp, label %for.body, label %for.cond16.preheader, !llvm.loop !9
for.cond19.preheader: ; preds = %for.cond16.preheader, %for.end32
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.end32 ], [ 1, %for.cond16.preheader ]
%8 = phi i32 [ %23, %for.end32 ], [ %1, %for.cond16.preheader ]
%cmp20.not50 = icmp slt i32 %8, 1
br i1 %cmp20.not50, label %for.end32, label %for.body21.lr.ph
for.body21.lr.ph: ; preds = %for.cond19.preheader
%arrayidx25 = getelementptr inbounds [101 x i32], ptr @points, i64 0, i64 %indvars.iv56
%9 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%10 = add nuw i32 %8, 1
%wide.trip.count = zext i32 %10 to i64
%11 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %8, 8
br i1 %min.iters.check, label %for.body21.preheader, label %vector.ph
vector.ph: ; preds = %for.body21.lr.ph
%n.vec = and i64 %11, -8
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 0, i32 0, i32 0>, %vector.ph ], [ %18, %vector.body ]
%vec.phi61 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%offset.idx = or i64 %index, 1
%12 = getelementptr inbounds [101 x i32], ptr @points, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load62 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = icmp sgt <4 x i32> %wide.load, %broadcast.splat
%15 = icmp sgt <4 x i32> %wide.load62, %broadcast.splat
%16 = zext <4 x i1> %14 to <4 x i32>
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = add <4 x i32> %vec.phi, %16
%19 = add <4 x i32> %vec.phi61, %17
%index.next = add nuw i64 %index, 8
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %19, %18
%21 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %11, %n.vec
br i1 %cmp.n, label %for.end32, label %for.body21.preheader
for.body21.preheader: ; preds = %for.body21.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body21.lr.ph ], [ %ind.end, %middle.block ]
%res.052.ph = phi i32 [ 1, %for.body21.lr.ph ], [ %21, %middle.block ]
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body21 ], [ %indvars.iv.ph, %for.body21.preheader ]
%res.052 = phi i32 [ %spec.select, %for.body21 ], [ %res.052.ph, %for.body21.preheader ]
%arrayidx23 = getelementptr inbounds [101 x i32], ptr @points, i64 0, i64 %indvars.iv
%22 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %22, %9
%inc28 = zext i1 %cmp26 to i32
%spec.select = add nuw nsw i32 %res.052, %inc28
%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.end32, label %for.body21, !llvm.loop !14
for.end32: ; preds = %for.body21, %middle.block, %for.cond19.preheader
%res.0.lcssa = phi i32 [ 1, %for.cond19.preheader ], [ %21, %middle.block ], [ %spec.select, %for.body21 ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %res.0.lcssa)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%24 = sext i32 %23 to i64
%cmp17.not.not = icmp slt i64 %indvars.iv56, %24
br i1 %cmp17.not.not, label %for.cond19.preheader, label %for.end36, !llvm.loop !15
for.end36: ; preds = %for.end32, %for.cond16.preheader
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(){
long long int a, b, c, k;
scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
long long int ans;
if(k%2)
ans = b - a;
else
ans = a - b;
printf("%lld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%1 = and i64 %0, 1
%tobool.not = icmp eq i64 %1, 0
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %entry
%2 = load i64, ptr %b, align 8, !tbaa !5
%3 = load i64, ptr %a, align 8, !tbaa !5
%sub = sub nsw i64 %2, %3
br label %if.end
if.else: ; preds = %entry
%4 = load i64, ptr %a, align 8, !tbaa !5
%5 = load i64, ptr %b, align 8, !tbaa !5
%sub1 = sub nsw i64 %4, %5
br label %if.end
if.end: ; preds = %if.else, %if.then
%ans.0 = phi i64 [ %sub, %if.then ], [ %sub1, %if.else ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int i;
long long tak,nak,hik,K,Un=10000000000000000000;
scanf("%lld %lld %lld %lld",&tak,&nak,&hik,&K);
if(tak-nak>=Un&&Un-(tak-nak)<=0){
if(K%2==0){
printf("%lld\n",tak-nak);
}else if(K%2==1){
printf("%lld\n",nak-tak);
}
}else{
printf("Unfair\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211496/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211496/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [7 x i8] c"Unfair\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%tak = alloca i64, align 8
%nak = alloca i64, align 8
%hik = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %tak) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %nak) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %hik) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tak, ptr noundef nonnull %nak, ptr noundef nonnull %hik, ptr noundef nonnull %K)
%0 = load i64, ptr %tak, align 8, !tbaa !5
%1 = load i64, ptr %nak, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%cmp = icmp sgt i64 %sub, -8446744073709551617
br i1 %cmp, label %if.then, label %if.else14
if.then: ; preds = %entry
%2 = load i64, ptr %K, align 8, !tbaa !5
%rem = srem i64 %2, 2
switch i64 %rem, label %if.end16 [
i64 0, label %if.then5
i64 1, label %if.then10
]
if.then5: ; preds = %if.then
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
br label %if.end16
if.then10: ; preds = %if.then
%sub11 = sub nsw i64 %1, %0
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub11)
br label %if.end16
if.else14: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end16
if.end16: ; preds = %if.then, %if.then5, %if.then10, %if.else14
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %hik) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %nak) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %tak) #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int compareInt(const void* a, const void* b)
{
int aNum = *(int*)a;
int bNum = *(int*)b;
return aNum - bNum;
}
int main(void){
int n, x;
int a[105];
scanf("%d %d", &n,&x);
//int sum = 0;
for(int i=0;i<n;i++){
scanf("%d", &a[i]);
//sum+=a[i];
}
/*
if(x>sum){
printf("%d", n-1);
return 0;
}
*/
qsort(a, n, sizeof(int), compareInt);
int i,s=0;int ans=0;
for(i=0;i<n&&s<=x;i++){
s+=a[i];
}
if(s==x && i==n){
ans = n;
}else if(s!=x && i==n){
ans = n-1;
}
else if(i!=n){
ans = i-1;
}
printf("%d", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211582/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211582/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compareInt(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%a = alloca [105 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 %x) #5
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compareInt) #5
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %x, align 4
%cmp449 = icmp sgt i32 %1, 0
%cmp650 = icmp sgt i32 %2, -1
%3 = select i1 %cmp449, i1 %cmp650, i1 false
br i1 %3, label %for.body8.preheader, label %for.end13
for.body8.preheader: ; preds = %for.cond.cleanup
%4 = zext i32 %1 to i64
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body8: ; preds = %for.body8.preheader, %for.body8
%indvars.iv58 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next59, %for.body8 ]
%s.052 = phi i32 [ 0, %for.body8.preheader ], [ %add, %for.body8 ]
%arrayidx10 = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %indvars.iv58
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%add = add nsw i32 %7, %s.052
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%cmp4 = icmp ult i64 %indvars.iv.next59, %4
%cmp6 = icmp sle i32 %add, %2
%8 = select i1 %cmp4, i1 %cmp6, i1 false
br i1 %8, label %for.body8, label %for.end13.loopexit, !llvm.loop !11
for.end13.loopexit: ; preds = %for.body8
%9 = trunc i64 %indvars.iv.next59 to i32
br label %for.end13
for.end13: ; preds = %for.end13.loopexit, %for.cond.cleanup
%i2.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %9, %for.end13.loopexit ]
%s.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %add, %for.end13.loopexit ]
%cmp14 = icmp eq i32 %s.0.lcssa, %2
%cmp16 = icmp eq i32 %i2.0.lcssa, %1
%or.cond = and i1 %cmp16, %cmp14
br i1 %or.cond, label %if.end30, label %if.else
if.else: ; preds = %for.end13
%cmp16.not = xor i1 %cmp16, true
%brmerge = or i1 %cmp14, %cmp16.not
br i1 %brmerge, label %if.else24, label %if.then23
if.then23: ; preds = %if.else
%sub = add nsw i32 %1, -1
br label %if.end30
if.else24: ; preds = %if.else
%sub28 = add nsw i32 %i2.0.lcssa, -1
%spec.select = select i1 %cmp16, i32 0, i32 %sub28
br label %if.end30
if.end30: ; preds = %if.else24, %for.end13, %if.then23
%ans.0 = phi i32 [ %sub, %if.then23 ], [ %1, %for.end13 ], [ %spec.select, %if.else24 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
// puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int cmp(const void *a, const void *b){
ll A=*(ll *)a, B=*(ll *)b;
if(A==B)return 0;
else return A>B ? 1:-1;//昇順ソート 1,2,....9
}
int main(void){
ll N, x, a[105], ans=0;
in2(N, x);
rep(i, N) in(a[i]);
qsort(a, N, sizeof(ll), cmp);
for(ll i=0; i<N-1; i++){
if(x>=a[i]){
ans++;
x -= a[i];
}
else break;
}
if(x==a[N-1]) ans++;
put(ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211625/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211625/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @powll(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%r.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !5
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%r.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #2 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%cmp = icmp eq i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = select i1 %cmp1, i32 1, i32 -1
%retval.0 = select i1 %cmp, i32 0, i32 %cond
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i64, align 8
%x = alloca i64, align 8
%a = alloca [105 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 840, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %x)
%0 = load i64, ptr %N, align 8, !tbaa !9
%cmp35 = icmp sgt i64 %0, 0
br i1 %cmp35, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %.lcssa, i64 noundef 8, ptr noundef nonnull @cmp) #6
%1 = load i64, ptr %N, align 8, !tbaa !9
%sub = add i64 %1, -1
%x.promoted = load i64, ptr %x, align 8, !tbaa !9
%cmp438 = icmp sgt i64 %1, 1
br i1 %cmp438, label %for.body6, label %cleanup
for.body: ; preds = %entry, %for.body
%i.036 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [105 x i64], ptr %a, i64 0, i64 %i.036
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.036, 1
%2 = load i64, ptr %N, align 8, !tbaa !9
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.body6: ; preds = %for.cond.cleanup, %if.then
%i2.041 = phi i64 [ %inc13, %if.then ], [ 0, %for.cond.cleanup ]
%sub113739 = phi i64 [ %sub11, %if.then ], [ %x.promoted, %for.cond.cleanup ]
%arrayidx7 = getelementptr inbounds [105 x i64], ptr %a, i64 0, i64 %i2.041
%3 = load i64, ptr %arrayidx7, align 8, !tbaa !9
%cmp8.not = icmp slt i64 %sub113739, %3
br i1 %cmp8.not, label %cleanup, label %if.then
if.then: ; preds = %for.body6
%inc13 = add nuw nsw i64 %i2.041, 1
%sub11 = sub nsw i64 %sub113739, %3
store i64 %sub11, ptr %x, align 8, !tbaa !9
%exitcond.not = icmp eq i64 %inc13, %sub
br i1 %exitcond.not, label %cleanup, label %for.body6, !llvm.loop !14
cleanup: ; preds = %if.then, %for.body6, %for.cond.cleanup
%4 = phi i64 [ %x.promoted, %for.cond.cleanup ], [ %sub113739, %for.body6 ], [ %sub11, %if.then ]
%ans.0.lcssa = phi i64 [ 0, %for.cond.cleanup ], [ %i2.041, %for.body6 ], [ %sub, %if.then ]
%arrayidx16 = getelementptr inbounds [105 x i64], ptr %a, i64 0, i64 %sub
%5 = load i64, ptr %arrayidx16, align 8, !tbaa !9
%cmp17 = icmp eq i64 %4, %5
%inc19 = zext i1 %cmp17 to i64
%spec.select = add nuw nsw i64 %ans.0.lcssa, %inc19
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 840, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 "no-trapping-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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.unroll.disable"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.mustprogress"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = distinct !{!13, !8}
!14 = distinct !{!14, !8}
|
#include<stdio.h>
int main()
{
int n, x;
scanf("%d %d", &n, &x);
int i;
int a[102];
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
int p;
for (i = 0; i < n - 1; i++)
if (a[i] > a[i + 1])
{
p = a[i];
a[i] = a[i + 1];
a[i + 1] = p;
if (i > 0)
i -= 2;
}
int ans = 0;
i = 0;
while (a[i] <= x && i < n)
{
x -= a[i];
i++;
ans++;
}
if (i == n && x > 0)
ans--;
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211683/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211683/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%a = alloca [102 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x)
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4
%cmp65 = icmp sgt i32 %0, 0
br i1 %cmp65, label %for.body, label %while.cond.preheader.thread
while.cond.preheader.thread: ; preds = %entry
%x.promoted90 = load i32, ptr %x, align 4
br label %while.end
for.cond2.preheader: ; preds = %for.body
%sub = add nsw i32 %1, -1
%cmp367 = icmp sgt i32 %1, 1
br i1 %cmp367, label %for.body4, label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [102 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4
%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 !5
while.cond.preheader: ; preds = %for.inc24, %for.cond2.preheader
%x.promoted = load i32, ptr %x, align 4
%3 = load i32, ptr %a, align 16, !tbaa !7
%cmp2970 = icmp sle i32 %3, %x.promoted
%cmp3071 = icmp sgt i32 %1, 0
%4 = and i1 %cmp3071, %cmp2970
br i1 %4, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%5 = zext i32 %1 to i64
br label %while.body
for.body4: ; preds = %for.cond2.preheader, %for.inc24
%i.168 = phi i32 [ %inc25.pre-phi, %for.inc24 ], [ 0, %for.cond2.preheader ]
%idxprom5 = sext i32 %i.168 to i64
%arrayidx6 = getelementptr inbounds [102 x i32], ptr %a, i64 0, i64 %idxprom5
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !7
%add = add nsw i32 %i.168, 1
%idxprom7 = sext i32 %add to i64
%arrayidx8 = getelementptr inbounds [102 x i32], ptr %a, i64 0, i64 %idxprom7
%7 = load i32, ptr %arrayidx8, align 4, !tbaa !7
%cmp9 = icmp sgt i32 %6, %7
br i1 %cmp9, label %if.then, label %for.inc24
if.then: ; preds = %for.body4
store i32 %7, ptr %arrayidx6, align 4, !tbaa !7
store i32 %6, ptr %arrayidx8, align 4, !tbaa !7
%cmp20 = icmp sgt i32 %i.168, 0
%sub22 = add nsw i32 %i.168, -2
%spec.select = select i1 %cmp20, i32 %sub22, i32 %i.168
%.pre = add nsw i32 %spec.select, 1
br label %for.inc24
for.inc24: ; preds = %if.then, %for.body4
%inc25.pre-phi = phi i32 [ %.pre, %if.then ], [ %add, %for.body4 ]
%cmp3 = icmp slt i32 %inc25.pre-phi, %sub
br i1 %cmp3, label %for.body4, label %while.cond.preheader, !llvm.loop !11
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv80 = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next81, %while.body ]
%8 = phi i32 [ %3, %while.body.preheader ], [ %9, %while.body ]
%sub336972 = phi i32 [ %x.promoted, %while.body.preheader ], [ %sub33, %while.body ]
%sub33 = sub nsw i32 %sub336972, %8
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%arrayidx28 = getelementptr inbounds [102 x i32], ptr %a, i64 0, i64 %indvars.iv.next81
%9 = load i32, ptr %arrayidx28, align 4, !tbaa !7
%cmp29 = icmp sle i32 %9, %sub33
%cmp30 = icmp ult i64 %indvars.iv.next81, %5
%10 = and i1 %cmp30, %cmp29
br i1 %10, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !12
while.cond.while.end_crit_edge: ; preds = %while.body
%indvars = trunc i64 %indvars.iv.next81 to i32
store i32 %sub33, ptr %x, align 4, !tbaa !7
br label %while.end
while.end: ; preds = %while.cond.preheader.thread, %while.cond.while.end_crit_edge, %while.cond.preheader
%.lcssa648893 = phi i32 [ %1, %while.cond.while.end_crit_edge ], [ %1, %while.cond.preheader ], [ %0, %while.cond.preheader.thread ]
%i.3.lcssa = phi i32 [ %indvars, %while.cond.while.end_crit_edge ], [ 0, %while.cond.preheader ], [ 0, %while.cond.preheader.thread ]
%.lcssa = phi i32 [ %sub33, %while.cond.while.end_crit_edge ], [ %x.promoted, %while.cond.preheader ], [ %x.promoted90, %while.cond.preheader.thread ]
%cmp36 = icmp eq i32 %i.3.lcssa, %.lcssa648893
%cmp37 = icmp sgt i32 %.lcssa, 0
%or.cond = and i1 %cmp36, %cmp37
%dec = sext i1 %or.cond to i32
%spec.select63 = add nsw i32 %i.3.lcssa, %dec
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select63)
call void @llvm.lifetime.end.p0(i64 408, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
//Binary Search Tree 1
#include <stdio.h>
#include <stdlib.h>
struct node{
int key;
struct node *left,*right,*parent;
};
typedef struct node Node;
Node *rootnode;
Node *NIL;
void Insert(int );
void Preorder(Node *);
void Inorder(Node *);
int main(void){
int n,i,key;
char command[6];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",command);
if(command[0]=='i'){
scanf("%d",&key);
Insert(key);
}
else if(command[0]=='p'){
Inorder(rootnode);
printf("\n");
Preorder(rootnode);
printf("\n");
}
}
return 0;
}
void Insert(int key){
Node *parent=rootnode;
Node *z;
Node *y=NIL;
z=(Node *)malloc(sizeof(Node));
z->key=key;
z->left=NIL;
z->right=NIL;
while(parent!=NIL){
y=parent;
if(key > parent->key)
parent=parent->right;
else
parent=parent->left;
}
if(y==NIL)rootnode=z;
z->parent=y;
if(y!=NIL){
if(key > y->key)
y->right=z;
else
y->left=z;
}
}
void Preorder(Node *node){
printf(" %d",node->key);
if(node->left!=NIL)
Preorder(node->left);
if(node->right!=NIL)
Preorder(node->right);
}
void Inorder(Node *node){
if(node->left!=NIL)
Inorder(node->left);
printf(" %d",node->key);
if(node->right!=NIL)
Inorder(node->right);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211733/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211733/source.c"
target datalayout = "e-m:e-p270: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 }
@.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
@rootnode = dso_local local_unnamed_addr global ptr null, align 8
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%key = alloca i32, align 4
%command = alloca [6 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #5
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %command) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %command)
%1 = load i8, ptr %command, align 1, !tbaa !9
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%2 = load i32, ptr %key, align 4, !tbaa !5
%3 = load ptr, ptr @rootnode, align 8, !tbaa !10
%4 = load ptr, ptr @NIL, align 8, !tbaa !10
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !12
%left.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
store ptr %4, ptr %left.i, align 8, !tbaa !14
%right.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %4, ptr %right.i, align 8, !tbaa !15
%cmp.not38.i = icmp eq ptr %3, %4
br i1 %cmp.not38.i, label %while.end.i, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%parent.039.i = phi ptr [ %parent.1.i, %while.body.i ], [ %3, %if.then ]
%5 = load i32, ptr %parent.039.i, align 8, !tbaa !12
%cmp3.i = icmp slt i32 %5, %2
%right4.i = getelementptr inbounds %struct.node, ptr %parent.039.i, i64 0, i32 2
%left5.i = getelementptr inbounds %struct.node, ptr %parent.039.i, i64 0, i32 1
%parent.1.in.i = select i1 %cmp3.i, ptr %right4.i, ptr %left5.i
%parent.1.i = load ptr, ptr %parent.1.in.i, align 8, !tbaa !10
%cmp.not.i = icmp eq ptr %parent.1.i, %4
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !16
while.end.i: ; preds = %while.body.i, %if.then
%y.0.lcssa.i = phi ptr [ %3, %if.then ], [ %parent.039.i, %while.body.i ]
%cmp6.i = icmp eq ptr %y.0.lcssa.i, %4
br i1 %cmp6.i, label %if.end8.thread.i, label %if.then11.i
if.end8.thread.i: ; preds = %while.end.i
store ptr %call.i, ptr @rootnode, align 8, !tbaa !10
%parent937.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store ptr %4, ptr %parent937.i, align 8, !tbaa !18
br label %for.inc
if.then11.i: ; preds = %while.end.i
%parent9.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store ptr %y.0.lcssa.i, ptr %parent9.i, align 8, !tbaa !18
%6 = load i32, ptr %y.0.lcssa.i, align 8, !tbaa !12
%cmp13.i = icmp slt i32 %6, %2
br i1 %cmp13.i, label %if.then14.i, label %if.else16.i
if.then14.i: ; preds = %if.then11.i
%right15.i = getelementptr inbounds %struct.node, ptr %y.0.lcssa.i, i64 0, i32 2
store ptr %call.i, ptr %right15.i, align 8, !tbaa !15
br label %for.inc
if.else16.i: ; preds = %if.then11.i
%left17.i = getelementptr inbounds %struct.node, ptr %y.0.lcssa.i, i64 0, i32 1
store ptr %call.i, ptr %left17.i, align 8, !tbaa !14
br label %for.inc
if.then9: ; preds = %for.body
%7 = load ptr, ptr @rootnode, align 8, !tbaa !10
call void @Inorder(ptr noundef %7)
%putchar = call i32 @putchar(i32 10)
%8 = load ptr, ptr @rootnode, align 8, !tbaa !10
call void @Preorder(ptr noundef %8)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.else16.i, %if.then14.i, %if.end8.thread.i, %for.body, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %command) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #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 uwtable
define dso_local void @Insert(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @rootnode, align 8, !tbaa !10
%1 = load ptr, ptr @NIL, align 8, !tbaa !10
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %key, ptr %call, align 8, !tbaa !12
%left = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store ptr %1, ptr %left, align 8, !tbaa !14
%right = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %1, ptr %right, align 8, !tbaa !15
%cmp.not38 = icmp eq ptr %0, %1
br i1 %cmp.not38, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%parent.039 = phi ptr [ %parent.1, %while.body ], [ %0, %entry ]
%2 = load i32, ptr %parent.039, align 8, !tbaa !12
%cmp3 = icmp slt i32 %2, %key
%right4 = getelementptr inbounds %struct.node, ptr %parent.039, i64 0, i32 2
%left5 = getelementptr inbounds %struct.node, ptr %parent.039, i64 0, i32 1
%parent.1.in = select i1 %cmp3, ptr %right4, ptr %left5
%parent.1 = load ptr, ptr %parent.1.in, align 8, !tbaa !10
%cmp.not = icmp eq ptr %parent.1, %1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%y.0.lcssa = phi ptr [ %0, %entry ], [ %parent.039, %while.body ]
%cmp6 = icmp eq ptr %y.0.lcssa, %1
br i1 %cmp6, label %if.end8.thread, label %if.then11
if.end8.thread: ; preds = %while.end
store ptr %call, ptr @rootnode, align 8, !tbaa !10
%parent937 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr %1, ptr %parent937, align 8, !tbaa !18
br label %if.end19
if.then11: ; preds = %while.end
%parent9 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr %y.0.lcssa, ptr %parent9, align 8, !tbaa !18
%3 = load i32, ptr %y.0.lcssa, align 8, !tbaa !12
%cmp13 = icmp slt i32 %3, %key
br i1 %cmp13, label %if.then14, label %if.else16
if.then14: ; preds = %if.then11
%right15 = getelementptr inbounds %struct.node, ptr %y.0.lcssa, i64 0, i32 2
store ptr %call, ptr %right15, align 8, !tbaa !15
br label %if.end19
if.else16: ; preds = %if.then11
%left17 = getelementptr inbounds %struct.node, ptr %y.0.lcssa, i64 0, i32 1
store ptr %call, ptr %left17, align 8, !tbaa !14
br label %if.end19
if.end19: ; preds = %if.end8.thread, %if.then14, %if.else16
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @Inorder(ptr nocapture noundef readonly %node) local_unnamed_addr #0 {
entry:
%.pre = load ptr, ptr @NIL, align 8, !tbaa !10
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%0 = phi ptr [ %.pre, %entry ], [ %4, %if.end ]
%node.tr = phi ptr [ %node, %entry ], [ %3, %if.end ]
%left = getelementptr inbounds %struct.node, ptr %node.tr, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !14
%cmp.not = icmp eq ptr %1, %0
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @Inorder(ptr noundef %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%2 = load i32, ptr %node.tr, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2)
%right = getelementptr inbounds %struct.node, ptr %node.tr, i64 0, i32 2
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !10
%cmp2.not = icmp eq ptr %3, %4
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Preorder(ptr nocapture noundef readonly %node) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%node.tr = phi ptr [ %node, %entry ], [ %4, %if.end ]
%0 = load i32, ptr %node.tr, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %node.tr, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !14
%2 = load ptr, ptr @NIL, align 8, !tbaa !10
%cmp.not = icmp eq ptr %1, %2
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @Preorder(ptr noundef %1)
%.pre = load ptr, ptr @NIL, align 8, !tbaa !10
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%3 = phi ptr [ %.pre, %if.then ], [ %1, %tailrecurse ]
%right = getelementptr inbounds %struct.node, ptr %node.tr, i64 0, i32 2
%4 = load ptr, ptr %right, align 8, !tbaa !15
%cmp2.not = icmp eq ptr %4, %3
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"node", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!14 = !{!13, !11, i64 8}
!15 = !{!13, !11, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!13, !11, i64 24}
!19 = distinct !{!19, !17}
|
#include <stdio.h>
#include <stdlib.h>
#define N_MAX 500001
struct node{
int key;
struct node *right;
struct node *left;
struct node *parent;
};
typedef struct node *Node;
Node root = NULL;
void insert(int k){
Node y = NULL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->right = NULL;
z->left = NULL;
while(x != NULL){
y = x;
if(z->key < x->key){
x = x->left;
}else{
x = x->right;
}
}
z->parent = y;
if(y == NULL){
root = z;
}else if(z->key < y->key){
y->left = z;
}else{
y->right = z;
}
}
/* 中間順アルゴリズム */
void inorder(Node u){
if(u == NULL){
return;
}
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
/* 先行順アルゴリズム */
void preorder(Node u){
if(u == NULL){
return;
}
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211777/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211777/source.c"
target datalayout = "e-m:e-p270: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 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !9
%right = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%1 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %if.then12, %if.else14, %if.then7
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %if.then7 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%right = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%2 = load ptr, ptr %right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%0 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%right = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%2 = load ptr, ptr %right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !9
%right.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then
%x.035.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i.lcssa.sink, ptr %parent.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++){
int n,j,k=0;
scanf("%d",&n);
int a[n];
for(j=0;j<n;j++){
scanf("%d",&a[j]);
}
for(j=0;j<n;j++){
if(j+1==a[j]){
k++;
}
}
if(k==n){
printf("0\n");
}
else{
if(a[0]==1||a[n-1]==n){
printf("1\n");
}
else if(a[0]==n&&a[n-1]==1){
printf("3\n");
}
else{
printf("2\n");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21182/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21182/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"1\00", align 1
@str.7 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %0, 0
br i1 %cmp62, label %for.body, label %for.end42
for.body: ; preds = %entry, %if.end39
%i.063 = phi i32 [ %inc41, %if.end39 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp356 = icmp sgt i32 %4, 0
br i1 %cmp356, label %for.body4, label %for.end15
for.cond6.preheader: ; preds = %for.body4
%cmp758 = icmp sgt i32 %19, 0
br i1 %cmp758, label %for.body8.preheader, label %for.end15
for.body8.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %19 to i64
%min.iters.check = icmp ult i32 %19, 8
br i1 %min.iters.check, label %for.body8.preheader75, label %vector.ph
vector.ph: ; preds = %for.body8.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%vec.phi73 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%5 = add nuw nsw <4 x i64> %vec.ind, <i64 1, i64 1, i64 1, i64 1>
%6 = add <4 x i64> %vec.ind, <i64 5, i64 5, i64 5, i64 5>
%7 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load74 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = zext <4 x i32> %wide.load to <4 x i64>
%10 = zext <4 x i32> %wide.load74 to <4 x i64>
%11 = icmp eq <4 x i64> %5, %9
%12 = icmp eq <4 x i64> %6, %10
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = add <4 x i32> %vec.phi, %13
%16 = add <4 x i32> %vec.phi73, %14
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %16, %15
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end15, label %for.body8.preheader75
for.body8.preheader75: ; preds = %for.body8.preheader, %middle.block
%indvars.iv66.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec, %middle.block ]
%k.059.ph = phi i32 [ 0, %for.body8.preheader ], [ %18, %middle.block ]
br label %for.body8
for.body4: ; preds = %for.body, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%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
%cmp3 = icmp slt i64 %indvars.iv.next, %20
br i1 %cmp3, label %for.body4, label %for.cond6.preheader, !llvm.loop !13
for.body8: ; preds = %for.body8.preheader75, %for.body8
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body8 ], [ %indvars.iv66.ph, %for.body8.preheader75 ]
%k.059 = phi i32 [ %spec.select, %for.body8 ], [ %k.059.ph, %for.body8.preheader75 ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv66
%21 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%22 = zext i32 %21 to i64
%cmp11 = icmp eq i64 %indvars.iv.next67, %22
%inc12 = zext i1 %cmp11 to i32
%spec.select = add nuw nsw i32 %k.059, %inc12
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %for.end15, label %for.body8, !llvm.loop !14
for.end15: ; preds = %for.body8, %middle.block, %for.body, %for.cond6.preheader
%.lcssa71 = phi i32 [ %19, %for.cond6.preheader ], [ %4, %for.body ], [ %19, %middle.block ], [ %19, %for.body8 ]
%k.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %for.body ], [ %18, %middle.block ], [ %spec.select, %for.body8 ]
%cmp16 = icmp eq i32 %k.0.lcssa, %.lcssa71
br i1 %cmp16, label %if.end39, label %if.else
if.else: ; preds = %for.end15
%23 = load i32, ptr %vla, align 16, !tbaa !5
%cmp20 = icmp eq i32 %23, 1
br i1 %cmp20, label %if.end39, label %lor.lhs.false
lor.lhs.false: ; preds = %if.else
%sub = add nsw i32 %.lcssa71, -1
%idxprom21 = sext i32 %sub to i64
%arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %idxprom21
%24 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %24, %.lcssa71
br i1 %cmp23, label %if.end39, label %if.else26
if.else26: ; preds = %lor.lhs.false
%cmp28 = icmp eq i32 %23, %.lcssa71
%cmp32 = icmp eq i32 %24, 1
%or.cond = and i1 %cmp28, %cmp32
%str.5.str = select i1 %or.cond, ptr @str.5, ptr @str
br label %if.end39
if.end39: ; preds = %if.else26, %if.else, %lor.lhs.false, %for.end15
%str.6.sink = phi ptr [ @str.7, %for.end15 ], [ @str.6, %lor.lhs.false ], [ @str.6, %if.else ], [ %str.5.str, %if.else26 ]
%puts54 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
%inc41 = add nuw nsw i32 %i.063, 1
%25 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc41, %25
br i1 %cmp, label %for.body, label %for.end42, !llvm.loop !15
for.end42: ; preds = %if.end39, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
typedef struct node *Node;
struct node{
int key;
Node Right;
Node Left;
Node Parent;
};
Node root;
void insert(int k)
{
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->Left = NIL;
z->Right = NIL;
while(x != NIL){
y = x;
if(z->key < x->key)
x = x->Left;
else
x = x->Right;
}
z->Parent = y;
if(y == NIL)
root = z;
else if(z->key < y->key)
y->Left = z;
else
y->Right = z;
}
void inorder(Node r){
if(r == NIL) return;
inorder(r->Left);
printf(" %d",r->key);
inorder(r->Right);
}
void preorder(Node r){
if(r == NIL) return;
printf(" %d",r->key);
preorder(r->Left);
preorder(r->Right);
}
void print()
{
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
int main()
{
int m,i,k;
char s[6];
scanf("%d",&m);
for(i=0; i<m; i++){
scanf("%s%d",s,&k);
//printf("i = %d\n",i);
if(s[0] == 'i')
insert(k);
else
print();
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211863/source.c"
target datalayout = "e-m:e-p270: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 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%s%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !9
%Right = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %Right, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%1 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%Left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2
%Right5 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %Left4, ptr %Right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%Parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr null, ptr %Parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%Parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %Parent, align 8, !tbaa !14
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%Left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%Right15 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %if.then12, %if.else14, %if.then7
%Left13.sink = phi ptr [ %Left13, %if.then12 ], [ %Right15, %if.else14 ], [ @root, %if.then7 ]
store ptr %call, ptr %Left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr noundef readonly %r) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %r, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%r.tr5 = phi ptr [ %2, %if.end ], [ %r, %entry ]
%Left = getelementptr inbounds %struct.node, ptr %r.tr5, i64 0, i32 2
%0 = load ptr, ptr %Left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%1 = load i32, ptr %r.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%Right = getelementptr inbounds %struct.node, ptr %r.tr5, i64 0, i32 1
%2 = load ptr, ptr %Right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 @preorder(ptr noundef readonly %r) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %r, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%r.tr5 = phi ptr [ %2, %if.end ], [ %r, %entry ]
%0 = load i32, ptr %r.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%Left = getelementptr inbounds %struct.node, ptr %r.tr5, i64 0, i32 2
%1 = load ptr, ptr %Left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%Right = getelementptr inbounds %struct.node, ptr %r.tr5, i64 0, i32 1
%2 = load ptr, ptr %Right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
tail call void @inorder(ptr noundef %0)
%putchar = tail call i32 @putchar(i32 10)
%1 = load ptr, ptr @root, align 8, !tbaa !5
tail call void @preorder(ptr noundef %1)
%putchar2 = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [6 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %s) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !17
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.06 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %s, ptr noundef nonnull %k)
%1 = load i8, ptr %s, align 1, !tbaa !18
%cmp2 = icmp eq i8 %1, 105
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%2 = load i32, ptr %k, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !9
%Right.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %Right.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%Left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 2
%Right5.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %Left4.i, ptr %Right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then
%x.035.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%Left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%Parent.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i.lcssa.sink, ptr %Parent.i, align 8, !tbaa !14
store ptr %call.i, ptr %Left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar.i = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar2.i = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.else
%inc = add nuw nsw i32 %i.06, 1
%7 = load i32, ptr %m, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %s) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x){
}
Node treeMaximum(Node x){
}
Node treeSearch(Node u, int k){
}
Node treeSuccessor(Node x){
}
void treeDelete(Node z){
Node y; // node to be deleted
Node x; // child of y
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x != NIL){
y=x;
if(z->key<x->key) x = x->left;
else x = x->right;
}
z->parent = y;
if(y == NIL)root = z;
else if(z->key<y->key)y->left = z;
else y->right = z;
}
void inorder(Node u){
if(u == NIL)return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(Node u){
if(u==NIL)return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211920/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211920/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMaximum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSearch(ptr nocapture noundef readnone %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSuccessor(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #0 {
entry:
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #2 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 void @preorder(ptr noundef readonly %u) local_unnamed_addr #2 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.041 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then16, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then23: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar39 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
for.inc: ; preds = %for.body, %if.then, %if.then23, %if.then31, %insert.exit
%inc = add nuw nsw i32 %i.041, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @putchar(i32 noundef) 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 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-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 allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
typedef struct node{
int key;
struct node *l;
struct node *r;
struct node *p;
} Node;
typedef struct node* NodePointer;
NodePointer root;
void insert(int key){
NodePointer x, y, z;
y = NIL;
x = root;
z = malloc(sizeof(struct node));
z->key = key;
z->l = NIL;
z->r = NIL;
while(x != NIL){
y = x;
if(z->key < x->key) x = x->l;
else x = x->r;
z->p = y;
}
z->p = y;
if(y == NIL) root = z;
else if(z->key < y->key) y->l = z;
else y->r = z;
}
void inorder(NodePointer t){
if(t->l != NIL) inorder(t->l);
printf(" %d", t->key);
if(t->r != NIL) inorder(t->r);
}
void preorder(NodePointer t){
printf(" %d", t->key);
if(t->l != NIL) preorder(t->l);
if(t->r != NIL) preorder(t->r);
}
int main(){
int i, n, x;
char com[10];
scanf("%d",&n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if(com[0] == 'i'){
scanf("%d", &x);
insert(x);
}
else if(com[0] == 'p'){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_211964/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_211964/source.c"
target datalayout = "e-m:e-p270: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 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %key, ptr %call, align 8, !tbaa !9
%l = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
%cmp.not38 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %l, i8 0, i64 16, i1 false)
%p741 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
br i1 %cmp.not38, label %if.then9, label %while.body
while.body: ; preds = %entry, %while.body
%x.039 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%1 = load i32, ptr %x.039, align 8, !tbaa !9
%cmp4 = icmp sgt i32 %1, %key
%l5 = getelementptr inbounds %struct.node, ptr %x.039, i64 0, i32 1
%r6 = getelementptr inbounds %struct.node, ptr %x.039, i64 0, i32 2
%x.1.in = select i1 %cmp4, ptr %l5, ptr %r6
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
store ptr %x.039, ptr %p741, align 8, !tbaa !12
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else10, label %while.body, !llvm.loop !13
if.then9: ; preds = %entry
store ptr null, ptr %p741, align 8, !tbaa !12
br label %if.end19
if.else10: ; preds = %while.body
%p7 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store ptr %x.039, ptr %p7, align 8, !tbaa !12
%2 = load i32, ptr %x.039, align 8, !tbaa !9
%cmp13 = icmp sgt i32 %2, %key
br i1 %cmp13, label %if.then14, label %if.else16
if.then14: ; preds = %if.else10
%l15 = getelementptr inbounds %struct.node, ptr %x.039, i64 0, i32 1
br label %if.end19
if.else16: ; preds = %if.else10
%r17 = getelementptr inbounds %struct.node, ptr %x.039, i64 0, i32 2
br label %if.end19
if.end19: ; preds = %if.then14, %if.else16, %if.then9
%l15.sink = phi ptr [ %l15, %if.then14 ], [ %r17, %if.else16 ], [ @root, %if.then9 ]
store ptr %call, ptr %l15.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr nocapture noundef readonly %t) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%t.tr = phi ptr [ %t, %entry ], [ %2, %if.end ]
%l = getelementptr inbounds %struct.node, ptr %t.tr, i64 0, i32 1
%0 = load ptr, ptr %l, align 8, !tbaa !15
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @inorder(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%1 = load i32, ptr %t.tr, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%r = getelementptr inbounds %struct.node, ptr %t.tr, i64 0, i32 2
%2 = load ptr, ptr %r, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
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 @preorder(ptr nocapture noundef readonly %t) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%t.tr = phi ptr [ %t, %entry ], [ %2, %if.end ]
%0 = load i32, ptr %t.tr, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%l = getelementptr inbounds %struct.node, ptr %t.tr, i64 0, i32 1
%1 = load ptr, ptr %l, align 8, !tbaa !15
%cmp.not = icmp eq ptr %1, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preorder(ptr noundef nonnull %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%r = getelementptr inbounds %struct.node, ptr %t.tr, i64 0, i32 2
%2 = load ptr, ptr %r, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 1, !tbaa !18
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !9
%l.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
%cmp.not38.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %l.i, i8 0, i64 16, i1 false)
%p741.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
br i1 %cmp.not38.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.039.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.039.i, align 8, !tbaa !9
%cmp4.i = icmp sgt i32 %4, %2
%l5.i = getelementptr inbounds %struct.node, ptr %x.039.i, i64 0, i32 1
%r6.i = getelementptr inbounds %struct.node, ptr %x.039.i, i64 0, i32 2
%x.1.in.i = select i1 %cmp4.i, ptr %l5.i, ptr %r6.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
store ptr %x.039.i, ptr %p741.i, align 8, !tbaa !12
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !13
insert.exit: ; preds = %while.body.i, %if.then
%storemerge = phi ptr [ null, %if.then ], [ %x.039.i, %while.body.i ]
%l15.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
store ptr %storemerge, ptr %p741.i, align 8, !tbaa !12
store ptr %call.i, ptr %l15.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 16}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
Node root;
Node treeMinimum(Node x){
}
Node treeMaximum(Node x){
}
Node treeSearch(Node u, int k){
}
Node treeSuccessor(Node x){
}
void treeDelete(Node z){
Node y;
Node x;
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x!=NIL){
y=x;
if(z->key < x->key){
x=x->left;
}else{
x=x->right;
}
}
z->parent=y;
if(y==NULL){
root=z;
}else if(z->key < y->key){
y->left=z;
}else{
y->right=z;
}
}
void inorder(Node u){
if(u!=NIL){
inorder(u->left);
printf(" ");
printf("%d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL){
printf(" ");
printf("%d",u->key);
preorder(u->left);
preorder(u->right);
}
}
int main(){
int n=0, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", &com[0]);
if ( com[0] == 'f' ){
x=0;
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212028/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212028/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMaximum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSearch(ptr nocapture noundef readnone %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSuccessor(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #0 {
entry:
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #2 {
entry:
%cmp.not5 = icmp eq ptr %u, null
br i1 %cmp.not5, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr6 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr6, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%putchar = tail call i32 @putchar(i32 32)
%key = getelementptr inbounds %struct.node, ptr %u.tr6, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
%2 = load ptr, ptr %u.tr6, align 8, !tbaa !16
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
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 void @preorder(ptr noundef readonly %u) local_unnamed_addr #2 {
entry:
%cmp.not5 = icmp eq ptr %u, null
br i1 %cmp.not5, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr6 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%putchar = tail call i32 @putchar(i32 32)
%key = getelementptr inbounds %struct.node, ptr %u.tr6, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr6, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr6, align 8, !tbaa !16
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
store i32 0, ptr %n, align 4, !tbaa !17
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.042 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then17
i8 112, label %if.then24
i8 100, label %if.then32
]
if.then: ; preds = %for.body
store i32 0, ptr %x, align 4, !tbaa !17
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
if.then17: ; preds = %for.body
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then17, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then17 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then17
%.sink = phi ptr [ null, %if.then17 ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then17 ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then24: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar40 = call i32 @putchar(i32 10)
br label %for.inc
if.then32: ; preds = %for.body
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
for.inc: ; preds = %for.body, %if.then, %if.then24, %if.then32, %insert.exit
%inc = add nuw nsw i32 %i.042, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @putchar(i32 noundef) 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 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-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 allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include <stdio.h>
#include <stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
void insert(int);
void inorder(Node);
void preorder(Node);
Node root;
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x != NIL){
y = x;
if(z->key < x->key){
x = x->left;
}
else{
x = x->right;
}
}
z->parent = y;
if(y == NIL){
root = z;
}
else if(z->key < y->key){
y->left = z;
}
else y->right = z;
}
void inorder(Node u){
if(u != NIL){
inorder(u->left);
printf(" %d", u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u != NIL){
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212071/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212071/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@.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
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !9
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = load ptr, ptr @root, align 8, !tbaa !10
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !12
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !12
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !10
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !14
insert.exit: ; preds = %while.body.i, %if.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !16
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !10
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !10
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !10
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !10
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !12
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !12
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !10
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !14
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !16
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !12
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !10
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !18
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !19
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp eq ptr %u, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%u.tr5 = phi ptr [ %2, %if.then ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !18
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !19
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 24}
!13 = !{!"node", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !11, i64 16}
!17 = distinct !{!17, !15}
!18 = !{!13, !11, i64 8}
!19 = !{!13, !11, i64 0}
|
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
struct Node{
int key;
struct Node *p,*l,*r;
};
struct Node *root,*NIL;
void insert(int);
void inorder(struct Node*);
void preorder(struct Node*);
int main(){
int m,x;
int i;
char k[10];
scanf("%d",&m);
for(i=0; i < m; i++){
scanf("%s",k);
if(strcmp(k,"insert")==0){
scanf("%d",&x);
insert(x);
}
else if(strcmp(k,"print")==0){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
void insert(int a){
struct Node *y=NIL;
struct Node *x=root;
struct Node *z;
z=((struct Node *)malloc(sizeof(struct Node)));
z->key=a;
z->l=NIL;
z->r=NIL;
while(x!=NIL){
y=x;
if(z->key < x->key) x=x->l;
else x=x->r;
}
z->p=y;
if(y==NIL) root=z;
else {
if(z->key < y->key){
y->l=z;
}
else y->r =z;
}
}
void inorder(struct Node *x){
if(x == NIL) return;
inorder(x->l);
printf(" %d",x->key);
inorder(x->r);
}
void preorder(struct Node *x){
if(x==NIL) return;
printf(" %d",x->key);
preorder(x->l);
preorder(x->r);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212114/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212114/source.c"
target datalayout = "e-m:e-p270: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 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@root = dso_local local_unnamed_addr global ptr null, align 8
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@.str.5 = 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:
%m = alloca i32, align 4
%x = alloca i32, align 4
%k = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %k) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.018 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %k, ptr noundef nonnull dereferenceable(7) @.str.2, i64 7)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load ptr, ptr @NIL, align 8, !tbaa !9
%3 = load ptr, ptr @root, align 8, !tbaa !9
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %1, ptr %call.i, align 8, !tbaa !11
%l.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %2, ptr %l.i, align 8, !tbaa !13
%r.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %2, ptr %r.i, align 8, !tbaa !14
%cmp.not34.i = icmp eq ptr %3, %2
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i
while.end.thread.i: ; preds = %if.then
%p37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %2, ptr %p37.i, align 8, !tbaa !15
br label %insert.exit
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !11
%cmp3.i = icmp sgt i32 %4, %1
%l4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%r5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 3
%x.1.in.i = select i1 %cmp3.i, ptr %l4.i, ptr %r5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !9
%cmp.not.i = icmp eq ptr %x.1.i, %2
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !16
while.end.i: ; preds = %while.body.i
%p.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %x.035.i, ptr %p.i, align 8, !tbaa !15
%cmp6.i = icmp eq ptr %x.035.i, %2
%spec.select16 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%l13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select16, %while.end.i ]
store ptr %call.i, ptr %l13.sink.i, align 8, !tbaa !9
br label %for.inc
if.else: ; preds = %for.body
%bcmp14 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %k, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6)
%cmp8 = icmp eq i32 %bcmp14, 0
br i1 %cmp8, label %if.then9, label %for.inc
if.then9: ; preds = %if.else
%5 = load ptr, ptr @root, align 8, !tbaa !9
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !9
call void @preorder(ptr noundef %6)
%putchar15 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.then9, %if.else
%inc = add nuw nsw i32 %i.018, 1
%7 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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 uwtable
define dso_local void @insert(i32 noundef %a) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !9
%1 = load ptr, ptr @root, align 8, !tbaa !9
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
store i32 %a, ptr %call, align 8, !tbaa !11
%l = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %l, align 8, !tbaa !13
%r = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %r, align 8, !tbaa !14
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%p37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %p37, align 8, !tbaa !15
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !11
%cmp3 = icmp sgt i32 %2, %a
%l4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%r5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 3
%x.1.in = select i1 %cmp3, ptr %l4, ptr %r5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !9
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body
%p = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %x.035, ptr %p, align 8, !tbaa !15
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !11
%cmp11 = icmp sgt i32 %3, %a
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%l13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%r15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 3
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%l13.sink = phi ptr [ %l13, %if.then12 ], [ %r15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ]
store ptr %call, ptr %l13.sink, align 8, !tbaa !9
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp4 = icmp eq ptr %0, %x
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr5 = phi ptr [ %3, %if.end ], [ %x, %entry ]
%l = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 2
%1 = load ptr, ptr %l, align 8, !tbaa !13
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %x.tr5, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %2)
%r = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 3
%3 = load ptr, ptr %r, align 8, !tbaa !14
%4 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp4 = icmp eq ptr %0, %x
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr5 = phi ptr [ %3, %if.end ], [ %x, %entry ]
%1 = load i32, ptr %x.tr5, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
%l = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 2
%2 = load ptr, ptr %l, align 8, !tbaa !13
tail call void @preorder(ptr noundef %2)
%r = getelementptr inbounds %struct.Node, ptr %x.tr5, i64 0, i32 3
%3 = load ptr, ptr %r, align 8, !tbaa !14
%4 = load ptr, ptr @NIL, align 8, !tbaa !9
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"Node", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, i64 24}
!15 = !{!12, !10, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Node{
int key;
struct Node *right,*left,*parent;
};
//typedef struct Node;
struct Node *root,*NIL;
void insert(int k){
struct Node *y=NIL;
struct Node *x=root;
struct Node *z;
z=(struct Node *)malloc(sizeof(struct Node));
z->key=k;
z->left=NIL;
z->right=NIL;
while(x!=NIL){
y=x;
if(z->key < x->key) x=x->left;
else x=x->right;
}
z->parent=y;
if(y==NIL) root=z;
else {
if(z->key < y->key) y->left=z;
else y->right=z;
}
}
void inorder(struct Node *u){
if(u==NIL) return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(struct Node *u){
if(u==NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main()
{
int n,i,x;
char str1[]="insert";
char str2[]="print";
char com[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",com);
if(strcmp(com,str1)==0){
scanf("%d",&x);
insert(x);
}
else if(strcmp(com,str2)==0){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212165/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212165/source.c"
target datalayout = "e-m:e-p270: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 }
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@__const.main.str1 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@__const.main.str2 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%1 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !9
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %left, align 8, !tbaa !12
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %right, align 8, !tbaa !13
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %parent37, align 8, !tbaa !14
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %2, %k
%left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %3, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !12
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !13
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !12
tail call void @preorder(ptr noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !13
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.020 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @__const.main.str1, i64 7)
%cmp5 = icmp eq i32 %bcmp, 0
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %for.body
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !17
%2 = load ptr, ptr @NIL, align 8, !tbaa !5
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %1, ptr %call.i, align 8, !tbaa !9
%left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %2, ptr %left.i, align 8, !tbaa !12
%right.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %2, ptr %right.i, align 8, !tbaa !13
%cmp.not34.i = icmp eq ptr %3, %2
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i
while.end.thread.i: ; preds = %if.then
%parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %2, ptr %parent37.i, align 8, !tbaa !14
br label %insert.exit
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %1
%left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, %2
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !15
while.end.i: ; preds = %while.body.i
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !14
%cmp6.i = icmp eq ptr %x.035.i, %2
%spec.select18 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select18, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%bcmp16 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %com, ptr noundef nonnull dereferenceable(6) @__const.main.str2, i64 6)
%cmp10 = icmp eq i32 %bcmp16, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.else
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar17 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.then11, %if.else
%inc = add nuw nsw i32 %i.020, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 willreturn memory(argmem: read) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !6, i64 24}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !16}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x != NIL){
y=x;
if(z->key < x->key) x=x->left;
else x=x->right;
}
z->parent=y;
if(y==NIL) root=z;
else if(z->key < y->key) y->left=z;
else y->right=z;
}
void inorder(Node u){
if(u==NIL) return ;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(Node u){
if(u==NIL) return ;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212208/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212208/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *Left;
struct node *Right;
struct node *Parent;
int ndkey;
};
typedef struct node * NodePointer;
NodePointer root = NULL;
NodePointer NIL = NULL;
NodePointer makeNode(){
NodePointer node = malloc(sizeof(struct node));
node->Left = NULL;
node->Right = NULL;
node->Parent = NULL;
node->ndkey = 0;
return node;
}
void insert(int ndkey){
NodePointer z = makeNode();
NodePointer x = root;
NodePointer y = NIL;
z -> ndkey = ndkey;
while(x!=NIL){
y = x;
if(z->ndkey < y->ndkey) x = x -> Left;
else x = x -> Right;
}
z -> Parent = y;
if(y == NIL) root = z;
else if(z -> ndkey < y -> ndkey) y -> Left = z;
else y -> Right = z;
}
void preO(NodePointer p){
printf(" %d", p->ndkey);
if(p->Left != NULL) preO(p->Left);
if(p->Right != NULL) preO(p->Right);
}
void i_order(NodePointer p){
if(p->Left != NULL) i_order(p->Left);
printf(" %d", p->ndkey);
if(p->Right != NULL) i_order(p->Right);
}
int main(){
int i,m,n;
char O[10];
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%s",O);
if(O[0]=='i'){
scanf("%d",&n);
insert(n);
}
else if(O[0]=='p'){
i_order(root);
printf("\n");
preO(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212259/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212259/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @makeNode() local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %call, i8 0, i64 28, i1 false)
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @insert(i32 noundef %ndkey) local_unnamed_addr #3 {
entry:
%call.i = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %call.i, i8 0, i64 16, i1 false)
%0 = load ptr, ptr @root, align 8, !tbaa !5
%1 = load ptr, ptr @NIL, align 8, !tbaa !5
%ndkey1 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %ndkey, ptr %ndkey1, align 8, !tbaa !9
%cmp.not31 = icmp eq ptr %0, %1
br i1 %cmp.not31, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%x.032 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%ndkey3 = getelementptr inbounds %struct.node, ptr %x.032, i64 0, i32 3
%2 = load i32, ptr %ndkey3, align 8, !tbaa !9
%cmp4 = icmp sgt i32 %2, %ndkey
%Right = getelementptr inbounds %struct.node, ptr %x.032, i64 0, i32 1
%x.1.in = select i1 %cmp4, ptr %x.032, ptr %Right
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, %1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%y.0.lcssa = phi ptr [ %0, %entry ], [ %x.032, %while.body ]
%Parent = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %y.0.lcssa, ptr %Parent, align 8, !tbaa !14
%cmp5 = icmp eq ptr %y.0.lcssa, %1
br i1 %cmp5, label %if.end16, label %if.else7
if.else7: ; preds = %while.end
%ndkey9 = getelementptr inbounds %struct.node, ptr %y.0.lcssa, i64 0, i32 3
%3 = load i32, ptr %ndkey9, align 8, !tbaa !9
%cmp10 = icmp sgt i32 %3, %ndkey
%Right14 = getelementptr inbounds %struct.node, ptr %y.0.lcssa, i64 0, i32 1
%spec.select = select i1 %cmp10, ptr %y.0.lcssa, ptr %Right14
br label %if.end16
if.end16: ; preds = %if.else7, %while.end
%y.0.lcssa.sink = phi ptr [ @root, %while.end ], [ %spec.select, %if.else7 ]
store ptr %call.i, ptr %y.0.lcssa.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @preO(ptr nocapture noundef readonly %p) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%p.tr = phi ptr [ %p, %entry ], [ %2, %if.end ]
%ndkey = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 3
%0 = load i32, ptr %ndkey, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%1 = load ptr, ptr %p.tr, align 8, !tbaa !15
%cmp.not = icmp eq ptr %1, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preO(ptr noundef nonnull %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%Right = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1
%2 = load ptr, ptr %Right, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
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 void @i_order(ptr nocapture noundef readonly %p) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%p.tr = phi ptr [ %p, %entry ], [ %2, %if.end ]
%0 = load ptr, ptr %p.tr, align 8, !tbaa !15
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @i_order(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%ndkey = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 3
%1 = load i32, ptr %ndkey, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%Right = getelementptr inbounds %struct.node, ptr %p.tr, i64 0, i32 1
%2 = load ptr, ptr %Right, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%O = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %O) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !17
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %O)
%1 = load i8, ptr %O, align 1, !tbaa !18
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !17
%call.i.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %call.i.i, i8 0, i64 16, i1 false)
%3 = load ptr, ptr @root, align 8, !tbaa !5
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%ndkey1.i = getelementptr inbounds %struct.node, ptr %call.i.i, i64 0, i32 3
store i32 %2, ptr %ndkey1.i, align 8, !tbaa !9
%cmp.not31.i = icmp eq ptr %3, %4
br i1 %cmp.not31.i, label %while.end.i, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.032.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%ndkey3.i = getelementptr inbounds %struct.node, ptr %x.032.i, i64 0, i32 3
%5 = load i32, ptr %ndkey3.i, align 8, !tbaa !9
%cmp4.i = icmp sgt i32 %5, %2
%Right.i = getelementptr inbounds %struct.node, ptr %x.032.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp4.i, ptr %x.032.i, ptr %Right.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, %4
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !12
while.end.i: ; preds = %while.body.i, %if.then
%y.0.lcssa.i = phi ptr [ %3, %if.then ], [ %x.032.i, %while.body.i ]
%Parent.i = getelementptr inbounds %struct.node, ptr %call.i.i, i64 0, i32 2
store ptr %y.0.lcssa.i, ptr %Parent.i, align 8, !tbaa !14
%cmp5.i = icmp eq ptr %y.0.lcssa.i, %4
br i1 %cmp5.i, label %insert.exit, label %if.else7.i
if.else7.i: ; preds = %while.end.i
%ndkey9.i = getelementptr inbounds %struct.node, ptr %y.0.lcssa.i, i64 0, i32 3
%6 = load i32, ptr %ndkey9.i, align 8, !tbaa !9
%cmp10.i = icmp sgt i32 %6, %2
%Right14.i = getelementptr inbounds %struct.node, ptr %y.0.lcssa.i, i64 0, i32 1
%spec.select.i = select i1 %cmp10.i, ptr %y.0.lcssa.i, ptr %Right14.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %if.else7.i
%y.0.lcssa.sink.i = phi ptr [ @root, %while.end.i ], [ %spec.select.i, %if.else7.i ]
store ptr %call.i.i, ptr %y.0.lcssa.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%7 = load ptr, ptr @root, align 8, !tbaa !5
call void @i_order(ptr noundef %7)
%putchar = call i32 @putchar(i32 10)
%8 = load ptr, ptr @root, align 8, !tbaa !5
call void @preO(ptr noundef %8)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%9 = load i32, ptr %m, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %O) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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 @putchar(i32 noundef) 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 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree 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 #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 nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
typedef struct Node{
int key;
struct Node *right,*left,*parent;
}Node;
Node *root;
void insert(int k){
Node *y=NIL;
Node *x=root;
Node *z;
z=malloc(sizeof(Node));
z->key=k;
z->left=NIL;
z->right=NIL;
while(x!=NIL){
y=x;
if(z->key < x->key){
x=x->left;
}else{
x=x->right;
}
}
z->parent=y;
if(y==NIL){
root=z;
}else{
if(z->key < y->key){
y->left=z;
}else{
y->right=z;
}
}
}
void inorder(Node *u){
if(u==NIL)return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(Node *u){
if(u==NIL)return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n,i,x;
char com[20];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",com);
if(com[0]=='i'){
scanf("%d",&x);
insert(x);
}else if(com[0]=='p'){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212301/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212301/source.c"
target datalayout = "e-m:e-p270: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 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !9
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%1 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %if.then12, %if.else14, %if.then7
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %if.then7 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%2 = load ptr, ptr %right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%0 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%2 = load ptr, ptr %right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !9
%right.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %right.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%4 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then
%x.035.i.lcssa.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i.lcssa.sink, ptr %parent.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include <stdio.h>
#include <stdlib.h>
int get_int() {
int n = 0;
int c = getchar_unlocked();
if(c == 45) {
c = getchar_unlocked();
while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
return -n;
} else if(c < 48 || 57 < c) return c;
while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
return n;
}
int get_str(char *str) {
int c;
while((c = getchar_unlocked()) > 32) *str++ = (char)c;
*str = 0;
return c;
}
void put_int(int n) {
if(!n) {
putchar_unlocked('0');
return;
}
if(n < 0) n = -n, putchar_unlocked('-');
char buf[11];
int i = 0;
while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
while(i--)putchar_unlocked(buf[i]);
}
typedef struct Node {
int key;
struct Node *left, *right;
} Node;
typedef struct BST {
Node *root;
size_t size;
} BST;
void bst_init(BST *BST) {
BST->root = NULL;
BST->size = 0;
}
void bst_insert(BST *BST, int key) {
Node *new_node = malloc(sizeof(Node));
new_node->key = key;
new_node->left = NULL;
new_node->right = NULL;
Node *tmp;
Node *root = BST->root;
while(root != NULL) {
tmp = root;
if(key < root->key) root = root->left;
else root = root->right;
}
if(BST->size == 0) BST->root = new_node;
else if(key < tmp->key) tmp->left = new_node;
else tmp->right = new_node;
BST->size++;
}
void bst_inorder(Node *root) {
if(root == NULL) return;
bst_inorder(root->left);
putchar_unlocked(' '), put_int(root->key);
bst_inorder(root->right);
}
void bst_preorder(Node *root) {
if(root == NULL) return;
putchar_unlocked(' '), put_int(root->key);
bst_preorder(root->left);
bst_preorder(root->right);
}
int main(int argc, char **argv) {
BST BST;
bst_init(&BST);
int m = get_int();
char c[8];
for(int i = 0; i < m; ++i) {
get_str(c);
if(*c == 'i') {
int key = get_int();
bst_insert(&BST, key);
} else {
bst_inorder(BST.root);
putchar_unlocked('\n');
bst_preorder(BST.root);
putchar_unlocked('\n');
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212345/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212345/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
%struct.Node = type { i32, ptr, ptr }
%struct.BST = type { ptr, i64 }
@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 @get_int() 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) #7
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
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %getchar_unlocked.exit
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i33 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i33, align 8, !tbaa !9
%_IO_read_end.i34 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i34, align 8, !tbaa !14
%cmp.not.i35 = icmp ult ptr %5, %6
br i1 %cmp.not.i35, label %cond.false.i39, label %cond.true.i36, !prof !15
cond.true.i36: ; preds = %if.then
%call.i37 = tail call i32 @__uflow(ptr noundef nonnull %4) #7
br label %getchar_unlocked.exit42
cond.false.i39: ; preds = %if.then
%incdec.ptr.i40 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i40, ptr %_IO_read_ptr.i33, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i41 = zext i8 %7 to i32
br label %getchar_unlocked.exit42
getchar_unlocked.exit42: ; preds = %cond.true.i36, %cond.false.i39
%cond.i38 = phi i32 [ %call.i37, %cond.true.i36 ], [ %conv3.i41, %cond.false.i39 ]
%8 = add i32 %cond.i38, -48
%9 = icmp ult i32 %8, 10
br i1 %9, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %getchar_unlocked.exit42
%.pre70 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit52
%10 = phi ptr [ %14, %getchar_unlocked.exit52 ], [ %.pre70, %while.body.preheader ]
%c.066 = phi i32 [ %cond.i48, %getchar_unlocked.exit52 ], [ %cond.i38, %while.body.preheader ]
%n.065 = phi i32 [ %add, %getchar_unlocked.exit52 ], [ 0, %while.body.preheader ]
%mul = mul nsw i32 %n.065, 10
%and = and i32 %c.066, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i43 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 1
%11 = load ptr, ptr %_IO_read_ptr.i43, align 8, !tbaa !9
%_IO_read_end.i44 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 2
%12 = load ptr, ptr %_IO_read_end.i44, align 8, !tbaa !14
%cmp.not.i45 = icmp ult ptr %11, %12
br i1 %cmp.not.i45, label %cond.false.i49, label %cond.true.i46, !prof !15
cond.true.i46: ; preds = %while.body
%call.i47 = tail call i32 @__uflow(ptr noundef nonnull %10) #7
%.pre69 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit52
cond.false.i49: ; preds = %while.body
%incdec.ptr.i50 = getelementptr inbounds i8, ptr %11, i64 1
store ptr %incdec.ptr.i50, ptr %_IO_read_ptr.i43, align 8, !tbaa !9
%13 = load i8, ptr %11, align 1, !tbaa !16
%conv3.i51 = zext i8 %13 to i32
br label %getchar_unlocked.exit52
getchar_unlocked.exit52: ; preds = %cond.true.i46, %cond.false.i49
%14 = phi ptr [ %.pre69, %cond.true.i46 ], [ %10, %cond.false.i49 ]
%cond.i48 = phi i32 [ %call.i47, %cond.true.i46 ], [ %conv3.i51, %cond.false.i49 ]
%15 = add i32 %cond.i48, -48
%16 = icmp ult i32 %15, 10
br i1 %16, label %while.body, label %while.end, !llvm.loop !17
while.end: ; preds = %getchar_unlocked.exit52, %getchar_unlocked.exit42
%n.0.lcssa = phi i32 [ 0, %getchar_unlocked.exit42 ], [ %add, %getchar_unlocked.exit52 ]
%sub = sub nsw i32 0, %n.0.lcssa
br label %cleanup
if.else: ; preds = %getchar_unlocked.exit
%17 = add i32 %cond.i, -58
%or.cond = icmp ult i32 %17, -10
br i1 %or.cond, label %cleanup, label %while.body14.preheader
while.body14.preheader: ; preds = %if.else
%.pre68 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body14
while.body14: ; preds = %while.body14.preheader, %getchar_unlocked.exit62
%18 = phi ptr [ %22, %getchar_unlocked.exit62 ], [ %.pre68, %while.body14.preheader ]
%c.164 = phi i32 [ %cond.i58, %getchar_unlocked.exit62 ], [ %cond.i, %while.body14.preheader ]
%n.163 = phi i32 [ %add17, %getchar_unlocked.exit62 ], [ 0, %while.body14.preheader ]
%mul15 = mul nsw i32 %n.163, 10
%and16 = and i32 %c.164, 15
%add17 = add nsw i32 %and16, %mul15
%_IO_read_ptr.i53 = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 1
%19 = load ptr, ptr %_IO_read_ptr.i53, align 8, !tbaa !9
%_IO_read_end.i54 = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 2
%20 = load ptr, ptr %_IO_read_end.i54, align 8, !tbaa !14
%cmp.not.i55 = icmp ult ptr %19, %20
br i1 %cmp.not.i55, label %cond.false.i59, label %cond.true.i56, !prof !15
cond.true.i56: ; preds = %while.body14
%call.i57 = tail call i32 @__uflow(ptr noundef nonnull %18) #7
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit62
cond.false.i59: ; preds = %while.body14
%incdec.ptr.i60 = getelementptr inbounds i8, ptr %19, i64 1
store ptr %incdec.ptr.i60, ptr %_IO_read_ptr.i53, align 8, !tbaa !9
%21 = load i8, ptr %19, align 1, !tbaa !16
%conv3.i61 = zext i8 %21 to i32
br label %getchar_unlocked.exit62
getchar_unlocked.exit62: ; preds = %cond.true.i56, %cond.false.i59
%22 = phi ptr [ %.pre, %cond.true.i56 ], [ %18, %cond.false.i59 ]
%cond.i58 = phi i32 [ %call.i57, %cond.true.i56 ], [ %conv3.i61, %cond.false.i59 ]
%23 = add i32 %cond.i58, -48
%24 = icmp ult i32 %23, 10
br i1 %24, label %while.body14, label %cleanup, !llvm.loop !19
cleanup: ; preds = %getchar_unlocked.exit62, %if.else, %while.end
%retval.0 = phi i32 [ %sub, %while.end ], [ %cond.i, %if.else ], [ %add17, %getchar_unlocked.exit62 ]
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: nounwind uwtable
define dso_local i32 @get_str(ptr nocapture noundef writeonly %str) local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %while.body, %entry
%str.addr.0 = phi ptr [ %str, %entry ], [ %incdec.ptr, %while.body ]
%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 = %while.cond
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #7
br label %getchar_unlocked.exit
cond.false.i: ; preds = %while.cond
%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 sgt i32 %cond.i, 32
br i1 %cmp, label %while.body, label %while.end
while.body: ; preds = %getchar_unlocked.exit
%conv = trunc i32 %cond.i to i8
%incdec.ptr = getelementptr inbounds i8, ptr %str.addr.0, i64 1
store i8 %conv, ptr %str.addr.0, align 1, !tbaa !16
br label %while.cond, !llvm.loop !20
while.end: ; preds = %getchar_unlocked.exit
store i8 0, ptr %str.addr.0, align 1, !tbaa !16
ret i32 %cond.i
}
; Function Attrs: nounwind uwtable
define dso_local void @put_int(i32 noundef %n) local_unnamed_addr #0 {
entry:
%buf = alloca [11 x i8], align 1
%tobool.not = icmp eq i32 %n, 0
br i1 %tobool.not, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5
%1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !21
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6
%2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !22
%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 = %if.then
%call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 48) #7
br label %return
cond.false.i: ; preds = %if.then
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !21
store i8 48, ptr %1, align 1, !tbaa !16
br label %return
if.end: ; preds = %entry
%cmp = icmp slt i32 %n, 0
br i1 %cmp, label %if.then1, label %if.end3
if.then1: ; preds = %if.end
%sub = sub nsw i32 0, %n
%3 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i20 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 5
%4 = load ptr, ptr %_IO_write_ptr.i20, align 8, !tbaa !21
%_IO_write_end.i21 = getelementptr inbounds %struct._IO_FILE, ptr %3, i64 0, i32 6
%5 = load ptr, ptr %_IO_write_end.i21, align 8, !tbaa !22
%cmp.not.i22 = icmp ult ptr %4, %5
br i1 %cmp.not.i22, label %cond.false.i26, label %cond.true.i23, !prof !15
cond.true.i23: ; preds = %if.then1
%call.i24 = tail call i32 @__overflow(ptr noundef nonnull %3, i32 noundef 45) #7
br label %if.end3
cond.false.i26: ; preds = %if.then1
%incdec.ptr.i27 = getelementptr inbounds i8, ptr %4, i64 1
store ptr %incdec.ptr.i27, ptr %_IO_write_ptr.i20, align 8, !tbaa !21
store i8 45, ptr %4, align 1, !tbaa !16
br label %if.end3
if.end3: ; preds = %cond.false.i26, %cond.true.i23, %if.end
%n.addr.0 = phi i32 [ %n, %if.end ], [ %sub, %cond.true.i23 ], [ %sub, %cond.false.i26 ]
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf) #7
br label %while.body
while.body: ; preds = %if.end3, %while.body
%indvars.iv42 = phi i32 [ 1, %if.end3 ], [ %indvars.iv.next43, %while.body ]
%indvars.iv = phi i64 [ 0, %if.end3 ], [ %indvars.iv.next, %while.body ]
%n.addr.138 = phi i32 [ %n.addr.0, %if.end3 ], [ %div, %while.body ]
%rem = srem i32 %n.addr.138, 10
%6 = trunc i32 %rem to i8
%conv = add nsw i8 %6, 48
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !16
%div = sdiv i32 %n.addr.138, 10
%n.addr.138.off = add i32 %n.addr.138, 9
%tobool4.not = icmp ult i32 %n.addr.138.off, 19
%indvars.iv.next43 = add nuw i32 %indvars.iv42, 1
br i1 %tobool4.not, label %while.body7.preheader, label %while.body, !llvm.loop !23
while.body7.preheader: ; preds = %while.body
%7 = sext i32 %indvars.iv42 to i64
br label %while.body7
while.body7: ; preds = %while.body7.preheader, %putchar_unlocked.exit37
%indvars.iv44 = phi i64 [ %7, %while.body7.preheader ], [ %indvars.iv.next45, %putchar_unlocked.exit37 ]
%indvars.iv.next45 = add nsw i64 %indvars.iv44, -1
%arrayidx9 = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv.next45
%8 = load i8, ptr %arrayidx9, align 1, !tbaa !16
%9 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i29 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 5
%10 = load ptr, ptr %_IO_write_ptr.i29, align 8, !tbaa !21
%_IO_write_end.i30 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 6
%11 = load ptr, ptr %_IO_write_end.i30, align 8, !tbaa !22
%cmp.not.i31 = icmp ult ptr %10, %11
br i1 %cmp.not.i31, label %cond.false.i35, label %cond.true.i32, !prof !15
cond.true.i32: ; preds = %while.body7
%conv10 = zext i8 %8 to i32
%call.i33 = tail call i32 @__overflow(ptr noundef nonnull %9, i32 noundef %conv10) #7
br label %putchar_unlocked.exit37
cond.false.i35: ; preds = %while.body7
%incdec.ptr.i36 = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i36, ptr %_IO_write_ptr.i29, align 8, !tbaa !21
store i8 %8, ptr %10, align 1, !tbaa !16
br label %putchar_unlocked.exit37
putchar_unlocked.exit37: ; preds = %cond.true.i32, %cond.false.i35
%12 = and i64 %indvars.iv.next45, 4294967295
%tobool6.not = icmp eq i64 %12, 0
br i1 %tobool6.not, label %while.end12, label %while.body7, !llvm.loop !24
while.end12: ; preds = %putchar_unlocked.exit37
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf) #7
br label %return
return: ; preds = %cond.false.i, %cond.true.i, %while.end12
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @bst_init(ptr nocapture noundef writeonly %BST) local_unnamed_addr #2 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %BST, i8 0, i64 16, i1 false)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @bst_insert(ptr nocapture noundef %BST, i32 noundef %key) local_unnamed_addr #3 {
entry:
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
store i32 %key, ptr %call, align 8, !tbaa !25
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false)
%root.036 = load ptr, ptr %BST, align 8, !tbaa !5
%cmp.not37 = icmp eq ptr %root.036, null
br i1 %cmp.not37, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%root.038 = phi ptr [ %root.0, %while.body ], [ %root.036, %entry ]
%0 = load i32, ptr %root.038, align 8, !tbaa !25
%cmp4 = icmp sgt i32 %0, %key
%left5 = getelementptr inbounds %struct.Node, ptr %root.038, i64 0, i32 1
%right6 = getelementptr inbounds %struct.Node, ptr %root.038, i64 0, i32 2
%root.1.in = select i1 %cmp4, ptr %left5, ptr %right6
%root.0 = load ptr, ptr %root.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %root.0, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !27
while.end: ; preds = %while.body, %entry
%tmp.0.lcssa = phi ptr [ undef, %entry ], [ %root.038, %while.body ]
%size = getelementptr inbounds %struct.BST, ptr %BST, i64 0, i32 1
%1 = load i64, ptr %size, align 8, !tbaa !28
%cmp7 = icmp eq i64 %1, 0
br i1 %cmp7, label %if.end18, label %if.else10
if.else10: ; preds = %while.end
%2 = load i32, ptr %tmp.0.lcssa, align 8, !tbaa !25
%cmp12 = icmp sgt i32 %2, %key
br i1 %cmp12, label %if.then13, label %if.else15
if.then13: ; preds = %if.else10
%left14 = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa, i64 0, i32 1
br label %if.end18
if.else15: ; preds = %if.else10
%right16 = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa, i64 0, i32 2
br label %if.end18
if.end18: ; preds = %while.end, %if.then13, %if.else15
%left14.sink = phi ptr [ %left14, %if.then13 ], [ %right16, %if.else15 ], [ %BST, %while.end ]
store ptr %call, ptr %left14.sink, align 8, !tbaa !5
%inc = add i64 %1, 1
store i64 %inc, ptr %size, align 8, !tbaa !28
ret void
}
; 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: nounwind uwtable
define dso_local void @bst_inorder(ptr noundef readonly %root) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %root, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %putchar_unlocked.exit
%root.tr5 = phi ptr [ %5, %putchar_unlocked.exit ], [ %root, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !30
tail call void @bst_inorder(ptr noundef %0)
%1 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %1, i64 0, i32 5
%2 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !21
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %1, i64 0, i32 6
%3 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !22
%cmp.not.i = icmp ult ptr %2, %3
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %if.end
%call.i = tail call i32 @__overflow(ptr noundef nonnull %1, i32 noundef 32) #7
br label %putchar_unlocked.exit
cond.false.i: ; preds = %if.end
%incdec.ptr.i = getelementptr inbounds i8, ptr %2, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !21
store i8 32, ptr %2, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%4 = load i32, ptr %root.tr5, align 8, !tbaa !25
tail call void @put_int(i32 noundef %4)
%right = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 2
%5 = load ptr, ptr %right, align 8, !tbaa !31
%cmp = icmp eq ptr %5, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %putchar_unlocked.exit, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @bst_preorder(ptr noundef readonly %root) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %root, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %putchar_unlocked.exit
%root.tr5 = phi ptr [ %5, %putchar_unlocked.exit ], [ %root, %entry ]
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5
%1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !21
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6
%2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !22
%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 = %if.end
%call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 32) #7
br label %putchar_unlocked.exit
cond.false.i: ; preds = %if.end
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !21
store i8 32, ptr %1, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%3 = load i32, ptr %root.tr5, align 8, !tbaa !25
tail call void @put_int(i32 noundef %3)
%left = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 1
%4 = load ptr, ptr %left, align 8, !tbaa !30
tail call void @bst_preorder(ptr noundef %4)
%right = getelementptr inbounds %struct.Node, ptr %root.tr5, i64 0, i32 2
%5 = load ptr, ptr %right, align 8, !tbaa !31
%cmp = icmp eq ptr %5, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %putchar_unlocked.exit, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%BST.sroa.0 = alloca ptr, align 8
%c = alloca [8 x i8], align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %BST.sroa.0)
store ptr null, ptr %BST.sroa.0, align 8
%call = tail call i32 @get_int()
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #7
%cmp24 = icmp sgt i32 %call, 0
br i1 %cmp24, label %while.cond.i.preheader, label %for.cond.cleanup
while.cond.i.preheader: ; preds = %entry, %for.inc
%i.026 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%BST.sroa.7.025 = phi i64 [ %BST.sroa.7.1, %for.inc ], [ 0, %entry ]
%.pre27 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.cond.i
for.cond.cleanup: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %BST.sroa.0)
ret i32 0
while.cond.i: ; preds = %while.cond.i.preheader, %while.body.i
%0 = phi ptr [ %4, %while.body.i ], [ %.pre27, %while.cond.i.preheader ]
%str.addr.0.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %c, %while.cond.i.preheader ]
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %while.cond.i
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #7
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i
cond.false.i.i: ; preds = %while.cond.i
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i.i = zext i8 %3 to i32
br label %getchar_unlocked.exit.i
getchar_unlocked.exit.i: ; preds = %cond.false.i.i, %cond.true.i.i
%4 = phi ptr [ %.pre, %cond.true.i.i ], [ %0, %cond.false.i.i ]
%cond.i.i = phi i32 [ %call.i.i, %cond.true.i.i ], [ %conv3.i.i, %cond.false.i.i ]
%cmp.i = icmp sgt i32 %cond.i.i, 32
br i1 %cmp.i, label %while.body.i, label %get_str.exit
while.body.i: ; preds = %getchar_unlocked.exit.i
%conv.i = trunc i32 %cond.i.i to i8
%incdec.ptr.i = getelementptr inbounds i8, ptr %str.addr.0.i, i64 1
store i8 %conv.i, ptr %str.addr.0.i, align 1, !tbaa !16
br label %while.cond.i, !llvm.loop !20
get_str.exit: ; preds = %getchar_unlocked.exit.i
store i8 0, ptr %str.addr.0.i, align 1, !tbaa !16
%5 = load i8, ptr %c, align 1, !tbaa !16
%cmp3 = icmp eq i8 %5, 105
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %get_str.exit
%call5 = tail call i32 @get_int()
%call.i = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
store i32 %call5, ptr %call.i, align 8, !tbaa !25
%left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left.i, i8 0, i64 16, i1 false)
%BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.root.036.i = load ptr, ptr %BST.sroa.0, align 8, !tbaa !5
%cmp.not37.i = icmp eq ptr %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.root.036.i, null
br i1 %cmp.not37.i, label %while.end.i, label %while.body.i10
while.body.i10: ; preds = %if.then, %while.body.i10
%root.038.i = phi ptr [ %root.0.i, %while.body.i10 ], [ %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.root.036.i, %if.then ]
%6 = load i32, ptr %root.038.i, align 8, !tbaa !25
%cmp4.i = icmp sgt i32 %6, %call5
%left5.i = getelementptr inbounds %struct.Node, ptr %root.038.i, i64 0, i32 1
%right6.i = getelementptr inbounds %struct.Node, ptr %root.038.i, i64 0, i32 2
%root.1.in.i = select i1 %cmp4.i, ptr %left5.i, ptr %right6.i
%root.0.i = load ptr, ptr %root.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %root.0.i, null
br i1 %cmp.not.i, label %while.end.i, label %while.body.i10, !llvm.loop !27
while.end.i: ; preds = %while.body.i10, %if.then
%tmp.0.lcssa.i = phi ptr [ undef, %if.then ], [ %root.038.i, %while.body.i10 ]
%cmp7.i = icmp eq i64 %BST.sroa.7.025, 0
br i1 %cmp7.i, label %bst_insert.exit, label %if.else10.i
if.else10.i: ; preds = %while.end.i
%7 = load i32, ptr %tmp.0.lcssa.i, align 8, !tbaa !25
%cmp12.i = icmp sgt i32 %7, %call5
br i1 %cmp12.i, label %if.then13.i, label %if.else15.i
if.then13.i: ; preds = %if.else10.i
%left14.i = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa.i, i64 0, i32 1
br label %bst_insert.exit
if.else15.i: ; preds = %if.else10.i
%right16.i = getelementptr inbounds %struct.Node, ptr %tmp.0.lcssa.i, i64 0, i32 2
br label %bst_insert.exit
bst_insert.exit: ; preds = %while.end.i, %if.then13.i, %if.else15.i
%left14.sink.i = phi ptr [ %left14.i, %if.then13.i ], [ %right16.i, %if.else15.i ], [ %BST.sroa.0, %while.end.i ]
store ptr %call.i, ptr %left14.sink.i, align 8, !tbaa !5
%inc.i = add i64 %BST.sroa.7.025, 1
br label %for.inc
if.else: ; preds = %get_str.exit
%BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0. = load ptr, ptr %BST.sroa.0, align 8, !tbaa !32
tail call void @bst_inorder(ptr noundef %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.)
%8 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 5
%9 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !21
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 6
%10 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !22
%cmp.not.i11 = icmp ult ptr %9, %10
br i1 %cmp.not.i11, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %if.else
%call.i12 = tail call i32 @__overflow(ptr noundef nonnull %8, i32 noundef 10) #7
br label %putchar_unlocked.exit
cond.false.i: ; preds = %if.else
%incdec.ptr.i13 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i13, ptr %_IO_write_ptr.i, align 8, !tbaa !21
store i8 10, ptr %9, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
tail call void @bst_preorder(ptr noundef %BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.BST.sroa.0.0.)
%11 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i14 = getelementptr inbounds %struct._IO_FILE, ptr %11, i64 0, i32 5
%12 = load ptr, ptr %_IO_write_ptr.i14, align 8, !tbaa !21
%_IO_write_end.i15 = getelementptr inbounds %struct._IO_FILE, ptr %11, i64 0, i32 6
%13 = load ptr, ptr %_IO_write_end.i15, align 8, !tbaa !22
%cmp.not.i16 = icmp ult ptr %12, %13
br i1 %cmp.not.i16, label %cond.false.i20, label %cond.true.i17, !prof !15
cond.true.i17: ; preds = %putchar_unlocked.exit
%call.i18 = tail call i32 @__overflow(ptr noundef nonnull %11, i32 noundef 10) #7
br label %for.inc
cond.false.i20: ; preds = %putchar_unlocked.exit
%incdec.ptr.i21 = getelementptr inbounds i8, ptr %12, i64 1
store ptr %incdec.ptr.i21, ptr %_IO_write_ptr.i14, align 8, !tbaa !21
store i8 10, ptr %12, align 1, !tbaa !16
br label %for.inc
for.inc: ; preds = %cond.false.i20, %cond.true.i17, %bst_insert.exit
%BST.sroa.7.1 = phi i64 [ %inc.i, %bst_insert.exit ], [ %BST.sroa.7.025, %cond.true.i17 ], [ %BST.sroa.7.025, %cond.false.i20 ]
%inc = add nuw nsw i32 %i.026, 1
%exitcond.not = icmp eq i32 %inc, %call
br i1 %exitcond.not, label %for.cond.cleanup, label %while.cond.i.preheader, !llvm.loop !33
}
declare i32 @__uflow(ptr noundef) local_unnamed_addr #5
declare i32 @__overflow(ptr noundef, i32 noundef) 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 = { "no-trapping-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: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!20, !18}
!21 = !{!10, !6, i64 40}
!22 = !{!10, !6, i64 48}
!23 = distinct !{!23, !18}
!24 = distinct !{!24, !18}
!25 = !{!26, !11, i64 0}
!26 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16}
!27 = distinct !{!27, !18}
!28 = !{!29, !12, i64 8}
!29 = !{!"BST", !6, i64 0, !12, i64 8}
!30 = !{!26, !6, i64 8}
!31 = !{!26, !6, i64 16}
!32 = !{!29, !6, i64 0}
!33 = distinct !{!33, !18}
|
#include<stdio.h>
#include<stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x){
}
Node treeSearch(Node u, int k){
}
Node treeSuccessor(Node x){
}
void treeDelete(Node z){
Node y; // node to be deleted
Node x; // child of y
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x!=NIL){
y=x;
if(z->key<x->key){
x=x->left;
}
else{
x=x->right;
}
}
z->parent=y;
if(y==NIL){
root=z;
}
else if(z->key<y->key){
y->left=z;
}
else{
y->right=z;
}
}
void inorder(Node u){
if (u->left != NIL){
inorder(u->left);
}
printf(" %d", u->key);
if (u->right != NIL){
inorder(u->right);
}
}
void preorder(Node u){
printf(" %d",u->key);
if (u->left != NIL){
preorder(u->left);
}
if (u->right != NIL){
preorder(u->right);
}
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212396/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212396/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSearch(ptr nocapture noundef readnone %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSuccessor(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #0 {
entry:
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr nocapture noundef readonly %u) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%u.tr = phi ptr [ %u, %entry ], [ %2, %if.end ]
%left = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @inorder(ptr noundef nonnull %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%key = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
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 void @preorder(ptr nocapture noundef readonly %u) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%u.tr = phi ptr [ %u, %entry ], [ %2, %if.end ]
%key = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
%cmp.not = icmp eq ptr %1, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %tailrecurse
tail call void @preorder(ptr noundef nonnull %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%2 = load ptr, ptr %u.tr, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %2, null
br i1 %cmp2.not, label %if.end5, label %tailrecurse
if.end5: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.041 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then16, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then23: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar39 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
for.inc: ; preds = %for.body, %if.then, %if.then23, %if.then31, %insert.exit
%inc = add nuw nsw i32 %i.041, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @putchar(i32 noundef) 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 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-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 allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
struct node
{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
Node root;
Node treeMinimum(Node x)
{
}
Node treeSearch(Node u, int k)
{
}
Node treeSuccessor(Node x)
{
}
void treeDelete(Node z)
{
Node y;
Node x;
}
void insert(int k)
{
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x!=NIL)
{
y=x;
if(z->key < x->key)
{
x=x->left;
}
else
{
x=x->right;
}
}
z->parent=y;
if(y==NIL)
{
root=z;
}
else if(z->key < y->key)
{
y->left=z;
}
else
{
y->right=z;
}
}
void inorder(Node x)
{
if(x!=NIL)
{
inorder(x->left);
printf(" %d", x->key);
inorder(x->right);
}
}
void preorder(Node x)
{
if(x!=NIL)
{
printf(" %d", x->key);
preorder(x->left);
preorder(x->right);
}
}
int main()
{
int n, i, x;
char com[20];
scanf("%d", &n);
root=NIL;
for ( i = 0; i < n; i++ )
{
scanf("%s", com);
if ( com[0] == 'f' )
{
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL )
{
printf("yes\n");
}
else
{
printf("no\n");
}
}
else if ( com[0] == 'i' )
{
scanf("%d", &x);
insert(x);
}
else if ( com[0] == 'p' )
{
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
else if ( com[0] == 'd' )
{
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212446/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212446/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMinimum(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSearch(ptr nocapture noundef readnone %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeSuccessor(ptr nocapture noundef readnone %x) local_unnamed_addr #0 {
entry:
ret ptr undef
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @treeDelete(ptr nocapture noundef readnone %z) local_unnamed_addr #0 {
entry:
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %x) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq ptr %x, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%x.tr5 = phi ptr [ %2, %if.then ], [ %x, %entry ]
%left = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %x.tr5, align 8, !tbaa !16
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
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 void @preorder(ptr noundef readonly %x) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq ptr %x, null
br i1 %cmp.not4, label %if.end, label %if.then
if.then: ; preds = %entry, %if.then
%x.tr5 = phi ptr [ %2, %if.then ], [ %x, %entry ]
%key = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %x.tr5, align 8, !tbaa !16
%cmp.not = icmp eq ptr %2, null
br i1 %cmp.not, label %if.end, label %if.then
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
store ptr null, ptr @root, align 8, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.041 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !18
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !17
%3 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then16, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then23: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %6)
%putchar39 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
br label %for.inc
for.inc: ; preds = %for.body, %if.then, %if.then23, %if.then31, %insert.exit
%inc = add nuw nsw i32 %i.041, 1
%7 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 @putchar(i32 noundef) 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 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-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 allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !13}
|
#include <stdio.h>
int gcd(int a,int b){
if(a<b){int swap=a;a=b;b=swap;}
if(a%b==0) return b;
else return gcd(b,a%b);
}
int main(){
int t;
scanf("%d",&t);
while(t--){
int k;
scanf("%d",&k);
if(k==0 || k==100) printf("1\n");
else{
int div=gcd(k,100-k);
printf("%d\n",100/div);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21249/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21249/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"1\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%a.tr = phi i32 [ %a, %entry ], [ %spec.select12, %tailrecurse ]
%b.tr = phi i32 [ %b, %entry ], [ %rem, %tailrecurse ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %a.tr, i32 %b.tr)
%spec.select12 = tail call i32 @llvm.smin.i32(i32 %a.tr, i32 %b.tr)
%rem = srem i32 %spec.select, %spec.select12
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %return, label %tailrecurse
return: ; preds = %tailrecurse
ret i32 %spec.select12
}
; 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:
%t = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec7 = add nsw i32 %0, -1
store i32 %dec7, ptr %t, align 4, !tbaa !5
%tobool.not8 = icmp eq i32 %0, 0
br i1 %tobool.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4
switch i32 %1, label %if.else [
i32 100, label %if.then
i32 0, label %if.then
]
if.then: ; preds = %while.body, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %while.body
%sub = sub nsw i32 100, %1
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %if.else
%a.tr.i = phi i32 [ %1, %if.else ], [ %spec.select12.i, %tailrecurse.i ]
%b.tr.i = phi i32 [ %sub, %if.else ], [ %rem.i, %tailrecurse.i ]
%spec.select.i = call i32 @llvm.smax.i32(i32 %a.tr.i, i32 %b.tr.i)
%spec.select12.i = call i32 @llvm.smin.i32(i32 %a.tr.i, i32 %b.tr.i)
%rem.i = srem i32 %spec.select.i, %spec.select12.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %gcd.exit, label %tailrecurse.i
gcd.exit: ; preds = %tailrecurse.i
%div5 = sdiv i32 100, %spec.select12.i
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div5)
br label %if.end
if.end: ; preds = %gcd.exit, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
%2 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int t,a,b,i,c,max,min,m,n,r;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&a);
b=100;
max=a>b?a:b;
min=a<b?a:b;
m=max;
n=min;
do{
r=max%min;
max=min;
min=r;
}while(r!=0);
printf("%d\n",b/max);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21254/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21254/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %do.end
%i.021 = phi i32 [ %inc, %do.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4
%cond = call i32 @llvm.smax.i32(i32 %1, i32 100)
%cond7 = call i32 @llvm.smin.i32(i32 %1, i32 100)
br label %do.body
do.body: ; preds = %do.body, %for.body
%min.0 = phi i32 [ %cond7, %for.body ], [ %rem, %do.body ]
%max.0 = phi i32 [ %cond, %for.body ], [ %min.0, %do.body ]
%rem = srem i32 %max.0, %min.0
%cmp8.not = icmp eq i32 %rem, 0
br i1 %cmp8.not, label %do.end, label %do.body, !llvm.loop !9
do.end: ; preds = %do.body
%div = sdiv i32 100, %min.0
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
%inc = add nuw nsw i32 %i.021, 1
%2 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %do.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
void inorder(Node x){
if(x==NIL) return;
inorder(x->left);
printf(" %d",x->key);
inorder(x->right);
}
void preorder(Node x){
if(x==NIL) return;
printf(" %d",x->key);
preorder(x->left);
preorder(x->right);
}
Node treeMinimum(Node x){
while(x->left!=NIL) x=x->left;
return x;
}
Node treeMaximum(Node x){
while(x->right!=NIL) x=x->right;
return x;
}
/* B
Node treeSearch(Node u, int k){
}*/
Node treeSuccessor(Node x){
if(x->right!=NIL) return treeMinimum(x->right);
Node y=x->parent;
while(y!=NIL && x==y->right){
x=y;
y=y->parent;
}
return y;
}
/*
void treeDelete(Node x){
Node y;
Node x;
}
*/
void insert(int k){
Node y=NIL;
Node x=root;
Node z;
z=malloc(sizeof(struct node));
z->key=k;
z->left=NIL;
z->right=NIL;
while(x!=NIL){
y=x;
if(z->key < x->key) x=x->left;
else x=x->right;
}
z->parent=y;
if(y==NIL) root=z;
else if(z->key < y->key) y->left=z;
else y->right=z;
}
int main(){
int n,i,x;
char com[20];
scanf("%d",&n); //n=命令の数//
for(i=0;i<n;i++){
scanf("%s",com);
/* Bにて
if(com[0]=='f'){
scanf("%d",&x);
Node t=treeSearch(root,x);
if(t!=NIL) printf("yes\n");
else printf("no\n");
}else */
if(com[0]=='i'){
scanf("%d",&x);
insert(x);
}else if(com[0]=='p'){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
/* Cにて
else if(com[0]=='d'){
scanf("%d",&x);
treeDelete(treeSearch(root,x));
}*/
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212590/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212590/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %x, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr5 = phi ptr [ %2, %if.end ], [ %x, %entry ]
%left = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %x.tr5, align 8, !tbaa !12
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %x, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%x.tr5 = phi ptr [ %2, %if.end ], [ %x, %entry ]
%key = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !11
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %x.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !5
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %x.tr5, align 8, !tbaa !12
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeMinimum(ptr noundef readonly %x) local_unnamed_addr #2 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%x.addr.0 = phi ptr [ %x, %entry ], [ %0, %while.cond ]
%left = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !13
while.end: ; preds = %while.cond
ret ptr %x.addr.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeMaximum(ptr noundef readonly %x) local_unnamed_addr #2 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%x.addr.0 = phi ptr [ %x, %entry ], [ %0, %while.cond ]
%0 = load ptr, ptr %x.addr.0, align 8, !tbaa !12
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !15
while.end: ; preds = %while.cond
ret ptr %x.addr.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSuccessor(ptr noundef readonly %x) local_unnamed_addr #2 {
entry:
%0 = load ptr, ptr %x, align 8, !tbaa !12
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.cond, label %while.cond.i
while.cond.i: ; preds = %entry, %while.cond.i
%x.addr.0.i = phi ptr [ %1, %while.cond.i ], [ %0, %entry ]
%left.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i, i64 0, i32 1
%1 = load ptr, ptr %left.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %1, null
br i1 %cmp.not.i, label %return, label %while.cond.i, !llvm.loop !13
while.cond: ; preds = %entry, %land.rhs
%x.addr.0 = phi ptr [ %y.0, %land.rhs ], [ %x, %entry ]
%y.0.in = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 2
%y.0 = load ptr, ptr %y.0.in, align 8, !tbaa !16
%cmp2.not = icmp eq ptr %y.0, null
br i1 %cmp2.not, label %return, label %land.rhs
land.rhs: ; preds = %while.cond
%2 = load ptr, ptr %y.0, align 8, !tbaa !12
%cmp4 = icmp eq ptr %x.addr.0, %2
br i1 %cmp4, label %while.cond, label %return, !llvm.loop !17
return: ; preds = %while.cond.i, %land.rhs, %while.cond
%retval.0 = phi ptr [ %y.0, %land.rhs ], [ null, %while.cond ], [ %x.addr.0.i, %while.cond.i ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !18
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !11
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !11
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !18
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !19
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !16
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !11
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !18
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !20
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !21
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !20
%3 = load ptr, ptr @root, align 8, !tbaa !18
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %2, ptr %key.i, align 8, !tbaa !11
%cmp.not34.i = icmp eq ptr %3, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %3, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%4 = load i32, ptr %key2.i, align 8, !tbaa !11
%cmp3.i = icmp sgt i32 %4, %2
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !18
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !19
insert.exit: ; preds = %while.body.i, %if.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !16
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !18
br label %for.inc
if.then9: ; preds = %for.body
%5 = load ptr, ptr @root, align 8, !tbaa !18
call void @inorder(ptr noundef %5)
%putchar = call i32 @putchar(i32 10)
%6 = load ptr, ptr @root, align 8, !tbaa !18
call void @preorder(ptr noundef %6)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.016, 1
%7 = load i32, ptr %n, align 4, !tbaa !20
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !22
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 = { nofree nounwind "no-trapping-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(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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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 8}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!6, !7, i64 16}
!17 = distinct !{!17, !14}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !14}
!20 = !{!10, !10, i64 0}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !14}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while(x != NIL){
y = x;
if((z->key) < (x->key)) {
x = x->left;
}else {
x = x->right;
}
}
z->parent = y;
if(y == NIL) {
root = z;
}else {
if((z->key) < (y->key)) {
y->left = z;
}else {
y->right = z;
}
}
}
void inorder(Node u){
if(u == NIL) return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(Node u){
if(u == NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if(strcmp(com,"insert") == 0) {
scanf("%d", &x);
insert(x);
} else if (strcmp(com,"print") == 0) {
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212640/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212640/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"print\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !9
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !12
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !14
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !14
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !17
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %com, ptr noundef nonnull dereferenceable(7) @.str.3, i64 7)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !17
%2 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
%key.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %1, ptr %key.i, align 8, !tbaa !9
%cmp.not34.i = icmp eq ptr %2, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %2, %if.then ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%3 = load i32, ptr %key2.i, align 8, !tbaa !9
%cmp3.i = icmp sgt i32 %3, %1
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i, label %insert.exit, label %while.body.i, !llvm.loop !12
insert.exit: ; preds = %while.body.i, %if.then
%.sink = phi ptr [ null, %if.then ], [ %x.035.i, %while.body.i ]
%left13.sink.i = phi ptr [ @root, %if.then ], [ %x.1.in.i, %while.body.i ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !14
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%bcmp14 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %com, ptr noundef nonnull dereferenceable(6) @.str.4, i64 6)
%cmp8 = icmp eq i32 %bcmp14, 0
br i1 %cmp8, label %if.then9, label %for.inc
if.then9: ; preds = %if.else
%4 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %4)
%putchar = call i32 @putchar(i32 10)
%5 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %5)
%putchar15 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %insert.exit, %if.then9, %if.else
%inc = add nuw nsw i32 %i.017, 1
%6 = load i32, ptr %n, align 4, !tbaa !17
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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 #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 = { 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 #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 willreturn memory(argmem: read) }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"node", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !13}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int key;
int left;
int right;
} Node;
void insert(Node*, int, int);
void print1(Node*, int);
void print2(Node*, int);
int main()
{
char s[10];
Node *t;
int m;
int a;
int i;
int cnt=0;
scanf("%d", &m);
t=(Node*)malloc(sizeof(Node)*m);
for(i=0; i<m; i++)
{
scanf("%s", &s);
if(s[0]=='i'){scanf("%d", &a);insert(t, cnt, a);cnt++;}
if(s[0]=='p')
{
if(cnt>0) print1(t, 0);
printf("\n");
if(cnt>0) print2(t, 0);
printf("\n");
}
}
return 0;
}
void print1(Node *t, int p)
{
if(t[p].left>=0)print1(t, t[p].left);
printf(" %d", t[p].key);
if(t[p].right>=0)print1(t, t[p].right);
}
void print2(Node *t, int p)
{
printf(" %d",t[p].key);
if(t[p].left>=0)print2(t,t[p].left);
if(t[p].right>=0)print2(t,t[p].right);
}
void insert(Node *t, int cnt, int z)
{
int x=0, y;
if(cnt<1) x=-1;
t[cnt].key = z;
t[cnt].left = -1;
t[cnt].right= -1;
while(x>=0){
y = x;
if(z < t[x].key)
x = t[x].left;
else
x = t[x].right;
}
if(cnt<1){}
else if(z < t[y].key)
{
t[y].left = cnt;
}
else {
t[y].right = cnt;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212691/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212691/source.c"
target datalayout = "e-m:e-p270: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
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = 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:
%s = alloca [10 x i8], align 1
%m = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = mul nsw i64 %conv, 12
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%cnt.034 = phi i32 [ %cnt.1, %for.inc ], [ 0, %entry ]
%i.033 = phi i32 [ %inc24, %for.inc ], [ 0, %entry ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%1 = load i8, ptr %s, align 1, !tbaa !9
%cmp5 = icmp eq i8 %1, 105
br i1 %cmp5, label %if.then, label %if.end
if.then: ; preds = %for.body
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp.i = icmp slt i32 %cnt.034, 1
%idxprom.i = sext i32 %cnt.034 to i64
%arrayidx.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom.i
store i32 %2, ptr %arrayidx.i, align 4, !tbaa !10
%left.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom.i, i32 1
store i32 -1, ptr %left.i, align 4, !tbaa !12
%right.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom.i, i32 2
store i32 -1, ptr %right.i, align 4, !tbaa !13
br i1 %cmp.i, label %insert.exit, label %while.body.i
while.body.i: ; preds = %if.then, %while.body.i
%x.158.i = phi i32 [ %x.2.i, %while.body.i ], [ 0, %if.then ]
%idxprom6.i = zext i32 %x.158.i to i64
%arrayidx7.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom6.i
%3 = load i32, ptr %arrayidx7.i, align 4, !tbaa !10
%cmp9.i = icmp sgt i32 %3, %2
%left13.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom6.i, i32 1
%right16.i = getelementptr inbounds %struct.Node, ptr %call1, i64 %idxprom6.i, i32 2
%x.2.in.i = select i1 %cmp9.i, ptr %left13.i, ptr %right16.i
%x.2.i = load i32, ptr %x.2.in.i, align 4, !tbaa !5
%cmp5.i = icmp sgt i32 %x.2.i, -1
br i1 %cmp5.i, label %while.body.i, label %while.end.i, !llvm.loop !14
while.end.i: ; preds = %while.body.i
store i32 %cnt.034, ptr %x.2.in.i, align 4, !tbaa !5
br label %insert.exit
insert.exit: ; preds = %if.then, %while.end.i
%inc = add nsw i32 %cnt.034, 1
%.pr = load i8, ptr %s, align 1, !tbaa !9
br label %if.end
if.end: ; preds = %insert.exit, %for.body
%4 = phi i8 [ %.pr, %insert.exit ], [ %1, %for.body ]
%cnt.1 = phi i32 [ %inc, %insert.exit ], [ %cnt.034, %for.body ]
%cmp10 = icmp eq i8 %4, 112
br i1 %cmp10, label %if.then12, label %for.inc
if.then12: ; preds = %if.end
%cmp13 = icmp sgt i32 %cnt.1, 0
br i1 %cmp13, label %if.then15, label %if.end21.critedge
if.then15: ; preds = %if.then12
call void @print1(ptr noundef %call1, i32 noundef 0)
%putchar = call i32 @putchar(i32 10)
call void @print2(ptr noundef %call1, i32 noundef 0)
br label %if.end21
if.end21.critedge: ; preds = %if.then12
%putchar.c = call i32 @putchar(i32 10)
br label %if.end21
if.end21: ; preds = %if.end21.critedge, %if.then15
%putchar31 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.end, %if.end21
%inc24 = add nuw nsw i32 %i.033, 1
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc24, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !16
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(ptr nocapture noundef %t, i32 noundef %cnt, i32 noundef %z) local_unnamed_addr #4 {
entry:
%cmp = icmp slt i32 %cnt, 1
%idxprom = sext i32 %cnt to i64
%arrayidx = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom
store i32 %z, ptr %arrayidx, align 4, !tbaa !10
%left = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom, i32 1
store i32 -1, ptr %left, align 4, !tbaa !12
%right = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom, i32 2
store i32 -1, ptr %right, align 4, !tbaa !13
br i1 %cmp, label %if.end34, label %while.body
while.body: ; preds = %entry, %while.body
%x.158 = phi i32 [ %x.2, %while.body ], [ 0, %entry ]
%idxprom6 = zext i32 %x.158 to i64
%arrayidx7 = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom6
%0 = load i32, ptr %arrayidx7, align 4, !tbaa !10
%cmp9 = icmp sgt i32 %0, %z
%left13 = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom6, i32 1
%right16 = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom6, i32 2
%x.2.in = select i1 %cmp9, ptr %left13, ptr %right16
%x.2 = load i32, ptr %x.2.in, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %x.2, -1
br i1 %cmp5, label %while.body, label %while.end, !llvm.loop !14
while.end: ; preds = %while.body
br i1 %cmp, label %if.end34, label %if.else20
if.else20: ; preds = %while.end
%1 = zext i32 %x.158 to i64
%arrayidx22 = getelementptr inbounds %struct.Node, ptr %t, i64 %1
%2 = load i32, ptr %arrayidx22, align 4, !tbaa !10
%cmp24 = icmp sgt i32 %2, %z
%left28 = getelementptr inbounds %struct.Node, ptr %t, i64 %1, i32 1
%right32 = getelementptr inbounds %struct.Node, ptr %t, i64 %1, i32 2
%left28.sink = select i1 %cmp24, ptr %left28, ptr %right32
store i32 %cnt, ptr %left28.sink, align 4, !tbaa !5
br label %if.end34
if.end34: ; preds = %if.else20, %entry, %while.end
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print1(ptr nocapture noundef readonly %t, i32 noundef %p) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%p.tr = phi i32 [ %p, %entry ], [ %2, %if.end ]
%idxprom = sext i32 %p.tr to i64
%arrayidx = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom
%left = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom, i32 1
%0 = load i32, ptr %left, align 4, !tbaa !12
%cmp = icmp sgt i32 %0, -1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %tailrecurse
tail call void @print1(ptr noundef nonnull %t, i32 noundef %0)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%1 = load i32, ptr %arrayidx, align 4, !tbaa !10
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%right = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !13
%cmp8 = icmp sgt i32 %2, -1
br i1 %cmp8, label %tailrecurse, label %if.end13
if.end13: ; preds = %if.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(ptr nocapture noundef readonly %t, i32 noundef %p) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end, %entry
%p.tr = phi i32 [ %p, %entry ], [ %2, %if.end ]
%idxprom = sext i32 %p.tr to i64
%arrayidx = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !10
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %0)
%left = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom, i32 1
%1 = load i32, ptr %left, align 4, !tbaa !12
%cmp = icmp sgt i32 %1, -1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %tailrecurse
tail call void @print2(ptr noundef nonnull %t, i32 noundef %1)
br label %if.end
if.end: ; preds = %if.then, %tailrecurse
%right = getelementptr inbounds %struct.Node, ptr %t, i64 %idxprom, i32 2
%2 = load i32, ptr %right, align 4, !tbaa !13
%cmp8 = icmp sgt i32 %2, -1
br i1 %cmp8, label %tailrecurse, label %if.end13
if.end13: ; preds = %if.end
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 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 0}
!11 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!12 = !{!11, !6, i64 4}
!13 = !{!11, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
int key;
struct Node *right,*left,*parent;
};
struct Node *root,*NIL;
struct Node * find(struct Node *u,int k){
while(u!=NIL&&k!=u->key){
if(k < u->key) u=u->left;
else u = u->right;
}
return u;
}
void insert(int k){
struct Node *y = NIL;
struct Node *x = root;
struct Node *z;
z = (struct Node *)malloc(sizeof(struct Node));
z->key = k;
z->left = NIL;
z->right =NIL;
while(x!=NIL){
y=x;
if(z->key < x->key){
x=x->left;
}
else x = x->right;
}
z->parent = y;
if(y==NIL){
root =z;
}
else{
if(z->key<y->key)
y->left=z;
else y->right = z;
}
}
void inorder(struct Node *u){
if(u==NIL)return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(struct Node *u){
if(u==NIL)return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n,i,x;
char com[20];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",com);
if(com[0]=='f'){
struct Node *t = find(root,x);
if(t==NIL)printf("no\n");
else printf("yes\n");
}
else if(com[0]=='i'){
scanf("%d",&x);
insert(x);
}
else if(com[0] == 'p'){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212734/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212734/source.c"
target datalayout = "e-m:e-p270: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 }
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"yes\00", align 1
@str.6 = private unnamed_addr constant [3 x i8] c"no\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @find(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10 = icmp eq ptr %0, %u
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ]
%1 = load i32, ptr %u.addr.011, align 8, !tbaa !9
%cmp1.not = icmp eq i32 %1, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %1, %k
%left = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 2
%right = getelementptr inbounds %struct.Node, ptr %u.addr.011, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %left, ptr %right
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %u.addr.1, %0
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !12
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ %u, %entry ], [ %0, %while.body ], [ %u.addr.011, %land.rhs ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%1 = load ptr, ptr @root, align 8, !tbaa !5
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !9
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %left, align 8, !tbaa !14
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %right, align 8, !tbaa !15
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %parent37, align 8, !tbaa !16
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp3 = icmp sgt i32 %2, %k
%left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !5
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !9
%cmp11 = icmp sgt i32 %3, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 void @preorder(ptr noundef readonly %u) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%1 = load i32, ptr %u.tr5, align 8, !tbaa !9
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @preorder(ptr noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.041 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !19
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then15
i8 112, label %if.then22
]
if.then: ; preds = %for.body
%2 = load ptr, ptr @root, align 8, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !18
%4 = load ptr, ptr @NIL, align 8, !tbaa !5
%cmp.not10.i = icmp eq ptr %4, %2
br i1 %cmp.not10.i, label %find.exit, label %land.rhs.i
land.rhs.i: ; preds = %if.then, %while.body.i
%u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i ], [ %2, %if.then ]
%5 = load i32, ptr %u.addr.011.i, align 8, !tbaa !9
%cmp1.not.i = icmp eq i32 %5, %3
br i1 %cmp1.not.i, label %find.exit, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp3.i = icmp sgt i32 %5, %3
%left.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 2
%right.i = getelementptr inbounds %struct.Node, ptr %u.addr.011.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %right.i
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %u.addr.1.i, %4
br i1 %cmp.not.i, label %if.then7, label %land.rhs.i, !llvm.loop !12
find.exit: ; preds = %land.rhs.i, %if.then
%u.addr.0.lcssa.i = phi ptr [ %2, %if.then ], [ %u.addr.011.i, %land.rhs.i ]
%cmp5 = icmp eq ptr %u.addr.0.lcssa.i, %4
br i1 %cmp5, label %if.then7, label %if.else
if.then7: ; preds = %while.body.i, %find.exit
%puts30 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %find.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then15: ; preds = %for.body
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%6 = load i32, ptr %x, align 4, !tbaa !18
%7 = load ptr, ptr @NIL, align 8, !tbaa !5
%8 = load ptr, ptr @root, align 8, !tbaa !5
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %6, ptr %call.i, align 8, !tbaa !9
%left.i31 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %7, ptr %left.i31, align 8, !tbaa !14
%right.i32 = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %7, ptr %right.i32, align 8, !tbaa !15
%cmp.not34.i = icmp eq ptr %8, %7
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i33
while.end.thread.i: ; preds = %if.then15
%parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %7, ptr %parent37.i, align 8, !tbaa !16
br label %insert.exit
while.body.i33: ; preds = %if.then15, %while.body.i33
%x.035.i = phi ptr [ %x.1.i, %while.body.i33 ], [ %8, %if.then15 ]
%9 = load i32, ptr %x.035.i, align 8, !tbaa !9
%cmp3.i34 = icmp sgt i32 %9, %6
%left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i34, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !5
%cmp.not.i35 = icmp eq ptr %x.1.i, %7
br i1 %cmp.not.i35, label %while.end.i, label %while.body.i33, !llvm.loop !17
while.end.i: ; preds = %while.body.i33
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !16
%cmp6.i = icmp eq ptr %x.035.i, %7
%spec.select38 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select38, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !5
br label %for.inc
if.then22: ; preds = %for.body
%10 = load ptr, ptr @root, align 8, !tbaa !5
call void @inorder(ptr noundef %10)
%putchar = call i32 @putchar(i32 10)
%11 = load ptr, ptr @root, align 8, !tbaa !5
call void @preorder(ptr noundef %11)
%putchar29 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %if.then7, %if.else, %if.then22, %insert.exit
%inc = add nuw nsw i32 %i.041, 1
%12 = load i32, ptr %n, align 4, !tbaa !18
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !20
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Node", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 24}
!17 = distinct !{!17, !13}
!18 = !{!11, !11, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !13}
|
#include<stdio.h>
#include<stdlib.h>
struct Node{
int key;
struct Node *right, *left, *parent;
};
struct Node *root , *NIL;
void insert(int);
void inorder(struct Node*);
void preorder(struct Node*);
int main(){
int n,i,x;
char c[10];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",c);
if(c[0]=='i'){
scanf("%d",&x);
insert(x);
}else if(c[0]=='p'){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}
return 0;
}
void insert(int k){
struct Node *y=NIL,*x=root,*z;
z=(struct Node *)malloc(sizeof(struct Node));
z->key=k;
z->left=NIL;
z->right=NIL;
while(x!=NIL){
y=x;
if(z->key<x->key){
x=x->left;
}else{
x=x->right;
}
}
z->parent=y;
if(y==NIL){
root=z;
}else{
if(z->key < y->key){
y->left=z;
}else{
y->right=z;
}
}
}
void inorder(struct Node *u){
if(u==NIL)return;
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
void preorder(struct Node *u){
if(u==NIL) return;
printf(" %d",u->key);
preorder(u->left);
preorder(u->right);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212778/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212778/source.c"
target datalayout = "e-m:e-p270: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 }
@.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
@root = dso_local local_unnamed_addr global ptr null, align 8
@NIL = dso_local local_unnamed_addr global ptr null, align 8
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%c = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %c) #5
%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
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%1 = load i8, ptr %c, align 1, !tbaa !9
switch i8 %1, label %for.inc [
i8 105, label %if.then
i8 112, label %if.then9
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = load ptr, ptr @NIL, align 8, !tbaa !10
%4 = load ptr, ptr @root, align 8, !tbaa !10
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %2, ptr %call.i, align 8, !tbaa !12
%left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 2
store ptr %3, ptr %left.i, align 8, !tbaa !14
%right.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
store ptr %3, ptr %right.i, align 8, !tbaa !15
%cmp.not34.i = icmp eq ptr %4, %3
br i1 %cmp.not34.i, label %while.end.thread.i, label %while.body.i
while.end.thread.i: ; preds = %if.then
%parent37.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %3, ptr %parent37.i, align 8, !tbaa !16
br label %insert.exit
while.body.i: ; preds = %if.then, %while.body.i
%x.035.i = phi ptr [ %x.1.i, %while.body.i ], [ %4, %if.then ]
%5 = load i32, ptr %x.035.i, align 8, !tbaa !12
%cmp3.i = icmp sgt i32 %5, %2
%left4.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 2
%right5.i = getelementptr inbounds %struct.Node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i, ptr %left4.i, ptr %right5.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !10
%cmp.not.i = icmp eq ptr %x.1.i, %3
br i1 %cmp.not.i, label %while.end.i, label %while.body.i, !llvm.loop !17
while.end.i: ; preds = %while.body.i
%parent.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 3
store ptr %x.035.i, ptr %parent.i, align 8, !tbaa !16
%cmp6.i = icmp eq ptr %x.035.i, %3
%spec.select15 = select i1 %cmp6.i, ptr @root, ptr %x.1.in.i
br label %insert.exit
insert.exit: ; preds = %while.end.i, %while.end.thread.i
%left13.sink.i = phi ptr [ @root, %while.end.thread.i ], [ %spec.select15, %while.end.i ]
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !10
br label %for.inc
if.then9: ; preds = %for.body
%6 = load ptr, ptr @root, align 8, !tbaa !10
call void @inorder(ptr noundef %6)
%putchar = call i32 @putchar(i32 10)
%7 = load ptr, ptr @root, align 8, !tbaa !10
call void @preorder(ptr noundef %7)
%putchar14 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %for.body, %insert.exit, %if.then9
%inc = add nuw nsw i32 %i.017, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !19
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !10
%1 = load ptr, ptr @root, align 8, !tbaa !10
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #6
store i32 %k, ptr %call, align 8, !tbaa !12
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 2
store ptr %0, ptr %left, align 8, !tbaa !14
%right = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
store ptr %0, ptr %right, align 8, !tbaa !15
%cmp.not34 = icmp eq ptr %1, %0
br i1 %cmp.not34, label %while.end.thread, label %while.body
while.end.thread: ; preds = %entry
%parent37 = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %0, ptr %parent37, align 8, !tbaa !16
br label %if.end17
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %1, %entry ]
%2 = load i32, ptr %x.035, align 8, !tbaa !12
%cmp3 = icmp sgt i32 %2, %k
%left4 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
%right5 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %right5
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !10
%cmp.not = icmp eq ptr %x.1, %0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !17
while.end: ; preds = %while.body
%parent = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 3
store ptr %x.035, ptr %parent, align 8, !tbaa !16
%cmp6 = icmp eq ptr %x.035, %0
br i1 %cmp6, label %if.end17, label %if.else8
if.else8: ; preds = %while.end
%3 = load i32, ptr %x.035, align 8, !tbaa !12
%cmp11 = icmp sgt i32 %3, %k
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%left13 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 2
br label %if.end17
if.else14: ; preds = %if.else8
%right15 = getelementptr inbounds %struct.Node, ptr %x.035, i64 0, i32 1
br label %if.end17
if.end17: ; preds = %while.end, %while.end.thread, %if.then12, %if.else14
%left13.sink = phi ptr [ %left13, %if.then12 ], [ %right15, %if.else14 ], [ @root, %while.end.thread ], [ @root, %while.end ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !10
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !10
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%1 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @inorder(ptr noundef %1)
%2 = load i32, ptr %u.tr5, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !10
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @NIL, align 8, !tbaa !10
%cmp4 = icmp eq ptr %0, %u
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %3, %if.end ], [ %u, %entry ]
%1 = load i32, ptr %u.tr5, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %1)
%left = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 2
%2 = load ptr, ptr %left, align 8, !tbaa !14
tail call void @preorder(ptr noundef %2)
%right = getelementptr inbounds %struct.Node, ptr %u.tr5, i64 0, i32 1
%3 = load ptr, ptr %right, align 8, !tbaa !15
%4 = load ptr, ptr @NIL, align 8, !tbaa !10
%cmp = icmp eq ptr %4, %3
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"Node", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!14 = !{!13, !11, i64 16}
!15 = !{!13, !11, i64 8}
!16 = !{!13, !11, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
|
#include <stdio.h>
#include <stdlib.h>
struct node{
struct node *right;
struct node *left;
struct node *parent;
int key;
};
typedef struct node * Node;
#define NIL NULL
Node root;
Node treeMinimum(Node x){
while( x->left != NIL){
x = x->left;
}
return x;
}
Node treeMaximum(Node x){
}
Node treeSearch(Node u, int k){
while( u != NIL && k != u->key ){
if (k < u->key ) u = u->left;
else u = u->right;
}
return u;
}
Node treeSuccessor(Node x){
if( x->right != NIL){
return treeMinimum(x->right);
}
Node y = x->parent;
while( y != NIL && x == y->right ){
x = y;
y = y->parent;
}
return y;
}
void treeDelete(Node z){
Node y; // node to be deleted
Node x; // child of y
if( z->left == NIL || z->right == NIL) y = z;
else y = treeSuccessor(z);
if( y->left != NIL){
x = y->left;
}
else x = y->right;
if(x != NIL ){
x->parent = y->parent;
}
if( y->parent == NIL ){
root = x;
}
else {
if(y == y->parent->left){
y->parent->left = x;
} else {
y->parent->right = x;
}
}
if( y != z ){
z->key = y->key;
}
free(y);
}
void insert(int k){
Node y = NIL;
Node x = root;
Node z;
z = (Node)malloc(sizeof(struct node));
z->key = k;
z->left = NIL;
z->right = NIL;
while ( x != NIL ){
y = x;
if ( z->key < x->key ){
x = x->left;
} else {
x = x->right;
}
}
z->parent = y;
if ( y == NIL ){
root = z;
} else {
if ( z->key < y->key ){
y->left = z;
}else {
y->right = z;
}
}
}
void inorder(Node u){
if (u == NIL) return;
inorder(u->left);
printf(" %d", u->key);
inorder(u->right);
}
void preorder(Node u){
if( u == NIL ) return;
printf(" %d", u->key);
preorder(u->left);
preorder(u->right);
}
int main(){
int n, i, x;
char com[20];
scanf("%d", &n);
for ( i = 0; i < n; i++ ){
scanf("%s", com);
if ( com[0] == 'f' ){
scanf("%d", &x);
Node t = treeSearch(root, x);
if ( t != NIL ) printf("yes\n");
else printf("no\n");
} else if ( com[0] == 'i' ){
scanf("%d", &x);
insert(x);
} else if ( com[0] == 'p' ){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
} else if ( com[0] == 'd' ){
scanf("%d", &x);
treeDelete(treeSearch(root, x));
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212828/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212828/source.c"
target datalayout = "e-m:e-p270: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 { ptr, ptr, ptr, i32 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeMinimum(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%x.addr.0 = phi ptr [ %x, %entry ], [ %0, %while.cond ]
%left = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !11
while.end: ; preds = %while.cond
ret ptr %x.addr.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noalias ptr @treeMaximum(ptr nocapture noundef readnone %x) local_unnamed_addr #1 {
entry:
ret ptr undef
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSearch(ptr noundef readonly %u, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp.not10 = icmp eq ptr %u, null
br i1 %cmp.not10, label %while.end, label %land.rhs
land.rhs: ; preds = %entry, %while.body
%u.addr.011 = phi ptr [ %u.addr.1, %while.body ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.addr.011, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !13
%cmp1.not = icmp eq i32 %0, %k
br i1 %cmp1.not, label %while.end, label %while.body
while.body: ; preds = %land.rhs
%cmp3 = icmp sgt i32 %0, %k
%left = getelementptr inbounds %struct.node, ptr %u.addr.011, i64 0, i32 1
%u.addr.1.in = select i1 %cmp3, ptr %left, ptr %u.addr.011
%u.addr.1 = load ptr, ptr %u.addr.1.in, align 8, !tbaa !14
%cmp.not = icmp eq ptr %u.addr.1, null
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !15
while.end: ; preds = %land.rhs, %while.body, %entry
%u.addr.0.lcssa = phi ptr [ null, %entry ], [ null, %while.body ], [ %u.addr.011, %land.rhs ]
ret ptr %u.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @treeSuccessor(ptr noundef readonly %x) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr %x, align 8, !tbaa !16
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.cond, label %while.cond.i
while.cond.i: ; preds = %entry, %while.cond.i
%x.addr.0.i = phi ptr [ %1, %while.cond.i ], [ %0, %entry ]
%left.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i, i64 0, i32 1
%1 = load ptr, ptr %left.i, align 8, !tbaa !5
%cmp.not.i = icmp eq ptr %1, null
br i1 %cmp.not.i, label %return, label %while.cond.i, !llvm.loop !11
while.cond: ; preds = %entry, %land.rhs
%x.addr.0 = phi ptr [ %y.0, %land.rhs ], [ %x, %entry ]
%y.0.in = getelementptr inbounds %struct.node, ptr %x.addr.0, i64 0, i32 2
%y.0 = load ptr, ptr %y.0.in, align 8, !tbaa !17
%cmp2.not = icmp eq ptr %y.0, null
br i1 %cmp2.not, label %return, label %land.rhs
land.rhs: ; preds = %while.cond
%2 = load ptr, ptr %y.0, align 8, !tbaa !16
%cmp4 = icmp eq ptr %x.addr.0, %2
br i1 %cmp4, label %while.cond, label %return, !llvm.loop !18
return: ; preds = %while.cond.i, %land.rhs, %while.cond
%retval.0 = phi ptr [ %y.0, %land.rhs ], [ null, %while.cond ], [ %x.addr.0.i, %while.cond.i ]
ret ptr %retval.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nounwind uwtable
define dso_local void @treeDelete(ptr noundef %z) local_unnamed_addr #3 {
entry:
%left = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %if.end8, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%1 = load ptr, ptr %z, align 8, !tbaa !16
%cmp1 = icmp eq ptr %1, null
br i1 %cmp1, label %if.then10, label %while.cond.i.i
while.cond.i.i: ; preds = %lor.lhs.false, %while.cond.i.i
%x.addr.0.i.i = phi ptr [ %2, %while.cond.i.i ], [ %1, %lor.lhs.false ]
%left.i.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i.i, i64 0, i32 1
%2 = load ptr, ptr %left.i.i, align 8, !tbaa !5
%cmp.not.i.i = icmp eq ptr %2, null
br i1 %cmp.not.i.i, label %if.end8, label %while.cond.i.i, !llvm.loop !11
if.end8: ; preds = %while.cond.i.i, %entry
%y.0.ph = phi ptr [ %z, %entry ], [ %x.addr.0.i.i, %while.cond.i.i ]
%3 = load ptr, ptr %y.0.ph, align 8, !tbaa !16
%cmp9.not = icmp eq ptr %3, null
br i1 %cmp9.not, label %if.end12, label %if.then10
if.then10: ; preds = %lor.lhs.false, %if.end8
%y.059 = phi ptr [ %y.0.ph, %if.end8 ], [ %z, %lor.lhs.false ]
%x.055 = phi ptr [ %3, %if.end8 ], [ %0, %lor.lhs.false ]
%parent = getelementptr inbounds %struct.node, ptr %y.059, i64 0, i32 2
%4 = load ptr, ptr %parent, align 8, !tbaa !17
%parent11 = getelementptr inbounds %struct.node, ptr %x.055, i64 0, i32 2
store ptr %4, ptr %parent11, align 8, !tbaa !17
br label %if.end12
if.end12: ; preds = %if.then10, %if.end8
%y.061 = phi ptr [ %y.059, %if.then10 ], [ %y.0.ph, %if.end8 ]
%x.056 = phi ptr [ %x.055, %if.then10 ], [ null, %if.end8 ]
%parent13 = getelementptr inbounds %struct.node, ptr %y.061, i64 0, i32 2
%5 = load ptr, ptr %parent13, align 8, !tbaa !17
%cmp14 = icmp eq ptr %5, null
br i1 %cmp14, label %if.end27, label %if.else16
if.else16: ; preds = %if.end12
%left18 = getelementptr inbounds %struct.node, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %left18, align 8, !tbaa !5
%cmp19 = icmp eq ptr %y.061, %6
%left18. = select i1 %cmp19, ptr %left18, ptr %5
br label %if.end27
if.end27: ; preds = %if.else16, %if.end12
%left18.sink = phi ptr [ @root, %if.end12 ], [ %left18., %if.else16 ]
store ptr %x.056, ptr %left18.sink, align 8, !tbaa !14
%cmp28.not = icmp eq ptr %y.061, %z
br i1 %cmp28.not, label %if.end31, label %if.then29
if.then29: ; preds = %if.end27
%key = getelementptr inbounds %struct.node, ptr %y.061, i64 0, i32 3
%7 = load i32, ptr %key, align 8, !tbaa !13
%key30 = getelementptr inbounds %struct.node, ptr %z, i64 0, i32 3
store i32 %7, ptr %key30, align 8, !tbaa !13
br label %if.end31
if.end31: ; preds = %if.then29, %if.end27
tail call void @free(ptr noundef nonnull %y.061) #10
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @insert(i32 noundef %k) local_unnamed_addr #5 {
entry:
%0 = load ptr, ptr @root, align 8, !tbaa !14
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #11
%key = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 3
store i32 %k, ptr %key, align 8, !tbaa !13
%cmp.not34 = icmp eq ptr %0, null
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call, i8 0, i64 16, i1 false)
br i1 %cmp.not34, label %if.then7, label %while.body
while.body: ; preds = %entry, %while.body
%x.035 = phi ptr [ %x.1, %while.body ], [ %0, %entry ]
%key2 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%1 = load i32, ptr %key2, align 8, !tbaa !13
%cmp3 = icmp sgt i32 %1, %k
%left4 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%x.1.in = select i1 %cmp3, ptr %left4, ptr %x.035
%x.1 = load ptr, ptr %x.1.in, align 8, !tbaa !14
%cmp.not = icmp eq ptr %x.1, null
br i1 %cmp.not, label %if.else8, label %while.body, !llvm.loop !19
if.then7: ; preds = %entry
%parent37 = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr null, ptr %parent37, align 8, !tbaa !17
br label %if.end17
if.else8: ; preds = %while.body
%parent = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 2
store ptr %x.035, ptr %parent, align 8, !tbaa !17
%key10 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 3
%2 = load i32, ptr %key10, align 8, !tbaa !13
%cmp11 = icmp sgt i32 %2, %k
%left13 = getelementptr inbounds %struct.node, ptr %x.035, i64 0, i32 1
%spec.select = select i1 %cmp11, ptr %left13, ptr %x.035
br label %if.end17
if.end17: ; preds = %if.else8, %if.then7
%left13.sink = phi ptr [ @root, %if.then7 ], [ %spec.select, %if.else8 ]
store ptr %call, ptr %left13.sink, align 8, !tbaa !14
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind uwtable
define dso_local void @inorder(ptr noundef readonly %u) local_unnamed_addr #5 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !5
tail call void @inorder(ptr noundef %0)
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%1 = load i32, ptr %key, align 8, !tbaa !13
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local void @preorder(ptr noundef readonly %u) local_unnamed_addr #5 {
entry:
%cmp4 = icmp eq ptr %u, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%u.tr5 = phi ptr [ %2, %if.end ], [ %u, %entry ]
%key = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 3
%0 = load i32, ptr %key, align 8, !tbaa !13
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%left = getelementptr inbounds %struct.node, ptr %u.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !5
tail call void @preorder(ptr noundef %1)
%2 = load ptr, ptr %u.tr5, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%com = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #10
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %com) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !20
%cmp63 = icmp sgt i32 %0, 0
br i1 %cmp63, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.064 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %com)
%1 = load i8, ptr %com, align 16, !tbaa !21
switch i8 %1, label %for.inc [
i8 102, label %if.then
i8 105, label %if.then16
i8 112, label %if.then23
i8 100, label %if.then31
]
if.then: ; preds = %for.body
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load ptr, ptr @root, align 8, !tbaa !14
%3 = load i32, ptr %x, align 4, !tbaa !20
%cmp.not10.i = icmp eq ptr %2, null
br i1 %cmp.not10.i, label %if.else, label %land.rhs.i
land.rhs.i: ; preds = %if.then, %while.body.i
%u.addr.011.i = phi ptr [ %u.addr.1.i, %while.body.i ], [ %2, %if.then ]
%key.i = getelementptr inbounds %struct.node, ptr %u.addr.011.i, i64 0, i32 3
%4 = load i32, ptr %key.i, align 8, !tbaa !13
%cmp1.not.i = icmp eq i32 %4, %3
br i1 %cmp1.not.i, label %if.then8, label %while.body.i
while.body.i: ; preds = %land.rhs.i
%cmp3.i = icmp sgt i32 %4, %3
%left.i = getelementptr inbounds %struct.node, ptr %u.addr.011.i, i64 0, i32 1
%u.addr.1.in.i = select i1 %cmp3.i, ptr %left.i, ptr %u.addr.011.i
%u.addr.1.i = load ptr, ptr %u.addr.1.in.i, align 8, !tbaa !14
%cmp.not.i = icmp eq ptr %u.addr.1.i, null
br i1 %cmp.not.i, label %if.else, label %land.rhs.i, !llvm.loop !15
if.then8: ; preds = %land.rhs.i
%puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else: ; preds = %while.body.i, %if.then
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc
if.then16: ; preds = %for.body
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%5 = load i32, ptr %x, align 4, !tbaa !20
%6 = load ptr, ptr @root, align 8, !tbaa !14
%call.i = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #11
%key.i41 = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 3
store i32 %5, ptr %key.i41, align 8, !tbaa !13
%cmp.not34.i = icmp eq ptr %6, null
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %call.i, i8 0, i64 16, i1 false)
br i1 %cmp.not34.i, label %insert.exit, label %while.body.i42
while.body.i42: ; preds = %if.then16, %while.body.i42
%x.035.i = phi ptr [ %x.1.i, %while.body.i42 ], [ %6, %if.then16 ]
%key2.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 3
%7 = load i32, ptr %key2.i, align 8, !tbaa !13
%cmp3.i43 = icmp sgt i32 %7, %5
%left4.i = getelementptr inbounds %struct.node, ptr %x.035.i, i64 0, i32 1
%x.1.in.i = select i1 %cmp3.i43, ptr %left4.i, ptr %x.035.i
%x.1.i = load ptr, ptr %x.1.in.i, align 8, !tbaa !14
%cmp.not.i44 = icmp eq ptr %x.1.i, null
br i1 %cmp.not.i44, label %insert.exit, label %while.body.i42, !llvm.loop !19
insert.exit: ; preds = %while.body.i42, %if.then16
%.sink = phi ptr [ null, %if.then16 ], [ %x.035.i, %while.body.i42 ]
%left13.sink.i = phi ptr [ @root, %if.then16 ], [ %x.1.in.i, %while.body.i42 ]
%parent37.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 2
store ptr %.sink, ptr %parent37.i, align 8, !tbaa !17
store ptr %call.i, ptr %left13.sink.i, align 8, !tbaa !14
br label %for.inc
if.then23: ; preds = %for.body
%8 = load ptr, ptr @root, align 8, !tbaa !14
call void @inorder(ptr noundef %8)
%putchar = call i32 @putchar(i32 10)
%9 = load ptr, ptr @root, align 8, !tbaa !14
call void @preorder(ptr noundef %9)
%putchar39 = call i32 @putchar(i32 10)
br label %for.inc
if.then31: ; preds = %for.body
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%10 = load ptr, ptr @root, align 8, !tbaa !14
%11 = load i32, ptr %x, align 4, !tbaa !20
%cmp.not10.i45 = icmp eq ptr %10, null
br i1 %cmp.not10.i45, label %treeSearch.exit57, label %land.rhs.i46
land.rhs.i46: ; preds = %if.then31, %while.body.i50
%u.addr.011.i47 = phi ptr [ %u.addr.1.i54, %while.body.i50 ], [ %10, %if.then31 ]
%key.i48 = getelementptr inbounds %struct.node, ptr %u.addr.011.i47, i64 0, i32 3
%12 = load i32, ptr %key.i48, align 8, !tbaa !13
%cmp1.not.i49 = icmp eq i32 %12, %11
br i1 %cmp1.not.i49, label %treeSearch.exit57, label %while.body.i50
while.body.i50: ; preds = %land.rhs.i46
%cmp3.i51 = icmp sgt i32 %12, %11
%left.i52 = getelementptr inbounds %struct.node, ptr %u.addr.011.i47, i64 0, i32 1
%u.addr.1.in.i53 = select i1 %cmp3.i51, ptr %left.i52, ptr %u.addr.011.i47
%u.addr.1.i54 = load ptr, ptr %u.addr.1.in.i53, align 8, !tbaa !14
%cmp.not.i55 = icmp eq ptr %u.addr.1.i54, null
br i1 %cmp.not.i55, label %treeSearch.exit57, label %land.rhs.i46, !llvm.loop !15
treeSearch.exit57: ; preds = %land.rhs.i46, %while.body.i50, %if.then31
%u.addr.0.lcssa.i56 = phi ptr [ null, %if.then31 ], [ %u.addr.011.i47, %land.rhs.i46 ], [ null, %while.body.i50 ]
%left.i58 = getelementptr inbounds %struct.node, ptr %u.addr.0.lcssa.i56, i64 0, i32 1
%13 = load ptr, ptr %left.i58, align 8, !tbaa !5
%cmp.i = icmp eq ptr %13, null
br i1 %cmp.i, label %if.end8.i, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %treeSearch.exit57
%14 = load ptr, ptr %u.addr.0.lcssa.i56, align 8, !tbaa !16
%cmp1.i = icmp eq ptr %14, null
br i1 %cmp1.i, label %if.then10.i, label %while.cond.i.i.i
while.cond.i.i.i: ; preds = %lor.lhs.false.i, %while.cond.i.i.i
%x.addr.0.i.i.i = phi ptr [ %15, %while.cond.i.i.i ], [ %14, %lor.lhs.false.i ]
%left.i.i.i = getelementptr inbounds %struct.node, ptr %x.addr.0.i.i.i, i64 0, i32 1
%15 = load ptr, ptr %left.i.i.i, align 8, !tbaa !5
%cmp.not.i.i.i = icmp eq ptr %15, null
br i1 %cmp.not.i.i.i, label %if.end8.i, label %while.cond.i.i.i, !llvm.loop !11
if.end8.i: ; preds = %while.cond.i.i.i, %treeSearch.exit57
%y.0.ph.i = phi ptr [ %u.addr.0.lcssa.i56, %treeSearch.exit57 ], [ %x.addr.0.i.i.i, %while.cond.i.i.i ]
%16 = load ptr, ptr %y.0.ph.i, align 8, !tbaa !16
%cmp9.not.i = icmp eq ptr %16, null
br i1 %cmp9.not.i, label %if.end12.i, label %if.then10.i
if.then10.i: ; preds = %if.end8.i, %lor.lhs.false.i
%y.059.i = phi ptr [ %y.0.ph.i, %if.end8.i ], [ %u.addr.0.lcssa.i56, %lor.lhs.false.i ]
%x.055.i = phi ptr [ %16, %if.end8.i ], [ %13, %lor.lhs.false.i ]
%parent.i59 = getelementptr inbounds %struct.node, ptr %y.059.i, i64 0, i32 2
%17 = load ptr, ptr %parent.i59, align 8, !tbaa !17
%parent11.i = getelementptr inbounds %struct.node, ptr %x.055.i, i64 0, i32 2
store ptr %17, ptr %parent11.i, align 8, !tbaa !17
br label %if.end12.i
if.end12.i: ; preds = %if.then10.i, %if.end8.i
%y.061.i = phi ptr [ %y.059.i, %if.then10.i ], [ %y.0.ph.i, %if.end8.i ]
%x.056.i = phi ptr [ %x.055.i, %if.then10.i ], [ null, %if.end8.i ]
%parent13.i = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 2
%18 = load ptr, ptr %parent13.i, align 8, !tbaa !17
%cmp14.i = icmp eq ptr %18, null
br i1 %cmp14.i, label %if.end27.i, label %if.else16.i
if.else16.i: ; preds = %if.end12.i
%left18.i = getelementptr inbounds %struct.node, ptr %18, i64 0, i32 1
%19 = load ptr, ptr %left18.i, align 8, !tbaa !5
%cmp19.i = icmp eq ptr %y.061.i, %19
%left18..i = select i1 %cmp19.i, ptr %left18.i, ptr %18
br label %if.end27.i
if.end27.i: ; preds = %if.else16.i, %if.end12.i
%left18.sink.i = phi ptr [ @root, %if.end12.i ], [ %left18..i, %if.else16.i ]
store ptr %x.056.i, ptr %left18.sink.i, align 8, !tbaa !14
%cmp28.not.i = icmp eq ptr %y.061.i, %u.addr.0.lcssa.i56
br i1 %cmp28.not.i, label %treeDelete.exit, label %if.then29.i
if.then29.i: ; preds = %if.end27.i
%key.i60 = getelementptr inbounds %struct.node, ptr %y.061.i, i64 0, i32 3
%20 = load i32, ptr %key.i60, align 8, !tbaa !13
%key30.i = getelementptr inbounds %struct.node, ptr %u.addr.0.lcssa.i56, i64 0, i32 3
store i32 %20, ptr %key30.i, align 8, !tbaa !13
br label %treeDelete.exit
treeDelete.exit: ; preds = %if.end27.i, %if.then29.i
call void @free(ptr noundef nonnull %y.061.i) #10
br label %for.inc
for.inc: ; preds = %for.body, %if.then8, %if.else, %if.then23, %treeDelete.exit, %insert.exit
%inc = add nuw nsw i32 %i.064, 1
%21 = load i32, ptr %n, align 4, !tbaa !20
%cmp = icmp slt i32 %inc, %21
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !22
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %com) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 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 #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind }
attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nounwind }
attributes #11 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"node", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !10, i64 24}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !7, i64 16}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!10, !10, i64 0}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !12}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 500000
#define DUMMY 2000000001
struct Node{
int key;
struct Node *left,*right;
};
struct Node *make_node(int x){
struct Node *node = malloc(sizeof(struct Node));
if(node != NULL){
node->key = x;
node->left = NULL;
node->right = NULL;
}
return node;
}
struct Node *root;
struct Node *insert(int,struct Node*);
void insort(struct Node*);
void presort(struct Node*);
int main(void){
int m,n=0;
int i;
int k;
char order[7];
root = NULL;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%s",order);
if(strcmp(order,"insert") == 0){
scanf("%d",&k);
root = insert(k,root);
}else if(strcmp(order,"print") == 0){
insort(root);
printf("\n");
presort(root);
printf("\n");
}
}
}
struct Node *insert(int key,struct Node *node){
if (node == NULL)
return make_node(key);
else if (key < node->key)
node->left = insert(key, node->left);
else if (key > node->key)
node->right = insert(key, node->right);
return node;
}
void insort(struct Node *node){
if(node == NULL) return;
insort(node->left);
printf(" %d",node->key);
insort(node->right);
}
void presort(struct Node *node){
if(node == NULL) return;
printf(" %d",node->key);
presort(node->left);
presort(node->right);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212871/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212871/source.c"
target datalayout = "e-m:e-p270: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 }
@root = dso_local local_unnamed_addr global ptr null, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"insert\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @make_node(i32 noundef %x) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
store i32 %x, ptr %call, align 8, !tbaa !5
%left = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left, i8 0, i64 16, i1 false)
br label %if.end
if.end: ; preds = %if.then, %entry
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%m = alloca i32, align 4
%k = alloca i32, align 4
%order = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %order) #9
store ptr null, ptr @root, align 8, !tbaa !11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !12
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.018 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %order)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %order, ptr noundef nonnull dereferenceable(7) @.str.2, i64 7)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !12
%2 = load ptr, ptr @root, align 8, !tbaa !11
%call6 = call ptr @insert(i32 noundef %1, ptr noundef %2)
store ptr %call6, ptr @root, align 8, !tbaa !11
br label %for.inc
if.else: ; preds = %for.body
%bcmp15 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %order, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6)
%cmp9 = icmp eq i32 %bcmp15, 0
br i1 %cmp9, label %if.then10, label %for.inc
if.then10: ; preds = %if.else
%3 = load ptr, ptr @root, align 8, !tbaa !11
call void @insort(ptr noundef %3)
%putchar = call i32 @putchar(i32 10)
%4 = load ptr, ptr @root, align 8, !tbaa !11
call void @presort(ptr noundef %4)
%putchar16 = call i32 @putchar(i32 10)
br label %for.inc
for.inc: ; preds = %if.then, %if.then10, %if.else
%inc = add nuw nsw i32 %i.018, 1
%5 = load i32, ptr %m, align 4, !tbaa !12
%cmp = icmp slt i32 %inc, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %order) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local ptr @insert(i32 noundef %key, ptr noundef %node) local_unnamed_addr #3 {
entry:
%cmp = icmp eq ptr %node, null
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call.i = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
%cmp.not.i = icmp eq ptr %call.i, null
br i1 %cmp.not.i, label %common.ret25, label %if.then.i
if.then.i: ; preds = %if.then
store i32 %key, ptr %call.i, align 8, !tbaa !5
%left.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %left.i, i8 0, i64 16, i1 false)
br label %common.ret25
if.else: ; preds = %entry
%0 = load i32, ptr %node, align 8, !tbaa !5
%cmp2 = icmp sgt i32 %0, %key
br i1 %cmp2, label %if.then3, label %if.else6
common.ret25: ; preds = %if.then.i, %if.then, %if.else6, %if.then9, %if.then3
%common.ret25.op = phi ptr [ %node, %if.then3 ], [ %node, %if.then9 ], [ %node, %if.else6 ], [ null, %if.then ], [ %call.i, %if.then.i ]
ret ptr %common.ret25.op
if.then3: ; preds = %if.else
%left = getelementptr inbounds %struct.Node, ptr %node, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
%call4 = tail call ptr @insert(i32 noundef %key, ptr noundef %1)
store ptr %call4, ptr %left, align 8, !tbaa !15
br label %common.ret25
if.else6: ; preds = %if.else
%cmp8 = icmp slt i32 %0, %key
br i1 %cmp8, label %if.then9, label %common.ret25
if.then9: ; preds = %if.else6
%right = getelementptr inbounds %struct.Node, ptr %node, i64 0, i32 2
%2 = load ptr, ptr %right, align 8, !tbaa !16
%call10 = tail call ptr @insert(i32 noundef %key, ptr noundef %2)
store ptr %call10, ptr %right, align 8, !tbaa !16
br label %common.ret25
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @insort(ptr noundef readonly %node) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq ptr %node, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%node.tr5 = phi ptr [ %2, %if.end ], [ %node, %entry ]
%left = getelementptr inbounds %struct.Node, ptr %node.tr5, i64 0, i32 1
%0 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @insort(ptr noundef %0)
%1 = load i32, ptr %node.tr5, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
%right = getelementptr inbounds %struct.Node, ptr %node.tr5, i64 0, i32 2
%2 = load ptr, ptr %right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
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 void @presort(ptr noundef readonly %node) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq ptr %node, null
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%node.tr5 = phi ptr [ %2, %if.end ], [ %node, %entry ]
%0 = load i32, ptr %node.tr5, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %0)
%left = getelementptr inbounds %struct.Node, ptr %node.tr5, i64 0, i32 1
%1 = load ptr, ptr %left, align 8, !tbaa !15
tail call void @presort(ptr noundef %1)
%right = getelementptr inbounds %struct.Node, ptr %node.tr5, i64 0, i32 2
%2 = load ptr, ptr %right, align 8, !tbaa !16
%cmp = icmp eq ptr %2, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree 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 #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 willreturn memory(argmem: read) }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind allocsize(0) }
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, !7, i64 0}
!6 = !{!"Node", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !10, i64 8}
!16 = !{!6, !10, i64 16}
|
#include <stdio.h>
#include <math.h>
int main(void) {
while(1){
long long int n;
scanf("%lld",&n);
if(n==0) break;
long long int y;
scanf("%lld",&y);
long long int i,b[n],r[n],t[n];
for(i=0;i<n;i++){
scanf("%lld %lld %lld",&b[i],&r[i],&t[i]);
}
double a[n];
for(i=0;i<n;i++){
if(t[i]==1){
a[i]=1.0+(y*(r[i]/100.0));
}
else{
a[i]=pow(1.0+(r[i]/100.0),y);
}
}
long long int j,tmp;
for(j=n-1;j>0;j--){
for(i=0;i<j;i++){
if(a[i]<a[i+1]){
tmp=a[i];
a[i]=a[i+1];
a[i+1]=tmp;
tmp=b[i];
b[i]=b[i+1];
b[i+1]=tmp;
}
}
}
printf("%lld\n",b[0]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212929/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212929/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [15 x i8] c"%lld %lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
%call106 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp107 = icmp eq i64 %0, 0
br i1 %cmp107, label %while.end, label %if.end
if.end: ; preds = %entry, %cleanup
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #6
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%1 = load i64, ptr %n, align 8, !tbaa !5
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i64, ptr %n, align 8, !tbaa !5
%vla2 = alloca i64, i64 %3, align 16
%vla3 = alloca i64, i64 %3, align 16
%cmp496 = icmp sgt i64 %3, 0
br i1 %cmp496, label %for.body, label %cleanup
for.body: ; preds = %if.end, %for.body
%i.097 = phi i64 [ %inc, %for.body ], [ 0, %if.end ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.097
%arrayidx5 = getelementptr inbounds i64, ptr %vla2, i64 %i.097
%arrayidx6 = getelementptr inbounds i64, ptr %vla3, i64 %i.097
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6)
%inc = add nuw nsw i64 %i.097, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp4 = icmp slt i64 %inc, %4
br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%vla8 = alloca double, i64 %4, align 16
%cmp1098 = icmp sgt i64 %4, 0
br i1 %cmp1098, label %for.body11, label %cleanup
for.cond28.preheader: ; preds = %for.inc25
%cmp29104 = icmp sgt i64 %12, 1
br i1 %cmp29104, label %for.body35.preheader, label %cleanup
for.body11: ; preds = %for.end, %for.inc25
%5 = phi i64 [ %12, %for.inc25 ], [ %4, %for.end ]
%i.199 = phi i64 [ %inc26, %for.inc25 ], [ 0, %for.end ]
%arrayidx12 = getelementptr inbounds i64, ptr %vla3, i64 %i.199
%6 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%cmp13 = icmp eq i64 %6, 1
br i1 %cmp13, label %if.then14, label %if.else
if.then14: ; preds = %for.body11
%7 = load i64, ptr %y, align 8, !tbaa !5
%conv = sitofp i64 %7 to double
%arrayidx15 = getelementptr inbounds i64, ptr %vla2, i64 %i.199
%8 = load i64, ptr %arrayidx15, align 8, !tbaa !5
%conv16 = sitofp i64 %8 to double
%div = fdiv double %conv16, 1.000000e+02
%9 = call double @llvm.fmuladd.f64(double %conv, double %div, double 1.000000e+00)
br label %for.inc25
if.else: ; preds = %for.body11
%arrayidx18 = getelementptr inbounds i64, ptr %vla2, i64 %i.199
%10 = load i64, ptr %arrayidx18, align 8, !tbaa !5
%conv19 = sitofp i64 %10 to double
%div20 = fdiv double %conv19, 1.000000e+02
%add = fadd double %div20, 1.000000e+00
%11 = load i64, ptr %y, align 8, !tbaa !5
%conv21 = sitofp i64 %11 to double
%call22 = call double @pow(double noundef %add, double noundef %conv21) #6
%.pre = load i64, ptr %n, align 8, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %if.then14, %if.else
%12 = phi i64 [ %5, %if.then14 ], [ %.pre, %if.else ]
%call22.sink = phi double [ %9, %if.then14 ], [ %call22, %if.else ]
%13 = getelementptr inbounds double, ptr %vla8, i64 %i.199
store double %call22.sink, ptr %13, align 8
%inc26 = add nuw nsw i64 %i.199, 1
%cmp10 = icmp slt i64 %inc26, %12
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !11
for.cond28.loopexit: ; preds = %for.inc57
%cmp29 = icmp sgt i64 %j.0105.in, 2
br i1 %cmp29, label %for.body35.preheader, label %cleanup, !llvm.loop !12
for.body35.preheader: ; preds = %for.cond28.preheader, %for.cond28.loopexit
%j.0105.in = phi i64 [ %j.0105, %for.cond28.loopexit ], [ %12, %for.cond28.preheader ]
%j.0105 = add nsw i64 %j.0105.in, -1
%.pre110 = load double, ptr %vla8, align 16, !tbaa !13
br label %for.body35
for.body35: ; preds = %for.body35.preheader, %for.inc57
%14 = phi double [ %18, %for.inc57 ], [ %.pre110, %for.body35.preheader ]
%i.2102 = phi i64 [ %add37, %for.inc57 ], [ 0, %for.body35.preheader ]
%add37 = add nuw nsw i64 %i.2102, 1
%arrayidx38 = getelementptr inbounds double, ptr %vla8, i64 %add37
%15 = load double, ptr %arrayidx38, align 8, !tbaa !13
%cmp39 = fcmp olt double %14, %15
br i1 %cmp39, label %if.then41, label %for.inc57
if.then41: ; preds = %for.body35
%arrayidx36 = getelementptr inbounds double, ptr %vla8, i64 %i.2102
%conv43 = fptosi double %14 to i64
store double %15, ptr %arrayidx36, align 8, !tbaa !13
%conv47 = sitofp i64 %conv43 to double
store double %conv47, ptr %arrayidx38, align 8, !tbaa !13
%arrayidx50 = getelementptr inbounds i64, ptr %vla, i64 %i.2102
%16 = load <2 x i64>, ptr %arrayidx50, align 8, !tbaa !5
%17 = shufflevector <2 x i64> %16, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %17, ptr %arrayidx50, align 8, !tbaa !5
br label %for.inc57
for.inc57: ; preds = %for.body35, %if.then41
%18 = phi double [ %15, %for.body35 ], [ %conv47, %if.then41 ]
%cmp33 = icmp slt i64 %add37, %j.0105
br i1 %cmp33, label %for.body35, label %for.cond28.loopexit, !llvm.loop !15
cleanup: ; preds = %for.cond28.loopexit, %if.end, %for.end, %for.cond28.preheader
%19 = load i64, ptr %vla, align 16, !tbaa !5
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %19)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%20 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp eq i64 %20, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 8, 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(void)
{
int n,i;
int a[100001];
int b[100000];
long int sum=0;
scanf("%d",&n);
for(i=0;i<n+1;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
scanf("%d",&b[i]);
for(i=0;i<n;i++){
if(a[n-i]>=b[n-1-i])
sum+=b[n-1-i];
else{
sum+=a[n-i];
b[n-1-i]-=a[n-i];
if(a[n-1-i]>=b[n-1-i]){
sum+=b[n-1-i];
a[n-1-i]-=b[n-1-i];
}else{
sum+=a[n-1-i];
a[n-1-i]=0;
}
}
}
printf("%ld",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_212972/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_212972/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100001 x i32], align 16
%b = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not110 = icmp slt i32 %0, 0
br i1 %cmp.not110, label %for.end79, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3112 = icmp sgt i32 %1, 0
br i1 %cmp3112, label %for.body4, label %for.end79
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond2.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.body4
%cmp12114 = icmp sgt i32 %4, 0
br i1 %cmp12114, label %for.body13.preheader, label %for.end79
for.body13.preheader: ; preds = %for.cond11.preheader
%3 = zext i32 %4 to i64
%wide.trip.count = zext i32 %4 to i64
br label %for.body13
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %b, i64 0, i64 %indvars.iv120
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp3 = icmp slt i64 %indvars.iv.next121, %5
br i1 %cmp3, label %for.body4, label %for.cond11.preheader, !llvm.loop !11
for.body13: ; preds = %for.body13.preheader, %for.inc77
%indvars.iv123 = phi i64 [ 0, %for.body13.preheader ], [ %indvars.iv.next124, %for.inc77 ]
%sum.0116 = phi i64 [ 0, %for.body13.preheader ], [ %sum.1, %for.inc77 ]
%6 = sub nsw i64 %3, %indvars.iv123
%arrayidx15 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %6
%7 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%8 = trunc i64 %indvars.iv123 to i32
%9 = xor i32 %8, -1
%sub17 = add i32 %4, %9
%idxprom18 = sext i32 %sub17 to i64
%arrayidx19 = getelementptr inbounds [100000 x i32], ptr %b, i64 0, i64 %idxprom18
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20.not = icmp slt i32 %7, %10
br i1 %cmp20.not, label %if.else, label %if.then
if.then: ; preds = %for.body13
%conv = sext i32 %10 to i64
%add25 = add nsw i64 %sum.0116, %conv
br label %for.inc77
if.else: ; preds = %for.body13
%conv29 = sext i32 %7 to i64
%add30 = add nsw i64 %sum.0116, %conv29
%sub38 = sub nsw i32 %10, %7
store i32 %sub38, ptr %arrayidx19, align 4, !tbaa !5
%arrayidx42 = getelementptr inbounds [100001 x i32], ptr %a, i64 0, i64 %idxprom18
%11 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%cmp47.not = icmp slt i32 %11, %sub38
br i1 %cmp47.not, label %if.else65, label %if.then49
if.then49: ; preds = %if.else
%conv54 = sext i32 %sub38 to i64
%add55 = add nsw i64 %add30, %conv54
%sub64 = sub nsw i32 %11, %sub38
store i32 %sub64, ptr %arrayidx42, align 4, !tbaa !5
br label %for.inc77
if.else65: ; preds = %if.else
%conv70 = sext i32 %11 to i64
%add71 = add nsw i64 %add30, %conv70
store i32 0, ptr %arrayidx42, align 4, !tbaa !5
br label %for.inc77
for.inc77: ; preds = %if.then, %if.else65, %if.then49
%sum.1 = phi i64 [ %add25, %if.then ], [ %add55, %if.then49 ], [ %add71, %if.else65 ]
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%exitcond.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count
br i1 %exitcond.not, label %for.end79, label %for.body13, !llvm.loop !12
for.end79: ; preds = %for.inc77, %entry, %for.cond2.preheader, %for.cond11.preheader
%sum.0.lcssa = phi i64 [ 0, %for.cond11.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %sum.1, %for.inc77 ]
%call80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void)
{
int n;
scanf("%d", &n);
long long int a[100005]={0}, b[100005]={0};
int i;
for (i=0;i<=n;i++){
scanf("%lld", &a[i]);
}
for (i=0;i<n;i++){
scanf("%lld", &b[i]);
}
long long int ans = 0;
for (i=0;i<n;i++)
{
if (a[i]<=b[i])
{
ans += a[i];
b[i] -= a[i];
if (a[i + 1] <= b[i])
{
ans += a[i+1];
a[i+1] = 0;
}
else
{
ans += b[i];
a[i+1] -= b[i];
}
}
else
ans += b[i];
}
printf("%lld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213014/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213014/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100005 x i64], align 16
%b = alloca [100005 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800040) %a, i8 0, i64 800040, i1 false)
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800040) %b, i8 0, i64 800040, i1 false)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not84 = icmp slt i32 %0, 0
br i1 %cmp.not84, label %for.end55, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp386 = icmp sgt i32 %1, 0
br i1 %cmp386, label %for.body4, label %for.end55
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond2.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.body4
%cmp1288 = icmp sgt i32 %3, 0
br i1 %cmp1288, label %for.body13.preheader, label %for.end55
for.body13.preheader: ; preds = %for.cond11.preheader
%wide.trip.count = zext i32 %3 to i64
br label %for.body13
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %indvars.iv94
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp3 = icmp slt i64 %indvars.iv.next95, %4
br i1 %cmp3, label %for.body4, label %for.cond11.preheader, !llvm.loop !11
for.body13: ; preds = %for.body13.preheader, %for.inc53
%indvars.iv97 = phi i64 [ 0, %for.body13.preheader ], [ %indvars.iv.next98.pre-phi, %for.inc53 ]
%ans.090 = phi i64 [ 0, %for.body13.preheader ], [ %ans.1, %for.inc53 ]
%arrayidx15 = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %indvars.iv97
%5 = load i64, ptr %arrayidx15, align 8, !tbaa !12
%arrayidx17 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %indvars.iv97
%6 = load i64, ptr %arrayidx17, align 8, !tbaa !12
%cmp18.not = icmp sgt i64 %5, %6
br i1 %cmp18.not, label %if.else48, label %if.then
if.then: ; preds = %for.body13
%sub = sub nsw i64 %6, %5
store i64 %sub, ptr %arrayidx17, align 8, !tbaa !12
%7 = add nuw nsw i64 %indvars.iv97, 1
%arrayidx27 = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %7
%8 = load i64, ptr %arrayidx27, align 8, !tbaa !12
%cmp30.not = icmp sgt i64 %8, %sub
br i1 %cmp30.not, label %if.else, label %if.then31
if.then31: ; preds = %if.then
%add = add nsw i64 %5, %ans.090
%add35 = add nsw i64 %add, %8
store i64 0, ptr %arrayidx27, align 8, !tbaa !12
br label %for.inc53
if.else: ; preds = %if.then
%add41 = add i64 %6, %ans.090
%sub47 = sub nsw i64 %8, %sub
store i64 %sub47, ptr %arrayidx27, align 8, !tbaa !12
br label %for.inc53
if.else48: ; preds = %for.body13
%add51 = add nsw i64 %6, %ans.090
%.pre = add nuw nsw i64 %indvars.iv97, 1
br label %for.inc53
for.inc53: ; preds = %if.else48, %if.else, %if.then31
%indvars.iv.next98.pre-phi = phi i64 [ %.pre, %if.else48 ], [ %7, %if.else ], [ %7, %if.then31 ]
%ans.1 = phi i64 [ %add51, %if.else48 ], [ %add41, %if.else ], [ %add35, %if.then31 ]
%exitcond.not = icmp eq i64 %indvars.iv.next98.pre-phi, %wide.trip.count
br i1 %exitcond.not, label %for.end55, label %for.body13, !llvm.loop !14
for.end55: ; preds = %for.inc53, %entry, %for.cond2.preheader, %for.cond11.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond11.preheader ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %ans.1, %for.inc53 ]
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(void) {
long n, i;
scanf("%ld", &n);
long a[n + 1], b[n];
for ( i = 0; i <= n; i++ ) {
scanf("%ld", &a[i]);
}
for ( i = 0; i < n; i++ ) {
scanf("%ld", &b[i]);
}
long ans = 0, remain_a = 0, remain_b = 0;
/* 1 番目の街から n 番目の街までを考える */
for ( i = 0; i < n; i++ ) {
/* (i - 1) 番目の街の残り戦力を使う */
remain_a = a[i] - remain_b;
/* 残り戦力で倒しきれていたら i 番目の街の戦力は残る */
if ( remain_a <= 0 ) {
ans += a[i];
remain_b = b[i];
}
/* 倒しきれなかったら i 番目の街の戦力を使用する */
else {
remain_a -= b[i];
/* i 番目の街の戦力で倒しきれていたら余りを持ち越す */
if ( remain_a <= 0 ) {
ans += a[i];
remain_b = 0 - remain_a;
}
/* i 番目の街の戦力でも倒しきれなかったら余りはなし */
else {
ans += (remain_b + b[i]);
remain_b = 0;
}
}
}
/* (n + 1) 番目の街は n 番目の街の残り戦力しかない */
if ( a[n] > remain_b ) {
ans += remain_b;
}
else {
ans += a[n];
}
printf("%ld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213058/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213058/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %0, 1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %add, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%vla1 = alloca i64, i64 %2, align 16
%cmp.not68 = icmp slt i64 %2, 0
br i1 %cmp.not68, label %for.end33, label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp470 = icmp sgt i64 %3, 0
br i1 %cmp470, label %for.body5, label %for.end33
for.body: ; preds = %entry, %for.body
%i.069 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.069
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.069, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.069, %3
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.body5
%cmp1272 = icmp sgt i64 %4, 0
br i1 %cmp1272, label %for.body13, label %for.end33
for.body5: ; preds = %for.cond3.preheader, %for.body5
%i.171 = phi i64 [ %inc9, %for.body5 ], [ 0, %for.cond3.preheader ]
%arrayidx6 = getelementptr inbounds i64, ptr %vla1, i64 %i.171
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%inc9 = add nuw nsw i64 %i.171, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp4 = icmp slt i64 %inc9, %4
br i1 %cmp4, label %for.body5, label %for.cond11.preheader, !llvm.loop !11
for.body13: ; preds = %for.cond11.preheader, %for.inc31
%remain_b.075 = phi i64 [ %remain_b.1, %for.inc31 ], [ 0, %for.cond11.preheader ]
%ans.074 = phi i64 [ %ans.1, %for.inc31 ], [ 0, %for.cond11.preheader ]
%i.273 = phi i64 [ %inc32, %for.inc31 ], [ 0, %for.cond11.preheader ]
%arrayidx14 = getelementptr inbounds i64, ptr %vla, i64 %i.273
%5 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%sub = sub nsw i64 %5, %remain_b.075
%cmp15 = icmp slt i64 %sub, 1
%arrayidx18 = getelementptr inbounds i64, ptr %vla1, i64 %i.273
%6 = load i64, ptr %arrayidx18, align 8, !tbaa !5
br i1 %cmp15, label %for.inc31, label %if.else
if.else: ; preds = %for.body13
%sub20 = sub nsw i64 %sub, %6
%cmp21 = icmp slt i64 %sub20, 1
br i1 %cmp21, label %if.then22, label %if.else26
if.then22: ; preds = %if.else
%sub25 = sub nsw i64 0, %sub20
br label %for.inc31
if.else26: ; preds = %if.else
%add28 = add nsw i64 %6, %remain_b.075
br label %for.inc31
for.inc31: ; preds = %for.body13, %if.else26, %if.then22
%.pn = phi i64 [ %5, %if.then22 ], [ %add28, %if.else26 ], [ %5, %for.body13 ]
%remain_b.1 = phi i64 [ %sub25, %if.then22 ], [ 0, %if.else26 ], [ %6, %for.body13 ]
%ans.1 = add nsw i64 %.pn, %ans.074
%inc32 = add nuw nsw i64 %i.273, 1
%exitcond.not = icmp eq i64 %inc32, %4
br i1 %exitcond.not, label %for.end33, label %for.body13, !llvm.loop !12
for.end33: ; preds = %for.inc31, %entry, %for.cond3.preheader, %for.cond11.preheader
%.lcssa82 = phi i64 [ %4, %for.cond11.preheader ], [ %3, %for.cond3.preheader ], [ %2, %entry ], [ %4, %for.inc31 ]
%ans.0.lcssa = phi i64 [ 0, %for.cond11.preheader ], [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %ans.1, %for.inc31 ]
%remain_b.0.lcssa = phi i64 [ 0, %for.cond11.preheader ], [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %remain_b.1, %for.inc31 ]
%arrayidx34 = getelementptr inbounds i64, ptr %vla, i64 %.lcssa82
%7 = load i64, ptr %arrayidx34, align 8, !tbaa !5
%remain_b.0. = call i64 @llvm.smin.i64(i64 %7, i64 %remain_b.0.lcssa)
%ans.2 = add nsw i64 %remain_b.0., %ans.0.lcssa
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.2)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(){
long long int n,a[100010],b[100010],ans=0;
scanf("%lld",&n);
int i,j,tmp=0;
for(i=0;i<n+1;i++){
scanf("%lld",&a[i]);
}
for(i=0;i<n;i++){
scanf("%lld",&b[i]);
}
for(i=0;i<n;i++){
if(a[i]>=b[i])
ans+=b[i];
else{
if(a[i]+a[i+1]<=b[i]){
ans +=a[i]+a[i+1];
a[i+1]=0;
}
else{
ans +=b[i];
a[i+1]-=b[i]-a[i];
}
}
}
printf("%lld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213100/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213100/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [100010 x i64], align 16
%b = alloca [100010 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not90 = icmp slt i64 %0, 0
br i1 %cmp.not90, label %for.end64, label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp593 = icmp sgt i64 %1, 0
br i1 %cmp593, label %for.body7, label %for.end64
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not = icmp slt i64 %1, %indvars.iv.next
br i1 %cmp.not, label %for.cond3.preheader, label %for.body, !llvm.loop !9
for.cond14.preheader: ; preds = %for.body7
%cmp1696 = icmp sgt i64 %2, 0
br i1 %cmp1696, label %for.body18, label %for.end64
for.body7: ; preds = %for.cond3.preheader, %for.body7
%indvars.iv103 = phi i64 [ %indvars.iv.next104, %for.body7 ], [ 0, %for.cond3.preheader ]
%arrayidx9 = getelementptr inbounds [100010 x i64], ptr %b, i64 0, i64 %indvars.iv103
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9)
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp5 = icmp sgt i64 %2, %indvars.iv.next104
br i1 %cmp5, label %for.body7, label %for.cond14.preheader, !llvm.loop !11
for.body18: ; preds = %for.cond14.preheader, %for.inc62
%indvars.iv106 = phi i64 [ %5, %for.inc62 ], [ 0, %for.cond14.preheader ]
%ans.098 = phi i64 [ %ans.1, %for.inc62 ], [ 0, %for.cond14.preheader ]
%arrayidx20 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv106
%3 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%arrayidx22 = getelementptr inbounds [100010 x i64], ptr %b, i64 0, i64 %indvars.iv106
%4 = load i64, ptr %arrayidx22, align 8, !tbaa !5
%cmp23.not = icmp slt i64 %3, %4
%5 = add nuw nsw i64 %indvars.iv106, 1
br i1 %cmp23.not, label %if.else, label %for.inc62
if.else: ; preds = %for.body18
%arrayidx32 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %5
%6 = load i64, ptr %arrayidx32, align 8, !tbaa !5
%add33 = add nsw i64 %6, %3
%cmp36.not = icmp sgt i64 %add33, %4
%sub.neg = sub i64 %3, %4
%sub60 = add i64 %sub.neg, %6
%sub60.sink = select i1 %cmp36.not, i64 %sub60, i64 0
%.pn.ph = call i64 @llvm.smin.i64(i64 %add33, i64 %4)
store i64 %sub60.sink, ptr %arrayidx32, align 8, !tbaa !5
br label %for.inc62
for.inc62: ; preds = %if.else, %for.body18
%.pn = phi i64 [ %4, %for.body18 ], [ %.pn.ph, %if.else ]
%ans.1 = add nsw i64 %.pn, %ans.098
%exitcond.not = icmp eq i64 %5, %2
br i1 %exitcond.not, label %for.end64, label %for.body18, !llvm.loop !12
for.end64: ; preds = %for.inc62, %entry, %for.cond3.preheader, %for.cond14.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond14.preheader ], [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %ans.1, %for.inc62 ]
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define HEIGHT 12
#define WIDTH 6
int calcChain( void );
int deleteBlock( void );
int findGroup( int, int );
int findGroup_body( int, int, char, int, int );
void deleteGroup( int, int );
void deleteGroup_body( int, int, int, int );
void fallBlock( void );
typedef struct {
char color;
int state;
} FIELD;
FIELD field[ HEIGHT ][ WIDTH ];
const int dx[ 4 ] = { -1, 0, 1, 0 };
const int dy[ 4 ] = { 0, -1, 0, 1 };
int main( void ) {
int i, j, n;
scanf( "%d%*c", &n );
while ( n-- ) {
for ( i = 0; i < HEIGHT; i++ ) {
for ( j = 0; j < WIDTH; j++ ) {
scanf( "%c", &field[ i ][ j ].color );
field[ i ][ j ].state = -1;
}
scanf( "%*c" );
}
printf( "%d\n", calcChain() );
}
return 0;
}
int calcChain( void ) {
int chain;
for ( chain = 0; ; chain++ ) {
if ( !deleteBlock() )
break;
fallBlock();
}
return chain;
}
int deleteBlock( void ) {
int i, j, deleted;
deleted = 0;
for ( i = 0; i < HEIGHT; i++ )
for ( j = 0; j < WIDTH; j++ )
if ( field[ i ][ j ].color != '.' && field[ i ][ j ].color != 'O' && field[ i ][ j ].state == -1 )
if ( findGroup( i, j ) >= 4 ) {
deleted = 1;
deleteGroup( i, j );
}
return deleted;
}
int findGroup( int i, int j ) {
int id = i * WIDTH + j;
field[ i ][ j ].state = id;
return findGroup_body( i, j + 1, field[ i ][ j ].color, id, 0 ) + findGroup_body( i + 1, j, field[ i ][ j ].color, id, 1 ) + 1;
}
int findGroup_body( int i, int j, char color, int id, int comeDir ) {
int tmp, d;
if ( i < 0 || i >= HEIGHT || j < 0 || j >= WIDTH || field[ i ][ j ].state == id || field[ i ][ j ].color != color )
return 0;
field[ i ][ j ].state = id;
tmp = 0;
for ( d = 0; d < 4; d++ )
if ( d != comeDir )
tmp += findGroup_body( i + dy[ d ], j + dx[ d ], color, id, d + 2 & 3 );
return tmp + 1;
}
void deleteGroup( int i, int j ) {
int id = i * WIDTH + j, d;
field[ i ][ j ].color = '.';
for ( d = 0; d < 4; d++ )
deleteGroup_body( i + dy[ d ], j + dx[ d ], id, d + 2 & 3 );
}
void deleteGroup_body( int i, int j, int id, int comeDir ) {
int d;
if ( i < 0 || i >= HEIGHT || j < 0 || j >= WIDTH )
return;
if ( field[ i ][ j ].state != id ) {
if ( field[ i ][ j ].color == 'O' )
field[ i ][ j ].color = '.';
return;
}
field[ i ][ j ].color = '.';
field[ i ][ j ].state = -1;
for ( d = 0; d < 4; d++ )
if ( d != comeDir )
deleteGroup_body( i + dy[ d ], j + dx[ d ], id, d + 2 & 3 );
}
void fallBlock( void ) {
int i, j, cnt;
for ( j = 0; j < WIDTH; j++ ) {
cnt = 0;
for ( i = HEIGHT - 1; i >= 0; i-- )
if ( field[ i ][ j ].color == '.' )
cnt++;
else {
field[ i + cnt ][ j ].color = field[ i ][ j ].color;
field[ i + cnt ][ j ].state = -1;
}
for ( i = cnt - 1; i >= 0; i-- ) {
field[ i ][ j ].color = '.';
field[ i ][ j ].state = -1;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213151/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213151/source.c"
target datalayout = "e-m:e-p270: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.FIELD = type { i8, i32 }
@dx = dso_local local_unnamed_addr constant [4 x i32] [i32 -1, i32 0, i32 1, i32 0], align 16
@dy = dso_local local_unnamed_addr constant [4 x i32] [i32 0, i32 -1, i32 0, i32 1], align 16
@.str = private unnamed_addr constant [6 x i8] c"%d%*c\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@field = dso_local global [12 x [6 x %struct.FIELD]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%*c\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%dec25 = add nsw i32 %0, -1
store i32 %dec25, ptr %n, align 4, !tbaa !5
%tobool.not26 = icmp eq i32 %0, 0
br i1 %tobool.not26, label %while.end, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.cond1.preheader.backedge ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%state = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 0, i32 1
store i32 -1, ptr %state, align 4, !tbaa !9
%arrayidx5.1 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.1)
%state.1 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 1, i32 1
store i32 -1, ptr %state.1, align 4, !tbaa !9
%arrayidx5.2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.2)
%state.2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 2, i32 1
store i32 -1, ptr %state.2, align 4, !tbaa !9
%arrayidx5.3 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 3
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.3)
%state.3 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 3, i32 1
store i32 -1, ptr %state.3, align 4, !tbaa !9
%arrayidx5.4 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 4
%call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.4)
%state.4 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 4, i32 1
store i32 -1, ptr %state.4, align 4, !tbaa !9
%arrayidx5.5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 5
%call6.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.5)
%state.5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv, i64 5, i32 1
store i32 -1, ptr %state.5, align 4, !tbaa !9
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 12
br i1 %exitcond.not, label %for.end14, label %for.cond1.preheader.backedge
for.cond1.preheader.backedge: ; preds = %for.cond1.preheader, %calcChain.exit
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %calcChain.exit ]
br label %for.cond1.preheader, !llvm.loop !11
for.end14: ; preds = %for.cond1.preheader
%call2.i = call i32 @deleteBlock(), !range !13
%tobool.not3.i = icmp eq i32 %call2.i, 0
br i1 %tobool.not3.i, label %calcChain.exit, label %if.end.i
if.end.i: ; preds = %for.end14, %deleteBlock.exit
%chain.04.i = phi i32 [ %inc.i, %deleteBlock.exit ], [ 0, %for.end14 ]
call void @fallBlock()
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc27.i, %if.end.i
%indvars.iv56.i = phi i64 [ 0, %if.end.i ], [ %indvars.iv.next57.i, %for.inc27.i ]
%deleted.051.i = phi i32 [ 0, %if.end.i ], [ %deleted.2.i, %for.inc27.i ]
%1 = mul nuw nsw i64 %indvars.iv56.i, 6
%indvars.iv.next57.i = add nuw nsw i64 %indvars.iv56.i, 1
%2 = trunc i64 %1 to i32
%3 = trunc i64 %indvars.iv56.i to i32
%4 = trunc i64 %indvars.iv.next57.i to i32
%5 = add i32 %3, -1
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%deleted.149.i = phi i32 [ %deleted.051.i, %for.cond1.preheader.i ], [ %deleted.2.i, %for.inc.i ]
%indvars55.i = trunc i64 %indvars.iv.i to i32
%arrayidx5.i = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv56.i, i64 %indvars.iv.i
%6 = load i8, ptr %arrayidx5.i, align 8, !tbaa !14
switch i8 %6, label %land.lhs.true16.i [
i8 46, label %for.inc.i
i8 79, label %for.inc.i
]
land.lhs.true16.i: ; preds = %for.body3.i
%state.i = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv56.i, i64 %indvars.iv.i, i32 1
%7 = load i32, ptr %state.i, align 4, !tbaa !9
%cmp21.i = icmp eq i32 %7, -1
br i1 %cmp21.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %land.lhs.true16.i
%8 = add nuw nsw i64 %indvars.iv.i, %1
%add.i.i = add nuw nsw i32 %indvars55.i, %2
%9 = trunc i64 %8 to i32
store i32 %9, ptr %state.i, align 4, !tbaa !9
%10 = add i32 %indvars55.i, 1
%call.i.i = call i32 @findGroup_body(i32 noundef %3, i32 noundef %10, i8 noundef signext %6, i32 noundef %add.i.i, i32 noundef 0)
%11 = load i8, ptr %arrayidx5.i, align 8, !tbaa !14
%call14.i.i = call i32 @findGroup_body(i32 noundef %4, i32 noundef %indvars55.i, i8 noundef signext %11, i32 noundef %add.i.i, i32 noundef 1)
%add15.i.i = add i32 %call.i.i, 1
%add16.i.i = add i32 %add15.i.i, %call14.i.i
%cmp23.i = icmp sgt i32 %add16.i.i, 3
br i1 %cmp23.i, label %if.then25.i, label %for.inc.i
if.then25.i: ; preds = %if.then.i
store i8 46, ptr %arrayidx5.i, align 8, !tbaa !14
%12 = add i32 %indvars55.i, -1
call void @deleteGroup_body(i32 noundef %3, i32 noundef %12, i32 noundef %add.i.i, i32 noundef 2)
call void @deleteGroup_body(i32 noundef %5, i32 noundef %indvars55.i, i32 noundef %add.i.i, i32 noundef 3)
call void @deleteGroup_body(i32 noundef %3, i32 noundef %10, i32 noundef %add.i.i, i32 noundef 0)
call void @deleteGroup_body(i32 noundef %4, i32 noundef %indvars55.i, i32 noundef %add.i.i, i32 noundef 1)
br label %for.inc.i
for.inc.i: ; preds = %if.then25.i, %if.then.i, %land.lhs.true16.i, %for.body3.i, %for.body3.i
%deleted.2.i = phi i32 [ 1, %if.then25.i ], [ %deleted.149.i, %if.then.i ], [ %deleted.149.i, %land.lhs.true16.i ], [ %deleted.149.i, %for.body3.i ], [ %deleted.149.i, %for.body3.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, 6
br i1 %exitcond.not.i, label %for.inc27.i, label %for.body3.i, !llvm.loop !15
for.inc27.i: ; preds = %for.inc.i
%exitcond61.not.i = icmp eq i64 %indvars.iv.next57.i, 12
br i1 %exitcond61.not.i, label %deleteBlock.exit, label %for.cond1.preheader.i, !llvm.loop !16
deleteBlock.exit: ; preds = %for.inc27.i
%inc.i = add nuw nsw i32 %chain.04.i, 1
%tobool.not.i = icmp eq i32 %deleted.2.i, 0
br i1 %tobool.not.i, label %calcChain.exit, label %if.end.i
calcChain.exit: ; preds = %deleteBlock.exit, %for.end14
%chain.0.lcssa.i = phi i32 [ 0, %for.end14 ], [ %inc.i, %deleteBlock.exit ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %chain.0.lcssa.i)
%13 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %13, 0
br i1 %tobool.not, label %while.end, label %for.cond1.preheader.backedge
while.end: ; preds = %calcChain.exit, %entry
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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @calcChain() local_unnamed_addr #3 {
entry:
%call2 = tail call i32 @deleteBlock(), !range !13
%tobool.not3 = icmp eq i32 %call2, 0
br i1 %tobool.not3, label %for.end, label %if.end
if.end: ; preds = %entry, %if.end
%chain.04 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
tail call void @fallBlock()
%inc = add nuw nsw i32 %chain.04, 1
%call = tail call i32 @deleteBlock(), !range !13
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %for.end, label %if.end
for.end: ; preds = %if.end, %entry
%chain.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %if.end ]
ret i32 %chain.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @deleteBlock() local_unnamed_addr #3 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc27
%indvars.iv56 = phi i64 [ 0, %entry ], [ %indvars.iv.next57, %for.inc27 ]
%deleted.051 = phi i32 [ 0, %entry ], [ %deleted.2, %for.inc27 ]
%0 = mul nuw nsw i64 %indvars.iv56, 6
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%1 = trunc i64 %0 to i32
%2 = trunc i64 %indvars.iv56 to i32
%3 = trunc i64 %indvars.iv.next57 to i32
%4 = trunc i64 %indvars.iv56 to i32
%5 = add i32 %4, -1
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%deleted.149 = phi i32 [ %deleted.051, %for.cond1.preheader ], [ %deleted.2, %for.inc ]
%indvars55 = trunc i64 %indvars.iv to i32
%arrayidx5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv56, i64 %indvars.iv
%6 = load i8, ptr %arrayidx5, align 8, !tbaa !14
switch i8 %6, label %land.lhs.true16 [
i8 46, label %for.inc
i8 79, label %for.inc
]
land.lhs.true16: ; preds = %for.body3
%state = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv56, i64 %indvars.iv, i32 1
%7 = load i32, ptr %state, align 4, !tbaa !9
%cmp21 = icmp eq i32 %7, -1
br i1 %cmp21, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true16
%8 = add nuw nsw i64 %indvars.iv, %0
%add.i = add nuw nsw i32 %indvars55, %1
%9 = trunc i64 %8 to i32
store i32 %9, ptr %state, align 4, !tbaa !9
%10 = trunc i64 %indvars.iv to i32
%11 = add i32 %10, 1
%call.i = tail call i32 @findGroup_body(i32 noundef %2, i32 noundef %11, i8 noundef signext %6, i32 noundef %add.i, i32 noundef 0)
%12 = load i8, ptr %arrayidx5, align 8, !tbaa !14
%call14.i = tail call i32 @findGroup_body(i32 noundef %3, i32 noundef %indvars55, i8 noundef signext %12, i32 noundef %add.i, i32 noundef 1)
%add15.i = add i32 %call.i, 1
%add16.i = add i32 %add15.i, %call14.i
%cmp23 = icmp sgt i32 %add16.i, 3
br i1 %cmp23, label %if.then25, label %for.inc
if.then25: ; preds = %if.then
store i8 46, ptr %arrayidx5, align 8, !tbaa !14
%13 = trunc i64 %indvars.iv to i32
%14 = add i32 %13, -1
tail call void @deleteGroup_body(i32 noundef %2, i32 noundef %14, i32 noundef %add.i, i32 noundef 2)
tail call void @deleteGroup_body(i32 noundef %5, i32 noundef %indvars55, i32 noundef %add.i, i32 noundef 3)
tail call void @deleteGroup_body(i32 noundef %2, i32 noundef %11, i32 noundef %add.i, i32 noundef 0)
tail call void @deleteGroup_body(i32 noundef %3, i32 noundef %indvars55, i32 noundef %add.i, i32 noundef 1)
br label %for.inc
for.inc: ; preds = %for.body3, %for.body3, %land.lhs.true16, %if.then25, %if.then
%deleted.2 = phi i32 [ 1, %if.then25 ], [ %deleted.149, %if.then ], [ %deleted.149, %land.lhs.true16 ], [ %deleted.149, %for.body3 ], [ %deleted.149, %for.body3 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 6
br i1 %exitcond.not, label %for.inc27, label %for.body3, !llvm.loop !15
for.inc27: ; preds = %for.inc
%exitcond61.not = icmp eq i64 %indvars.iv.next57, 12
br i1 %exitcond61.not, label %for.end29, label %for.cond1.preheader, !llvm.loop !16
for.end29: ; preds = %for.inc27
ret i32 %deleted.2
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @fallBlock() local_unnamed_addr #4 {
entry:
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc40
%indvars.iv69 = phi i64 [ 0, %entry ], [ %indvars.iv.next70, %for.inc40 ]
%arrayidx5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 11, i64 %indvars.iv69
%0 = load i8, ptr %arrayidx5, align 8, !tbaa !14
%cmp6 = icmp eq i8 %0, 46
br i1 %cmp6, label %for.inc, label %if.else
for.body26.lr.ph: ; preds = %for.inc.11.thread, %for.inc.11
%cnt.1.1174 = phi i32 [ %inc.11, %for.inc.11.thread ], [ %cnt.1.10, %for.inc.11 ]
%1 = zext i32 %cnt.1.1174 to i64
br label %for.body26
if.else: ; preds = %for.cond1.preheader
%state = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 11, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state, align 4, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.cond1.preheader, %if.else
%cnt.1 = phi i32 [ 0, %if.else ], [ 1, %for.cond1.preheader ]
%arrayidx5.1 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 10, i64 %indvars.iv69
%2 = load i8, ptr %arrayidx5.1, align 8, !tbaa !14
%cmp6.1 = icmp eq i8 %2, 46
br i1 %cmp6.1, label %if.then.1, label %if.else.1
if.else.1: ; preds = %for.inc
%add.1 = or i32 %cnt.1, 10
%idxprom13.1 = zext i32 %add.1 to i64
%arrayidx16.1 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.1, i64 %indvars.iv69
store i8 %2, ptr %arrayidx16.1, align 8, !tbaa !14
%state.1 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.1, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.1, align 4, !tbaa !9
br label %for.inc.1
if.then.1: ; preds = %for.inc
%inc.1 = add nuw nsw i32 %cnt.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.else.1
%cnt.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %cnt.1, %if.else.1 ]
%arrayidx5.2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 9, i64 %indvars.iv69
%3 = load i8, ptr %arrayidx5.2, align 8, !tbaa !14
%cmp6.2 = icmp eq i8 %3, 46
br i1 %cmp6.2, label %if.then.2, label %if.else.2
if.else.2: ; preds = %for.inc.1
%add.2 = add nuw nsw i32 %cnt.1.1, 9
%idxprom13.2 = zext i32 %add.2 to i64
%arrayidx16.2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.2, i64 %indvars.iv69
store i8 %3, ptr %arrayidx16.2, align 8, !tbaa !14
%state.2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.2, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.2, align 4, !tbaa !9
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nuw nsw i32 %cnt.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.else.2
%cnt.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ %cnt.1.1, %if.else.2 ]
%arrayidx5.3 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 8, i64 %indvars.iv69
%4 = load i8, ptr %arrayidx5.3, align 8, !tbaa !14
%cmp6.3 = icmp eq i8 %4, 46
br i1 %cmp6.3, label %if.then.3, label %if.else.3
if.else.3: ; preds = %for.inc.2
%add.3 = add nuw nsw i32 %cnt.1.2, 8
%idxprom13.3 = zext i32 %add.3 to i64
%arrayidx16.3 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.3, i64 %indvars.iv69
store i8 %4, ptr %arrayidx16.3, align 8, !tbaa !14
%state.3 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.3, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.3, align 4, !tbaa !9
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%inc.3 = add nuw nsw i32 %cnt.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.else.3
%cnt.1.3 = phi i32 [ %inc.3, %if.then.3 ], [ %cnt.1.2, %if.else.3 ]
%arrayidx5.4 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 7, i64 %indvars.iv69
%5 = load i8, ptr %arrayidx5.4, align 8, !tbaa !14
%cmp6.4 = icmp eq i8 %5, 46
br i1 %cmp6.4, label %if.then.4, label %if.else.4
if.else.4: ; preds = %for.inc.3
%add.4 = add nuw nsw i32 %cnt.1.3, 7
%idxprom13.4 = zext i32 %add.4 to i64
%arrayidx16.4 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.4, i64 %indvars.iv69
store i8 %5, ptr %arrayidx16.4, align 8, !tbaa !14
%state.4 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.4, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.4, align 4, !tbaa !9
br label %for.inc.4
if.then.4: ; preds = %for.inc.3
%inc.4 = add nuw nsw i32 %cnt.1.3, 1
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %if.else.4
%cnt.1.4 = phi i32 [ %inc.4, %if.then.4 ], [ %cnt.1.3, %if.else.4 ]
%arrayidx5.5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 6, i64 %indvars.iv69
%6 = load i8, ptr %arrayidx5.5, align 8, !tbaa !14
%cmp6.5 = icmp eq i8 %6, 46
br i1 %cmp6.5, label %if.then.5, label %if.else.5
if.else.5: ; preds = %for.inc.4
%add.5 = add nuw nsw i32 %cnt.1.4, 6
%idxprom13.5 = zext i32 %add.5 to i64
%arrayidx16.5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.5, i64 %indvars.iv69
store i8 %6, ptr %arrayidx16.5, align 8, !tbaa !14
%state.5 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.5, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.5, align 4, !tbaa !9
br label %for.inc.5
if.then.5: ; preds = %for.inc.4
%inc.5 = add nuw nsw i32 %cnt.1.4, 1
br label %for.inc.5
for.inc.5: ; preds = %if.then.5, %if.else.5
%cnt.1.5 = phi i32 [ %inc.5, %if.then.5 ], [ %cnt.1.4, %if.else.5 ]
%arrayidx5.6 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 5, i64 %indvars.iv69
%7 = load i8, ptr %arrayidx5.6, align 8, !tbaa !14
%cmp6.6 = icmp eq i8 %7, 46
br i1 %cmp6.6, label %if.then.6, label %if.else.6
if.else.6: ; preds = %for.inc.5
%add.6 = add nuw nsw i32 %cnt.1.5, 5
%idxprom13.6 = zext i32 %add.6 to i64
%arrayidx16.6 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.6, i64 %indvars.iv69
store i8 %7, ptr %arrayidx16.6, align 8, !tbaa !14
%state.6 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.6, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.6, align 4, !tbaa !9
br label %for.inc.6
if.then.6: ; preds = %for.inc.5
%inc.6 = add nuw nsw i32 %cnt.1.5, 1
br label %for.inc.6
for.inc.6: ; preds = %if.then.6, %if.else.6
%cnt.1.6 = phi i32 [ %inc.6, %if.then.6 ], [ %cnt.1.5, %if.else.6 ]
%arrayidx5.7 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 4, i64 %indvars.iv69
%8 = load i8, ptr %arrayidx5.7, align 8, !tbaa !14
%cmp6.7 = icmp eq i8 %8, 46
br i1 %cmp6.7, label %if.then.7, label %if.else.7
if.else.7: ; preds = %for.inc.6
%add.7 = add nuw nsw i32 %cnt.1.6, 4
%idxprom13.7 = zext i32 %add.7 to i64
%arrayidx16.7 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.7, i64 %indvars.iv69
store i8 %8, ptr %arrayidx16.7, align 8, !tbaa !14
%state.7 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.7, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.7, align 4, !tbaa !9
br label %for.inc.7
if.then.7: ; preds = %for.inc.6
%inc.7 = add nuw nsw i32 %cnt.1.6, 1
br label %for.inc.7
for.inc.7: ; preds = %if.then.7, %if.else.7
%cnt.1.7 = phi i32 [ %inc.7, %if.then.7 ], [ %cnt.1.6, %if.else.7 ]
%arrayidx5.8 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 3, i64 %indvars.iv69
%9 = load i8, ptr %arrayidx5.8, align 8, !tbaa !14
%cmp6.8 = icmp eq i8 %9, 46
br i1 %cmp6.8, label %if.then.8, label %if.else.8
if.else.8: ; preds = %for.inc.7
%add.8 = add nuw nsw i32 %cnt.1.7, 3
%idxprom13.8 = zext i32 %add.8 to i64
%arrayidx16.8 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.8, i64 %indvars.iv69
store i8 %9, ptr %arrayidx16.8, align 8, !tbaa !14
%state.8 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.8, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.8, align 4, !tbaa !9
br label %for.inc.8
if.then.8: ; preds = %for.inc.7
%inc.8 = add nuw nsw i32 %cnt.1.7, 1
br label %for.inc.8
for.inc.8: ; preds = %if.then.8, %if.else.8
%cnt.1.8 = phi i32 [ %inc.8, %if.then.8 ], [ %cnt.1.7, %if.else.8 ]
%arrayidx5.9 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 2, i64 %indvars.iv69
%10 = load i8, ptr %arrayidx5.9, align 8, !tbaa !14
%cmp6.9 = icmp eq i8 %10, 46
br i1 %cmp6.9, label %if.then.9, label %if.else.9
if.else.9: ; preds = %for.inc.8
%add.9 = add nuw nsw i32 %cnt.1.8, 2
%idxprom13.9 = zext i32 %add.9 to i64
%arrayidx16.9 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.9, i64 %indvars.iv69
store i8 %10, ptr %arrayidx16.9, align 8, !tbaa !14
%state.9 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.9, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.9, align 4, !tbaa !9
br label %for.inc.9
if.then.9: ; preds = %for.inc.8
%inc.9 = add nuw nsw i32 %cnt.1.8, 1
br label %for.inc.9
for.inc.9: ; preds = %if.then.9, %if.else.9
%cnt.1.9 = phi i32 [ %inc.9, %if.then.9 ], [ %cnt.1.8, %if.else.9 ]
%arrayidx5.10 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 1, i64 %indvars.iv69
%11 = load i8, ptr %arrayidx5.10, align 8, !tbaa !14
%cmp6.10 = icmp eq i8 %11, 46
%inc.10 = add nuw nsw i32 %cnt.1.9, 1
br i1 %cmp6.10, label %for.inc.10, label %if.else.10
if.else.10: ; preds = %for.inc.9
%idxprom13.10 = zext i32 %inc.10 to i64
%arrayidx16.10 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.10, i64 %indvars.iv69
store i8 %11, ptr %arrayidx16.10, align 8, !tbaa !14
%state.10 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.10, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.10, align 4, !tbaa !9
br label %for.inc.10
for.inc.10: ; preds = %for.inc.9, %if.else.10
%cnt.1.10 = phi i32 [ %cnt.1.9, %if.else.10 ], [ %inc.10, %for.inc.9 ]
%arrayidx5.11 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 0, i64 %indvars.iv69
%12 = load i8, ptr %arrayidx5.11, align 8, !tbaa !14
%cmp6.11 = icmp eq i8 %12, 46
br i1 %cmp6.11, label %for.inc.11.thread, label %for.inc.11
for.inc.11.thread: ; preds = %for.inc.10
%inc.11 = add nuw nsw i32 %cnt.1.10, 1
br label %for.body26.lr.ph
for.inc.11: ; preds = %for.inc.10
%idxprom13.11 = zext i32 %cnt.1.10 to i64
%arrayidx16.11 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.11, i64 %indvars.iv69
store i8 %12, ptr %arrayidx16.11, align 8, !tbaa !14
%state.11 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom13.11, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state.11, align 4, !tbaa !9
%cmp2464.not = icmp eq i32 %cnt.1.10, 0
br i1 %cmp2464.not, label %for.inc40, label %for.body26.lr.ph
for.body26: ; preds = %for.body26.lr.ph, %for.body26
%indvars.iv = phi i64 [ %1, %for.body26.lr.ph ], [ %indvars.iv.next, %for.body26 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx30 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv.next, i64 %indvars.iv69
store i8 46, ptr %arrayidx30, align 8, !tbaa !14
%state36 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %indvars.iv.next, i64 %indvars.iv69, i32 1
store i32 -1, ptr %state36, align 4, !tbaa !9
%cmp24 = icmp ugt i64 %indvars.iv, 1
br i1 %cmp24, label %for.body26, label %for.inc40, !llvm.loop !17
for.inc40: ; preds = %for.body26, %for.inc.11
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond.not = icmp eq i64 %indvars.iv.next70, 6
br i1 %exitcond.not, label %for.end42, label %for.cond1.preheader, !llvm.loop !18
for.end42: ; preds = %for.inc40
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @findGroup(i32 noundef %i, i32 noundef %j) local_unnamed_addr #3 {
entry:
%mul = mul nsw i32 %i, 6
%add = add nsw i32 %mul, %j
%idxprom = sext i32 %i to i64
%idxprom1 = sext i32 %j to i64
%arrayidx2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom1
%state = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom1, i32 1
store i32 %add, ptr %state, align 4, !tbaa !9
%add3 = add nsw i32 %j, 1
%0 = load i8, ptr %arrayidx2, align 8, !tbaa !14
%call = tail call i32 @findGroup_body(i32 noundef %i, i32 noundef %add3, i8 noundef signext %0, i32 noundef %add, i32 noundef 0)
%add8 = add nsw i32 %i, 1
%1 = load i8, ptr %arrayidx2, align 8, !tbaa !14
%call14 = tail call i32 @findGroup_body(i32 noundef %add8, i32 noundef %j, i8 noundef signext %1, i32 noundef %add, i32 noundef 1)
%add15 = add i32 %call, 1
%add16 = add i32 %add15, %call14
ret i32 %add16
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @deleteGroup(i32 noundef %i, i32 noundef %j) local_unnamed_addr #3 {
entry:
%mul = mul nsw i32 %i, 6
%add = add nsw i32 %mul, %j
%idxprom = sext i32 %i to i64
%idxprom1 = sext i32 %j to i64
%arrayidx2 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom1
store i8 46, ptr %arrayidx2, align 8, !tbaa !14
%add8 = add nsw i32 %j, -1
tail call void @deleteGroup_body(i32 noundef %i, i32 noundef %add8, i32 noundef %add, i32 noundef 2)
%add5.1 = add nsw i32 %i, -1
tail call void @deleteGroup_body(i32 noundef %add5.1, i32 noundef %j, i32 noundef %add, i32 noundef 3)
%add8.2 = add nsw i32 %j, 1
tail call void @deleteGroup_body(i32 noundef %i, i32 noundef %add8.2, i32 noundef %add, i32 noundef 0)
%add5.3 = add nsw i32 %i, 1
tail call void @deleteGroup_body(i32 noundef %add5.3, i32 noundef %j, i32 noundef %add, i32 noundef 1)
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @findGroup_body(i32 noundef %i, i32 noundef %j, i8 noundef signext %color, i32 noundef %id, i32 noundef %comeDir) local_unnamed_addr #5 {
entry:
%or.cond = icmp ugt i32 %i, 11
%0 = icmp ugt i32 %j, 5
%or.cond40 = or i1 %or.cond, %0
br i1 %or.cond40, label %cleanup, label %lor.lhs.false6
lor.lhs.false6: ; preds = %entry
%idxprom = zext i32 %i to i64
%idxprom7 = zext i32 %j to i64
%state = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom7, i32 1
%1 = load i32, ptr %state, align 4, !tbaa !9
%cmp9 = icmp eq i32 %1, %id
br i1 %cmp9, label %cleanup, label %lor.lhs.false10
lor.lhs.false10: ; preds = %lor.lhs.false6
%arrayidx8 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom7
%2 = load i8, ptr %arrayidx8, align 8, !tbaa !14
%cmp17.not = icmp eq i8 %2, %color
br i1 %cmp17.not, label %if.end, label %cleanup
if.end: ; preds = %lor.lhs.false10
store i32 %id, ptr %state, align 4, !tbaa !9
%cmp26.not = icmp eq i32 %comeDir, 0
br i1 %cmp26.not, label %for.inc.1, label %for.inc
for.inc: ; preds = %if.end
%add33 = add nsw i32 %j, -1
%call = tail call i32 @findGroup_body(i32 noundef %i, i32 noundef %add33, i8 noundef signext %color, i32 noundef %id, i32 noundef 2)
%cmp26.not.1 = icmp eq i32 %comeDir, 1
br i1 %cmp26.not.1, label %for.inc.2, label %for.inc.1
for.inc.1: ; preds = %if.end, %for.inc
%tmp.166 = phi i32 [ %call, %for.inc ], [ 0, %if.end ]
%add.1 = add nsw i32 %i, -1
%call.1 = tail call i32 @findGroup_body(i32 noundef %add.1, i32 noundef %j, i8 noundef signext %color, i32 noundef %id, i32 noundef 3)
%add35.1 = add nsw i32 %call.1, %tmp.166
%cmp26.not.2 = icmp eq i32 %comeDir, 2
br i1 %cmp26.not.2, label %if.then28.3, label %for.inc.2
for.inc.2: ; preds = %for.inc, %for.inc.1
%tmp.1.169 = phi i32 [ %add35.1, %for.inc.1 ], [ %call, %for.inc ]
%add33.2 = add nuw nsw i32 %j, 1
%call.2 = tail call i32 @findGroup_body(i32 noundef %i, i32 noundef %add33.2, i8 noundef signext %color, i32 noundef %id, i32 noundef 0)
%add35.2 = add nsw i32 %call.2, %tmp.1.169
%cmp26.not.3 = icmp eq i32 %comeDir, 3
br i1 %cmp26.not.3, label %for.inc.3, label %if.then28.3
if.then28.3: ; preds = %for.inc.1, %for.inc.2
%tmp.1.272 = phi i32 [ %add35.2, %for.inc.2 ], [ %add35.1, %for.inc.1 ]
%add.3 = add nuw nsw i32 %i, 1
%call.3 = tail call i32 @findGroup_body(i32 noundef %add.3, i32 noundef %j, i8 noundef signext %color, i32 noundef %id, i32 noundef 1)
%add35.3 = add nsw i32 %call.3, %tmp.1.272
br label %for.inc.3
for.inc.3: ; preds = %if.then28.3, %for.inc.2
%tmp.1.3 = phi i32 [ %add35.3, %if.then28.3 ], [ %add35.2, %for.inc.2 ]
%add37 = add nsw i32 %tmp.1.3, 1
br label %cleanup
cleanup: ; preds = %entry, %lor.lhs.false6, %lor.lhs.false10, %for.inc.3
%retval.0 = phi i32 [ %add37, %for.inc.3 ], [ 0, %lor.lhs.false10 ], [ 0, %lor.lhs.false6 ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @deleteGroup_body(i32 noundef %i, i32 noundef %j, i32 noundef %id, i32 noundef %comeDir) local_unnamed_addr #5 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then38.3, %entry
%i.tr = phi i32 [ %i, %entry ], [ %add.3, %if.then38.3 ]
%comeDir.tr = phi i32 [ %comeDir, %entry ], [ 1, %if.then38.3 ]
%or.cond = icmp ugt i32 %i.tr, 11
%0 = icmp ugt i32 %j, 5
%or.cond47 = or i1 %or.cond, %0
br i1 %or.cond47, label %cleanup, label %if.end
if.end: ; preds = %tailrecurse
%idxprom = zext i32 %i.tr to i64
%idxprom6 = zext i32 %j to i64
%arrayidx7 = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom6
%state = getelementptr inbounds [12 x [6 x %struct.FIELD]], ptr @field, i64 0, i64 %idxprom, i64 %idxprom6, i32 1
%1 = load i32, ptr %state, align 4, !tbaa !9
%cmp8.not = icmp eq i32 %1, %id
br i1 %cmp8.not, label %if.end23, label %if.then9
if.then9: ; preds = %if.end
%2 = load i8, ptr %arrayidx7, align 8, !tbaa !14
%cmp14 = icmp eq i8 %2, 79
br i1 %cmp14, label %if.then16, label %cleanup
if.then16: ; preds = %if.then9
store i8 46, ptr %arrayidx7, align 8, !tbaa !14
br label %cleanup
if.end23: ; preds = %if.end
store i8 46, ptr %arrayidx7, align 8, !tbaa !14
store i32 -1, ptr %state, align 4, !tbaa !9
%cmp36.not = icmp eq i32 %comeDir.tr, 0
br i1 %cmp36.not, label %for.inc.1.thread73, label %for.inc
for.inc.1.thread73: ; preds = %if.end23
%add.174 = add nsw i32 %i.tr, -1
tail call void @deleteGroup_body(i32 noundef %add.174, i32 noundef %j, i32 noundef %id, i32 noundef 3)
br label %for.inc.2.thread77
for.inc: ; preds = %if.end23
%add43 = add nsw i32 %j, -1
tail call void @deleteGroup_body(i32 noundef %i.tr, i32 noundef %add43, i32 noundef %id, i32 noundef 2)
%cmp36.not.1 = icmp eq i32 %comeDir.tr, 1
br i1 %cmp36.not.1, label %for.inc.2.thread77, label %for.inc.1
for.inc.1: ; preds = %for.inc
%add.1 = add nsw i32 %i.tr, -1
tail call void @deleteGroup_body(i32 noundef %add.1, i32 noundef %j, i32 noundef %id, i32 noundef 3)
%cmp36.not.2 = icmp eq i32 %comeDir.tr, 2
br i1 %cmp36.not.2, label %if.then38.3, label %for.inc.2
for.inc.2.thread77: ; preds = %for.inc.1.thread73, %for.inc
%add43.278 = add nuw nsw i32 %j, 1
tail call void @deleteGroup_body(i32 noundef %i.tr, i32 noundef %add43.278, i32 noundef %id, i32 noundef 0)
br label %if.then38.3
for.inc.2: ; preds = %for.inc.1
%add43.2 = add nuw nsw i32 %j, 1
tail call void @deleteGroup_body(i32 noundef %i.tr, i32 noundef %add43.2, i32 noundef %id, i32 noundef 0)
%cmp36.not.3 = icmp eq i32 %comeDir.tr, 3
br i1 %cmp36.not.3, label %cleanup, label %if.then38.3
if.then38.3: ; preds = %for.inc.1, %for.inc.2.thread77, %for.inc.2
%add.3 = add nuw nsw i32 %i.tr, 1
br label %tailrecurse
cleanup: ; preds = %for.inc.2, %if.then9, %if.then16, %tailrecurse
ret void
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, 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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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 = !{!"", !7, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i32 0, i32 2}
!14 = !{!10, !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <stdlib.h>
void
solver(int m1, int m2)
{
if (m1==m2) {
printf("0\n");
return;
}
printf("1\n");
}
int
main(int argc, char *argv[])
{
int m1, m2, d1, d2;
scanf("%d%d", &m1, &d1);
scanf("%d%d", &m2, &d2);
solver(m1, m2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213201/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213201/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @solver(i32 noundef %m1, i32 noundef %m2) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %m1, %m2
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%m1 = alloca i32, align 4
%m2 = alloca i32, align 4
%d1 = alloca i32, align 4
%d2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m1, ptr noundef nonnull %d1)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m2, ptr noundef nonnull %d2)
%0 = load i32, ptr %m1, align 4, !tbaa !5
%1 = load i32, ptr %m2, align 4, !tbaa !5
%cmp.i = icmp eq i32 %0, %1
%str.3.str.i = select i1 %cmp.i, ptr @str.3, ptr @str
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main(void){
int M1, D1, M2, D2;
scanf("%d %d", &M1, &D1);
scanf("%d %d", &M2, &D2);
if(D2==1){
printf("1");
}else{
printf("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213252/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%M1 = alloca i32, align 4
%D1 = alloca i32, align 4
%M2 = alloca i32, align 4
%D2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M1, ptr noundef nonnull %D1)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M2, ptr noundef nonnull %D2)
%0 = load i32, ptr %D2, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
%. = select i1 %cmp, i32 49, i32 48
%putchar = call i32 @putchar(i32 %.)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M1) #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 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int m1,m2,d1,d2;
scanf("%d%d%d%d",&m1,&d1,&m2,&d2);
if(m2-m1 == 1)printf("1\n");
else printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213302/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m1 = alloca i32, align 4
%m2 = alloca i32, align 4
%d1 = alloca i32, align 4
%d2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m1, ptr noundef nonnull %d1, ptr noundef nonnull %m2, ptr noundef nonnull %d2)
%0 = load i32, ptr %m2, align 4, !tbaa !5
%1 = load i32, ptr %m1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cmp = icmp eq i32 %sub, 1
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#define abs(a) ((a)>(0)?(a):-(a))
int n,A,B,C;
int min(int a,int b,int c,int d){
int min=a;
if(b<min)min=b;
if(c<min)min=c;
if(d<min)min=d;
return min;
}
int dfs(int a,int b,int c,int d,int *l){
if(d==n&&(a*b*c>0)) return abs(a-A)+abs(b-B)+abs(c-C)-30;
else if(d==n)return 1e9;
else{
int r1=dfs(a,b,c,d+1,l);
int r2=dfs(a+l[d],b,c,d+1,l)+10;
int r3=dfs(a,b+l[d],c,d+1,l)+10;
int r4=dfs(a,b,c+l[d],d+1,l)+10;
return min(r1,r2,r3,r4);
}
}
int main(){
int i;
scanf("%d%d%d%d",&n,&A,&B,&C);
int l[n];
for(i=0;i<n;i++)scanf("%d",&l[i]);
printf("%d",dfs(0,0,0,0,l));
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local global i32 0, align 4
@B = dso_local global i32 0, align 4
@C = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) local_unnamed_addr #0 {
entry:
%spec.select = tail call i32 @llvm.smin.i32(i32 %b, i32 %a)
%min.1 = tail call i32 @llvm.smin.i32(i32 %spec.select, i32 %c)
%min.2 = tail call i32 @llvm.smin.i32(i32 %min.1, i32 %d)
ret i32 %min.2
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d, ptr noundef %l) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %d
br i1 %cmp, label %land.lhs.true, label %if.else29
land.lhs.true: ; preds = %entry
%mul = mul nsw i32 %b, %a
%mul1 = mul nsw i32 %mul, %c
%cmp2 = icmp sgt i32 %mul1, 0
br i1 %cmp2, label %if.then, label %common.ret83
if.then: ; preds = %land.lhs.true
%1 = load i32, ptr @A, align 4, !tbaa !5
%sub = sub nsw i32 %a, %1
%cond = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
%2 = load i32, ptr @B, align 4, !tbaa !5
%sub7 = sub nsw i32 %b, %2
%cond15 = tail call i32 @llvm.abs.i32(i32 %sub7, i1 true)
%3 = load i32, ptr @C, align 4, !tbaa !5
%sub16 = sub nsw i32 %c, %3
%cond24 = tail call i32 @llvm.abs.i32(i32 %sub16, i1 true)
%add = add nsw i32 %cond, -30
%add25 = add i32 %add, %cond15
%sub26 = add i32 %add25, %cond24
br label %common.ret83
common.ret83: ; preds = %land.lhs.true, %if.then, %if.else29
%common.ret83.op = phi i32 [ %min.2.i, %if.else29 ], [ %sub26, %if.then ], [ 1000000000, %land.lhs.true ]
ret i32 %common.ret83.op
if.else29: ; preds = %entry
%add30 = add nsw i32 %d, 1
%call = tail call i32 @dfs(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %add30, ptr noundef %l)
%idxprom = sext i32 %d to i64
%arrayidx = getelementptr inbounds i32, ptr %l, i64 %idxprom
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add31 = add nsw i32 %4, %a
%call33 = tail call i32 @dfs(i32 noundef %add31, i32 noundef %b, i32 noundef %c, i32 noundef %add30, ptr noundef %l)
%add34 = add nsw i32 %call33, 10
%add37 = add nsw i32 %4, %b
%call39 = tail call i32 @dfs(i32 noundef %a, i32 noundef %add37, i32 noundef %c, i32 noundef %add30, ptr noundef %l)
%add40 = add nsw i32 %call39, 10
%add43 = add nsw i32 %4, %c
%call45 = tail call i32 @dfs(i32 noundef %a, i32 noundef %b, i32 noundef %add43, i32 noundef %add30, ptr noundef %l)
%add46 = add nsw i32 %call45, 10
%spec.select.i = tail call i32 @llvm.smin.i32(i32 %add34, i32 %call)
%min.1.i = tail call i32 @llvm.smin.i32(i32 %spec.select.i, i32 %add40)
%min.2.i = tail call i32 @llvm.smin.i32(i32 %min.1.i, i32 %add46)
br label %common.ret83
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @A, ptr noundef nonnull @B, ptr noundef nonnull @C)
%0 = load i32, ptr @n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%vla = alloca i32, i64 %1, align 16
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 @dfs(i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, ptr noundef nonnull %vla)
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call2)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int X,Y;
scanf("%d %d",&X,&Y);
if(Y%4 == 0 && Y/4 <= X && X <= Y/2){
printf("Yes");
}else if(Y%2 == 0 && Y%4 != 0 && Y/4+1 <= X && X <= Y/2){
printf("Yes");
}else{
printf("No");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213397/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213397/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"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:
%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 %Y, align 4, !tbaa !5
%1 = and i32 %0, 3
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%div = sdiv i32 %0, 4
%2 = load i32, ptr %X, align 4, !tbaa !5
%cmp1.not = icmp sgt i32 %div, %2
%div3 = sdiv i32 %0, 2
%cmp4.not = icmp sgt i32 %2, %div3
%or.cond = or i1 %cmp1.not, %cmp4.not
br i1 %or.cond, label %if.else19, label %if.end21
if.else: ; preds = %entry
%3 = and i32 %0, 1
%cmp7.not = icmp eq i32 %3, 0
br i1 %cmp7.not, label %land.lhs.true11, label %if.else19
land.lhs.true11: ; preds = %if.else
%div12 = sdiv i32 %0, 4
%4 = load i32, ptr %X, align 4, !tbaa !5
%cmp13.not.not = icmp sge i32 %div12, %4
%div15 = sdiv i32 %0, 2
%cmp16.not = icmp sgt i32 %4, %div15
%or.cond24 = or i1 %cmp13.not.not, %cmp16.not
br i1 %or.cond24, label %if.else19, label %if.end21
if.else19: ; preds = %land.lhs.true, %land.lhs.true11, %if.else
br label %if.end21
if.end21: ; preds = %land.lhs.true11, %land.lhs.true, %if.else19
%.str.1.sink = phi ptr [ @.str.2, %if.else19 ], [ @.str.1, %land.lhs.true ], [ @.str.1, %land.lhs.true11 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
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 t;
scanf("%d",&t);
while(t--)
{
long long int x,n;
scanf("%lld %lld",&x,&n);
if(x%2 == 0)
{
if(n%4 == 1)
{
x = x-n;
}
if(n%4 == 2)
{
x++;
}
if(n%4 == 3)
{
x = x + n + 1;
}
}
else
{
if(n%4 == 1)
{
x = x + n;
}
if(n%4 == 2)
{
x--;
}
if(n%4 == 3)
{
x = x - n - 1;
}
}
printf("%lld\n",x);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%x = alloca i64, align 8
%n = alloca i64, align 8
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
%dec36 = add nsw i32 %0, -1
store i32 %dec36, ptr %t, align 4, !tbaa !5
%tobool.not37 = icmp eq i32 %0, 0
br i1 %tobool.not37, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end30
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %n)
%1 = load i64, ptr %x, align 8, !tbaa !9
%2 = and i64 %1, 1
%cmp = icmp eq i64 %2, 0
%3 = load i64, ptr %n, align 8, !tbaa !9
%4 = and i64 %3, -9223372036854775805
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
switch i64 %4, label %if.end30 [
i64 1, label %if.end.thread
i64 2, label %if.then7
i64 3, label %if.then11
]
if.end.thread: ; preds = %if.then
%sub = sub nsw i64 %1, %3
store i64 %sub, ptr %x, align 8, !tbaa !9
br label %if.end30
if.then7: ; preds = %if.then
%inc = add nuw nsw i64 %1, 1
store i64 %inc, ptr %x, align 8, !tbaa !9
br label %if.end30
if.then11: ; preds = %if.then
%add = add i64 %3, 1
%add12 = add i64 %add, %1
store i64 %add12, ptr %x, align 8, !tbaa !9
br label %if.end30
if.else: ; preds = %while.body
switch i64 %4, label %if.end30 [
i64 1, label %if.end18.thread
i64 2, label %if.then21
i64 3, label %if.then26
]
if.end18.thread: ; preds = %if.else
%add17 = add nsw i64 %3, %1
store i64 %add17, ptr %x, align 8, !tbaa !9
br label %if.end30
if.then21: ; preds = %if.else
%dec22 = add nsw i64 %1, -1
store i64 %dec22, ptr %x, align 8, !tbaa !9
br label %if.end30
if.then26: ; preds = %if.else
%5 = xor i64 %3, -1
%sub28 = add i64 %1, %5
store i64 %sub28, ptr %x, align 8, !tbaa !9
br label %if.end30
if.end30: ; preds = %if.else, %if.then, %if.then21, %if.end18.thread, %if.then7, %if.end.thread, %if.then26, %if.then11
%6 = phi i64 [ %1, %if.else ], [ %1, %if.then ], [ %dec22, %if.then21 ], [ %add17, %if.end18.thread ], [ %inc, %if.then7 ], [ %sub, %if.end.thread ], [ %sub28, %if.then26 ], [ %add12, %if.then11 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %6)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
%7 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end30, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdbool.h>
int main() {
int x, y;
scanf("%d %d", &x, &y);
bool ok = 0;
for (int i = 0; i <= x; i++) {
if (i * 2 + (x - i) * 4 == y) ok = 1;
}
if (ok) printf("Yes\n");
else printf("No\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = 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:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%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
%cmp.not11 = icmp slt i32 %0, 0
br i1 %cmp.not11, label %if.else, label %iter.check
iter.check: ; preds = %entry
%1 = load i32, ptr %y, align 4, !tbaa !5
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check15 = icmp ult i32 %2, 16
br i1 %min.iters.check15, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i32 %2, -16
%broadcast.splatinsert = insertelement <16 x i32> poison, i32 %0, i64 0
%broadcast.splat = shufflevector <16 x i32> %broadcast.splatinsert, <16 x i32> poison, <16 x i32> zeroinitializer
%broadcast.splatinsert16 = insertelement <16 x i32> poison, i32 %1, i64 0
%broadcast.splat17 = shufflevector <16 x i32> %broadcast.splatinsert16, <16 x i32> poison, <16 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.ind = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <16 x i8> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%3 = shl nuw nsw <16 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%4 = sub nsw <16 x i32> %broadcast.splat, %vec.ind
%5 = shl nsw <16 x i32> %4, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
%6 = add nsw <16 x i32> %5, %3
%7 = icmp eq <16 x i32> %6, %broadcast.splat17
%8 = select <16 x i1> %7, <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <16 x i8> %vec.phi
%index.next = add nuw i32 %index, 16
%vec.ind.next = add <16 x i32> %vec.ind, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
%9 = icmp eq i32 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.select.cmp = icmp ne <16 x i8> %8, zeroinitializer
%10 = bitcast <16 x i1> %rdx.select.cmp to i16
%.not = icmp ne i16 %10, 0
%rdx.select = zext i1 %.not to i8
%cmp.n = icmp eq i32 %2, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i32 %2, 8
%min.epilog.iters.check.not.not = icmp eq i32 %n.vec.remaining, 0
br i1 %min.epilog.iters.check.not.not, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%bc.merge.rdx = phi i8 [ 0, %vector.main.loop.iter.check ], [ %rdx.select, %vec.epilog.iter.check ]
%bc.resume.val = phi i32 [ 0, %vector.main.loop.iter.check ], [ %n.vec, %vec.epilog.iter.check ]
%n.vec19 = and i32 %2, -8
%.splatinsert = insertelement <8 x i32> poison, i32 %bc.resume.val, i64 0
%.splat = shufflevector <8 x i32> %.splatinsert, <8 x i32> poison, <8 x i32> zeroinitializer
%induction = or <8 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
%minmax.ident.splatinsert = insertelement <8 x i8> poison, i8 %bc.merge.rdx, i64 0
%minmax.ident.splat = shufflevector <8 x i8> %minmax.ident.splatinsert, <8 x i8> poison, <8 x i32> zeroinitializer
%broadcast.splatinsert26 = insertelement <8 x i32> poison, i32 %0, i64 0
%broadcast.splat27 = shufflevector <8 x i32> %broadcast.splatinsert26, <8 x i32> poison, <8 x i32> zeroinitializer
%broadcast.splatinsert28 = insertelement <8 x i32> poison, i32 %1, i64 0
%broadcast.splat29 = shufflevector <8 x i32> %broadcast.splatinsert28, <8 x i32> poison, <8 x i32> zeroinitializer
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index22 = phi i32 [ %bc.resume.val, %vec.epilog.ph ], [ %index.next30, %vec.epilog.vector.body ]
%vec.ind23 = phi <8 x i32> [ %induction, %vec.epilog.ph ], [ %vec.ind.next24, %vec.epilog.vector.body ]
%vec.phi25 = phi <8 x i8> [ %minmax.ident.splat, %vec.epilog.ph ], [ %16, %vec.epilog.vector.body ]
%11 = shl nuw nsw <8 x i32> %vec.ind23, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%12 = sub nsw <8 x i32> %broadcast.splat27, %vec.ind23
%13 = shl nsw <8 x i32> %12, <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
%14 = add nsw <8 x i32> %13, %11
%15 = icmp eq <8 x i32> %14, %broadcast.splat29
%16 = select <8 x i1> %15, <8 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, <8 x i8> %vec.phi25
%index.next30 = add nuw i32 %index22, 8
%vec.ind.next24 = add <8 x i32> %vec.ind23, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
%17 = icmp eq i32 %index.next30, %n.vec19
br i1 %17, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !13
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%.scalar = bitcast <8 x i8> %16 to i64
%.not34 = icmp ne i64 %.scalar, 0
%rdx.select32 = zext i1 %.not34 to i8
%cmp.n21 = icmp eq i32 %2, %n.vec19
br i1 %cmp.n21, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%i.013.ph = phi i32 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec19, %vec.epilog.middle.block ]
%ok.012.ph = phi i8 [ 0, %iter.check ], [ %rdx.select, %vec.epilog.iter.check ], [ %rdx.select32, %vec.epilog.middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %vec.epilog.middle.block, %middle.block
%spec.select.lcssa = phi i8 [ %rdx.select, %middle.block ], [ %rdx.select32, %vec.epilog.middle.block ], [ %spec.select, %for.body ]
%18 = and i8 %spec.select.lcssa, 1
%19 = icmp eq i8 %18, 0
br i1 %19, label %if.else, label %if.end6
for.body: ; preds = %for.body.preheader, %for.body
%i.013 = phi i32 [ %inc, %for.body ], [ %i.013.ph, %for.body.preheader ]
%ok.012 = phi i8 [ %spec.select, %for.body ], [ %ok.012.ph, %for.body.preheader ]
%mul = shl nuw nsw i32 %i.013, 1
%sub = sub nsw i32 %0, %i.013
%mul1 = shl nsw i32 %sub, 2
%add = add nsw i32 %mul1, %mul
%cmp2 = icmp eq i32 %add, %1
%spec.select = select i1 %cmp2, i8 1, i8 %ok.012
%inc = add nuw i32 %i.013, 1
%exitcond.not = icmp eq i32 %i.013, %0
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
if.else: ; preds = %entry, %for.cond.cleanup
br label %if.end6
if.end6: ; preds = %for.cond.cleanup, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.cond.cleanup ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11, !12}
!14 = distinct !{!14, !10, !12, !11}
|
#include<stdio.h>
int main(void) {
int x, y;
scanf("%d %d", &x, &y);
if (2*x <= y && y <= 4*x && y % 2 == 0)
printf("Yes");
else
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213526/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213526/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"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:
%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
%mul = shl nsw i32 %0, 1
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp.not = icmp sle i32 %mul, %1
%mul1 = shl nsw i32 %0, 2
%cmp2.not = icmp sle i32 %1, %mul1
%or.cond.not8 = select i1 %cmp.not, i1 %cmp2.not, i1 false
%2 = and i32 %1, 1
%cmp4 = icmp eq i32 %2, 0
%or.cond7 = and i1 %or.cond.not8, %cmp4
%.str.1..str.2 = select i1 %or.cond7, ptr @.str.1, ptr @.str.2
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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>
#include <string.h>
int main() {
int s[5], i, n, x, ans;
memset(s, 0, sizeof s);
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
s[x]++;
}
ans = s[4];
x = s[1] < s[3] ? s[1] : s[3];
ans += x;
s[1] -= x;
s[3] -= x;
ans += s[2] / 2;
s[2] %= 2;
if (s[3])
ans += s[3] + s[2];
else
ans += (s[1] + s[2] * 2 + 3) / 4;
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21357/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21357/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%s = alloca [5 x i32], align 16
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %s, i8 0, i64 20, 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
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.033 = phi i32 [ %inc2, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc2 = add nuw nsw i32 %i.033, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %3
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%arrayidx3.phi.trans.insert = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 4
%.pre = load i32, ptr %arrayidx3.phi.trans.insert, align 16, !tbaa !5
%arrayidx4.phi.trans.insert = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 1
%.pre34 = load i32, ptr %arrayidx4.phi.trans.insert, align 4
%arrayidx5.phi.trans.insert = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 3
%.pre35 = load i32, ptr %arrayidx5.phi.trans.insert, align 4
%arrayidx12.phi.trans.insert = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 2
%.pre36 = load i32, ptr %arrayidx12.phi.trans.insert, align 8, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%4 = phi i32 [ %.pre36, %for.end.loopexit ], [ 0, %entry ]
%5 = phi i32 [ %.pre35, %for.end.loopexit ], [ 0, %entry ]
%6 = phi i32 [ %.pre34, %for.end.loopexit ], [ 0, %entry ]
%7 = phi i32 [ %.pre, %for.end.loopexit ], [ 0, %entry ]
%cond = call i32 @llvm.smin.i32(i32 %6, i32 %5)
store i32 %cond, ptr %x, align 4, !tbaa !5
%rem = srem i32 %4, 2
%div = sdiv i32 %4, 2
%tobool.not.not = icmp sgt i32 %5, %6
br i1 %tobool.not.not, label %if.then, label %if.else
if.then: ; preds = %for.end
%sub11 = sub nsw i32 %5, %cond
%add18 = add nsw i32 %rem, %sub11
br label %if.end
if.else: ; preds = %for.end
%sub = sub nsw i32 %6, %cond
%mul = shl nsw i32 %rem, 1
%add22 = add i32 %sub, 3
%add23 = add i32 %add22, %mul
%div24 = sdiv i32 %add23, 4
br label %if.end
if.end: ; preds = %if.else, %if.then
%add18.pn = phi i32 [ %add18, %if.then ], [ %div24, %if.else ]
%add = add nsw i32 %cond, %7
%add13 = add nsw i32 %add, %div
%ans.0 = add nsw i32 %add13, %add18.pn
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(){
int a,b;
double c,d;
scanf("%d %d",&a,&b);
c = (double)a*2-(double)b/2;
d = floor(c);
if(c == d && 0<=c && a-c>=0){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213612/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213612/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %b, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%neg = fmul double %conv1, -5.000000e-01
%2 = call double @llvm.fmuladd.f64(double %conv, double 2.000000e+00, double %neg)
%3 = call double @llvm.floor.f64(double %2)
%cmp = fcmp une double %2, %3
%cmp3 = fcmp ult double %2, 0.000000e+00
%or.cond.not16 = or i1 %cmp3, %cmp
%sub = fsub double %conv, %2
%cmp7 = fcmp ult double %sub, 0.000000e+00
%or.cond15 = select i1 %or.cond.not16, i1 true, i1 %cmp7
%str.str.3 = select i1 %or.cond15, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int h, f;
scanf("%d%d", &h, &f);
int ashi = h*2;
int flag=0;
for(int kame = 0; ashi <= f && kame <= h; kame++)
{
ashi = (h-kame) * 2 + kame * 4;
if(ashi==f)
flag =1;
}
if(flag==1)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213656/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213656/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = 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:
%h = alloca i32, align 4
%f = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %f)
%0 = load i32, ptr %h, align 4
%mul = shl nsw i32 %0, 1
%1 = load i32, ptr %f, align 4, !tbaa !5
%cmp16 = icmp sle i32 %mul, %1
%cmp117 = icmp sgt i32 %0, -1
%2 = and i1 %cmp16, %cmp117
br i1 %2, label %for.body, label %if.else
for.cond.cleanup: ; preds = %for.body
%3 = icmp eq i32 %spec.select, 1
br i1 %3, label %if.end9, label %if.else
for.body: ; preds = %entry, %for.body
%kame.019 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%flag.018 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%sub = sub nsw i32 %0, %kame.019
%mul2 = shl nsw i32 %sub, 1
%mul3 = shl nsw i32 %kame.019, 2
%add = add nsw i32 %mul2, %mul3
%cmp4 = icmp eq i32 %add, %1
%spec.select = select i1 %cmp4, i32 1, i32 %flag.018
%inc = add nuw nsw i32 %kame.019, 1
%cmp = icmp sle i32 %add, %1
%cmp1 = icmp slt i32 %kame.019, %0
%4 = and i1 %cmp, %cmp1
br i1 %4, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.else: ; preds = %entry, %for.cond.cleanup
br label %if.end9
if.end9: ; preds = %for.cond.cleanup, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.cond.cleanup ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main (void)
{
int X,Y,t;
scanf("%d",&Y);
scanf("%d",&X);
t=(4*Y-X)/2;
if(Y-t>=0&&t>=0&&X%2==0)
{
puts("Yes");
}else{
puts("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213706/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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 %Y)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %Y, align 4, !tbaa !5
%mul = shl nsw i32 %0, 2
%1 = load i32, ptr %X, align 4, !tbaa !5
%sub = sub nsw i32 %mul, %1
%div = sdiv i32 %sub, 2
%cmp = icmp sge i32 %0, %div
%cmp3 = icmp sgt i32 %sub, -2
%or.cond = and i1 %cmp3, %cmp
%2 = and i32 %1, 1
%cmp5 = icmp eq i32 %2, 0
%or.cond9 = and i1 %cmp5, %or.cond
%.str.1..str.2 = select i1 %or.cond9, ptr @.str.1, ptr @.str.2
%call7 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int groups_by_size[5];
int main() {
int n;
scanf("%d ", &n);
int i;
for (i = 0; i < n; ++i) {
int size;
scanf("%d ", &size);
++groups_by_size[size];
}
int answer = groups_by_size[4] + groups_by_size[3] + groups_by_size[2] / 2
+ groups_by_size[2] % 2
+ ((groups_by_size[1] -= groups_by_size[3] + 2 * (groups_by_size[2] % 2)) < 0?
0: groups_by_size[1] / 4 + !!(groups_by_size[1] % 4));
printf("%d\n", answer);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@groups_by_size = dso_local local_unnamed_addr global [5 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
%size = 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
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.017 = phi i32 [ %inc2, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %size)
%1 = load i32, ptr %size, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [5 x i32], ptr @groups_by_size, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #3
%inc2 = add nuw nsw i32 %i.017, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%4 = load i32, ptr getelementptr inbounds ([5 x i32], ptr @groups_by_size, i64 0, i64 4), align 16, !tbaa !5
%5 = load i32, ptr getelementptr inbounds ([5 x i32], ptr @groups_by_size, i64 0, i64 3), align 4, !tbaa !5
%6 = load i32, ptr getelementptr inbounds ([5 x i32], ptr @groups_by_size, i64 0, i64 2), align 8, !tbaa !5
%rem = srem i32 %6, 2
%div = sdiv i32 %6, 2
%7 = load i32, ptr getelementptr inbounds ([5 x i32], ptr @groups_by_size, i64 0, i64 1), align 4, !tbaa !5
%8 = shl nsw i32 %rem, 1
%9 = add i32 %5, %8
%sub = sub i32 %7, %9
store i32 %sub, ptr getelementptr inbounds ([5 x i32], ptr @groups_by_size, i64 0, i64 1), align 4, !tbaa !5
%cmp7 = icmp slt i32 %sub, 0
br i1 %cmp7, label %cond.end, label %cond.false
cond.false: ; preds = %for.end
%div815 = lshr i32 %sub, 2
%rem9 = and i32 %sub, 3
%tobool = icmp ne i32 %rem9, 0
%lnot.ext = zext i1 %tobool to i32
%add11 = add nuw nsw i32 %div815, %lnot.ext
br label %cond.end
cond.end: ; preds = %for.end, %cond.false
%cond = phi i32 [ %add11, %cond.false ], [ 0, %for.end ]
%add = add nsw i32 %5, %4
%add3 = add nsw i32 %add, %div
%add4 = add nsw i32 %add3, %rem
%add12 = add nsw i32 %add4, %cond
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add12)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int x,y;
scanf("%d%d",&x,&y);
y -= 2 * x;
puts(y < 0 || y > 2*x || y % 2 ?"No":"Yes");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213793/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213793/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%mul = shl nsw i32 %0, 1
%1 = load i32, ptr %y, align 4, !tbaa !5
%sub = sub nsw i32 %1, %mul
store i32 %sub, ptr %y, align 4, !tbaa !5
%cmp = icmp slt i32 %sub, 0
%cmp2 = icmp sgt i32 %sub, %mul
%or.cond = or i1 %cmp, %cmp2
%rem = and i32 %1, 1
%tobool.not = icmp eq i32 %rem, 0
%2 = select i1 %tobool.not, ptr @.str.2, ptr @.str.1
%cond = select i1 %or.cond, ptr @.str.1, ptr %2
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void){
char s[7];
scanf("%s",&s);
if(strcmp(s,"Sunny")==0){printf("Cloudy");}
if(strcmp(s,"Cloudy")==0){printf("Rainy");}
if(strcmp(s,"Rainy")==0){printf("Sunny");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213843/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [7 x i8], align 1
call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %s, ptr noundef nonnull dereferenceable(6) @.str.1, i64 6)
%cmp = icmp eq i32 %bcmp, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.then, %entry
%bcmp15 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %s, ptr noundef nonnull dereferenceable(7) @.str.2, i64 7)
%cmp5 = icmp eq i32 %bcmp15, 0
br i1 %cmp5, label %if.then6, label %if.end8
if.then6: ; preds = %if.end
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end8
if.end8: ; preds = %if.then6, %if.end
%bcmp16 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %s, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6)
%cmp11 = icmp eq i32 %bcmp16, 0
br i1 %cmp11, label %if.then12, label %if.end14
if.then12: ; preds = %if.end8
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end14
if.end14: ; preds = %if.then12, %if.end8
call void @llvm.lifetime.end.p0(i64 7, 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 willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 willreturn memory(argmem: read) }
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)"}
|
#include<stdio.h>
#include<string.h>
int main(){
char S[10];
char *A="Sunny";
char *B="Cloudy";
char *C="Rainy";
scanf("%s",&S);
if(strcmp(S,A)==0){
printf("%s",B);
}else if(strcmp(S,B)==0){
printf("%s",C);
}else if(strcmp(S,C)==0){
printf("%s",A);
}else{
printf("error");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213900/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213900/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Sunny\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %S)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %S, ptr noundef nonnull dereferenceable(6) @.str, i64 6)
%cmp = icmp eq i32 %bcmp, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull @.str.1)
br label %if.end17
if.else: ; preds = %entry
%bcmp21 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %S, ptr noundef nonnull dereferenceable(7) @.str.1, i64 7)
%cmp5 = icmp eq i32 %bcmp21, 0
br i1 %cmp5, label %if.then6, label %if.else8
if.then6: ; preds = %if.else
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull @.str.2)
br label %if.end17
if.else8: ; preds = %if.else
%bcmp22 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %S, ptr noundef nonnull dereferenceable(6) @.str.2, i64 6)
%cmp11 = icmp eq i32 %bcmp22, 0
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else8
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull @.str)
br label %if.end17
if.else14: ; preds = %if.else8
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
br label %if.end17
if.end17: ; preds = %if.then6, %if.else14, %if.then12, %if.then
call void @llvm.lifetime.end.p0(i64 10, 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 willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 willreturn memory(argmem: read) }
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)"}
|
#include<stdio.h>
#include<string.h>
int main (void){
char S[100];
char *s1 = "Sunny";
char *s2 = "Rainy";
char *s3 = "Cloudy";
scanf("%s",S);
if(strcmp(S,s1)== 0){
printf("Cloudy\n");
}else if(strcmp(S,s2)==0){
printf("Sunny\n");
}else if(strcmp(S,s3)==0){
printf("Rainy\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_213959/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_213959/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@str.7 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %S)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %S, ptr noundef nonnull dereferenceable(6) @str.7, i64 6)
%cmp = icmp eq i32 %bcmp, 0
br i1 %cmp, label %if.end16.sink.split, label %if.else
if.else: ; preds = %entry
%bcmp17 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %S, ptr noundef nonnull dereferenceable(6) @str, i64 6)
%cmp6 = icmp eq i32 %bcmp17, 0
br i1 %cmp6, label %if.end16.sink.split, label %if.else9
if.else9: ; preds = %if.else
%bcmp18 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %S, ptr noundef nonnull dereferenceable(7) @str.8, i64 7)
%cmp12 = icmp eq i32 %bcmp18, 0
br i1 %cmp12, label %if.end16.sink.split, label %if.end16
if.end16.sink.split: ; preds = %if.else9, %if.else, %entry
%str.7.sink = phi ptr [ @str.8, %entry ], [ @str.7, %if.else ], [ @str, %if.else9 ]
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
br label %if.end16
if.end16: ; preds = %if.end16.sink.split, %if.else9
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 willreturn memory(argmem: read) }
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)"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char S[10];
scanf("%s", S);
if(strcmp(S, "Sunny") == 0){
printf("Cloudy\n");
}
else if(strcmp(S, "Cloudy") == 0){
printf("Rainy\n");
}
else{
printf("Sunny\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214000/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214000/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %S) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %S, ptr noundef nonnull dereferenceable(6) @str, i64 6)
%cmp = icmp eq i32 %bcmp, 0
br i1 %cmp, label %if.end11, label %if.else
if.else: ; preds = %entry
%bcmp12 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %S, ptr noundef nonnull dereferenceable(7) @str.7, i64 7)
%cmp6 = icmp eq i32 %bcmp12, 0
%str.6.str = select i1 %cmp6, ptr @str.6, ptr @str
br label %if.end11
if.end11: ; preds = %if.else, %entry
%str.6.sink = phi ptr [ @str.7, %entry ], [ %str.6.str, %if.else ]
%puts13 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %S) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 willreturn memory(argmem: read) }
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)"}
|
#include <stdio.h>
int main(void)
{
char s[6];
scanf("%s", s);
if(s[0] == 'S'){
printf("Cloudy");
}else if(s[0] == 'C'){
printf("Rainy");
}else{
printf("Sunny");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214044/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214044/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [6 x i8], align 1
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%switch.selectcmp = icmp eq i8 %0, 67
%switch.select = select i1 %switch.selectcmp, ptr @.str.2, ptr @.str.3
%switch.selectcmp12 = icmp eq i8 %0, 83
%switch.select13 = select i1 %switch.selectcmp12, ptr @.str.1, ptr %switch.select
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %switch.select13)
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
char *w[256] = {};
w['S'] = "Cloudy";
w['C'] = "Rainy";
w['R'] = "Sunny";
char s[256];
fgets(s, 256, stdin);
puts(w[s[0]]);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214101/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214101/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Cloudy\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca [256 x ptr], align 16
%s = alloca [256 x i8], align 16
call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %w) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2048) %w, i8 0, i64 2048, i1 false)
%arrayidx = getelementptr inbounds [256 x ptr], ptr %w, i64 0, i64 83
store ptr @.str, ptr %arrayidx, align 8, !tbaa !5
%arrayidx1 = getelementptr inbounds [256 x ptr], ptr %w, i64 0, i64 67
store ptr @.str.1, ptr %arrayidx1, align 8, !tbaa !5
%arrayidx2 = getelementptr inbounds [256 x ptr], ptr %w, i64 0, i64 82
store ptr @.str.2, ptr %arrayidx2, align 16, !tbaa !5
call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %s) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %s, i32 noundef 256, ptr noundef %0)
%1 = load i8, ptr %s, align 16, !tbaa !9
%idxprom = sext i8 %1 to i64
%arrayidx4 = getelementptr inbounds [256 x ptr], ptr %w, i64 0, i64 %idxprom
%2 = load ptr, ptr %arrayidx4, align 8, !tbaa !5
%call5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %2)
call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
|
#include<stdio.h>
int main(){
char s[11];
scanf("%s",s);
if(s[0]=='S')puts("Cloudy");
if(s[0]=='C')puts("Rainy");
if(s[0]=='R')puts("Sunny");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214145/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214145/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 83
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call2 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
%.pr = load i8, ptr %s, align 1, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%1 = phi i8 [ %.pr, %if.then ], [ %0, %entry ]
%cmp5 = icmp eq i8 %1, 67
br i1 %cmp5, label %if.then7, label %if.end9
if.then7: ; preds = %if.end
%call8 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
%.pre = load i8, ptr %s, align 1, !tbaa !5
br label %if.end9
if.end9: ; preds = %if.then7, %if.end
%2 = phi i8 [ %.pre, %if.then7 ], [ %1, %if.end ]
%cmp12 = icmp eq i8 %2, 82
br i1 %cmp12, label %if.then14, label %if.end16
if.then14: ; preds = %if.end9
%call15 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end16
if.end16: ; preds = %if.then14, %if.end9
call void @llvm.lifetime.end.p0(i64 11, 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
typedef long long ll;
int main(){
char s[20];
scanf("%s",s);
if(s[0] == 'S') printf("Cloudy");
if(s[0] == 'C') printf("Rainy");
if(s[0] == 'R') printf("Sunny");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214196/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214196/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp = icmp eq i8 %0, 83
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%.pr = load i8, ptr %s, align 16, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%1 = phi i8 [ %.pr, %if.then ], [ %0, %entry ]
%cmp5 = icmp eq i8 %1, 67
br i1 %cmp5, label %if.then7, label %if.end9
if.then7: ; preds = %if.end
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
%.pre = load i8, ptr %s, align 16, !tbaa !5
br label %if.end9
if.end9: ; preds = %if.then7, %if.end
%2 = phi i8 [ %.pre, %if.then7 ], [ %1, %if.end ]
%cmp12 = icmp eq i8 %2, 82
br i1 %cmp12, label %if.then14, label %if.end16
if.then14: ; preds = %if.end9
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %if.end16
if.end16: ; preds = %if.then14, %if.end9
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define SIZE10 100000
typedef long long int ll;
typedef unsigned char u8;
int main(void){
int A = 0, B = 0, C = 0;
int N = 0;
int sum = 0;
char w[10];
scanf("%s", w);
if(w[0] == 'S'){
printf("Cloudy");
}
else if(w[0] == 'C'){
printf("Rainy");
}
else{
printf("Sunny");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214239/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214239/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"Cloudy\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Rainy\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"Sunny\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i8, ptr %w, align 1, !tbaa !5
%switch.selectcmp = icmp eq i8 %0, 67
%switch.select = select i1 %switch.selectcmp, ptr @.str.2, ptr @.str.3
%switch.selectcmp12 = icmp eq i8 %0, 83
%switch.select13 = select i1 %switch.selectcmp12, ptr @.str.1, ptr %switch.select
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %switch.select13)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %w) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int cards[128][14]={{0}};
int i,N;
scanf("%d",&N);
for(i=0;i<N;i++){
char c;
int cn;
scanf("%c",&c);
scanf("%c %d",&c,&cn);
cards[c][cn]=1;
}
for(i=1;i<=13;i++){
if(cards['S'][i]==0){
printf("S %d\n",i);
}
}
for(i=1;i<=13;i++){
if(cards['H'][i]==0){
printf("H %d\n",i);
}
}
for(i=1;i<=13;i++){
if(cards['C'][i]==0){
printf("C %d\n",i);
}
}
for(i=1;i<=13;i++){
if(cards['D'][i]==0){
printf("D %d\n",i);
}
}
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214297/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214297/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c %d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"S %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"H %d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"C %d\0A\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"D %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%cards = alloca [128 x [14 x i32]], align 16
%N = alloca i32, align 4
%c = alloca i8, align 1
%cn = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 7168, ptr nonnull %cards) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(7168) %cards, i8 0, i64 7168, i1 false)
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
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %entry
%arrayidx10 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 1
%1 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %1, 0
br i1 %cmp11, label %if.then, label %for.inc13
for.body: ; preds = %entry, %for.body
%i.073 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cn) #4
%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 %c, ptr noundef nonnull %cn)
%2 = load i8, ptr %c, align 1, !tbaa !9
%idxprom = sext i8 %2 to i64
%3 = load i32, ptr %cn, align 4, !tbaa !5
%idxprom3 = sext i32 %3 to i64
%arrayidx4 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 %idxprom, i64 %idxprom3
store i32 1, ptr %arrayidx4, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cn) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #4
%inc = add nuw nsw i32 %i.073, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !10
if.then: ; preds = %for.cond5.preheader
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 1)
br label %for.inc13
for.inc13: ; preds = %for.cond5.preheader, %if.then
%arrayidx10.1 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 2
%5 = load i32, ptr %arrayidx10.1, align 16, !tbaa !5
%cmp11.1 = icmp eq i32 %5, 0
br i1 %cmp11.1, label %if.then.1, label %for.inc13.1
if.then.1: ; preds = %for.inc13
%call12.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 2)
br label %for.inc13.1
for.inc13.1: ; preds = %if.then.1, %for.inc13
%arrayidx10.2 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 3
%6 = load i32, ptr %arrayidx10.2, align 4, !tbaa !5
%cmp11.2 = icmp eq i32 %6, 0
br i1 %cmp11.2, label %if.then.2, label %for.inc13.2
if.then.2: ; preds = %for.inc13.1
%call12.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 3)
br label %for.inc13.2
for.inc13.2: ; preds = %if.then.2, %for.inc13.1
%arrayidx10.3 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 4
%7 = load i32, ptr %arrayidx10.3, align 8, !tbaa !5
%cmp11.3 = icmp eq i32 %7, 0
br i1 %cmp11.3, label %if.then.3, label %for.inc13.3
if.then.3: ; preds = %for.inc13.2
%call12.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 4)
br label %for.inc13.3
for.inc13.3: ; preds = %if.then.3, %for.inc13.2
%arrayidx10.4 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 5
%8 = load i32, ptr %arrayidx10.4, align 4, !tbaa !5
%cmp11.4 = icmp eq i32 %8, 0
br i1 %cmp11.4, label %if.then.4, label %for.inc13.4
if.then.4: ; preds = %for.inc13.3
%call12.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 5)
br label %for.inc13.4
for.inc13.4: ; preds = %if.then.4, %for.inc13.3
%arrayidx10.5 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 6
%9 = load i32, ptr %arrayidx10.5, align 16, !tbaa !5
%cmp11.5 = icmp eq i32 %9, 0
br i1 %cmp11.5, label %if.then.5, label %for.inc13.5
if.then.5: ; preds = %for.inc13.4
%call12.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 6)
br label %for.inc13.5
for.inc13.5: ; preds = %if.then.5, %for.inc13.4
%arrayidx10.6 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 7
%10 = load i32, ptr %arrayidx10.6, align 4, !tbaa !5
%cmp11.6 = icmp eq i32 %10, 0
br i1 %cmp11.6, label %if.then.6, label %for.inc13.6
if.then.6: ; preds = %for.inc13.5
%call12.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 7)
br label %for.inc13.6
for.inc13.6: ; preds = %if.then.6, %for.inc13.5
%arrayidx10.7 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 8
%11 = load i32, ptr %arrayidx10.7, align 8, !tbaa !5
%cmp11.7 = icmp eq i32 %11, 0
br i1 %cmp11.7, label %if.then.7, label %for.inc13.7
if.then.7: ; preds = %for.inc13.6
%call12.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 8)
br label %for.inc13.7
for.inc13.7: ; preds = %if.then.7, %for.inc13.6
%arrayidx10.8 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 9
%12 = load i32, ptr %arrayidx10.8, align 4, !tbaa !5
%cmp11.8 = icmp eq i32 %12, 0
br i1 %cmp11.8, label %if.then.8, label %for.inc13.8
if.then.8: ; preds = %for.inc13.7
%call12.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 9)
br label %for.inc13.8
for.inc13.8: ; preds = %if.then.8, %for.inc13.7
%arrayidx10.9 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 10
%13 = load i32, ptr %arrayidx10.9, align 16, !tbaa !5
%cmp11.9 = icmp eq i32 %13, 0
br i1 %cmp11.9, label %if.then.9, label %for.inc13.9
if.then.9: ; preds = %for.inc13.8
%call12.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 10)
br label %for.inc13.9
for.inc13.9: ; preds = %if.then.9, %for.inc13.8
%arrayidx10.10 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 11
%14 = load i32, ptr %arrayidx10.10, align 4, !tbaa !5
%cmp11.10 = icmp eq i32 %14, 0
br i1 %cmp11.10, label %if.then.10, label %for.inc13.10
if.then.10: ; preds = %for.inc13.9
%call12.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 11)
br label %for.inc13.10
for.inc13.10: ; preds = %if.then.10, %for.inc13.9
%arrayidx10.11 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 12
%15 = load i32, ptr %arrayidx10.11, align 8, !tbaa !5
%cmp11.11 = icmp eq i32 %15, 0
br i1 %cmp11.11, label %if.then.11, label %for.inc13.11
if.then.11: ; preds = %for.inc13.10
%call12.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 12)
br label %for.inc13.11
for.inc13.11: ; preds = %if.then.11, %for.inc13.10
%arrayidx10.12 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 83, i64 13
%16 = load i32, ptr %arrayidx10.12, align 4, !tbaa !5
%cmp11.12 = icmp eq i32 %16, 0
br i1 %cmp11.12, label %if.then.12, label %for.inc13.12
if.then.12: ; preds = %for.inc13.11
%call12.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 13)
br label %for.inc13.12
for.inc13.12: ; preds = %if.then.12, %for.inc13.11
%arrayidx21 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 1
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp eq i32 %17, 0
br i1 %cmp22, label %if.then23, label %for.inc26
if.then23: ; preds = %for.inc13.12
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 1)
br label %for.inc26
for.inc26: ; preds = %for.inc13.12, %if.then23
%arrayidx21.1 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 2
%18 = load i32, ptr %arrayidx21.1, align 8, !tbaa !5
%cmp22.1 = icmp eq i32 %18, 0
br i1 %cmp22.1, label %if.then23.1, label %for.inc26.1
if.then23.1: ; preds = %for.inc26
%call24.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 2)
br label %for.inc26.1
for.inc26.1: ; preds = %if.then23.1, %for.inc26
%arrayidx21.2 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 3
%19 = load i32, ptr %arrayidx21.2, align 4, !tbaa !5
%cmp22.2 = icmp eq i32 %19, 0
br i1 %cmp22.2, label %if.then23.2, label %for.inc26.2
if.then23.2: ; preds = %for.inc26.1
%call24.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 3)
br label %for.inc26.2
for.inc26.2: ; preds = %if.then23.2, %for.inc26.1
%arrayidx21.3 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 4
%20 = load i32, ptr %arrayidx21.3, align 16, !tbaa !5
%cmp22.3 = icmp eq i32 %20, 0
br i1 %cmp22.3, label %if.then23.3, label %for.inc26.3
if.then23.3: ; preds = %for.inc26.2
%call24.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 4)
br label %for.inc26.3
for.inc26.3: ; preds = %if.then23.3, %for.inc26.2
%arrayidx21.4 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 5
%21 = load i32, ptr %arrayidx21.4, align 4, !tbaa !5
%cmp22.4 = icmp eq i32 %21, 0
br i1 %cmp22.4, label %if.then23.4, label %for.inc26.4
if.then23.4: ; preds = %for.inc26.3
%call24.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 5)
br label %for.inc26.4
for.inc26.4: ; preds = %if.then23.4, %for.inc26.3
%arrayidx21.5 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 6
%22 = load i32, ptr %arrayidx21.5, align 8, !tbaa !5
%cmp22.5 = icmp eq i32 %22, 0
br i1 %cmp22.5, label %if.then23.5, label %for.inc26.5
if.then23.5: ; preds = %for.inc26.4
%call24.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 6)
br label %for.inc26.5
for.inc26.5: ; preds = %if.then23.5, %for.inc26.4
%arrayidx21.6 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 7
%23 = load i32, ptr %arrayidx21.6, align 4, !tbaa !5
%cmp22.6 = icmp eq i32 %23, 0
br i1 %cmp22.6, label %if.then23.6, label %for.inc26.6
if.then23.6: ; preds = %for.inc26.5
%call24.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 7)
br label %for.inc26.6
for.inc26.6: ; preds = %if.then23.6, %for.inc26.5
%arrayidx21.7 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 8
%24 = load i32, ptr %arrayidx21.7, align 16, !tbaa !5
%cmp22.7 = icmp eq i32 %24, 0
br i1 %cmp22.7, label %if.then23.7, label %for.inc26.7
if.then23.7: ; preds = %for.inc26.6
%call24.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 8)
br label %for.inc26.7
for.inc26.7: ; preds = %if.then23.7, %for.inc26.6
%arrayidx21.8 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 9
%25 = load i32, ptr %arrayidx21.8, align 4, !tbaa !5
%cmp22.8 = icmp eq i32 %25, 0
br i1 %cmp22.8, label %if.then23.8, label %for.inc26.8
if.then23.8: ; preds = %for.inc26.7
%call24.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 9)
br label %for.inc26.8
for.inc26.8: ; preds = %if.then23.8, %for.inc26.7
%arrayidx21.9 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 10
%26 = load i32, ptr %arrayidx21.9, align 8, !tbaa !5
%cmp22.9 = icmp eq i32 %26, 0
br i1 %cmp22.9, label %if.then23.9, label %for.inc26.9
if.then23.9: ; preds = %for.inc26.8
%call24.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 10)
br label %for.inc26.9
for.inc26.9: ; preds = %if.then23.9, %for.inc26.8
%arrayidx21.10 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 11
%27 = load i32, ptr %arrayidx21.10, align 4, !tbaa !5
%cmp22.10 = icmp eq i32 %27, 0
br i1 %cmp22.10, label %if.then23.10, label %for.inc26.10
if.then23.10: ; preds = %for.inc26.9
%call24.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 11)
br label %for.inc26.10
for.inc26.10: ; preds = %if.then23.10, %for.inc26.9
%arrayidx21.11 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 12
%28 = load i32, ptr %arrayidx21.11, align 16, !tbaa !5
%cmp22.11 = icmp eq i32 %28, 0
br i1 %cmp22.11, label %if.then23.11, label %for.inc26.11
if.then23.11: ; preds = %for.inc26.10
%call24.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 12)
br label %for.inc26.11
for.inc26.11: ; preds = %if.then23.11, %for.inc26.10
%arrayidx21.12 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 72, i64 13
%29 = load i32, ptr %arrayidx21.12, align 4, !tbaa !5
%cmp22.12 = icmp eq i32 %29, 0
br i1 %cmp22.12, label %if.then23.12, label %for.inc26.12
if.then23.12: ; preds = %for.inc26.11
%call24.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 13)
br label %for.inc26.12
for.inc26.12: ; preds = %if.then23.12, %for.inc26.11
%arrayidx34 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 1
%30 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%cmp35 = icmp eq i32 %30, 0
br i1 %cmp35, label %if.then36, label %for.inc39
if.then36: ; preds = %for.inc26.12
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 1)
br label %for.inc39
for.inc39: ; preds = %for.inc26.12, %if.then36
%arrayidx34.1 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 2
%31 = load i32, ptr %arrayidx34.1, align 16, !tbaa !5
%cmp35.1 = icmp eq i32 %31, 0
br i1 %cmp35.1, label %if.then36.1, label %for.inc39.1
if.then36.1: ; preds = %for.inc39
%call37.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 2)
br label %for.inc39.1
for.inc39.1: ; preds = %if.then36.1, %for.inc39
%arrayidx34.2 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 3
%32 = load i32, ptr %arrayidx34.2, align 4, !tbaa !5
%cmp35.2 = icmp eq i32 %32, 0
br i1 %cmp35.2, label %if.then36.2, label %for.inc39.2
if.then36.2: ; preds = %for.inc39.1
%call37.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 3)
br label %for.inc39.2
for.inc39.2: ; preds = %if.then36.2, %for.inc39.1
%arrayidx34.3 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 4
%33 = load i32, ptr %arrayidx34.3, align 8, !tbaa !5
%cmp35.3 = icmp eq i32 %33, 0
br i1 %cmp35.3, label %if.then36.3, label %for.inc39.3
if.then36.3: ; preds = %for.inc39.2
%call37.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 4)
br label %for.inc39.3
for.inc39.3: ; preds = %if.then36.3, %for.inc39.2
%arrayidx34.4 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 5
%34 = load i32, ptr %arrayidx34.4, align 4, !tbaa !5
%cmp35.4 = icmp eq i32 %34, 0
br i1 %cmp35.4, label %if.then36.4, label %for.inc39.4
if.then36.4: ; preds = %for.inc39.3
%call37.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 5)
br label %for.inc39.4
for.inc39.4: ; preds = %if.then36.4, %for.inc39.3
%arrayidx34.5 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 6
%35 = load i32, ptr %arrayidx34.5, align 16, !tbaa !5
%cmp35.5 = icmp eq i32 %35, 0
br i1 %cmp35.5, label %if.then36.5, label %for.inc39.5
if.then36.5: ; preds = %for.inc39.4
%call37.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 6)
br label %for.inc39.5
for.inc39.5: ; preds = %if.then36.5, %for.inc39.4
%arrayidx34.6 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 7
%36 = load i32, ptr %arrayidx34.6, align 4, !tbaa !5
%cmp35.6 = icmp eq i32 %36, 0
br i1 %cmp35.6, label %if.then36.6, label %for.inc39.6
if.then36.6: ; preds = %for.inc39.5
%call37.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 7)
br label %for.inc39.6
for.inc39.6: ; preds = %if.then36.6, %for.inc39.5
%arrayidx34.7 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 8
%37 = load i32, ptr %arrayidx34.7, align 8, !tbaa !5
%cmp35.7 = icmp eq i32 %37, 0
br i1 %cmp35.7, label %if.then36.7, label %for.inc39.7
if.then36.7: ; preds = %for.inc39.6
%call37.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 8)
br label %for.inc39.7
for.inc39.7: ; preds = %if.then36.7, %for.inc39.6
%arrayidx34.8 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 9
%38 = load i32, ptr %arrayidx34.8, align 4, !tbaa !5
%cmp35.8 = icmp eq i32 %38, 0
br i1 %cmp35.8, label %if.then36.8, label %for.inc39.8
if.then36.8: ; preds = %for.inc39.7
%call37.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 9)
br label %for.inc39.8
for.inc39.8: ; preds = %if.then36.8, %for.inc39.7
%arrayidx34.9 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 10
%39 = load i32, ptr %arrayidx34.9, align 16, !tbaa !5
%cmp35.9 = icmp eq i32 %39, 0
br i1 %cmp35.9, label %if.then36.9, label %for.inc39.9
if.then36.9: ; preds = %for.inc39.8
%call37.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 10)
br label %for.inc39.9
for.inc39.9: ; preds = %if.then36.9, %for.inc39.8
%arrayidx34.10 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 11
%40 = load i32, ptr %arrayidx34.10, align 4, !tbaa !5
%cmp35.10 = icmp eq i32 %40, 0
br i1 %cmp35.10, label %if.then36.10, label %for.inc39.10
if.then36.10: ; preds = %for.inc39.9
%call37.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 11)
br label %for.inc39.10
for.inc39.10: ; preds = %if.then36.10, %for.inc39.9
%arrayidx34.11 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 12
%41 = load i32, ptr %arrayidx34.11, align 8, !tbaa !5
%cmp35.11 = icmp eq i32 %41, 0
br i1 %cmp35.11, label %if.then36.11, label %for.inc39.11
if.then36.11: ; preds = %for.inc39.10
%call37.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 12)
br label %for.inc39.11
for.inc39.11: ; preds = %if.then36.11, %for.inc39.10
%arrayidx34.12 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 67, i64 13
%42 = load i32, ptr %arrayidx34.12, align 4, !tbaa !5
%cmp35.12 = icmp eq i32 %42, 0
br i1 %cmp35.12, label %if.then36.12, label %for.inc39.12
if.then36.12: ; preds = %for.inc39.11
%call37.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 13)
br label %for.inc39.12
for.inc39.12: ; preds = %if.then36.12, %for.inc39.11
%arrayidx47 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 1
%43 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%cmp48 = icmp eq i32 %43, 0
br i1 %cmp48, label %if.then49, label %for.inc52
if.then49: ; preds = %for.inc39.12
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 1)
br label %for.inc52
for.inc52: ; preds = %for.inc39.12, %if.then49
%arrayidx47.1 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 2
%44 = load i32, ptr %arrayidx47.1, align 8, !tbaa !5
%cmp48.1 = icmp eq i32 %44, 0
br i1 %cmp48.1, label %if.then49.1, label %for.inc52.1
if.then49.1: ; preds = %for.inc52
%call50.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 2)
br label %for.inc52.1
for.inc52.1: ; preds = %if.then49.1, %for.inc52
%arrayidx47.2 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 3
%45 = load i32, ptr %arrayidx47.2, align 4, !tbaa !5
%cmp48.2 = icmp eq i32 %45, 0
br i1 %cmp48.2, label %if.then49.2, label %for.inc52.2
if.then49.2: ; preds = %for.inc52.1
%call50.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 3)
br label %for.inc52.2
for.inc52.2: ; preds = %if.then49.2, %for.inc52.1
%arrayidx47.3 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 4
%46 = load i32, ptr %arrayidx47.3, align 16, !tbaa !5
%cmp48.3 = icmp eq i32 %46, 0
br i1 %cmp48.3, label %if.then49.3, label %for.inc52.3
if.then49.3: ; preds = %for.inc52.2
%call50.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 4)
br label %for.inc52.3
for.inc52.3: ; preds = %if.then49.3, %for.inc52.2
%arrayidx47.4 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 5
%47 = load i32, ptr %arrayidx47.4, align 4, !tbaa !5
%cmp48.4 = icmp eq i32 %47, 0
br i1 %cmp48.4, label %if.then49.4, label %for.inc52.4
if.then49.4: ; preds = %for.inc52.3
%call50.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 5)
br label %for.inc52.4
for.inc52.4: ; preds = %if.then49.4, %for.inc52.3
%arrayidx47.5 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 6
%48 = load i32, ptr %arrayidx47.5, align 8, !tbaa !5
%cmp48.5 = icmp eq i32 %48, 0
br i1 %cmp48.5, label %if.then49.5, label %for.inc52.5
if.then49.5: ; preds = %for.inc52.4
%call50.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 6)
br label %for.inc52.5
for.inc52.5: ; preds = %if.then49.5, %for.inc52.4
%arrayidx47.6 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 7
%49 = load i32, ptr %arrayidx47.6, align 4, !tbaa !5
%cmp48.6 = icmp eq i32 %49, 0
br i1 %cmp48.6, label %if.then49.6, label %for.inc52.6
if.then49.6: ; preds = %for.inc52.5
%call50.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 7)
br label %for.inc52.6
for.inc52.6: ; preds = %if.then49.6, %for.inc52.5
%arrayidx47.7 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 8
%50 = load i32, ptr %arrayidx47.7, align 16, !tbaa !5
%cmp48.7 = icmp eq i32 %50, 0
br i1 %cmp48.7, label %if.then49.7, label %for.inc52.7
if.then49.7: ; preds = %for.inc52.6
%call50.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 8)
br label %for.inc52.7
for.inc52.7: ; preds = %if.then49.7, %for.inc52.6
%arrayidx47.8 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 9
%51 = load i32, ptr %arrayidx47.8, align 4, !tbaa !5
%cmp48.8 = icmp eq i32 %51, 0
br i1 %cmp48.8, label %if.then49.8, label %for.inc52.8
if.then49.8: ; preds = %for.inc52.7
%call50.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 9)
br label %for.inc52.8
for.inc52.8: ; preds = %if.then49.8, %for.inc52.7
%arrayidx47.9 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 10
%52 = load i32, ptr %arrayidx47.9, align 8, !tbaa !5
%cmp48.9 = icmp eq i32 %52, 0
br i1 %cmp48.9, label %if.then49.9, label %for.inc52.9
if.then49.9: ; preds = %for.inc52.8
%call50.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 10)
br label %for.inc52.9
for.inc52.9: ; preds = %if.then49.9, %for.inc52.8
%arrayidx47.10 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 11
%53 = load i32, ptr %arrayidx47.10, align 4, !tbaa !5
%cmp48.10 = icmp eq i32 %53, 0
br i1 %cmp48.10, label %if.then49.10, label %for.inc52.10
if.then49.10: ; preds = %for.inc52.9
%call50.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 11)
br label %for.inc52.10
for.inc52.10: ; preds = %if.then49.10, %for.inc52.9
%arrayidx47.11 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 12
%54 = load i32, ptr %arrayidx47.11, align 16, !tbaa !5
%cmp48.11 = icmp eq i32 %54, 0
br i1 %cmp48.11, label %if.then49.11, label %for.inc52.11
if.then49.11: ; preds = %for.inc52.10
%call50.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 12)
br label %for.inc52.11
for.inc52.11: ; preds = %if.then49.11, %for.inc52.10
%arrayidx47.12 = getelementptr inbounds [128 x [14 x i32]], ptr %cards, i64 0, i64 68, i64 13
%55 = load i32, ptr %arrayidx47.12, align 4, !tbaa !5
%cmp48.12 = icmp eq i32 %55, 0
br i1 %cmp48.12, label %if.then49.12, label %for.inc52.12
if.then49.12: ; preds = %for.inc52.11
%call50.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef 13)
br label %for.inc52.12
for.inc52.12: ; preds = %if.then49.12, %for.inc52.11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 7168, ptr nonnull %cards) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int amount[10];
int N;
int min(int a,int b)
{
return (a<b)?a:b;
}
int main() {
scanf("%d",&N);
int i;
int s;
for(i=0;i<N;i++)
{
scanf("%d",&s);
amount[s]++;
}
int taxis=amount[4];
int three_and_one=min(amount[1],amount[3]);
amount[1]-=three_and_one;
amount[3]-=three_and_one;
taxis+=three_and_one;
taxis+=amount[3];
//
int two_and_two=amount[2]/2;
amount[2]-=two_and_two*2;
taxis+=two_and_two;
if (amount[2]==0)
{
taxis+=amount[1]/4;
amount[1]-=(amount[1]/4)*4;
if(amount[1]>0)
taxis++;
}
else
{
taxis++;
amount[1]-=2;
if(amount[1]>0)
{
taxis+=amount[1]/4;
amount[1]-=(amount[1]/4)*4;
if(amount[1]>0)
taxis++;
}
}
printf("%d\n",taxis);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21434/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21434/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@amount = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%s = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.048 = phi i32 [ %inc2, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%1 = load i32, ptr %s, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr @amount, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc2 = add nuw nsw i32 %i.048, 1
%3 = load i32, ptr @N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%4 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 4), align 16, !tbaa !5
%5 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 1), align 4, !tbaa !5
%6 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 3), align 4, !tbaa !5
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %5, %cond.i
%sub4 = sub nsw i32 %6, %cond.i
store i32 %sub4, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 3), align 4, !tbaa !5
%add5 = add i32 %6, %4
%7 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 2), align 8, !tbaa !5
%div = sdiv i32 %7, 2
%mul = shl nsw i32 %div, 1
%sub6 = sub nsw i32 %7, %mul
store i32 %sub6, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 2), align 8, !tbaa !5
%add7 = add nsw i32 %add5, %div
%cmp8 = icmp eq i32 %7, %mul
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.end
%div9 = sdiv i32 %sub, 4
%add10 = add nsw i32 %add7, %div9
%mul12 = shl nsw i32 %div9, 2
%sub13 = sub nsw i32 %sub, %mul12
store i32 %sub13, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 1), align 4, !tbaa !5
%cmp14 = icmp sgt i32 %sub13, 0
%inc16 = zext i1 %cmp14 to i32
%spec.select = add nsw i32 %add10, %inc16
br label %if.end31
if.else: ; preds = %for.end
%inc17 = add nsw i32 %add7, 1
%sub18 = add nsw i32 %sub, -2
store i32 %sub18, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 1), align 4, !tbaa !5
%cmp19 = icmp sgt i32 %sub, 2
br i1 %cmp19, label %if.then20, label %if.end31
if.then20: ; preds = %if.else
%div2145 = lshr i32 %sub18, 2
%add22 = add nsw i32 %inc17, %div2145
%sub25 = and i32 %sub18, 3
store i32 %sub25, ptr getelementptr inbounds ([10 x i32], ptr @amount, i64 0, i64 1), align 4, !tbaa !5
%cmp26.not = icmp ne i32 %sub25, 0
%inc28 = zext i1 %cmp26.not to i32
%spec.select46 = add nsw i32 %add22, %inc28
br label %if.end31
if.end31: ; preds = %if.then20, %if.then, %if.else
%taxis.0 = phi i32 [ %inc17, %if.else ], [ %spec.select, %if.then ], [ %spec.select46, %if.then20 ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %taxis.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int card[4][13];
const char mark[]={'S','H','C','D'};
int main()
{
int i,j,n;
scanf("%d", &n);
for(i=0; i<n; i++){
char a;
int x;
scanf(" %c %d",&a,&x);
if(a=='S') card[0][x-1]=1;
else if(a=='H') card[1][x-1]=1;
else if(a=='C') card[2][x-1]=1;
else if(a=='D') card[3][x-1]=1;
}
for(i=0;i<4;i++){
for(j=0;j<13;j++){
if(card[i][j]==0){
printf("%c %d\n",mark[i],j+1);
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214426/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214426/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@mark = dso_local local_unnamed_addr constant [4 x i8] c"SHCD", align 1
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c" %c %d\00", align 1
@card = dso_local local_unnamed_addr global [4 x [13 x i32]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"%c %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i8, align 1
%x = 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
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body, label %for.cond34.preheader.preheader
for.body: ; preds = %entry, %if.end29
%i.065 = phi i32 [ %inc, %if.end29 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %x)
%1 = load i8, ptr %a, align 1, !tbaa !9
switch i8 %1, label %if.end29 [
i8 83, label %if.then
i8 72, label %if.then7
i8 67, label %if.then15
i8 68, label %if.then23
]
if.then: ; preds = %for.body
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [13 x i32], ptr @card, i64 0, i64 %idxprom
br label %if.end29.sink.split
if.then7: ; preds = %for.body
%3 = load i32, ptr %x, align 4, !tbaa !5
%sub8 = add nsw i32 %3, -1
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 1, i64 %idxprom9
br label %if.end29.sink.split
if.then15: ; preds = %for.body
%4 = load i32, ptr %x, align 4, !tbaa !5
%sub16 = add nsw i32 %4, -1
%idxprom17 = sext i32 %sub16 to i64
%arrayidx18 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 2, i64 %idxprom17
br label %if.end29.sink.split
if.then23: ; preds = %for.body
%5 = load i32, ptr %x, align 4, !tbaa !5
%sub24 = add nsw i32 %5, -1
%idxprom25 = sext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 3, i64 %idxprom25
br label %if.end29.sink.split
if.end29.sink.split: ; preds = %if.then, %if.then15, %if.then23, %if.then7
%arrayidx10.sink = phi ptr [ %arrayidx10, %if.then7 ], [ %arrayidx26, %if.then23 ], [ %arrayidx18, %if.then15 ], [ %arrayidx, %if.then ]
store i32 1, ptr %arrayidx10.sink, align 4, !tbaa !5
br label %if.end29
if.end29: ; preds = %if.end29.sink.split, %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #3
%inc = add nuw nsw i32 %i.065, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.cond34.preheader.preheader, !llvm.loop !10
for.cond34.preheader.preheader: ; preds = %if.end29, %entry
br label %for.cond34.preheader
for.cond34.preheader: ; preds = %for.cond34.preheader.preheader, %for.inc50.12
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc50.12 ], [ 0, %for.cond34.preheader.preheader ]
%arrayidx46 = getelementptr inbounds [4 x i8], ptr @mark, i64 0, i64 %indvars.iv
%arrayidx41 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 0
%7 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%cmp42 = icmp eq i32 %7, 0
br i1 %cmp42, label %if.then44, label %for.inc50
if.then44: ; preds = %for.cond34.preheader
%8 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47 = sext i8 %8 to i32
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47, i32 noundef 1)
br label %for.inc50
for.inc50: ; preds = %for.cond34.preheader, %if.then44
%arrayidx41.1 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 1
%9 = load i32, ptr %arrayidx41.1, align 4, !tbaa !5
%cmp42.1 = icmp eq i32 %9, 0
br i1 %cmp42.1, label %if.then44.1, label %for.inc50.1
if.then44.1: ; preds = %for.inc50
%10 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.1 = sext i8 %10 to i32
%call48.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.1, i32 noundef 2)
br label %for.inc50.1
for.inc50.1: ; preds = %if.then44.1, %for.inc50
%arrayidx41.2 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 2
%11 = load i32, ptr %arrayidx41.2, align 4, !tbaa !5
%cmp42.2 = icmp eq i32 %11, 0
br i1 %cmp42.2, label %if.then44.2, label %for.inc50.2
if.then44.2: ; preds = %for.inc50.1
%12 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.2 = sext i8 %12 to i32
%call48.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.2, i32 noundef 3)
br label %for.inc50.2
for.inc50.2: ; preds = %if.then44.2, %for.inc50.1
%arrayidx41.3 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 3
%13 = load i32, ptr %arrayidx41.3, align 4, !tbaa !5
%cmp42.3 = icmp eq i32 %13, 0
br i1 %cmp42.3, label %if.then44.3, label %for.inc50.3
if.then44.3: ; preds = %for.inc50.2
%14 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.3 = sext i8 %14 to i32
%call48.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.3, i32 noundef 4)
br label %for.inc50.3
for.inc50.3: ; preds = %if.then44.3, %for.inc50.2
%arrayidx41.4 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 4
%15 = load i32, ptr %arrayidx41.4, align 4, !tbaa !5
%cmp42.4 = icmp eq i32 %15, 0
br i1 %cmp42.4, label %if.then44.4, label %for.inc50.4
if.then44.4: ; preds = %for.inc50.3
%16 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.4 = sext i8 %16 to i32
%call48.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.4, i32 noundef 5)
br label %for.inc50.4
for.inc50.4: ; preds = %if.then44.4, %for.inc50.3
%arrayidx41.5 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 5
%17 = load i32, ptr %arrayidx41.5, align 4, !tbaa !5
%cmp42.5 = icmp eq i32 %17, 0
br i1 %cmp42.5, label %if.then44.5, label %for.inc50.5
if.then44.5: ; preds = %for.inc50.4
%18 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.5 = sext i8 %18 to i32
%call48.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.5, i32 noundef 6)
br label %for.inc50.5
for.inc50.5: ; preds = %if.then44.5, %for.inc50.4
%arrayidx41.6 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 6
%19 = load i32, ptr %arrayidx41.6, align 4, !tbaa !5
%cmp42.6 = icmp eq i32 %19, 0
br i1 %cmp42.6, label %if.then44.6, label %for.inc50.6
if.then44.6: ; preds = %for.inc50.5
%20 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.6 = sext i8 %20 to i32
%call48.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.6, i32 noundef 7)
br label %for.inc50.6
for.inc50.6: ; preds = %if.then44.6, %for.inc50.5
%arrayidx41.7 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 7
%21 = load i32, ptr %arrayidx41.7, align 4, !tbaa !5
%cmp42.7 = icmp eq i32 %21, 0
br i1 %cmp42.7, label %if.then44.7, label %for.inc50.7
if.then44.7: ; preds = %for.inc50.6
%22 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.7 = sext i8 %22 to i32
%call48.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.7, i32 noundef 8)
br label %for.inc50.7
for.inc50.7: ; preds = %if.then44.7, %for.inc50.6
%arrayidx41.8 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 8
%23 = load i32, ptr %arrayidx41.8, align 4, !tbaa !5
%cmp42.8 = icmp eq i32 %23, 0
br i1 %cmp42.8, label %if.then44.8, label %for.inc50.8
if.then44.8: ; preds = %for.inc50.7
%24 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.8 = sext i8 %24 to i32
%call48.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.8, i32 noundef 9)
br label %for.inc50.8
for.inc50.8: ; preds = %if.then44.8, %for.inc50.7
%arrayidx41.9 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 9
%25 = load i32, ptr %arrayidx41.9, align 4, !tbaa !5
%cmp42.9 = icmp eq i32 %25, 0
br i1 %cmp42.9, label %if.then44.9, label %for.inc50.9
if.then44.9: ; preds = %for.inc50.8
%26 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.9 = sext i8 %26 to i32
%call48.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.9, i32 noundef 10)
br label %for.inc50.9
for.inc50.9: ; preds = %if.then44.9, %for.inc50.8
%arrayidx41.10 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 10
%27 = load i32, ptr %arrayidx41.10, align 4, !tbaa !5
%cmp42.10 = icmp eq i32 %27, 0
br i1 %cmp42.10, label %if.then44.10, label %for.inc50.10
if.then44.10: ; preds = %for.inc50.9
%28 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.10 = sext i8 %28 to i32
%call48.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.10, i32 noundef 11)
br label %for.inc50.10
for.inc50.10: ; preds = %if.then44.10, %for.inc50.9
%arrayidx41.11 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 11
%29 = load i32, ptr %arrayidx41.11, align 4, !tbaa !5
%cmp42.11 = icmp eq i32 %29, 0
br i1 %cmp42.11, label %if.then44.11, label %for.inc50.11
if.then44.11: ; preds = %for.inc50.10
%30 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.11 = sext i8 %30 to i32
%call48.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.11, i32 noundef 12)
br label %for.inc50.11
for.inc50.11: ; preds = %if.then44.11, %for.inc50.10
%arrayidx41.12 = getelementptr inbounds [4 x [13 x i32]], ptr @card, i64 0, i64 %indvars.iv, i64 12
%31 = load i32, ptr %arrayidx41.12, align 4, !tbaa !5
%cmp42.12 = icmp eq i32 %31, 0
br i1 %cmp42.12, label %if.then44.12, label %for.inc50.12
if.then44.12: ; preds = %for.inc50.11
%32 = load i8, ptr %arrayidx46, align 1, !tbaa !9
%conv47.12 = sext i8 %32 to i32
%call48.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv47.12, i32 noundef 13)
br label %for.inc50.12
for.inc50.12: ; preds = %if.then44.12, %for.inc50.11
%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.end55, label %for.cond34.preheader, !llvm.loop !12
for.end55: ; preds = %for.inc50.12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#define Max 20000
int N;
int S[Max];
int main()
{
scanf("%d", &N);
int max = 0;
int i;
for (i = 0; i < N; i++)
{
scanf("%d", &S[i]);
max += S[i];
}
int d;
for (d = 1; d * d <= N; d++)
{
if (N % d == 0)
{
int s, j, sum;
int step = N / d;
if (3 <= d)
{
//printf(":%d\n", d);
for (s = 0; s < N / d; s++)
{
sum = 0;
j = s;
while (j < N)
{
//printf("--%d--%d\n", d, j);
sum += S[j];
j += step;
}
if (sum > max) max = sum;
}
}
// N / d
if (3 <= N / d)
{
step = d;
//printf(":%d\n", N / d);
for (s = 0; s < d; s++)
{
sum = 0;
j = s;
while (j < N)
{
//printf("--%d--%d\n", N / d, j);
sum += S[j];
j += step;
}
if (sum > max) max = sum;
}
}
}
}
printf("%d\n", max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21447/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21447/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@S = dso_local global [20000 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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body, label %for.end49
for.cond4.preheader: ; preds = %for.body
%cmp5.not101 = icmp slt i32 %3, 1
br i1 %cmp5.not101, label %for.end49, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%1 = zext i32 %3 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%max.084 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %2, %max.084
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr @N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.body6: ; preds = %for.body6.preheader, %for.inc47
%indvar = phi i64 [ 0, %for.body6.preheader ], [ %indvar.next, %for.inc47 ]
%indvars.iv115 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next116, %for.inc47 ]
%max.1102 = phi i32 [ %add, %for.body6.preheader ], [ %max.8, %for.inc47 ]
%5 = trunc i64 %indvars.iv115 to i32
%rem = srem i32 %3, %5
%div = sdiv i32 %3, %5
%cmp7 = icmp eq i32 %rem, 0
br i1 %cmp7, label %if.then, label %for.inc47
if.then: ; preds = %for.body6
%cmp8 = icmp ugt i64 %indvars.iv115, 2
%cmp1291 = icmp sgt i32 %div, 0
%or.cond = and i1 %cmp8, %cmp1291
br i1 %or.cond, label %while.cond.preheader.preheader, label %if.end24
while.cond.preheader.preheader: ; preds = %if.then
%6 = zext i32 %div to i64
%xtraiter = and i64 %6, 1
%7 = icmp eq i32 %div, 1
br i1 %7, label %if.end24.loopexit.unr-lcssa, label %while.cond.preheader.preheader.new
while.cond.preheader.preheader.new: ; preds = %while.cond.preheader.preheader
%unroll_iter = and i64 %6, 4294967294
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.end.1, %while.cond.preheader.preheader.new
%indvars.iv107 = phi i64 [ 0, %while.cond.preheader.preheader.new ], [ %indvars.iv.next108.1, %while.end.1 ]
%max.292 = phi i32 [ %max.1102, %while.cond.preheader.preheader.new ], [ %spec.select.1, %while.end.1 ]
%niter = phi i64 [ 0, %while.cond.preheader.preheader.new ], [ %niter.next.1, %while.end.1 ]
%indvars112 = trunc i64 %indvars.iv107 to i32
%cmp1487 = icmp sgt i32 %3, %indvars112
br i1 %cmp1487, label %while.body, label %while.end
while.body: ; preds = %while.cond.preheader, %while.body
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %while.body ], [ %indvars.iv107, %while.cond.preheader ]
%sum.089 = phi i32 [ %add17, %while.body ], [ 0, %while.cond.preheader ]
%arrayidx16 = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv109
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%add17 = add nsw i32 %8, %sum.089
%indvars.iv.next110 = add i64 %indvars.iv109, %6
%cmp14 = icmp slt i64 %indvars.iv.next110, %1
br i1 %cmp14, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %while.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %add17, %while.body ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %sum.0.lcssa, i32 %max.292)
%indvars.iv.next108 = or i64 %indvars.iv107, 1
%indvars112.1 = trunc i64 %indvars.iv.next108 to i32
%cmp1487.1 = icmp sgt i32 %3, %indvars112.1
br i1 %cmp1487.1, label %while.body.1, label %while.end.1
while.body.1: ; preds = %while.end, %while.body.1
%indvars.iv109.1 = phi i64 [ %indvars.iv.next110.1, %while.body.1 ], [ %indvars.iv.next108, %while.end ]
%sum.089.1 = phi i32 [ %add17.1, %while.body.1 ], [ 0, %while.end ]
%arrayidx16.1 = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv109.1
%9 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%add17.1 = add nsw i32 %9, %sum.089.1
%indvars.iv.next110.1 = add i64 %indvars.iv109.1, %6
%cmp14.1 = icmp slt i64 %indvars.iv.next110.1, %1
br i1 %cmp14.1, label %while.body.1, label %while.end.1, !llvm.loop !11
while.end.1: ; preds = %while.body.1, %while.end
%sum.0.lcssa.1 = phi i32 [ 0, %while.end ], [ %add17.1, %while.body.1 ]
%spec.select.1 = tail call i32 @llvm.smax.i32(i32 %sum.0.lcssa.1, i32 %spec.select)
%indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 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 %if.end24.loopexit.unr-lcssa, label %while.cond.preheader, !llvm.loop !12
if.end24.loopexit.unr-lcssa: ; preds = %while.end.1, %while.cond.preheader.preheader
%spec.select.lcssa.ph = phi i32 [ undef, %while.cond.preheader.preheader ], [ %spec.select.1, %while.end.1 ]
%indvars.iv107.unr = phi i64 [ 0, %while.cond.preheader.preheader ], [ %indvars.iv.next108.1, %while.end.1 ]
%max.292.unr = phi i32 [ %max.1102, %while.cond.preheader.preheader ], [ %spec.select.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %if.end24, label %while.cond.preheader.epil
while.cond.preheader.epil: ; preds = %if.end24.loopexit.unr-lcssa
%indvars112.epil = trunc i64 %indvars.iv107.unr to i32
%cmp1487.epil = icmp sgt i32 %3, %indvars112.epil
br i1 %cmp1487.epil, label %while.body.epil, label %while.end.epil
while.body.epil: ; preds = %while.cond.preheader.epil, %while.body.epil
%indvars.iv109.epil = phi i64 [ %indvars.iv.next110.epil, %while.body.epil ], [ %indvars.iv107.unr, %while.cond.preheader.epil ]
%sum.089.epil = phi i32 [ %add17.epil, %while.body.epil ], [ 0, %while.cond.preheader.epil ]
%arrayidx16.epil = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv109.epil
%10 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%add17.epil = add nsw i32 %10, %sum.089.epil
%indvars.iv.next110.epil = add i64 %indvars.iv109.epil, %6
%cmp14.epil = icmp slt i64 %indvars.iv.next110.epil, %1
br i1 %cmp14.epil, label %while.body.epil, label %while.end.epil, !llvm.loop !11
while.end.epil: ; preds = %while.body.epil, %while.cond.preheader.epil
%sum.0.lcssa.epil = phi i32 [ 0, %while.cond.preheader.epil ], [ %add17.epil, %while.body.epil ]
%spec.select.epil = tail call i32 @llvm.smax.i32(i32 %sum.0.lcssa.epil, i32 %max.292.unr)
br label %if.end24
if.end24: ; preds = %while.end.epil, %if.end24.loopexit.unr-lcssa, %if.then
%max.4 = phi i32 [ %max.1102, %if.then ], [ %spec.select.lcssa.ph, %if.end24.loopexit.unr-lcssa ], [ %spec.select.epil, %while.end.epil ]
%cmp26 = icmp sgt i32 %div, 2
br i1 %cmp26, label %while.cond31.preheader.preheader, label %for.inc47
while.cond31.preheader.preheader: ; preds = %if.end24
%xtraiter128 = and i64 %indvars.iv115, 1
%11 = icmp eq i64 %indvar, 0
br i1 %11, label %for.inc47.loopexit.unr-lcssa, label %while.cond31.preheader.preheader.new
while.cond31.preheader.preheader.new: ; preds = %while.cond31.preheader.preheader
%unroll_iter131 = and i64 %indvars.iv115, -2
br label %while.cond31.preheader
while.cond31.preheader: ; preds = %while.end38.1, %while.cond31.preheader.preheader.new
%indvars.iv113 = phi i64 [ 0, %while.cond31.preheader.preheader.new ], [ %indvars.iv.next114.1, %while.end38.1 ]
%max.599 = phi i32 [ %max.4, %while.cond31.preheader.preheader.new ], [ %spec.select82.1, %while.end38.1 ]
%niter132 = phi i64 [ 0, %while.cond31.preheader.preheader.new ], [ %niter132.next.1, %while.end38.1 ]
%indvars120 = trunc i64 %indvars.iv113 to i32
%cmp3295 = icmp sgt i32 %3, %indvars120
br i1 %cmp3295, label %while.body33, label %while.end38
while.body33: ; preds = %while.cond31.preheader, %while.body33
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %while.body33 ], [ %indvars.iv113, %while.cond31.preheader ]
%sum.197 = phi i32 [ %add36, %while.body33 ], [ 0, %while.cond31.preheader ]
%arrayidx35 = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv117
%12 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%add36 = add nsw i32 %12, %sum.197
%indvars.iv.next118 = add i64 %indvars.iv117, %indvars.iv115
%13 = trunc i64 %indvars.iv.next118 to i32
%cmp32 = icmp sgt i32 %3, %13
br i1 %cmp32, label %while.body33, label %while.end38, !llvm.loop !13
while.end38: ; preds = %while.body33, %while.cond31.preheader
%sum.1.lcssa = phi i32 [ 0, %while.cond31.preheader ], [ %add36, %while.body33 ]
%spec.select82 = tail call i32 @llvm.smax.i32(i32 %sum.1.lcssa, i32 %max.599)
%indvars.iv.next114 = or i64 %indvars.iv113, 1
%indvars120.1 = trunc i64 %indvars.iv.next114 to i32
%cmp3295.1 = icmp sgt i32 %3, %indvars120.1
br i1 %cmp3295.1, label %while.body33.1, label %while.end38.1
while.body33.1: ; preds = %while.end38, %while.body33.1
%indvars.iv117.1 = phi i64 [ %indvars.iv.next118.1, %while.body33.1 ], [ %indvars.iv.next114, %while.end38 ]
%sum.197.1 = phi i32 [ %add36.1, %while.body33.1 ], [ 0, %while.end38 ]
%arrayidx35.1 = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv117.1
%14 = load i32, ptr %arrayidx35.1, align 4, !tbaa !5
%add36.1 = add nsw i32 %14, %sum.197.1
%indvars.iv.next118.1 = add i64 %indvars.iv117.1, %indvars.iv115
%15 = trunc i64 %indvars.iv.next118.1 to i32
%cmp32.1 = icmp sgt i32 %3, %15
br i1 %cmp32.1, label %while.body33.1, label %while.end38.1, !llvm.loop !13
while.end38.1: ; preds = %while.body33.1, %while.end38
%sum.1.lcssa.1 = phi i32 [ 0, %while.end38 ], [ %add36.1, %while.body33.1 ]
%spec.select82.1 = tail call i32 @llvm.smax.i32(i32 %sum.1.lcssa.1, i32 %spec.select82)
%indvars.iv.next114.1 = add nuw nsw i64 %indvars.iv113, 2
%niter132.next.1 = add i64 %niter132, 2
%niter132.ncmp.1 = icmp eq i64 %niter132.next.1, %unroll_iter131
br i1 %niter132.ncmp.1, label %for.inc47.loopexit.unr-lcssa, label %while.cond31.preheader, !llvm.loop !14
for.inc47.loopexit.unr-lcssa: ; preds = %while.end38.1, %while.cond31.preheader.preheader
%spec.select82.lcssa.ph = phi i32 [ undef, %while.cond31.preheader.preheader ], [ %spec.select82.1, %while.end38.1 ]
%indvars.iv113.unr = phi i64 [ 0, %while.cond31.preheader.preheader ], [ %indvars.iv.next114.1, %while.end38.1 ]
%max.599.unr = phi i32 [ %max.4, %while.cond31.preheader.preheader ], [ %spec.select82.1, %while.end38.1 ]
%lcmp.mod129.not = icmp eq i64 %xtraiter128, 0
br i1 %lcmp.mod129.not, label %for.inc47, label %while.cond31.preheader.epil
while.cond31.preheader.epil: ; preds = %for.inc47.loopexit.unr-lcssa
%indvars120.epil = trunc i64 %indvars.iv113.unr to i32
%cmp3295.epil = icmp sgt i32 %3, %indvars120.epil
br i1 %cmp3295.epil, label %while.body33.epil, label %while.end38.epil
while.body33.epil: ; preds = %while.cond31.preheader.epil, %while.body33.epil
%indvars.iv117.epil = phi i64 [ %indvars.iv.next118.epil, %while.body33.epil ], [ %indvars.iv113.unr, %while.cond31.preheader.epil ]
%sum.197.epil = phi i32 [ %add36.epil, %while.body33.epil ], [ 0, %while.cond31.preheader.epil ]
%arrayidx35.epil = getelementptr inbounds [20000 x i32], ptr @S, i64 0, i64 %indvars.iv117.epil
%16 = load i32, ptr %arrayidx35.epil, align 4, !tbaa !5
%add36.epil = add nsw i32 %16, %sum.197.epil
%indvars.iv.next118.epil = add i64 %indvars.iv117.epil, %indvars.iv115
%17 = trunc i64 %indvars.iv.next118.epil to i32
%cmp32.epil = icmp sgt i32 %3, %17
br i1 %cmp32.epil, label %while.body33.epil, label %while.end38.epil, !llvm.loop !13
while.end38.epil: ; preds = %while.body33.epil, %while.cond31.preheader.epil
%sum.1.lcssa.epil = phi i32 [ 0, %while.cond31.preheader.epil ], [ %add36.epil, %while.body33.epil ]
%spec.select82.epil = tail call i32 @llvm.smax.i32(i32 %sum.1.lcssa.epil, i32 %max.599.unr)
br label %for.inc47
for.inc47: ; preds = %while.end38.epil, %for.inc47.loopexit.unr-lcssa, %if.end24, %for.body6
%max.8 = phi i32 [ %max.1102, %for.body6 ], [ %max.4, %if.end24 ], [ %spec.select82.lcssa.ph, %for.inc47.loopexit.unr-lcssa ], [ %spec.select82.epil, %while.end38.epil ]
%indvars.iv.next116 = add nuw i64 %indvars.iv115, 1
%18 = trunc i64 %indvars.iv.next116 to i32
%mul = mul nsw i32 %18, %18
%cmp5.not = icmp sgt i32 %mul, %3
%indvar.next = add i64 %indvar, 1
br i1 %cmp5.not, label %for.end49, label %for.body6, !llvm.loop !15
for.end49: ; preds = %for.inc47, %entry, %for.cond4.preheader
%max.1.lcssa = phi i32 [ %add, %for.cond4.preheader ], [ 0, %entry ], [ %max.8, %for.inc47 ]
%call50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.1.lcssa)
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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define EGARA 4
#define MAISUU 13
int main(void){
int n;
int i, j;
int cards[4][14];
char egara;
int rank;
//initialize
for(i=0;i<EGARA;i++){
for(j=1;j<=MAISUU;j++){
cards[i][j]=0;
}
}
//input
scanf("%d\n", &n);
for(i=0;i<n;i++){
scanf("%c %d\n", &egara, &rank);
switch(egara){
case 'S' : cards[0][rank]=1; break;
case 'H' : cards[1][rank]=1; break;
case 'C' : cards[2][rank]=1; break;
case 'D' : cards[3][rank]=1; break;
default : return(1);
}
}
//output
for(j=1;j<=MAISUU;j++){
if(cards[0][j]==0){
printf("%c %d\n", 'S', j);
}
}
for(j=1;j<=MAISUU;j++){
if(cards[1][j]==0){
printf("%c %d\n", 'H', j);
}
}
for(j=1;j<=MAISUU;j++){
if(cards[2][j]==0){
printf("%c %d\n", 'C', j);
}
}
for(j=1;j<=MAISUU;j++){
if(cards[3][j]==0){
printf("%c %d\n", 'D', j);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214512/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214512/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%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
%cards = alloca [4 x [14 x i32]], align 16
%egara = alloca i8, align 1
%rank = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 224, ptr nonnull %cards) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %egara) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %rank) #4
%scevgep = getelementptr inbounds i8, ptr %cards, i64 4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(52) %scevgep, i8 0, i64 52, i1 false), !tbaa !5
%scevgep.1 = getelementptr inbounds i8, ptr %cards, i64 60
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(52) %scevgep.1, i8 0, i64 52, i1 false), !tbaa !5
%scevgep.2 = getelementptr inbounds i8, ptr %cards, i64 116
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(52) %scevgep.2, i8 0, i64 52, i1 false), !tbaa !5
%scevgep.3 = getelementptr inbounds i8, ptr %cards, i64 172
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(52) %scevgep.3, i8 0, i64 52, 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
%cmp10119 = icmp sgt i32 %0, 0
br i1 %cmp10119, label %for.body11, label %for.cond31.preheader
for.cond31.preheader: ; preds = %for.inc28, %entry
%1 = load i32, ptr %scevgep, align 4, !tbaa !5
%cmp38 = icmp eq i32 %1, 0
br i1 %cmp38, label %if.then, label %for.inc41
for.body11: ; preds = %entry, %for.inc28
%i.1120 = phi i32 [ %inc29, %for.inc28 ], [ 0, %entry ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %egara, ptr noundef nonnull %rank)
%2 = load i8, ptr %egara, align 1, !tbaa !9
%conv = sext i8 %2 to i32
switch i32 %conv, label %cleanup [
i32 83, label %sw.bb
i32 72, label %sw.bb16
i32 67, label %sw.bb20
i32 68, label %sw.bb24
]
sw.bb: ; preds = %for.body11
%3 = load i32, ptr %rank, align 4, !tbaa !5
%idxprom14 = sext i32 %3 to i64
%arrayidx15 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 %idxprom14
br label %for.inc28
sw.bb16: ; preds = %for.body11
%4 = load i32, ptr %rank, align 4, !tbaa !5
%idxprom18 = sext i32 %4 to i64
%arrayidx19 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 %idxprom18
br label %for.inc28
sw.bb20: ; preds = %for.body11
%5 = load i32, ptr %rank, align 4, !tbaa !5
%idxprom22 = sext i32 %5 to i64
%arrayidx23 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 %idxprom22
br label %for.inc28
sw.bb24: ; preds = %for.body11
%6 = load i32, ptr %rank, align 4, !tbaa !5
%idxprom26 = sext i32 %6 to i64
%arrayidx27 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 %idxprom26
br label %for.inc28
for.inc28: ; preds = %sw.bb, %sw.bb16, %sw.bb20, %sw.bb24
%arrayidx15.sink = phi ptr [ %arrayidx15, %sw.bb ], [ %arrayidx19, %sw.bb16 ], [ %arrayidx23, %sw.bb20 ], [ %arrayidx27, %sw.bb24 ]
store i32 1, ptr %arrayidx15.sink, align 4, !tbaa !5
%inc29 = add nuw nsw i32 %i.1120, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc29, %7
br i1 %cmp10, label %for.body11, label %for.cond31.preheader, !llvm.loop !10
if.then: ; preds = %for.cond31.preheader
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 1)
br label %for.inc41
for.inc41: ; preds = %for.cond31.preheader, %if.then
%arrayidx37.1 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 2
%8 = load i32, ptr %arrayidx37.1, align 8, !tbaa !5
%cmp38.1 = icmp eq i32 %8, 0
br i1 %cmp38.1, label %if.then.1, label %for.inc41.1
if.then.1: ; preds = %for.inc41
%call40.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 2)
br label %for.inc41.1
for.inc41.1: ; preds = %if.then.1, %for.inc41
%arrayidx37.2 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 3
%9 = load i32, ptr %arrayidx37.2, align 4, !tbaa !5
%cmp38.2 = icmp eq i32 %9, 0
br i1 %cmp38.2, label %if.then.2, label %for.inc41.2
if.then.2: ; preds = %for.inc41.1
%call40.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 3)
br label %for.inc41.2
for.inc41.2: ; preds = %if.then.2, %for.inc41.1
%arrayidx37.3 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 4
%10 = load i32, ptr %arrayidx37.3, align 16, !tbaa !5
%cmp38.3 = icmp eq i32 %10, 0
br i1 %cmp38.3, label %if.then.3, label %for.inc41.3
if.then.3: ; preds = %for.inc41.2
%call40.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 4)
br label %for.inc41.3
for.inc41.3: ; preds = %if.then.3, %for.inc41.2
%arrayidx37.4 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 5
%11 = load i32, ptr %arrayidx37.4, align 4, !tbaa !5
%cmp38.4 = icmp eq i32 %11, 0
br i1 %cmp38.4, label %if.then.4, label %for.inc41.4
if.then.4: ; preds = %for.inc41.3
%call40.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 5)
br label %for.inc41.4
for.inc41.4: ; preds = %if.then.4, %for.inc41.3
%arrayidx37.5 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 6
%12 = load i32, ptr %arrayidx37.5, align 8, !tbaa !5
%cmp38.5 = icmp eq i32 %12, 0
br i1 %cmp38.5, label %if.then.5, label %for.inc41.5
if.then.5: ; preds = %for.inc41.4
%call40.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 6)
br label %for.inc41.5
for.inc41.5: ; preds = %if.then.5, %for.inc41.4
%arrayidx37.6 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 7
%13 = load i32, ptr %arrayidx37.6, align 4, !tbaa !5
%cmp38.6 = icmp eq i32 %13, 0
br i1 %cmp38.6, label %if.then.6, label %for.inc41.6
if.then.6: ; preds = %for.inc41.5
%call40.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 7)
br label %for.inc41.6
for.inc41.6: ; preds = %if.then.6, %for.inc41.5
%arrayidx37.7 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 8
%14 = load i32, ptr %arrayidx37.7, align 16, !tbaa !5
%cmp38.7 = icmp eq i32 %14, 0
br i1 %cmp38.7, label %if.then.7, label %for.inc41.7
if.then.7: ; preds = %for.inc41.6
%call40.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 8)
br label %for.inc41.7
for.inc41.7: ; preds = %if.then.7, %for.inc41.6
%arrayidx37.8 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 9
%15 = load i32, ptr %arrayidx37.8, align 4, !tbaa !5
%cmp38.8 = icmp eq i32 %15, 0
br i1 %cmp38.8, label %if.then.8, label %for.inc41.8
if.then.8: ; preds = %for.inc41.7
%call40.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 9)
br label %for.inc41.8
for.inc41.8: ; preds = %if.then.8, %for.inc41.7
%arrayidx37.9 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 10
%16 = load i32, ptr %arrayidx37.9, align 8, !tbaa !5
%cmp38.9 = icmp eq i32 %16, 0
br i1 %cmp38.9, label %if.then.9, label %for.inc41.9
if.then.9: ; preds = %for.inc41.8
%call40.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 10)
br label %for.inc41.9
for.inc41.9: ; preds = %if.then.9, %for.inc41.8
%arrayidx37.10 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 11
%17 = load i32, ptr %arrayidx37.10, align 4, !tbaa !5
%cmp38.10 = icmp eq i32 %17, 0
br i1 %cmp38.10, label %if.then.10, label %for.inc41.10
if.then.10: ; preds = %for.inc41.9
%call40.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 11)
br label %for.inc41.10
for.inc41.10: ; preds = %if.then.10, %for.inc41.9
%arrayidx37.11 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 12
%18 = load i32, ptr %arrayidx37.11, align 16, !tbaa !5
%cmp38.11 = icmp eq i32 %18, 0
br i1 %cmp38.11, label %if.then.11, label %for.inc41.11
if.then.11: ; preds = %for.inc41.10
%call40.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 12)
br label %for.inc41.11
for.inc41.11: ; preds = %if.then.11, %for.inc41.10
%arrayidx37.12 = getelementptr inbounds [14 x i32], ptr %cards, i64 0, i64 13
%19 = load i32, ptr %arrayidx37.12, align 4, !tbaa !5
%cmp38.12 = icmp eq i32 %19, 0
br i1 %cmp38.12, label %if.then.12, label %for.inc41.12
if.then.12: ; preds = %for.inc41.11
%call40.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 83, i32 noundef 13)
br label %for.inc41.12
for.inc41.12: ; preds = %if.then.12, %for.inc41.11
%20 = load i32, ptr %scevgep.1, align 4, !tbaa !5
%cmp51 = icmp eq i32 %20, 0
br i1 %cmp51, label %if.then53, label %for.inc56
if.then53: ; preds = %for.inc41.12
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 1)
br label %for.inc56
for.inc56: ; preds = %for.inc41.12, %if.then53
%arrayidx50.1 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 2
%21 = load i32, ptr %arrayidx50.1, align 16, !tbaa !5
%cmp51.1 = icmp eq i32 %21, 0
br i1 %cmp51.1, label %if.then53.1, label %for.inc56.1
if.then53.1: ; preds = %for.inc56
%call54.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 2)
br label %for.inc56.1
for.inc56.1: ; preds = %if.then53.1, %for.inc56
%arrayidx50.2 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 3
%22 = load i32, ptr %arrayidx50.2, align 4, !tbaa !5
%cmp51.2 = icmp eq i32 %22, 0
br i1 %cmp51.2, label %if.then53.2, label %for.inc56.2
if.then53.2: ; preds = %for.inc56.1
%call54.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 3)
br label %for.inc56.2
for.inc56.2: ; preds = %if.then53.2, %for.inc56.1
%arrayidx50.3 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 4
%23 = load i32, ptr %arrayidx50.3, align 8, !tbaa !5
%cmp51.3 = icmp eq i32 %23, 0
br i1 %cmp51.3, label %if.then53.3, label %for.inc56.3
if.then53.3: ; preds = %for.inc56.2
%call54.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 4)
br label %for.inc56.3
for.inc56.3: ; preds = %if.then53.3, %for.inc56.2
%arrayidx50.4 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 5
%24 = load i32, ptr %arrayidx50.4, align 4, !tbaa !5
%cmp51.4 = icmp eq i32 %24, 0
br i1 %cmp51.4, label %if.then53.4, label %for.inc56.4
if.then53.4: ; preds = %for.inc56.3
%call54.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 5)
br label %for.inc56.4
for.inc56.4: ; preds = %if.then53.4, %for.inc56.3
%arrayidx50.5 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 6
%25 = load i32, ptr %arrayidx50.5, align 16, !tbaa !5
%cmp51.5 = icmp eq i32 %25, 0
br i1 %cmp51.5, label %if.then53.5, label %for.inc56.5
if.then53.5: ; preds = %for.inc56.4
%call54.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 6)
br label %for.inc56.5
for.inc56.5: ; preds = %if.then53.5, %for.inc56.4
%arrayidx50.6 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 7
%26 = load i32, ptr %arrayidx50.6, align 4, !tbaa !5
%cmp51.6 = icmp eq i32 %26, 0
br i1 %cmp51.6, label %if.then53.6, label %for.inc56.6
if.then53.6: ; preds = %for.inc56.5
%call54.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 7)
br label %for.inc56.6
for.inc56.6: ; preds = %if.then53.6, %for.inc56.5
%arrayidx50.7 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 8
%27 = load i32, ptr %arrayidx50.7, align 8, !tbaa !5
%cmp51.7 = icmp eq i32 %27, 0
br i1 %cmp51.7, label %if.then53.7, label %for.inc56.7
if.then53.7: ; preds = %for.inc56.6
%call54.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 8)
br label %for.inc56.7
for.inc56.7: ; preds = %if.then53.7, %for.inc56.6
%arrayidx50.8 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 9
%28 = load i32, ptr %arrayidx50.8, align 4, !tbaa !5
%cmp51.8 = icmp eq i32 %28, 0
br i1 %cmp51.8, label %if.then53.8, label %for.inc56.8
if.then53.8: ; preds = %for.inc56.7
%call54.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 9)
br label %for.inc56.8
for.inc56.8: ; preds = %if.then53.8, %for.inc56.7
%arrayidx50.9 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 10
%29 = load i32, ptr %arrayidx50.9, align 16, !tbaa !5
%cmp51.9 = icmp eq i32 %29, 0
br i1 %cmp51.9, label %if.then53.9, label %for.inc56.9
if.then53.9: ; preds = %for.inc56.8
%call54.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 10)
br label %for.inc56.9
for.inc56.9: ; preds = %if.then53.9, %for.inc56.8
%arrayidx50.10 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 11
%30 = load i32, ptr %arrayidx50.10, align 4, !tbaa !5
%cmp51.10 = icmp eq i32 %30, 0
br i1 %cmp51.10, label %if.then53.10, label %for.inc56.10
if.then53.10: ; preds = %for.inc56.9
%call54.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 11)
br label %for.inc56.10
for.inc56.10: ; preds = %if.then53.10, %for.inc56.9
%arrayidx50.11 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 12
%31 = load i32, ptr %arrayidx50.11, align 8, !tbaa !5
%cmp51.11 = icmp eq i32 %31, 0
br i1 %cmp51.11, label %if.then53.11, label %for.inc56.11
if.then53.11: ; preds = %for.inc56.10
%call54.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 12)
br label %for.inc56.11
for.inc56.11: ; preds = %if.then53.11, %for.inc56.10
%arrayidx50.12 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 1, i64 13
%32 = load i32, ptr %arrayidx50.12, align 4, !tbaa !5
%cmp51.12 = icmp eq i32 %32, 0
br i1 %cmp51.12, label %if.then53.12, label %for.inc56.12
if.then53.12: ; preds = %for.inc56.11
%call54.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 72, i32 noundef 13)
br label %for.inc56.12
for.inc56.12: ; preds = %if.then53.12, %for.inc56.11
%33 = load i32, ptr %scevgep.2, align 4, !tbaa !5
%cmp66 = icmp eq i32 %33, 0
br i1 %cmp66, label %if.then68, label %for.inc71
if.then68: ; preds = %for.inc56.12
%call69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 1)
br label %for.inc71
for.inc71: ; preds = %for.inc56.12, %if.then68
%arrayidx65.1 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 2
%34 = load i32, ptr %arrayidx65.1, align 8, !tbaa !5
%cmp66.1 = icmp eq i32 %34, 0
br i1 %cmp66.1, label %if.then68.1, label %for.inc71.1
if.then68.1: ; preds = %for.inc71
%call69.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 2)
br label %for.inc71.1
for.inc71.1: ; preds = %if.then68.1, %for.inc71
%arrayidx65.2 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 3
%35 = load i32, ptr %arrayidx65.2, align 4, !tbaa !5
%cmp66.2 = icmp eq i32 %35, 0
br i1 %cmp66.2, label %if.then68.2, label %for.inc71.2
if.then68.2: ; preds = %for.inc71.1
%call69.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 3)
br label %for.inc71.2
for.inc71.2: ; preds = %if.then68.2, %for.inc71.1
%arrayidx65.3 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 4
%36 = load i32, ptr %arrayidx65.3, align 16, !tbaa !5
%cmp66.3 = icmp eq i32 %36, 0
br i1 %cmp66.3, label %if.then68.3, label %for.inc71.3
if.then68.3: ; preds = %for.inc71.2
%call69.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 4)
br label %for.inc71.3
for.inc71.3: ; preds = %if.then68.3, %for.inc71.2
%arrayidx65.4 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 5
%37 = load i32, ptr %arrayidx65.4, align 4, !tbaa !5
%cmp66.4 = icmp eq i32 %37, 0
br i1 %cmp66.4, label %if.then68.4, label %for.inc71.4
if.then68.4: ; preds = %for.inc71.3
%call69.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 5)
br label %for.inc71.4
for.inc71.4: ; preds = %if.then68.4, %for.inc71.3
%arrayidx65.5 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 6
%38 = load i32, ptr %arrayidx65.5, align 8, !tbaa !5
%cmp66.5 = icmp eq i32 %38, 0
br i1 %cmp66.5, label %if.then68.5, label %for.inc71.5
if.then68.5: ; preds = %for.inc71.4
%call69.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 6)
br label %for.inc71.5
for.inc71.5: ; preds = %if.then68.5, %for.inc71.4
%arrayidx65.6 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 7
%39 = load i32, ptr %arrayidx65.6, align 4, !tbaa !5
%cmp66.6 = icmp eq i32 %39, 0
br i1 %cmp66.6, label %if.then68.6, label %for.inc71.6
if.then68.6: ; preds = %for.inc71.5
%call69.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 7)
br label %for.inc71.6
for.inc71.6: ; preds = %if.then68.6, %for.inc71.5
%arrayidx65.7 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 8
%40 = load i32, ptr %arrayidx65.7, align 16, !tbaa !5
%cmp66.7 = icmp eq i32 %40, 0
br i1 %cmp66.7, label %if.then68.7, label %for.inc71.7
if.then68.7: ; preds = %for.inc71.6
%call69.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 8)
br label %for.inc71.7
for.inc71.7: ; preds = %if.then68.7, %for.inc71.6
%arrayidx65.8 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 9
%41 = load i32, ptr %arrayidx65.8, align 4, !tbaa !5
%cmp66.8 = icmp eq i32 %41, 0
br i1 %cmp66.8, label %if.then68.8, label %for.inc71.8
if.then68.8: ; preds = %for.inc71.7
%call69.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 9)
br label %for.inc71.8
for.inc71.8: ; preds = %if.then68.8, %for.inc71.7
%arrayidx65.9 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 10
%42 = load i32, ptr %arrayidx65.9, align 8, !tbaa !5
%cmp66.9 = icmp eq i32 %42, 0
br i1 %cmp66.9, label %if.then68.9, label %for.inc71.9
if.then68.9: ; preds = %for.inc71.8
%call69.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 10)
br label %for.inc71.9
for.inc71.9: ; preds = %if.then68.9, %for.inc71.8
%arrayidx65.10 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 11
%43 = load i32, ptr %arrayidx65.10, align 4, !tbaa !5
%cmp66.10 = icmp eq i32 %43, 0
br i1 %cmp66.10, label %if.then68.10, label %for.inc71.10
if.then68.10: ; preds = %for.inc71.9
%call69.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 11)
br label %for.inc71.10
for.inc71.10: ; preds = %if.then68.10, %for.inc71.9
%arrayidx65.11 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 12
%44 = load i32, ptr %arrayidx65.11, align 16, !tbaa !5
%cmp66.11 = icmp eq i32 %44, 0
br i1 %cmp66.11, label %if.then68.11, label %for.inc71.11
if.then68.11: ; preds = %for.inc71.10
%call69.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 12)
br label %for.inc71.11
for.inc71.11: ; preds = %if.then68.11, %for.inc71.10
%arrayidx65.12 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 2, i64 13
%45 = load i32, ptr %arrayidx65.12, align 4, !tbaa !5
%cmp66.12 = icmp eq i32 %45, 0
br i1 %cmp66.12, label %if.then68.12, label %for.inc71.12
if.then68.12: ; preds = %for.inc71.11
%call69.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 67, i32 noundef 13)
br label %for.inc71.12
for.inc71.12: ; preds = %if.then68.12, %for.inc71.11
%46 = load i32, ptr %scevgep.3, align 4, !tbaa !5
%cmp81 = icmp eq i32 %46, 0
br i1 %cmp81, label %if.then83, label %for.inc86
if.then83: ; preds = %for.inc71.12
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 1)
br label %for.inc86
for.inc86: ; preds = %for.inc71.12, %if.then83
%arrayidx80.1 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 2
%47 = load i32, ptr %arrayidx80.1, align 16, !tbaa !5
%cmp81.1 = icmp eq i32 %47, 0
br i1 %cmp81.1, label %if.then83.1, label %for.inc86.1
if.then83.1: ; preds = %for.inc86
%call84.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 2)
br label %for.inc86.1
for.inc86.1: ; preds = %if.then83.1, %for.inc86
%arrayidx80.2 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 3
%48 = load i32, ptr %arrayidx80.2, align 4, !tbaa !5
%cmp81.2 = icmp eq i32 %48, 0
br i1 %cmp81.2, label %if.then83.2, label %for.inc86.2
if.then83.2: ; preds = %for.inc86.1
%call84.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 3)
br label %for.inc86.2
for.inc86.2: ; preds = %if.then83.2, %for.inc86.1
%arrayidx80.3 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 4
%49 = load i32, ptr %arrayidx80.3, align 8, !tbaa !5
%cmp81.3 = icmp eq i32 %49, 0
br i1 %cmp81.3, label %if.then83.3, label %for.inc86.3
if.then83.3: ; preds = %for.inc86.2
%call84.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 4)
br label %for.inc86.3
for.inc86.3: ; preds = %if.then83.3, %for.inc86.2
%arrayidx80.4 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 5
%50 = load i32, ptr %arrayidx80.4, align 4, !tbaa !5
%cmp81.4 = icmp eq i32 %50, 0
br i1 %cmp81.4, label %if.then83.4, label %for.inc86.4
if.then83.4: ; preds = %for.inc86.3
%call84.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 5)
br label %for.inc86.4
for.inc86.4: ; preds = %if.then83.4, %for.inc86.3
%arrayidx80.5 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 6
%51 = load i32, ptr %arrayidx80.5, align 16, !tbaa !5
%cmp81.5 = icmp eq i32 %51, 0
br i1 %cmp81.5, label %if.then83.5, label %for.inc86.5
if.then83.5: ; preds = %for.inc86.4
%call84.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 6)
br label %for.inc86.5
for.inc86.5: ; preds = %if.then83.5, %for.inc86.4
%arrayidx80.6 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 7
%52 = load i32, ptr %arrayidx80.6, align 4, !tbaa !5
%cmp81.6 = icmp eq i32 %52, 0
br i1 %cmp81.6, label %if.then83.6, label %for.inc86.6
if.then83.6: ; preds = %for.inc86.5
%call84.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 7)
br label %for.inc86.6
for.inc86.6: ; preds = %if.then83.6, %for.inc86.5
%arrayidx80.7 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 8
%53 = load i32, ptr %arrayidx80.7, align 8, !tbaa !5
%cmp81.7 = icmp eq i32 %53, 0
br i1 %cmp81.7, label %if.then83.7, label %for.inc86.7
if.then83.7: ; preds = %for.inc86.6
%call84.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 8)
br label %for.inc86.7
for.inc86.7: ; preds = %if.then83.7, %for.inc86.6
%arrayidx80.8 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 9
%54 = load i32, ptr %arrayidx80.8, align 4, !tbaa !5
%cmp81.8 = icmp eq i32 %54, 0
br i1 %cmp81.8, label %if.then83.8, label %for.inc86.8
if.then83.8: ; preds = %for.inc86.7
%call84.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 9)
br label %for.inc86.8
for.inc86.8: ; preds = %if.then83.8, %for.inc86.7
%arrayidx80.9 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 10
%55 = load i32, ptr %arrayidx80.9, align 16, !tbaa !5
%cmp81.9 = icmp eq i32 %55, 0
br i1 %cmp81.9, label %if.then83.9, label %for.inc86.9
if.then83.9: ; preds = %for.inc86.8
%call84.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 10)
br label %for.inc86.9
for.inc86.9: ; preds = %if.then83.9, %for.inc86.8
%arrayidx80.10 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 11
%56 = load i32, ptr %arrayidx80.10, align 4, !tbaa !5
%cmp81.10 = icmp eq i32 %56, 0
br i1 %cmp81.10, label %if.then83.10, label %for.inc86.10
if.then83.10: ; preds = %for.inc86.9
%call84.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 11)
br label %for.inc86.10
for.inc86.10: ; preds = %if.then83.10, %for.inc86.9
%arrayidx80.11 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 12
%57 = load i32, ptr %arrayidx80.11, align 8, !tbaa !5
%cmp81.11 = icmp eq i32 %57, 0
br i1 %cmp81.11, label %if.then83.11, label %for.inc86.11
if.then83.11: ; preds = %for.inc86.10
%call84.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 12)
br label %for.inc86.11
for.inc86.11: ; preds = %if.then83.11, %for.inc86.10
%arrayidx80.12 = getelementptr inbounds [4 x [14 x i32]], ptr %cards, i64 0, i64 3, i64 13
%58 = load i32, ptr %arrayidx80.12, align 4, !tbaa !5
%cmp81.12 = icmp eq i32 %58, 0
br i1 %cmp81.12, label %if.then83.12, label %cleanup
if.then83.12: ; preds = %for.inc86.11
%call84.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 68, i32 noundef 13)
br label %cleanup
cleanup: ; preds = %for.body11, %for.inc86.11, %if.then83.12
%retval.0 = phi i32 [ 0, %if.then83.12 ], [ 0, %for.inc86.11 ], [ 1, %for.body11 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %rank) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %egara) #4
call void @llvm.lifetime.end.p0(i64 224, ptr nonnull %cards) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
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: 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
char a,S,H,C,D;
int i,j,k,n,s[13],h[13],c[13],d[13];
scanf("%d",&n);
for(i=0;i<=12;i++)
{
s[i]=0;
h[i]=0;
c[i]=0;
d[i]=0;
}
for(j=0;j<=2*n-1;j++)
{
scanf("%c",&a);
if(a=='S')
{
scanf("%d",&i);
s[i-1] = 1;
}
else if(a=='H')
{
scanf("%d",&i);
h[i-1] = 1;
}
else if(a=='C')
{
scanf("%d",&i);
c[i-1] = 1;
}
else if(a=='D')
{
scanf("%d",&i);
d[i-1] = 1;
}
}
for(i=0;i<13;i++)
{
if(s[i]==0)
{
k = i+1;
printf("S %d\n",k);
}
}
for(i=0;i<13;i++)
{
if(h[i]==0)
{
k = i+1;
printf("H %d\n",k);
}
}
for(i=0;i<13;i++)
{
if(c[i]==0)
{
k = i+1;
printf("C %d\n",k);
}
}
for(i=0;i<13;i++)
{
if(d[i]==0)
{
k = i+1;
printf("D %d\n",k);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214556/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214556/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"S %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"H %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"C %d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"D %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
%i = alloca i32, align 4
%n = alloca i32, align 4
%s = alloca [13 x i32], align 16
%h = alloca [13 x i32], align 16
%c = alloca [13 x i32], align 16
%d = alloca [13 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(52) %s, i8 0, i64 52, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(52) %h, i8 0, i64 52, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(52) %c, i8 0, i64 52, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(52) %d, i8 0, i64 52, i1 false), !tbaa !5
store i32 13, ptr %i, align 4, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp8.not.not122 = icmp sgt i32 %0, 0
br i1 %cmp8.not.not122, label %for.body9, label %for.cond49.preheader
for.cond49.preheader: ; preds = %for.inc46, %entry
store i32 0, ptr %i, align 4, !tbaa !5
br label %for.body52
for.body9: ; preds = %entry, %for.inc46
%j.0123 = phi i32 [ %inc47, %for.inc46 ], [ 0, %entry ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%1 = load i8, ptr %a, align 1, !tbaa !9
switch i8 %1, label %for.inc46 [
i8 83, label %for.inc46.sink.split
i8 72, label %if.then20
i8 67, label %if.then29
i8 68, label %if.then38
]
if.then20: ; preds = %for.body9
br label %for.inc46.sink.split
if.then29: ; preds = %for.body9
br label %for.inc46.sink.split
if.then38: ; preds = %for.body9
br label %for.inc46.sink.split
for.inc46.sink.split: ; preds = %for.body9, %if.then20, %if.then38, %if.then29
%s.sink = phi ptr [ %c, %if.then29 ], [ %d, %if.then38 ], [ %h, %if.then20 ], [ %s, %for.body9 ]
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%.sink = load i32, ptr %i, align 4, !tbaa !5
%sub14 = add nsw i32 %.sink, -1
%idxprom15 = sext i32 %sub14 to i64
%arrayidx16 = getelementptr inbounds [13 x i32], ptr %s.sink, i64 0, i64 %idxprom15
store i32 1, ptr %arrayidx16, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.inc46.sink.split, %for.body9
%inc47 = add nuw nsw i32 %j.0123, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%mul = shl nsw i32 %2, 1
%cmp8.not.not = icmp slt i32 %inc47, %mul
br i1 %cmp8.not.not, label %for.body9, label %for.cond49.preheader, !llvm.loop !10
for.cond63.preheader: ; preds = %for.inc60
store i32 0, ptr %i, align 4, !tbaa !5
br label %for.body66
for.body52: ; preds = %for.cond49.preheader, %for.inc60
%storemerge116124 = phi i32 [ 0, %for.cond49.preheader ], [ %inc61, %for.inc60 ]
%idxprom53 = sext i32 %storemerge116124 to i64
%arrayidx54 = getelementptr inbounds [13 x i32], ptr %s, i64 0, i64 %idxprom53
%3 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%cmp55 = icmp eq i32 %3, 0
br i1 %cmp55, label %if.then57, label %for.inc60
if.then57: ; preds = %for.body52
%add = add nsw i32 %storemerge116124, 1
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
%.pre = load i32, ptr %i, align 4, !tbaa !5
br label %for.inc60
for.inc60: ; preds = %for.body52, %if.then57
%4 = phi i32 [ %storemerge116124, %for.body52 ], [ %.pre, %if.then57 ]
%inc61 = add nsw i32 %4, 1
store i32 %inc61, ptr %i, align 4, !tbaa !5
%cmp50 = icmp slt i32 %4, 12
br i1 %cmp50, label %for.body52, label %for.cond63.preheader, !llvm.loop !12
for.cond78.preheader: ; preds = %for.inc75
store i32 0, ptr %i, align 4, !tbaa !5
br label %for.body81
for.body66: ; preds = %for.cond63.preheader, %for.inc75
%storemerge117125 = phi i32 [ 0, %for.cond63.preheader ], [ %inc76, %for.inc75 ]
%idxprom67 = sext i32 %storemerge117125 to i64
%arrayidx68 = getelementptr inbounds [13 x i32], ptr %h, i64 0, i64 %idxprom67
%5 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%cmp69 = icmp eq i32 %5, 0
br i1 %cmp69, label %if.then71, label %for.inc75
if.then71: ; preds = %for.body66
%add72 = add nsw i32 %storemerge117125, 1
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add72)
%.pre129 = load i32, ptr %i, align 4, !tbaa !5
br label %for.inc75
for.inc75: ; preds = %for.body66, %if.then71
%6 = phi i32 [ %storemerge117125, %for.body66 ], [ %.pre129, %if.then71 ]
%inc76 = add nsw i32 %6, 1
store i32 %inc76, ptr %i, align 4, !tbaa !5
%cmp64 = icmp slt i32 %6, 12
br i1 %cmp64, label %for.body66, label %for.cond78.preheader, !llvm.loop !13
for.cond93.preheader: ; preds = %for.inc90
store i32 0, ptr %i, align 4, !tbaa !5
br label %for.body96
for.body81: ; preds = %for.cond78.preheader, %for.inc90
%storemerge118126 = phi i32 [ 0, %for.cond78.preheader ], [ %inc91, %for.inc90 ]
%idxprom82 = sext i32 %storemerge118126 to i64
%arrayidx83 = getelementptr inbounds [13 x i32], ptr %c, i64 0, i64 %idxprom82
%7 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%cmp84 = icmp eq i32 %7, 0
br i1 %cmp84, label %if.then86, label %for.inc90
if.then86: ; preds = %for.body81
%add87 = add nsw i32 %storemerge118126, 1
%call88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %add87)
%.pre130 = load i32, ptr %i, align 4, !tbaa !5
br label %for.inc90
for.inc90: ; preds = %for.body81, %if.then86
%8 = phi i32 [ %storemerge118126, %for.body81 ], [ %.pre130, %if.then86 ]
%inc91 = add nsw i32 %8, 1
store i32 %inc91, ptr %i, align 4, !tbaa !5
%cmp79 = icmp slt i32 %8, 12
br i1 %cmp79, label %for.body81, label %for.cond93.preheader, !llvm.loop !14
for.body96: ; preds = %for.cond93.preheader, %for.inc105
%storemerge119127 = phi i32 [ 0, %for.cond93.preheader ], [ %inc106, %for.inc105 ]
%idxprom97 = sext i32 %storemerge119127 to i64
%arrayidx98 = getelementptr inbounds [13 x i32], ptr %d, i64 0, i64 %idxprom97
%9 = load i32, ptr %arrayidx98, align 4, !tbaa !5
%cmp99 = icmp eq i32 %9, 0
br i1 %cmp99, label %if.then101, label %for.inc105
if.then101: ; preds = %for.body96
%add102 = add nsw i32 %storemerge119127, 1
%call103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %add102)
%.pre131 = load i32, ptr %i, align 4, !tbaa !5
br label %for.inc105
for.inc105: ; preds = %for.body96, %if.then101
%10 = phi i32 [ %storemerge119127, %for.body96 ], [ %.pre131, %if.then101 ]
%inc106 = add nsw i32 %10, 1
store i32 %inc106, ptr %i, align 4, !tbaa !5
%cmp94 = icmp slt i32 %10, 12
br i1 %cmp94, label %for.body96, label %for.end107, !llvm.loop !15
for.end107: ; preds = %for.inc105
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!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>
#include<math.h>
int main() {
int test;
scanf("%d\n",&test);
int n;
for(int i=0;i<test;i++) {
int a=0,b=0;
scanf("%d\n",&n);
a = (2 *(1 - pow(2, n/2-1))) / (-1) + pow(2,n);
b = (pow(2,n/2) *(1 - pow(2, n/2))) / (-1) ;
if(i==(test-1)) printf("%d",a-b);
else printf("%d\n",a-b);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2146/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2146/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%test = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %test) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %test)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%0 = load i32, ptr %test, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %test) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.033 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %1, 2
%sub = add nsw i32 %div, -1
%ldexp = call double @ldexp(double 1.000000e+00, i32 %sub) #4
%sub3 = fsub double 1.000000e+00, %ldexp
%div4 = fmul double %sub3, 2.000000e+00
%2 = load i32, ptr %n, align 4, !tbaa !5
%ldexp29 = call double @ldexp(double 1.000000e+00, i32 %2) #4
%3 = fsub double %ldexp29, %div4
%conv7 = fptosi double %3 to i32
%4 = load i32, ptr %n, align 4, !tbaa !5
%div8 = sdiv i32 %4, 2
%ldexp30 = call double @ldexp(double 1.000000e+00, i32 %div8) #4
%5 = load i32, ptr %n, align 4, !tbaa !5
%div11 = sdiv i32 %5, 2
%ldexp31 = call double @ldexp(double 1.000000e+00, i32 %div11) #4
%sub14 = fsub double 1.000000e+00, %ldexp31
%6 = fneg double %ldexp30
%div16 = fmul double %sub14, %6
%conv17 = fptosi double %div16 to i32
%7 = load i32, ptr %test, align 4, !tbaa !5
%sub18 = add nsw i32 %7, -1
%cmp19 = icmp eq i32 %i.033, %sub18
%sub21 = sub nsw i32 %conv7, %conv17
%.str.1..str = select i1 %cmp19, ptr @.str.1, ptr @.str
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str, i32 noundef %sub21)
%inc = add nuw nsw i32 %i.033, 1
%8 = load i32, ptr %test, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn
declare double @ldexp(double, i32) 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 willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int card[4][13] = {};
char symbol;
int number;
int n;
int i, j;
scanf("%d", &n);
for(i=0; i<n*2; i++){
scanf("%c %d", &symbol, &number);
switch(symbol){
case 'S':
card[0][number-1] = 1;
break;
case 'H':
card[1][number-1] = 1;
break;
case 'C':
card[2][number-1] = 1;
break;
case 'D':
card[3][number-1] = 1;
break;
}
}
for(i=0; i<4; i++){
for(j=0; j<13; j++){
if(card[i][j]==0){
switch(i){
case 0:
printf("S %d\n", j+1);
break;
case 1:
printf("H %d\n", j+1);
break;
case 2:
printf("C %d\n", j+1);
break;
case 3:
printf("D %d\n", j+1);
break;
}
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214642/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214642/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%c %d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"S %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"H %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"C %d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"D %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%card = alloca [4 x [13 x i32]], align 16
%symbol = alloca i8, align 1
%number = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %card) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(208) %card, i8 0, i64 208, i1 false)
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %symbol) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #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
%cmp62 = icmp sgt i32 %0, 0
br i1 %cmp62, label %for.body, label %for.cond22.preheader.preheader
for.body: ; preds = %entry, %for.inc
%i.063 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %symbol, ptr noundef nonnull %number)
%1 = load i8, ptr %symbol, align 1, !tbaa !9
%conv = sext i8 %1 to i32
switch i32 %conv, label %for.inc [
i32 83, label %sw.bb
i32 72, label %sw.bb3
i32 67, label %sw.bb8
i32 68, label %sw.bb13
]
sw.bb: ; preds = %for.body
%2 = load i32, ptr %number, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx2 = getelementptr inbounds [13 x i32], ptr %card, i64 0, i64 %idxprom
br label %for.inc.sink.split
sw.bb3: ; preds = %for.body
%3 = load i32, ptr %number, align 4, !tbaa !5
%sub5 = add nsw i32 %3, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 1, i64 %idxprom6
br label %for.inc.sink.split
sw.bb8: ; preds = %for.body
%4 = load i32, ptr %number, align 4, !tbaa !5
%sub10 = add nsw i32 %4, -1
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 2, i64 %idxprom11
br label %for.inc.sink.split
sw.bb13: ; preds = %for.body
%5 = load i32, ptr %number, align 4, !tbaa !5
%sub15 = add nsw i32 %5, -1
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 3, i64 %idxprom16
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %sw.bb13, %sw.bb8, %sw.bb3, %sw.bb
%arrayidx2.sink = phi ptr [ %arrayidx2, %sw.bb ], [ %arrayidx7, %sw.bb3 ], [ %arrayidx12, %sw.bb8 ], [ %arrayidx17, %sw.bb13 ]
store i32 1, ptr %arrayidx2.sink, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body
%inc = add nuw nsw i32 %i.063, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%mul = shl nsw i32 %6, 1
%cmp = icmp slt i32 %inc, %mul
br i1 %cmp, label %for.body, label %for.cond22.preheader.preheader, !llvm.loop !10
for.cond22.preheader.preheader: ; preds = %for.inc, %entry
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.cond22.preheader.preheader, %for.inc47
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc47 ], [ 0, %for.cond22.preheader.preheader ]
%7 = trunc i64 %indvars.iv to i32
switch i32 %7, label %for.inc47 [
i32 0, label %for.body25.us.preheader
i32 1, label %for.body25.us66.preheader
i32 2, label %for.body25.us76.preheader
i32 3, label %for.body25.us86.preheader
]
for.body25.us86.preheader: ; preds = %for.cond22.preheader
%arrayidx29.us89 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 0
%8 = load i32, ptr %arrayidx29.us89, align 4, !tbaa !5
%cmp30.us90 = icmp eq i32 %8, 0
br i1 %cmp30.us90, label %if.then.us91, label %for.inc44.us92
for.body25.us76.preheader: ; preds = %for.cond22.preheader
%arrayidx29.us79 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 0
%9 = load i32, ptr %arrayidx29.us79, align 4, !tbaa !5
%cmp30.us80 = icmp eq i32 %9, 0
br i1 %cmp30.us80, label %if.then.us81, label %for.inc44.us82
for.body25.us66.preheader: ; preds = %for.cond22.preheader
%arrayidx29.us69 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 0
%10 = load i32, ptr %arrayidx29.us69, align 4, !tbaa !5
%cmp30.us70 = icmp eq i32 %10, 0
br i1 %cmp30.us70, label %if.then.us71, label %for.inc44.us72
for.body25.us.preheader: ; preds = %for.cond22.preheader
%arrayidx29.us = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 0
%11 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%cmp30.us = icmp eq i32 %11, 0
br i1 %cmp30.us, label %if.then.us, label %for.inc44.us
if.then.us: ; preds = %for.body25.us.preheader
%call33.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
br label %for.inc44.us
for.inc44.us: ; preds = %if.then.us, %for.body25.us.preheader
%arrayidx29.us.1 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%12 = load i32, ptr %arrayidx29.us.1, align 4, !tbaa !5
%cmp30.us.1 = icmp eq i32 %12, 0
br i1 %cmp30.us.1, label %if.then.us.1, label %for.inc44.us.1
if.then.us.1: ; preds = %for.inc44.us
%call33.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
br label %for.inc44.us.1
for.inc44.us.1: ; preds = %if.then.us.1, %for.inc44.us
%arrayidx29.us.2 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%13 = load i32, ptr %arrayidx29.us.2, align 4, !tbaa !5
%cmp30.us.2 = icmp eq i32 %13, 0
br i1 %cmp30.us.2, label %if.then.us.2, label %for.inc44.us.2
if.then.us.2: ; preds = %for.inc44.us.1
%call33.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
br label %for.inc44.us.2
for.inc44.us.2: ; preds = %if.then.us.2, %for.inc44.us.1
%arrayidx29.us.3 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%14 = load i32, ptr %arrayidx29.us.3, align 4, !tbaa !5
%cmp30.us.3 = icmp eq i32 %14, 0
br i1 %cmp30.us.3, label %if.then.us.3, label %for.inc44.us.3
if.then.us.3: ; preds = %for.inc44.us.2
%call33.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
br label %for.inc44.us.3
for.inc44.us.3: ; preds = %if.then.us.3, %for.inc44.us.2
%arrayidx29.us.4 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%15 = load i32, ptr %arrayidx29.us.4, align 4, !tbaa !5
%cmp30.us.4 = icmp eq i32 %15, 0
br i1 %cmp30.us.4, label %if.then.us.4, label %for.inc44.us.4
if.then.us.4: ; preds = %for.inc44.us.3
%call33.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
br label %for.inc44.us.4
for.inc44.us.4: ; preds = %if.then.us.4, %for.inc44.us.3
%arrayidx29.us.5 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%16 = load i32, ptr %arrayidx29.us.5, align 4, !tbaa !5
%cmp30.us.5 = icmp eq i32 %16, 0
br i1 %cmp30.us.5, label %if.then.us.5, label %for.inc44.us.5
if.then.us.5: ; preds = %for.inc44.us.4
%call33.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
br label %for.inc44.us.5
for.inc44.us.5: ; preds = %if.then.us.5, %for.inc44.us.4
%arrayidx29.us.6 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%17 = load i32, ptr %arrayidx29.us.6, align 4, !tbaa !5
%cmp30.us.6 = icmp eq i32 %17, 0
br i1 %cmp30.us.6, label %if.then.us.6, label %for.inc44.us.6
if.then.us.6: ; preds = %for.inc44.us.5
%call33.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 7)
br label %for.inc44.us.6
for.inc44.us.6: ; preds = %if.then.us.6, %for.inc44.us.5
%arrayidx29.us.7 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%18 = load i32, ptr %arrayidx29.us.7, align 4, !tbaa !5
%cmp30.us.7 = icmp eq i32 %18, 0
br i1 %cmp30.us.7, label %if.then.us.7, label %for.inc44.us.7
if.then.us.7: ; preds = %for.inc44.us.6
%call33.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 8)
br label %for.inc44.us.7
for.inc44.us.7: ; preds = %if.then.us.7, %for.inc44.us.6
%arrayidx29.us.8 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%19 = load i32, ptr %arrayidx29.us.8, align 4, !tbaa !5
%cmp30.us.8 = icmp eq i32 %19, 0
br i1 %cmp30.us.8, label %if.then.us.8, label %for.inc44.us.8
if.then.us.8: ; preds = %for.inc44.us.7
%call33.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 9)
br label %for.inc44.us.8
for.inc44.us.8: ; preds = %if.then.us.8, %for.inc44.us.7
%arrayidx29.us.9 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%20 = load i32, ptr %arrayidx29.us.9, align 4, !tbaa !5
%cmp30.us.9 = icmp eq i32 %20, 0
br i1 %cmp30.us.9, label %if.then.us.9, label %for.inc44.us.9
if.then.us.9: ; preds = %for.inc44.us.8
%call33.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 10)
br label %for.inc44.us.9
for.inc44.us.9: ; preds = %if.then.us.9, %for.inc44.us.8
%arrayidx29.us.10 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%21 = load i32, ptr %arrayidx29.us.10, align 4, !tbaa !5
%cmp30.us.10 = icmp eq i32 %21, 0
br i1 %cmp30.us.10, label %if.then.us.10, label %for.inc44.us.10
if.then.us.10: ; preds = %for.inc44.us.9
%call33.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 11)
br label %for.inc44.us.10
for.inc44.us.10: ; preds = %if.then.us.10, %for.inc44.us.9
%arrayidx29.us.11 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%22 = load i32, ptr %arrayidx29.us.11, align 4, !tbaa !5
%cmp30.us.11 = icmp eq i32 %22, 0
br i1 %cmp30.us.11, label %if.then.us.11, label %for.inc44.us.11
if.then.us.11: ; preds = %for.inc44.us.10
%call33.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 12)
br label %for.inc44.us.11
for.inc44.us.11: ; preds = %if.then.us.11, %for.inc44.us.10
%arrayidx29.us.12 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%23 = load i32, ptr %arrayidx29.us.12, align 4, !tbaa !5
%cmp30.us.12 = icmp eq i32 %23, 0
br i1 %cmp30.us.12, label %for.inc47.sink.split, label %for.inc47
if.then.us71: ; preds = %for.body25.us66.preheader
%call36.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 1)
br label %for.inc44.us72
for.inc44.us72: ; preds = %if.then.us71, %for.body25.us66.preheader
%arrayidx29.us69.1 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%24 = load i32, ptr %arrayidx29.us69.1, align 4, !tbaa !5
%cmp30.us70.1 = icmp eq i32 %24, 0
br i1 %cmp30.us70.1, label %if.then.us71.1, label %for.inc44.us72.1
if.then.us71.1: ; preds = %for.inc44.us72
%call36.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 2)
br label %for.inc44.us72.1
for.inc44.us72.1: ; preds = %if.then.us71.1, %for.inc44.us72
%arrayidx29.us69.2 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%25 = load i32, ptr %arrayidx29.us69.2, align 4, !tbaa !5
%cmp30.us70.2 = icmp eq i32 %25, 0
br i1 %cmp30.us70.2, label %if.then.us71.2, label %for.inc44.us72.2
if.then.us71.2: ; preds = %for.inc44.us72.1
%call36.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 3)
br label %for.inc44.us72.2
for.inc44.us72.2: ; preds = %if.then.us71.2, %for.inc44.us72.1
%arrayidx29.us69.3 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%26 = load i32, ptr %arrayidx29.us69.3, align 4, !tbaa !5
%cmp30.us70.3 = icmp eq i32 %26, 0
br i1 %cmp30.us70.3, label %if.then.us71.3, label %for.inc44.us72.3
if.then.us71.3: ; preds = %for.inc44.us72.2
%call36.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 4)
br label %for.inc44.us72.3
for.inc44.us72.3: ; preds = %if.then.us71.3, %for.inc44.us72.2
%arrayidx29.us69.4 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%27 = load i32, ptr %arrayidx29.us69.4, align 4, !tbaa !5
%cmp30.us70.4 = icmp eq i32 %27, 0
br i1 %cmp30.us70.4, label %if.then.us71.4, label %for.inc44.us72.4
if.then.us71.4: ; preds = %for.inc44.us72.3
%call36.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 5)
br label %for.inc44.us72.4
for.inc44.us72.4: ; preds = %if.then.us71.4, %for.inc44.us72.3
%arrayidx29.us69.5 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%28 = load i32, ptr %arrayidx29.us69.5, align 4, !tbaa !5
%cmp30.us70.5 = icmp eq i32 %28, 0
br i1 %cmp30.us70.5, label %if.then.us71.5, label %for.inc44.us72.5
if.then.us71.5: ; preds = %for.inc44.us72.4
%call36.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 6)
br label %for.inc44.us72.5
for.inc44.us72.5: ; preds = %if.then.us71.5, %for.inc44.us72.4
%arrayidx29.us69.6 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%29 = load i32, ptr %arrayidx29.us69.6, align 4, !tbaa !5
%cmp30.us70.6 = icmp eq i32 %29, 0
br i1 %cmp30.us70.6, label %if.then.us71.6, label %for.inc44.us72.6
if.then.us71.6: ; preds = %for.inc44.us72.5
%call36.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 7)
br label %for.inc44.us72.6
for.inc44.us72.6: ; preds = %if.then.us71.6, %for.inc44.us72.5
%arrayidx29.us69.7 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%30 = load i32, ptr %arrayidx29.us69.7, align 4, !tbaa !5
%cmp30.us70.7 = icmp eq i32 %30, 0
br i1 %cmp30.us70.7, label %if.then.us71.7, label %for.inc44.us72.7
if.then.us71.7: ; preds = %for.inc44.us72.6
%call36.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 8)
br label %for.inc44.us72.7
for.inc44.us72.7: ; preds = %if.then.us71.7, %for.inc44.us72.6
%arrayidx29.us69.8 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%31 = load i32, ptr %arrayidx29.us69.8, align 4, !tbaa !5
%cmp30.us70.8 = icmp eq i32 %31, 0
br i1 %cmp30.us70.8, label %if.then.us71.8, label %for.inc44.us72.8
if.then.us71.8: ; preds = %for.inc44.us72.7
%call36.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 9)
br label %for.inc44.us72.8
for.inc44.us72.8: ; preds = %if.then.us71.8, %for.inc44.us72.7
%arrayidx29.us69.9 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%32 = load i32, ptr %arrayidx29.us69.9, align 4, !tbaa !5
%cmp30.us70.9 = icmp eq i32 %32, 0
br i1 %cmp30.us70.9, label %if.then.us71.9, label %for.inc44.us72.9
if.then.us71.9: ; preds = %for.inc44.us72.8
%call36.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 10)
br label %for.inc44.us72.9
for.inc44.us72.9: ; preds = %if.then.us71.9, %for.inc44.us72.8
%arrayidx29.us69.10 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%33 = load i32, ptr %arrayidx29.us69.10, align 4, !tbaa !5
%cmp30.us70.10 = icmp eq i32 %33, 0
br i1 %cmp30.us70.10, label %if.then.us71.10, label %for.inc44.us72.10
if.then.us71.10: ; preds = %for.inc44.us72.9
%call36.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 11)
br label %for.inc44.us72.10
for.inc44.us72.10: ; preds = %if.then.us71.10, %for.inc44.us72.9
%arrayidx29.us69.11 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%34 = load i32, ptr %arrayidx29.us69.11, align 4, !tbaa !5
%cmp30.us70.11 = icmp eq i32 %34, 0
br i1 %cmp30.us70.11, label %if.then.us71.11, label %for.inc44.us72.11
if.then.us71.11: ; preds = %for.inc44.us72.10
%call36.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 12)
br label %for.inc44.us72.11
for.inc44.us72.11: ; preds = %if.then.us71.11, %for.inc44.us72.10
%arrayidx29.us69.12 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%35 = load i32, ptr %arrayidx29.us69.12, align 4, !tbaa !5
%cmp30.us70.12 = icmp eq i32 %35, 0
br i1 %cmp30.us70.12, label %for.inc47.sink.split, label %for.inc47
if.then.us81: ; preds = %for.body25.us76.preheader
%call39.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 1)
br label %for.inc44.us82
for.inc44.us82: ; preds = %if.then.us81, %for.body25.us76.preheader
%arrayidx29.us79.1 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%36 = load i32, ptr %arrayidx29.us79.1, align 4, !tbaa !5
%cmp30.us80.1 = icmp eq i32 %36, 0
br i1 %cmp30.us80.1, label %if.then.us81.1, label %for.inc44.us82.1
if.then.us81.1: ; preds = %for.inc44.us82
%call39.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 2)
br label %for.inc44.us82.1
for.inc44.us82.1: ; preds = %if.then.us81.1, %for.inc44.us82
%arrayidx29.us79.2 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%37 = load i32, ptr %arrayidx29.us79.2, align 4, !tbaa !5
%cmp30.us80.2 = icmp eq i32 %37, 0
br i1 %cmp30.us80.2, label %if.then.us81.2, label %for.inc44.us82.2
if.then.us81.2: ; preds = %for.inc44.us82.1
%call39.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 3)
br label %for.inc44.us82.2
for.inc44.us82.2: ; preds = %if.then.us81.2, %for.inc44.us82.1
%arrayidx29.us79.3 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%38 = load i32, ptr %arrayidx29.us79.3, align 4, !tbaa !5
%cmp30.us80.3 = icmp eq i32 %38, 0
br i1 %cmp30.us80.3, label %if.then.us81.3, label %for.inc44.us82.3
if.then.us81.3: ; preds = %for.inc44.us82.2
%call39.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 4)
br label %for.inc44.us82.3
for.inc44.us82.3: ; preds = %if.then.us81.3, %for.inc44.us82.2
%arrayidx29.us79.4 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%39 = load i32, ptr %arrayidx29.us79.4, align 4, !tbaa !5
%cmp30.us80.4 = icmp eq i32 %39, 0
br i1 %cmp30.us80.4, label %if.then.us81.4, label %for.inc44.us82.4
if.then.us81.4: ; preds = %for.inc44.us82.3
%call39.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 5)
br label %for.inc44.us82.4
for.inc44.us82.4: ; preds = %if.then.us81.4, %for.inc44.us82.3
%arrayidx29.us79.5 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%40 = load i32, ptr %arrayidx29.us79.5, align 4, !tbaa !5
%cmp30.us80.5 = icmp eq i32 %40, 0
br i1 %cmp30.us80.5, label %if.then.us81.5, label %for.inc44.us82.5
if.then.us81.5: ; preds = %for.inc44.us82.4
%call39.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 6)
br label %for.inc44.us82.5
for.inc44.us82.5: ; preds = %if.then.us81.5, %for.inc44.us82.4
%arrayidx29.us79.6 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%41 = load i32, ptr %arrayidx29.us79.6, align 4, !tbaa !5
%cmp30.us80.6 = icmp eq i32 %41, 0
br i1 %cmp30.us80.6, label %if.then.us81.6, label %for.inc44.us82.6
if.then.us81.6: ; preds = %for.inc44.us82.5
%call39.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 7)
br label %for.inc44.us82.6
for.inc44.us82.6: ; preds = %if.then.us81.6, %for.inc44.us82.5
%arrayidx29.us79.7 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%42 = load i32, ptr %arrayidx29.us79.7, align 4, !tbaa !5
%cmp30.us80.7 = icmp eq i32 %42, 0
br i1 %cmp30.us80.7, label %if.then.us81.7, label %for.inc44.us82.7
if.then.us81.7: ; preds = %for.inc44.us82.6
%call39.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 8)
br label %for.inc44.us82.7
for.inc44.us82.7: ; preds = %if.then.us81.7, %for.inc44.us82.6
%arrayidx29.us79.8 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%43 = load i32, ptr %arrayidx29.us79.8, align 4, !tbaa !5
%cmp30.us80.8 = icmp eq i32 %43, 0
br i1 %cmp30.us80.8, label %if.then.us81.8, label %for.inc44.us82.8
if.then.us81.8: ; preds = %for.inc44.us82.7
%call39.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 9)
br label %for.inc44.us82.8
for.inc44.us82.8: ; preds = %if.then.us81.8, %for.inc44.us82.7
%arrayidx29.us79.9 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%44 = load i32, ptr %arrayidx29.us79.9, align 4, !tbaa !5
%cmp30.us80.9 = icmp eq i32 %44, 0
br i1 %cmp30.us80.9, label %if.then.us81.9, label %for.inc44.us82.9
if.then.us81.9: ; preds = %for.inc44.us82.8
%call39.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 10)
br label %for.inc44.us82.9
for.inc44.us82.9: ; preds = %if.then.us81.9, %for.inc44.us82.8
%arrayidx29.us79.10 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%45 = load i32, ptr %arrayidx29.us79.10, align 4, !tbaa !5
%cmp30.us80.10 = icmp eq i32 %45, 0
br i1 %cmp30.us80.10, label %if.then.us81.10, label %for.inc44.us82.10
if.then.us81.10: ; preds = %for.inc44.us82.9
%call39.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 11)
br label %for.inc44.us82.10
for.inc44.us82.10: ; preds = %if.then.us81.10, %for.inc44.us82.9
%arrayidx29.us79.11 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%46 = load i32, ptr %arrayidx29.us79.11, align 4, !tbaa !5
%cmp30.us80.11 = icmp eq i32 %46, 0
br i1 %cmp30.us80.11, label %if.then.us81.11, label %for.inc44.us82.11
if.then.us81.11: ; preds = %for.inc44.us82.10
%call39.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 12)
br label %for.inc44.us82.11
for.inc44.us82.11: ; preds = %if.then.us81.11, %for.inc44.us82.10
%arrayidx29.us79.12 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%47 = load i32, ptr %arrayidx29.us79.12, align 4, !tbaa !5
%cmp30.us80.12 = icmp eq i32 %47, 0
br i1 %cmp30.us80.12, label %for.inc47.sink.split, label %for.inc47
if.then.us91: ; preds = %for.body25.us86.preheader
%call42.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 1)
br label %for.inc44.us92
for.inc44.us92: ; preds = %if.then.us91, %for.body25.us86.preheader
%arrayidx29.us89.1 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%48 = load i32, ptr %arrayidx29.us89.1, align 4, !tbaa !5
%cmp30.us90.1 = icmp eq i32 %48, 0
br i1 %cmp30.us90.1, label %if.then.us91.1, label %for.inc44.us92.1
if.then.us91.1: ; preds = %for.inc44.us92
%call42.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 2)
br label %for.inc44.us92.1
for.inc44.us92.1: ; preds = %if.then.us91.1, %for.inc44.us92
%arrayidx29.us89.2 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%49 = load i32, ptr %arrayidx29.us89.2, align 4, !tbaa !5
%cmp30.us90.2 = icmp eq i32 %49, 0
br i1 %cmp30.us90.2, label %if.then.us91.2, label %for.inc44.us92.2
if.then.us91.2: ; preds = %for.inc44.us92.1
%call42.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 3)
br label %for.inc44.us92.2
for.inc44.us92.2: ; preds = %if.then.us91.2, %for.inc44.us92.1
%arrayidx29.us89.3 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%50 = load i32, ptr %arrayidx29.us89.3, align 4, !tbaa !5
%cmp30.us90.3 = icmp eq i32 %50, 0
br i1 %cmp30.us90.3, label %if.then.us91.3, label %for.inc44.us92.3
if.then.us91.3: ; preds = %for.inc44.us92.2
%call42.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 4)
br label %for.inc44.us92.3
for.inc44.us92.3: ; preds = %if.then.us91.3, %for.inc44.us92.2
%arrayidx29.us89.4 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%51 = load i32, ptr %arrayidx29.us89.4, align 4, !tbaa !5
%cmp30.us90.4 = icmp eq i32 %51, 0
br i1 %cmp30.us90.4, label %if.then.us91.4, label %for.inc44.us92.4
if.then.us91.4: ; preds = %for.inc44.us92.3
%call42.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 5)
br label %for.inc44.us92.4
for.inc44.us92.4: ; preds = %if.then.us91.4, %for.inc44.us92.3
%arrayidx29.us89.5 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%52 = load i32, ptr %arrayidx29.us89.5, align 4, !tbaa !5
%cmp30.us90.5 = icmp eq i32 %52, 0
br i1 %cmp30.us90.5, label %if.then.us91.5, label %for.inc44.us92.5
if.then.us91.5: ; preds = %for.inc44.us92.4
%call42.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 6)
br label %for.inc44.us92.5
for.inc44.us92.5: ; preds = %if.then.us91.5, %for.inc44.us92.4
%arrayidx29.us89.6 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%53 = load i32, ptr %arrayidx29.us89.6, align 4, !tbaa !5
%cmp30.us90.6 = icmp eq i32 %53, 0
br i1 %cmp30.us90.6, label %if.then.us91.6, label %for.inc44.us92.6
if.then.us91.6: ; preds = %for.inc44.us92.5
%call42.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 7)
br label %for.inc44.us92.6
for.inc44.us92.6: ; preds = %if.then.us91.6, %for.inc44.us92.5
%arrayidx29.us89.7 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%54 = load i32, ptr %arrayidx29.us89.7, align 4, !tbaa !5
%cmp30.us90.7 = icmp eq i32 %54, 0
br i1 %cmp30.us90.7, label %if.then.us91.7, label %for.inc44.us92.7
if.then.us91.7: ; preds = %for.inc44.us92.6
%call42.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 8)
br label %for.inc44.us92.7
for.inc44.us92.7: ; preds = %if.then.us91.7, %for.inc44.us92.6
%arrayidx29.us89.8 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%55 = load i32, ptr %arrayidx29.us89.8, align 4, !tbaa !5
%cmp30.us90.8 = icmp eq i32 %55, 0
br i1 %cmp30.us90.8, label %if.then.us91.8, label %for.inc44.us92.8
if.then.us91.8: ; preds = %for.inc44.us92.7
%call42.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 9)
br label %for.inc44.us92.8
for.inc44.us92.8: ; preds = %if.then.us91.8, %for.inc44.us92.7
%arrayidx29.us89.9 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%56 = load i32, ptr %arrayidx29.us89.9, align 4, !tbaa !5
%cmp30.us90.9 = icmp eq i32 %56, 0
br i1 %cmp30.us90.9, label %if.then.us91.9, label %for.inc44.us92.9
if.then.us91.9: ; preds = %for.inc44.us92.8
%call42.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 10)
br label %for.inc44.us92.9
for.inc44.us92.9: ; preds = %if.then.us91.9, %for.inc44.us92.8
%arrayidx29.us89.10 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%57 = load i32, ptr %arrayidx29.us89.10, align 4, !tbaa !5
%cmp30.us90.10 = icmp eq i32 %57, 0
br i1 %cmp30.us90.10, label %if.then.us91.10, label %for.inc44.us92.10
if.then.us91.10: ; preds = %for.inc44.us92.9
%call42.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 11)
br label %for.inc44.us92.10
for.inc44.us92.10: ; preds = %if.then.us91.10, %for.inc44.us92.9
%arrayidx29.us89.11 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%58 = load i32, ptr %arrayidx29.us89.11, align 4, !tbaa !5
%cmp30.us90.11 = icmp eq i32 %58, 0
br i1 %cmp30.us90.11, label %if.then.us91.11, label %for.inc44.us92.11
if.then.us91.11: ; preds = %for.inc44.us92.10
%call42.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 12)
br label %for.inc44.us92.11
for.inc44.us92.11: ; preds = %if.then.us91.11, %for.inc44.us92.10
%arrayidx29.us89.12 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%59 = load i32, ptr %arrayidx29.us89.12, align 4, !tbaa !5
%cmp30.us90.12 = icmp eq i32 %59, 0
br i1 %cmp30.us90.12, label %for.inc47.sink.split, label %for.inc47
for.inc47.sink.split: ; preds = %for.inc44.us92.11, %for.inc44.us82.11, %for.inc44.us72.11, %for.inc44.us.11
%.str.5.sink = phi ptr [ @.str.2, %for.inc44.us.11 ], [ @.str.3, %for.inc44.us72.11 ], [ @.str.4, %for.inc44.us82.11 ], [ @.str.5, %for.inc44.us92.11 ]
%call42.us.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.5.sink, i32 noundef 13)
br label %for.inc47
for.inc47: ; preds = %for.inc47.sink.split, %for.inc44.us92.11, %for.inc44.us82.11, %for.inc44.us72.11, %for.inc44.us.11, %for.cond22.preheader
%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.end49, label %for.cond22.preheader, !llvm.loop !12
for.end49: ; preds = %for.inc47
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %symbol) #4
call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %card) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
int main(void)
{
int i, j, n;
int rec[4][13] = {0};
char mark[4];
int num;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%s %d", mark, &num);
if(mark[0] == 'S') rec[0][num-1]++;
if(mark[0] == 'H') rec[1][num-1]++;
if(mark[0] == 'C') rec[2][num-1]++;
if(mark[0] == 'D') rec[3][num-1]++;
}
for(i = 0; i < 4; i++) {
for(j = 0; j < 13; j++) {
if(rec[i][j] == 0) {
switch(i) {
case 0: printf("S %d\n", j+1); break;
case 1: printf("H %d\n", j+1); break;
case 2: printf("C %d\n", j+1); break;
case 3: printf("D %d\n", j+1); break;
}
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214736/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214736/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"S %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"H %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"C %d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"D %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%rec = alloca [4 x [13 x i32]], align 16
%mark = alloca [4 x i8], align 1
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %rec) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(208) %rec, i8 0, i64 208, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %mark) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp86 = icmp sgt i32 %0, 0
br i1 %cmp86, label %for.body, label %for.cond44.preheader.preheader
for.body: ; preds = %entry, %for.inc
%i.087 = phi i32 [ %inc39, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %mark, ptr noundef nonnull %num)
%1 = load i8, ptr %mark, align 1, !tbaa !9
switch i8 %1, label %for.inc [
i8 83, label %if.end.thread
i8 72, label %if.then10
i8 67, label %if.then21
i8 68, label %if.then32
]
if.end.thread: ; preds = %for.body
%2 = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [13 x i32], ptr %rec, i64 0, i64 %idxprom
br label %for.inc.sink.split
if.then10: ; preds = %for.body
%3 = load i32, ptr %num, align 4, !tbaa !5
%sub12 = add nsw i32 %3, -1
%idxprom13 = sext i32 %sub12 to i64
%arrayidx14 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 1, i64 %idxprom13
br label %for.inc.sink.split
if.then21: ; preds = %for.body
%4 = load i32, ptr %num, align 4, !tbaa !5
%sub23 = add nsw i32 %4, -1
%idxprom24 = sext i32 %sub23 to i64
%arrayidx25 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 2, i64 %idxprom24
br label %for.inc.sink.split
if.then32: ; preds = %for.body
%5 = load i32, ptr %num, align 4, !tbaa !5
%sub34 = add nsw i32 %5, -1
%idxprom35 = sext i32 %sub34 to i64
%arrayidx36 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 3, i64 %idxprom35
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %if.then32, %if.then21, %if.end.thread, %if.then10
%arrayidx14.sink133 = phi ptr [ %arrayidx14, %if.then10 ], [ %arrayidx5, %if.end.thread ], [ %arrayidx25, %if.then21 ], [ %arrayidx36, %if.then32 ]
%6 = load i32, ptr %arrayidx14.sink133, align 4, !tbaa !5
%inc15 = add nsw i32 %6, 1
store i32 %inc15, ptr %arrayidx14.sink133, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body
%inc39 = add nuw nsw i32 %i.087, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc39, %7
br i1 %cmp, label %for.body, label %for.cond44.preheader.preheader, !llvm.loop !10
for.cond44.preheader.preheader: ; preds = %for.inc, %entry
br label %for.cond44.preheader
for.cond44.preheader: ; preds = %for.cond44.preheader.preheader, %for.inc69
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc69 ], [ 0, %for.cond44.preheader.preheader ]
%8 = trunc i64 %indvars.iv to i32
switch i32 %8, label %for.inc69 [
i32 0, label %for.body47.us.preheader
i32 1, label %for.body47.us90.preheader
i32 2, label %for.body47.us100.preheader
i32 3, label %for.body47.us110.preheader
]
for.body47.us110.preheader: ; preds = %for.cond44.preheader
%arrayidx51.us113 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 0
%9 = load i32, ptr %arrayidx51.us113, align 4, !tbaa !5
%cmp52.us114 = icmp eq i32 %9, 0
br i1 %cmp52.us114, label %if.then54.us115, label %for.inc66.us116
for.body47.us100.preheader: ; preds = %for.cond44.preheader
%arrayidx51.us103 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 0
%10 = load i32, ptr %arrayidx51.us103, align 4, !tbaa !5
%cmp52.us104 = icmp eq i32 %10, 0
br i1 %cmp52.us104, label %if.then54.us105, label %for.inc66.us106
for.body47.us90.preheader: ; preds = %for.cond44.preheader
%arrayidx51.us93 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 0
%11 = load i32, ptr %arrayidx51.us93, align 4, !tbaa !5
%cmp52.us94 = icmp eq i32 %11, 0
br i1 %cmp52.us94, label %if.then54.us95, label %for.inc66.us96
for.body47.us.preheader: ; preds = %for.cond44.preheader
%arrayidx51.us = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 0
%12 = load i32, ptr %arrayidx51.us, align 4, !tbaa !5
%cmp52.us = icmp eq i32 %12, 0
br i1 %cmp52.us, label %if.then54.us, label %for.inc66.us
if.then54.us: ; preds = %for.body47.us.preheader
%call55.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
br label %for.inc66.us
for.inc66.us: ; preds = %if.then54.us, %for.body47.us.preheader
%arrayidx51.us.1 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 1
%13 = load i32, ptr %arrayidx51.us.1, align 4, !tbaa !5
%cmp52.us.1 = icmp eq i32 %13, 0
br i1 %cmp52.us.1, label %if.then54.us.1, label %for.inc66.us.1
if.then54.us.1: ; preds = %for.inc66.us
%call55.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
br label %for.inc66.us.1
for.inc66.us.1: ; preds = %if.then54.us.1, %for.inc66.us
%arrayidx51.us.2 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 2
%14 = load i32, ptr %arrayidx51.us.2, align 4, !tbaa !5
%cmp52.us.2 = icmp eq i32 %14, 0
br i1 %cmp52.us.2, label %if.then54.us.2, label %for.inc66.us.2
if.then54.us.2: ; preds = %for.inc66.us.1
%call55.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
br label %for.inc66.us.2
for.inc66.us.2: ; preds = %if.then54.us.2, %for.inc66.us.1
%arrayidx51.us.3 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 3
%15 = load i32, ptr %arrayidx51.us.3, align 4, !tbaa !5
%cmp52.us.3 = icmp eq i32 %15, 0
br i1 %cmp52.us.3, label %if.then54.us.3, label %for.inc66.us.3
if.then54.us.3: ; preds = %for.inc66.us.2
%call55.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
br label %for.inc66.us.3
for.inc66.us.3: ; preds = %if.then54.us.3, %for.inc66.us.2
%arrayidx51.us.4 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 4
%16 = load i32, ptr %arrayidx51.us.4, align 4, !tbaa !5
%cmp52.us.4 = icmp eq i32 %16, 0
br i1 %cmp52.us.4, label %if.then54.us.4, label %for.inc66.us.4
if.then54.us.4: ; preds = %for.inc66.us.3
%call55.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
br label %for.inc66.us.4
for.inc66.us.4: ; preds = %if.then54.us.4, %for.inc66.us.3
%arrayidx51.us.5 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 5
%17 = load i32, ptr %arrayidx51.us.5, align 4, !tbaa !5
%cmp52.us.5 = icmp eq i32 %17, 0
br i1 %cmp52.us.5, label %if.then54.us.5, label %for.inc66.us.5
if.then54.us.5: ; preds = %for.inc66.us.4
%call55.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
br label %for.inc66.us.5
for.inc66.us.5: ; preds = %if.then54.us.5, %for.inc66.us.4
%arrayidx51.us.6 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 6
%18 = load i32, ptr %arrayidx51.us.6, align 4, !tbaa !5
%cmp52.us.6 = icmp eq i32 %18, 0
br i1 %cmp52.us.6, label %if.then54.us.6, label %for.inc66.us.6
if.then54.us.6: ; preds = %for.inc66.us.5
%call55.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 7)
br label %for.inc66.us.6
for.inc66.us.6: ; preds = %if.then54.us.6, %for.inc66.us.5
%arrayidx51.us.7 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 7
%19 = load i32, ptr %arrayidx51.us.7, align 4, !tbaa !5
%cmp52.us.7 = icmp eq i32 %19, 0
br i1 %cmp52.us.7, label %if.then54.us.7, label %for.inc66.us.7
if.then54.us.7: ; preds = %for.inc66.us.6
%call55.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 8)
br label %for.inc66.us.7
for.inc66.us.7: ; preds = %if.then54.us.7, %for.inc66.us.6
%arrayidx51.us.8 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 8
%20 = load i32, ptr %arrayidx51.us.8, align 4, !tbaa !5
%cmp52.us.8 = icmp eq i32 %20, 0
br i1 %cmp52.us.8, label %if.then54.us.8, label %for.inc66.us.8
if.then54.us.8: ; preds = %for.inc66.us.7
%call55.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 9)
br label %for.inc66.us.8
for.inc66.us.8: ; preds = %if.then54.us.8, %for.inc66.us.7
%arrayidx51.us.9 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 9
%21 = load i32, ptr %arrayidx51.us.9, align 4, !tbaa !5
%cmp52.us.9 = icmp eq i32 %21, 0
br i1 %cmp52.us.9, label %if.then54.us.9, label %for.inc66.us.9
if.then54.us.9: ; preds = %for.inc66.us.8
%call55.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 10)
br label %for.inc66.us.9
for.inc66.us.9: ; preds = %if.then54.us.9, %for.inc66.us.8
%arrayidx51.us.10 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 10
%22 = load i32, ptr %arrayidx51.us.10, align 4, !tbaa !5
%cmp52.us.10 = icmp eq i32 %22, 0
br i1 %cmp52.us.10, label %if.then54.us.10, label %for.inc66.us.10
if.then54.us.10: ; preds = %for.inc66.us.9
%call55.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 11)
br label %for.inc66.us.10
for.inc66.us.10: ; preds = %if.then54.us.10, %for.inc66.us.9
%arrayidx51.us.11 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 11
%23 = load i32, ptr %arrayidx51.us.11, align 4, !tbaa !5
%cmp52.us.11 = icmp eq i32 %23, 0
br i1 %cmp52.us.11, label %if.then54.us.11, label %for.inc66.us.11
if.then54.us.11: ; preds = %for.inc66.us.10
%call55.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 12)
br label %for.inc66.us.11
for.inc66.us.11: ; preds = %if.then54.us.11, %for.inc66.us.10
%arrayidx51.us.12 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 12
%24 = load i32, ptr %arrayidx51.us.12, align 4, !tbaa !5
%cmp52.us.12 = icmp eq i32 %24, 0
br i1 %cmp52.us.12, label %for.inc69.sink.split, label %for.inc69
if.then54.us95: ; preds = %for.body47.us90.preheader
%call58.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 1)
br label %for.inc66.us96
for.inc66.us96: ; preds = %if.then54.us95, %for.body47.us90.preheader
%arrayidx51.us93.1 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 1
%25 = load i32, ptr %arrayidx51.us93.1, align 4, !tbaa !5
%cmp52.us94.1 = icmp eq i32 %25, 0
br i1 %cmp52.us94.1, label %if.then54.us95.1, label %for.inc66.us96.1
if.then54.us95.1: ; preds = %for.inc66.us96
%call58.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 2)
br label %for.inc66.us96.1
for.inc66.us96.1: ; preds = %if.then54.us95.1, %for.inc66.us96
%arrayidx51.us93.2 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 2
%26 = load i32, ptr %arrayidx51.us93.2, align 4, !tbaa !5
%cmp52.us94.2 = icmp eq i32 %26, 0
br i1 %cmp52.us94.2, label %if.then54.us95.2, label %for.inc66.us96.2
if.then54.us95.2: ; preds = %for.inc66.us96.1
%call58.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 3)
br label %for.inc66.us96.2
for.inc66.us96.2: ; preds = %if.then54.us95.2, %for.inc66.us96.1
%arrayidx51.us93.3 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 3
%27 = load i32, ptr %arrayidx51.us93.3, align 4, !tbaa !5
%cmp52.us94.3 = icmp eq i32 %27, 0
br i1 %cmp52.us94.3, label %if.then54.us95.3, label %for.inc66.us96.3
if.then54.us95.3: ; preds = %for.inc66.us96.2
%call58.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 4)
br label %for.inc66.us96.3
for.inc66.us96.3: ; preds = %if.then54.us95.3, %for.inc66.us96.2
%arrayidx51.us93.4 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 4
%28 = load i32, ptr %arrayidx51.us93.4, align 4, !tbaa !5
%cmp52.us94.4 = icmp eq i32 %28, 0
br i1 %cmp52.us94.4, label %if.then54.us95.4, label %for.inc66.us96.4
if.then54.us95.4: ; preds = %for.inc66.us96.3
%call58.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 5)
br label %for.inc66.us96.4
for.inc66.us96.4: ; preds = %if.then54.us95.4, %for.inc66.us96.3
%arrayidx51.us93.5 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 5
%29 = load i32, ptr %arrayidx51.us93.5, align 4, !tbaa !5
%cmp52.us94.5 = icmp eq i32 %29, 0
br i1 %cmp52.us94.5, label %if.then54.us95.5, label %for.inc66.us96.5
if.then54.us95.5: ; preds = %for.inc66.us96.4
%call58.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 6)
br label %for.inc66.us96.5
for.inc66.us96.5: ; preds = %if.then54.us95.5, %for.inc66.us96.4
%arrayidx51.us93.6 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 6
%30 = load i32, ptr %arrayidx51.us93.6, align 4, !tbaa !5
%cmp52.us94.6 = icmp eq i32 %30, 0
br i1 %cmp52.us94.6, label %if.then54.us95.6, label %for.inc66.us96.6
if.then54.us95.6: ; preds = %for.inc66.us96.5
%call58.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 7)
br label %for.inc66.us96.6
for.inc66.us96.6: ; preds = %if.then54.us95.6, %for.inc66.us96.5
%arrayidx51.us93.7 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 7
%31 = load i32, ptr %arrayidx51.us93.7, align 4, !tbaa !5
%cmp52.us94.7 = icmp eq i32 %31, 0
br i1 %cmp52.us94.7, label %if.then54.us95.7, label %for.inc66.us96.7
if.then54.us95.7: ; preds = %for.inc66.us96.6
%call58.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 8)
br label %for.inc66.us96.7
for.inc66.us96.7: ; preds = %if.then54.us95.7, %for.inc66.us96.6
%arrayidx51.us93.8 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 8
%32 = load i32, ptr %arrayidx51.us93.8, align 4, !tbaa !5
%cmp52.us94.8 = icmp eq i32 %32, 0
br i1 %cmp52.us94.8, label %if.then54.us95.8, label %for.inc66.us96.8
if.then54.us95.8: ; preds = %for.inc66.us96.7
%call58.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 9)
br label %for.inc66.us96.8
for.inc66.us96.8: ; preds = %if.then54.us95.8, %for.inc66.us96.7
%arrayidx51.us93.9 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 9
%33 = load i32, ptr %arrayidx51.us93.9, align 4, !tbaa !5
%cmp52.us94.9 = icmp eq i32 %33, 0
br i1 %cmp52.us94.9, label %if.then54.us95.9, label %for.inc66.us96.9
if.then54.us95.9: ; preds = %for.inc66.us96.8
%call58.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 10)
br label %for.inc66.us96.9
for.inc66.us96.9: ; preds = %if.then54.us95.9, %for.inc66.us96.8
%arrayidx51.us93.10 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 10
%34 = load i32, ptr %arrayidx51.us93.10, align 4, !tbaa !5
%cmp52.us94.10 = icmp eq i32 %34, 0
br i1 %cmp52.us94.10, label %if.then54.us95.10, label %for.inc66.us96.10
if.then54.us95.10: ; preds = %for.inc66.us96.9
%call58.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 11)
br label %for.inc66.us96.10
for.inc66.us96.10: ; preds = %if.then54.us95.10, %for.inc66.us96.9
%arrayidx51.us93.11 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 11
%35 = load i32, ptr %arrayidx51.us93.11, align 4, !tbaa !5
%cmp52.us94.11 = icmp eq i32 %35, 0
br i1 %cmp52.us94.11, label %if.then54.us95.11, label %for.inc66.us96.11
if.then54.us95.11: ; preds = %for.inc66.us96.10
%call58.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 12)
br label %for.inc66.us96.11
for.inc66.us96.11: ; preds = %if.then54.us95.11, %for.inc66.us96.10
%arrayidx51.us93.12 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 12
%36 = load i32, ptr %arrayidx51.us93.12, align 4, !tbaa !5
%cmp52.us94.12 = icmp eq i32 %36, 0
br i1 %cmp52.us94.12, label %for.inc69.sink.split, label %for.inc69
if.then54.us105: ; preds = %for.body47.us100.preheader
%call61.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 1)
br label %for.inc66.us106
for.inc66.us106: ; preds = %if.then54.us105, %for.body47.us100.preheader
%arrayidx51.us103.1 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 1
%37 = load i32, ptr %arrayidx51.us103.1, align 4, !tbaa !5
%cmp52.us104.1 = icmp eq i32 %37, 0
br i1 %cmp52.us104.1, label %if.then54.us105.1, label %for.inc66.us106.1
if.then54.us105.1: ; preds = %for.inc66.us106
%call61.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 2)
br label %for.inc66.us106.1
for.inc66.us106.1: ; preds = %if.then54.us105.1, %for.inc66.us106
%arrayidx51.us103.2 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 2
%38 = load i32, ptr %arrayidx51.us103.2, align 4, !tbaa !5
%cmp52.us104.2 = icmp eq i32 %38, 0
br i1 %cmp52.us104.2, label %if.then54.us105.2, label %for.inc66.us106.2
if.then54.us105.2: ; preds = %for.inc66.us106.1
%call61.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 3)
br label %for.inc66.us106.2
for.inc66.us106.2: ; preds = %if.then54.us105.2, %for.inc66.us106.1
%arrayidx51.us103.3 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 3
%39 = load i32, ptr %arrayidx51.us103.3, align 4, !tbaa !5
%cmp52.us104.3 = icmp eq i32 %39, 0
br i1 %cmp52.us104.3, label %if.then54.us105.3, label %for.inc66.us106.3
if.then54.us105.3: ; preds = %for.inc66.us106.2
%call61.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 4)
br label %for.inc66.us106.3
for.inc66.us106.3: ; preds = %if.then54.us105.3, %for.inc66.us106.2
%arrayidx51.us103.4 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 4
%40 = load i32, ptr %arrayidx51.us103.4, align 4, !tbaa !5
%cmp52.us104.4 = icmp eq i32 %40, 0
br i1 %cmp52.us104.4, label %if.then54.us105.4, label %for.inc66.us106.4
if.then54.us105.4: ; preds = %for.inc66.us106.3
%call61.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 5)
br label %for.inc66.us106.4
for.inc66.us106.4: ; preds = %if.then54.us105.4, %for.inc66.us106.3
%arrayidx51.us103.5 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 5
%41 = load i32, ptr %arrayidx51.us103.5, align 4, !tbaa !5
%cmp52.us104.5 = icmp eq i32 %41, 0
br i1 %cmp52.us104.5, label %if.then54.us105.5, label %for.inc66.us106.5
if.then54.us105.5: ; preds = %for.inc66.us106.4
%call61.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 6)
br label %for.inc66.us106.5
for.inc66.us106.5: ; preds = %if.then54.us105.5, %for.inc66.us106.4
%arrayidx51.us103.6 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 6
%42 = load i32, ptr %arrayidx51.us103.6, align 4, !tbaa !5
%cmp52.us104.6 = icmp eq i32 %42, 0
br i1 %cmp52.us104.6, label %if.then54.us105.6, label %for.inc66.us106.6
if.then54.us105.6: ; preds = %for.inc66.us106.5
%call61.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 7)
br label %for.inc66.us106.6
for.inc66.us106.6: ; preds = %if.then54.us105.6, %for.inc66.us106.5
%arrayidx51.us103.7 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 7
%43 = load i32, ptr %arrayidx51.us103.7, align 4, !tbaa !5
%cmp52.us104.7 = icmp eq i32 %43, 0
br i1 %cmp52.us104.7, label %if.then54.us105.7, label %for.inc66.us106.7
if.then54.us105.7: ; preds = %for.inc66.us106.6
%call61.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 8)
br label %for.inc66.us106.7
for.inc66.us106.7: ; preds = %if.then54.us105.7, %for.inc66.us106.6
%arrayidx51.us103.8 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 8
%44 = load i32, ptr %arrayidx51.us103.8, align 4, !tbaa !5
%cmp52.us104.8 = icmp eq i32 %44, 0
br i1 %cmp52.us104.8, label %if.then54.us105.8, label %for.inc66.us106.8
if.then54.us105.8: ; preds = %for.inc66.us106.7
%call61.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 9)
br label %for.inc66.us106.8
for.inc66.us106.8: ; preds = %if.then54.us105.8, %for.inc66.us106.7
%arrayidx51.us103.9 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 9
%45 = load i32, ptr %arrayidx51.us103.9, align 4, !tbaa !5
%cmp52.us104.9 = icmp eq i32 %45, 0
br i1 %cmp52.us104.9, label %if.then54.us105.9, label %for.inc66.us106.9
if.then54.us105.9: ; preds = %for.inc66.us106.8
%call61.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 10)
br label %for.inc66.us106.9
for.inc66.us106.9: ; preds = %if.then54.us105.9, %for.inc66.us106.8
%arrayidx51.us103.10 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 10
%46 = load i32, ptr %arrayidx51.us103.10, align 4, !tbaa !5
%cmp52.us104.10 = icmp eq i32 %46, 0
br i1 %cmp52.us104.10, label %if.then54.us105.10, label %for.inc66.us106.10
if.then54.us105.10: ; preds = %for.inc66.us106.9
%call61.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 11)
br label %for.inc66.us106.10
for.inc66.us106.10: ; preds = %if.then54.us105.10, %for.inc66.us106.9
%arrayidx51.us103.11 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 11
%47 = load i32, ptr %arrayidx51.us103.11, align 4, !tbaa !5
%cmp52.us104.11 = icmp eq i32 %47, 0
br i1 %cmp52.us104.11, label %if.then54.us105.11, label %for.inc66.us106.11
if.then54.us105.11: ; preds = %for.inc66.us106.10
%call61.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 12)
br label %for.inc66.us106.11
for.inc66.us106.11: ; preds = %if.then54.us105.11, %for.inc66.us106.10
%arrayidx51.us103.12 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 12
%48 = load i32, ptr %arrayidx51.us103.12, align 4, !tbaa !5
%cmp52.us104.12 = icmp eq i32 %48, 0
br i1 %cmp52.us104.12, label %for.inc69.sink.split, label %for.inc69
if.then54.us115: ; preds = %for.body47.us110.preheader
%call64.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 1)
br label %for.inc66.us116
for.inc66.us116: ; preds = %if.then54.us115, %for.body47.us110.preheader
%arrayidx51.us113.1 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 1
%49 = load i32, ptr %arrayidx51.us113.1, align 4, !tbaa !5
%cmp52.us114.1 = icmp eq i32 %49, 0
br i1 %cmp52.us114.1, label %if.then54.us115.1, label %for.inc66.us116.1
if.then54.us115.1: ; preds = %for.inc66.us116
%call64.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 2)
br label %for.inc66.us116.1
for.inc66.us116.1: ; preds = %if.then54.us115.1, %for.inc66.us116
%arrayidx51.us113.2 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 2
%50 = load i32, ptr %arrayidx51.us113.2, align 4, !tbaa !5
%cmp52.us114.2 = icmp eq i32 %50, 0
br i1 %cmp52.us114.2, label %if.then54.us115.2, label %for.inc66.us116.2
if.then54.us115.2: ; preds = %for.inc66.us116.1
%call64.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 3)
br label %for.inc66.us116.2
for.inc66.us116.2: ; preds = %if.then54.us115.2, %for.inc66.us116.1
%arrayidx51.us113.3 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 3
%51 = load i32, ptr %arrayidx51.us113.3, align 4, !tbaa !5
%cmp52.us114.3 = icmp eq i32 %51, 0
br i1 %cmp52.us114.3, label %if.then54.us115.3, label %for.inc66.us116.3
if.then54.us115.3: ; preds = %for.inc66.us116.2
%call64.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 4)
br label %for.inc66.us116.3
for.inc66.us116.3: ; preds = %if.then54.us115.3, %for.inc66.us116.2
%arrayidx51.us113.4 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 4
%52 = load i32, ptr %arrayidx51.us113.4, align 4, !tbaa !5
%cmp52.us114.4 = icmp eq i32 %52, 0
br i1 %cmp52.us114.4, label %if.then54.us115.4, label %for.inc66.us116.4
if.then54.us115.4: ; preds = %for.inc66.us116.3
%call64.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 5)
br label %for.inc66.us116.4
for.inc66.us116.4: ; preds = %if.then54.us115.4, %for.inc66.us116.3
%arrayidx51.us113.5 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 5
%53 = load i32, ptr %arrayidx51.us113.5, align 4, !tbaa !5
%cmp52.us114.5 = icmp eq i32 %53, 0
br i1 %cmp52.us114.5, label %if.then54.us115.5, label %for.inc66.us116.5
if.then54.us115.5: ; preds = %for.inc66.us116.4
%call64.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 6)
br label %for.inc66.us116.5
for.inc66.us116.5: ; preds = %if.then54.us115.5, %for.inc66.us116.4
%arrayidx51.us113.6 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 6
%54 = load i32, ptr %arrayidx51.us113.6, align 4, !tbaa !5
%cmp52.us114.6 = icmp eq i32 %54, 0
br i1 %cmp52.us114.6, label %if.then54.us115.6, label %for.inc66.us116.6
if.then54.us115.6: ; preds = %for.inc66.us116.5
%call64.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 7)
br label %for.inc66.us116.6
for.inc66.us116.6: ; preds = %if.then54.us115.6, %for.inc66.us116.5
%arrayidx51.us113.7 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 7
%55 = load i32, ptr %arrayidx51.us113.7, align 4, !tbaa !5
%cmp52.us114.7 = icmp eq i32 %55, 0
br i1 %cmp52.us114.7, label %if.then54.us115.7, label %for.inc66.us116.7
if.then54.us115.7: ; preds = %for.inc66.us116.6
%call64.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 8)
br label %for.inc66.us116.7
for.inc66.us116.7: ; preds = %if.then54.us115.7, %for.inc66.us116.6
%arrayidx51.us113.8 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 8
%56 = load i32, ptr %arrayidx51.us113.8, align 4, !tbaa !5
%cmp52.us114.8 = icmp eq i32 %56, 0
br i1 %cmp52.us114.8, label %if.then54.us115.8, label %for.inc66.us116.8
if.then54.us115.8: ; preds = %for.inc66.us116.7
%call64.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 9)
br label %for.inc66.us116.8
for.inc66.us116.8: ; preds = %if.then54.us115.8, %for.inc66.us116.7
%arrayidx51.us113.9 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 9
%57 = load i32, ptr %arrayidx51.us113.9, align 4, !tbaa !5
%cmp52.us114.9 = icmp eq i32 %57, 0
br i1 %cmp52.us114.9, label %if.then54.us115.9, label %for.inc66.us116.9
if.then54.us115.9: ; preds = %for.inc66.us116.8
%call64.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 10)
br label %for.inc66.us116.9
for.inc66.us116.9: ; preds = %if.then54.us115.9, %for.inc66.us116.8
%arrayidx51.us113.10 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 10
%58 = load i32, ptr %arrayidx51.us113.10, align 4, !tbaa !5
%cmp52.us114.10 = icmp eq i32 %58, 0
br i1 %cmp52.us114.10, label %if.then54.us115.10, label %for.inc66.us116.10
if.then54.us115.10: ; preds = %for.inc66.us116.9
%call64.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 11)
br label %for.inc66.us116.10
for.inc66.us116.10: ; preds = %if.then54.us115.10, %for.inc66.us116.9
%arrayidx51.us113.11 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 11
%59 = load i32, ptr %arrayidx51.us113.11, align 4, !tbaa !5
%cmp52.us114.11 = icmp eq i32 %59, 0
br i1 %cmp52.us114.11, label %if.then54.us115.11, label %for.inc66.us116.11
if.then54.us115.11: ; preds = %for.inc66.us116.10
%call64.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 12)
br label %for.inc66.us116.11
for.inc66.us116.11: ; preds = %if.then54.us115.11, %for.inc66.us116.10
%arrayidx51.us113.12 = getelementptr inbounds [4 x [13 x i32]], ptr %rec, i64 0, i64 %indvars.iv, i64 12
%60 = load i32, ptr %arrayidx51.us113.12, align 4, !tbaa !5
%cmp52.us114.12 = icmp eq i32 %60, 0
br i1 %cmp52.us114.12, label %for.inc69.sink.split, label %for.inc69
for.inc69.sink.split: ; preds = %for.inc66.us116.11, %for.inc66.us106.11, %for.inc66.us96.11, %for.inc66.us.11
%.str.5.sink = phi ptr [ @.str.2, %for.inc66.us.11 ], [ @.str.3, %for.inc66.us96.11 ], [ @.str.4, %for.inc66.us106.11 ], [ @.str.5, %for.inc66.us116.11 ]
%call64.us.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.5.sink, i32 noundef 13)
br label %for.inc69
for.inc69: ; preds = %for.inc69.sink.split, %for.inc66.us116.11, %for.inc66.us106.11, %for.inc66.us96.11, %for.inc66.us.11, %for.cond44.preheader
%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.end71, label %for.cond44.preheader, !llvm.loop !12
for.end71: ; preds = %for.inc69
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %mark) #4
call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %rec) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(){
int n, k, a[101],winCount, i=0;
scanf("%i%i", &n,&k);
for (i = 0; i<n; i++)
scanf("%i", &a[i]);
winCount = a[k-1];
if (a[k-1] >0){
for (i = k-1; i<n&&a[i]==winCount; i++);
printf("%i", i);
}
else {
for (i = 0; i<k-1&&a[i]>0; i++);
printf("%i", i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21478/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21478/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%i%i\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%i\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [101 x i32], align 16
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 404, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%3 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %3, -1
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %idxprom2
%4 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %4, 0
br i1 %cmp7, label %for.cond9.preheader, label %for.cond19.preheader
for.cond19.preheader: ; preds = %for.end
%cmp2144 = icmp sgt i32 %3, 1
br i1 %cmp2144, label %land.rhs22.preheader, label %if.end
land.rhs22.preheader: ; preds = %for.cond19.preheader
%wide.trip.count = zext i32 %sub to i64
br label %land.rhs22
for.cond9.preheader: ; preds = %for.end
%cmp1048.not = icmp sgt i32 %3, %.lcssa
br i1 %cmp1048.not, label %if.end, label %land.rhs
land.rhs: ; preds = %for.cond9.preheader, %for.inc15
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.inc15 ], [ %idxprom2, %for.cond9.preheader ]
%arrayidx12 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv57
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp eq i32 %5, %4
br i1 %cmp13, label %for.inc15, label %for.end17.loopexit.split.loop.exit64
for.inc15: ; preds = %land.rhs
%indvars.iv.next58 = add nsw i64 %indvars.iv57, 1
%lftr.wideiv = trunc i64 %indvars.iv.next58 to i32
%exitcond60.not = icmp eq i32 %.lcssa, %lftr.wideiv
br i1 %exitcond60.not, label %if.end, label %land.rhs, !llvm.loop !11
for.end17.loopexit.split.loop.exit64: ; preds = %land.rhs
%6 = trunc i64 %indvars.iv57 to i32
br label %if.end
land.rhs22: ; preds = %land.rhs22.preheader, %for.inc28
%indvars.iv54 = phi i64 [ 0, %land.rhs22.preheader ], [ %indvars.iv.next55, %for.inc28 ]
%arrayidx24 = getelementptr inbounds [101 x i32], ptr %a, i64 0, i64 %indvars.iv54
%7 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %7, 0
br i1 %cmp25, label %for.inc28, label %for.end30.loopexit.split.loop.exit62
for.inc28: ; preds = %land.rhs22
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
br i1 %exitcond.not, label %if.end, label %land.rhs22, !llvm.loop !12
for.end30.loopexit.split.loop.exit62: ; preds = %land.rhs22
%8 = trunc i64 %indvars.iv54 to i32
br label %if.end
if.end: ; preds = %for.inc28, %for.inc15, %for.cond19.preheader, %for.end30.loopexit.split.loop.exit62, %for.cond9.preheader, %for.end17.loopexit.split.loop.exit64
%i.2.lcssa.sink = phi i32 [ %sub, %for.cond9.preheader ], [ %6, %for.end17.loopexit.split.loop.exit64 ], [ 0, %for.cond19.preheader ], [ %8, %for.end30.loopexit.split.loop.exit62 ], [ %.lcssa, %for.inc15 ], [ %sub, %for.inc28 ]
%call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.2.lcssa.sink)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %a) #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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <string.h>
int main(){
char *mark = "SHCD";
int card[4][13] = { 0 };
int i, j;
int n, t;
char c;
scanf("%d", &n);
for(i = 0; i < n; ++i){
scanf(" %c %d", &c, &t);
card[strchr(mark, c) - mark][t - 1] = 1;
}
for(i = 0; i < 4; ++i){
for(j = 0; j < 13; ++j){
if(!card[i][j]){
printf("%c %d\n", mark[i], j + 1);
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214822/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214822/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"SHCD\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c" %c %d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%c %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%card = alloca [4 x [13 x i32]], align 16
%n = alloca i32, align 4
%t = alloca i32, align 4
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %card) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(208) %card, i8 0, i64 208, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %for.cond8.preheader.preheader
for.body: ; preds = %entry, %for.body
%i.037 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %c, ptr noundef nonnull %t)
%1 = load i8, ptr %c, align 1, !tbaa !9
%conv = sext i8 %1 to i32
%memchr = call ptr @memchr(ptr noundef nonnull dereferenceable(1) @.str, i32 %conv, i64 5)
%sub.ptr.lhs.cast = ptrtoint ptr %memchr to i64
%sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, ptrtoint (ptr @.str to i64)
%2 = load i32, ptr %t, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %sub.ptr.sub, i64 %idxprom
store i32 1, ptr %arrayidx3, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.037, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.cond8.preheader.preheader, !llvm.loop !10
for.cond8.preheader.preheader: ; preds = %for.body, %entry
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.cond8.preheader.preheader, %for.inc20.12
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc20.12 ], [ 0, %for.cond8.preheader.preheader ]
%arrayidx17 = getelementptr inbounds i8, ptr @.str, i64 %indvars.iv
%arrayidx15 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 0
%4 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %if.then, label %for.inc20
if.then: ; preds = %for.cond8.preheader
%5 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18 = sext i8 %5 to i32
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18, i32 noundef 1)
br label %for.inc20
for.inc20: ; preds = %for.cond8.preheader, %if.then
%arrayidx15.1 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%6 = load i32, ptr %arrayidx15.1, align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %6, 0
br i1 %tobool.not.1, label %if.then.1, label %for.inc20.1
if.then.1: ; preds = %for.inc20
%7 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.1 = sext i8 %7 to i32
%call19.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.1, i32 noundef 2)
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.inc20
%arrayidx15.2 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%8 = load i32, ptr %arrayidx15.2, align 4, !tbaa !5
%tobool.not.2 = icmp eq i32 %8, 0
br i1 %tobool.not.2, label %if.then.2, label %for.inc20.2
if.then.2: ; preds = %for.inc20.1
%9 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.2 = sext i8 %9 to i32
%call19.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.2, i32 noundef 3)
br label %for.inc20.2
for.inc20.2: ; preds = %if.then.2, %for.inc20.1
%arrayidx15.3 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%10 = load i32, ptr %arrayidx15.3, align 4, !tbaa !5
%tobool.not.3 = icmp eq i32 %10, 0
br i1 %tobool.not.3, label %if.then.3, label %for.inc20.3
if.then.3: ; preds = %for.inc20.2
%11 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.3 = sext i8 %11 to i32
%call19.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.3, i32 noundef 4)
br label %for.inc20.3
for.inc20.3: ; preds = %if.then.3, %for.inc20.2
%arrayidx15.4 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%12 = load i32, ptr %arrayidx15.4, align 4, !tbaa !5
%tobool.not.4 = icmp eq i32 %12, 0
br i1 %tobool.not.4, label %if.then.4, label %for.inc20.4
if.then.4: ; preds = %for.inc20.3
%13 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.4 = sext i8 %13 to i32
%call19.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.4, i32 noundef 5)
br label %for.inc20.4
for.inc20.4: ; preds = %if.then.4, %for.inc20.3
%arrayidx15.5 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%14 = load i32, ptr %arrayidx15.5, align 4, !tbaa !5
%tobool.not.5 = icmp eq i32 %14, 0
br i1 %tobool.not.5, label %if.then.5, label %for.inc20.5
if.then.5: ; preds = %for.inc20.4
%15 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.5 = sext i8 %15 to i32
%call19.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.5, i32 noundef 6)
br label %for.inc20.5
for.inc20.5: ; preds = %if.then.5, %for.inc20.4
%arrayidx15.6 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%16 = load i32, ptr %arrayidx15.6, align 4, !tbaa !5
%tobool.not.6 = icmp eq i32 %16, 0
br i1 %tobool.not.6, label %if.then.6, label %for.inc20.6
if.then.6: ; preds = %for.inc20.5
%17 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.6 = sext i8 %17 to i32
%call19.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.6, i32 noundef 7)
br label %for.inc20.6
for.inc20.6: ; preds = %if.then.6, %for.inc20.5
%arrayidx15.7 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%18 = load i32, ptr %arrayidx15.7, align 4, !tbaa !5
%tobool.not.7 = icmp eq i32 %18, 0
br i1 %tobool.not.7, label %if.then.7, label %for.inc20.7
if.then.7: ; preds = %for.inc20.6
%19 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.7 = sext i8 %19 to i32
%call19.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.7, i32 noundef 8)
br label %for.inc20.7
for.inc20.7: ; preds = %if.then.7, %for.inc20.6
%arrayidx15.8 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%20 = load i32, ptr %arrayidx15.8, align 4, !tbaa !5
%tobool.not.8 = icmp eq i32 %20, 0
br i1 %tobool.not.8, label %if.then.8, label %for.inc20.8
if.then.8: ; preds = %for.inc20.7
%21 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.8 = sext i8 %21 to i32
%call19.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.8, i32 noundef 9)
br label %for.inc20.8
for.inc20.8: ; preds = %if.then.8, %for.inc20.7
%arrayidx15.9 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%22 = load i32, ptr %arrayidx15.9, align 4, !tbaa !5
%tobool.not.9 = icmp eq i32 %22, 0
br i1 %tobool.not.9, label %if.then.9, label %for.inc20.9
if.then.9: ; preds = %for.inc20.8
%23 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.9 = sext i8 %23 to i32
%call19.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.9, i32 noundef 10)
br label %for.inc20.9
for.inc20.9: ; preds = %if.then.9, %for.inc20.8
%arrayidx15.10 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%24 = load i32, ptr %arrayidx15.10, align 4, !tbaa !5
%tobool.not.10 = icmp eq i32 %24, 0
br i1 %tobool.not.10, label %if.then.10, label %for.inc20.10
if.then.10: ; preds = %for.inc20.9
%25 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.10 = sext i8 %25 to i32
%call19.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.10, i32 noundef 11)
br label %for.inc20.10
for.inc20.10: ; preds = %if.then.10, %for.inc20.9
%arrayidx15.11 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%26 = load i32, ptr %arrayidx15.11, align 4, !tbaa !5
%tobool.not.11 = icmp eq i32 %26, 0
br i1 %tobool.not.11, label %if.then.11, label %for.inc20.11
if.then.11: ; preds = %for.inc20.10
%27 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.11 = sext i8 %27 to i32
%call19.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.11, i32 noundef 12)
br label %for.inc20.11
for.inc20.11: ; preds = %if.then.11, %for.inc20.10
%arrayidx15.12 = getelementptr inbounds [4 x [13 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%28 = load i32, ptr %arrayidx15.12, align 4, !tbaa !5
%tobool.not.12 = icmp eq i32 %28, 0
br i1 %tobool.not.12, label %if.then.12, label %for.inc20.12
if.then.12: ; preds = %for.inc20.11
%29 = load i8, ptr %arrayidx17, align 1, !tbaa !9
%conv18.12 = sext i8 %29 to i32
%call19.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv18.12, i32 noundef 13)
br label %for.inc20.12
for.inc20.12: ; preds = %if.then.12, %for.inc20.11
%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.end25, label %for.cond8.preheader, !llvm.loop !12
for.end25: ; preds = %for.inc20.12
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %card) #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 willreturn memory(argmem: read)
declare ptr @memchr(ptr, i32, i64) 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 willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
int main(void) {
int a[52] = {0};
char b[4] = {'S','H','C','D'};
int d, n;
char c;
int e, f;
scanf("%d", &n);
for (f = 0; f < n; f++)
{
scanf("%*c%c %d", &c, &d);
for (e = 0; b[e] != c; e++)
{
d += 13;
}
a[d - 1] = 1;
}
for (f = 0; f < 4; f++)
{
for (e = 0; e < 13; e++)
{
if (a[f * 13 + e] == 0)
{
printf("%c %d\n", b[f], e + 1);
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214866/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214866/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.b = private unnamed_addr constant [4 x i8] c"SHCD", align 1
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%*c%c %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%c %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [52 x i32], align 16
%d = alloca i32, align 4
%n = alloca i32, align 4
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(208) %a, i8 0, i64 208, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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 %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body, label %for.cond16.preheader.preheader
for.body: ; preds = %entry, %for.end
%f.051 = phi i32 [ %inc10, %for.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c, ptr noundef nonnull %d)
%1 = load i8, ptr %c, align 1, !tbaa !9
%d.promoted = load i32, ptr %d, align 4, !tbaa !5
%cmp4.not47 = icmp eq i8 %1, 83
br i1 %cmp4.not47, label %for.end, label %for.body6
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.body ]
%add4648 = phi i32 [ %add, %for.body6 ], [ %d.promoted, %for.body ]
%add = add nsw i32 %add4648, 13
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [4 x i8], ptr @__const.main.b, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp4.not = icmp eq i8 %2, %1
br i1 %cmp4.not, label %for.cond2.for.end_crit_edge, label %for.body6, !llvm.loop !10
for.cond2.for.end_crit_edge: ; preds = %for.body6
store i32 %add, ptr %d, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond2.for.end_crit_edge, %for.body
%3 = phi i32 [ %add, %for.cond2.for.end_crit_edge ], [ %d.promoted, %for.body ]
%sub = add nsw i32 %3, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %idxprom7
store i32 1, ptr %arrayidx8, align 4, !tbaa !5
%inc10 = add nuw nsw i32 %f.051, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %4
br i1 %cmp, label %for.body, label %for.cond16.preheader.preheader, !llvm.loop !12
for.cond16.preheader.preheader: ; preds = %for.end, %entry
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.inc30.12
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc30.12 ], [ 0, %for.cond16.preheader.preheader ]
%5 = mul nuw nsw i64 %indvars.iv60, 13
%arrayidx26 = getelementptr inbounds [4 x i8], ptr @__const.main.b, i64 0, i64 %indvars.iv60
%arrayidx22 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %5
%6 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %6, 0
br i1 %cmp23, label %if.then, label %for.inc30
if.then: ; preds = %for.cond16.preheader
%7 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27 = sext i8 %7 to i32
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27, i32 noundef 1)
br label %for.inc30
for.inc30: ; preds = %for.cond16.preheader, %if.then
%8 = add nuw nsw i64 %5, 1
%arrayidx22.1 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %8
%9 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %9, 0
br i1 %cmp23.1, label %if.then.1, label %for.inc30.1
if.then.1: ; preds = %for.inc30
%10 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.1 = sext i8 %10 to i32
%call29.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.1, i32 noundef 2)
br label %for.inc30.1
for.inc30.1: ; preds = %if.then.1, %for.inc30
%11 = add nuw nsw i64 %5, 2
%arrayidx22.2 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %11
%12 = load i32, ptr %arrayidx22.2, align 4, !tbaa !5
%cmp23.2 = icmp eq i32 %12, 0
br i1 %cmp23.2, label %if.then.2, label %for.inc30.2
if.then.2: ; preds = %for.inc30.1
%13 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.2 = sext i8 %13 to i32
%call29.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.2, i32 noundef 3)
br label %for.inc30.2
for.inc30.2: ; preds = %if.then.2, %for.inc30.1
%14 = add nuw nsw i64 %5, 3
%arrayidx22.3 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %14
%15 = load i32, ptr %arrayidx22.3, align 4, !tbaa !5
%cmp23.3 = icmp eq i32 %15, 0
br i1 %cmp23.3, label %if.then.3, label %for.inc30.3
if.then.3: ; preds = %for.inc30.2
%16 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.3 = sext i8 %16 to i32
%call29.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.3, i32 noundef 4)
br label %for.inc30.3
for.inc30.3: ; preds = %if.then.3, %for.inc30.2
%17 = add nuw nsw i64 %5, 4
%arrayidx22.4 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %17
%18 = load i32, ptr %arrayidx22.4, align 4, !tbaa !5
%cmp23.4 = icmp eq i32 %18, 0
br i1 %cmp23.4, label %if.then.4, label %for.inc30.4
if.then.4: ; preds = %for.inc30.3
%19 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.4 = sext i8 %19 to i32
%call29.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.4, i32 noundef 5)
br label %for.inc30.4
for.inc30.4: ; preds = %if.then.4, %for.inc30.3
%20 = add nuw nsw i64 %5, 5
%arrayidx22.5 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %20
%21 = load i32, ptr %arrayidx22.5, align 4, !tbaa !5
%cmp23.5 = icmp eq i32 %21, 0
br i1 %cmp23.5, label %if.then.5, label %for.inc30.5
if.then.5: ; preds = %for.inc30.4
%22 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.5 = sext i8 %22 to i32
%call29.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.5, i32 noundef 6)
br label %for.inc30.5
for.inc30.5: ; preds = %if.then.5, %for.inc30.4
%23 = add nuw nsw i64 %5, 6
%arrayidx22.6 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %23
%24 = load i32, ptr %arrayidx22.6, align 4, !tbaa !5
%cmp23.6 = icmp eq i32 %24, 0
br i1 %cmp23.6, label %if.then.6, label %for.inc30.6
if.then.6: ; preds = %for.inc30.5
%25 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.6 = sext i8 %25 to i32
%call29.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.6, i32 noundef 7)
br label %for.inc30.6
for.inc30.6: ; preds = %if.then.6, %for.inc30.5
%26 = add nuw nsw i64 %5, 7
%arrayidx22.7 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %26
%27 = load i32, ptr %arrayidx22.7, align 4, !tbaa !5
%cmp23.7 = icmp eq i32 %27, 0
br i1 %cmp23.7, label %if.then.7, label %for.inc30.7
if.then.7: ; preds = %for.inc30.6
%28 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.7 = sext i8 %28 to i32
%call29.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.7, i32 noundef 8)
br label %for.inc30.7
for.inc30.7: ; preds = %if.then.7, %for.inc30.6
%29 = add nuw nsw i64 %5, 8
%arrayidx22.8 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %29
%30 = load i32, ptr %arrayidx22.8, align 4, !tbaa !5
%cmp23.8 = icmp eq i32 %30, 0
br i1 %cmp23.8, label %if.then.8, label %for.inc30.8
if.then.8: ; preds = %for.inc30.7
%31 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.8 = sext i8 %31 to i32
%call29.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.8, i32 noundef 9)
br label %for.inc30.8
for.inc30.8: ; preds = %if.then.8, %for.inc30.7
%32 = add nuw nsw i64 %5, 9
%arrayidx22.9 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %32
%33 = load i32, ptr %arrayidx22.9, align 4, !tbaa !5
%cmp23.9 = icmp eq i32 %33, 0
br i1 %cmp23.9, label %if.then.9, label %for.inc30.9
if.then.9: ; preds = %for.inc30.8
%34 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.9 = sext i8 %34 to i32
%call29.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.9, i32 noundef 10)
br label %for.inc30.9
for.inc30.9: ; preds = %if.then.9, %for.inc30.8
%35 = add nuw nsw i64 %5, 10
%arrayidx22.10 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %35
%36 = load i32, ptr %arrayidx22.10, align 4, !tbaa !5
%cmp23.10 = icmp eq i32 %36, 0
br i1 %cmp23.10, label %if.then.10, label %for.inc30.10
if.then.10: ; preds = %for.inc30.9
%37 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.10 = sext i8 %37 to i32
%call29.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.10, i32 noundef 11)
br label %for.inc30.10
for.inc30.10: ; preds = %if.then.10, %for.inc30.9
%38 = add nuw nsw i64 %5, 11
%arrayidx22.11 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %38
%39 = load i32, ptr %arrayidx22.11, align 4, !tbaa !5
%cmp23.11 = icmp eq i32 %39, 0
br i1 %cmp23.11, label %if.then.11, label %for.inc30.11
if.then.11: ; preds = %for.inc30.10
%40 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.11 = sext i8 %40 to i32
%call29.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.11, i32 noundef 12)
br label %for.inc30.11
for.inc30.11: ; preds = %if.then.11, %for.inc30.10
%41 = add nuw nsw i64 %5, 12
%arrayidx22.12 = getelementptr inbounds [52 x i32], ptr %a, i64 0, i64 %41
%42 = load i32, ptr %arrayidx22.12, align 4, !tbaa !5
%cmp23.12 = icmp eq i32 %42, 0
br i1 %cmp23.12, label %if.then.12, label %for.inc30.12
if.then.12: ; preds = %for.inc30.11
%43 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%conv27.12 = sext i8 %43 to i32
%call29.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv27.12, i32 noundef 13)
br label %for.inc30.12
for.inc30.12: ; preds = %if.then.12, %for.inc30.11
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%exitcond.not = icmp eq i64 %indvars.iv.next61, 4
br i1 %exitcond.not, label %for.end35, label %for.cond16.preheader, !llvm.loop !13
for.end35: ; preds = %for.inc30.12
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
/* Finding Missing Cards */
#include <stdio.h>
int main()
{
int card[4][14], c, n, i, j;
char s;
scanf("%d", &n);
for(i=0; i<n; i++){
for(j=0;j<2;j++){
scanf("%c %d", &s, &c);
}
if(s == 'S'){
card[0][c] = c;
}
else if(s == 'H'){
card[1][c] = c;
}
else if(s == 'C'){
card[2][c] = c;
}
else if(s == 'D'){
card[3][c] = c;
}
}
for(i=0;i<4;i++){
for(j=1; j<14; j++){
if(card[i][j] != j){
if(i == 0){ printf("S %d\n", j); }
else if(i == 1){ printf("H %d\n", j); }
else if(i == 2){ printf("C %d\n", j); }
else if(i == 3){ printf("D %d\n", j); }
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_214909/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_214909/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%c %d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"S %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"H %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"C %d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"D %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%card = alloca [4 x [14 x i32]], align 16
%c = alloca i32, align 4
%n = alloca i32, align 4
%s = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 224, ptr nonnull %card) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp100 = icmp sgt i32 %0, 0
br i1 %cmp100, label %for.cond1.preheader, label %for.cond41.preheader.preheader
for.cond1.preheader: ; preds = %entry, %for.inc34
%i.0101 = phi i32 [ %inc35, %for.inc34 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %c)
%call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %c)
%1 = load i8, ptr %s, align 1, !tbaa !9
switch i8 %1, label %for.inc34 [
i8 83, label %if.then
i8 72, label %if.then11
i8 67, label %if.then19
i8 68, label %if.then27
]
if.then: ; preds = %for.cond1.preheader
%2 = load i32, ptr %c, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx7 = getelementptr inbounds [14 x i32], ptr %card, i64 0, i64 %idxprom
store i32 %2, ptr %arrayidx7, align 4, !tbaa !5
br label %for.inc34
if.then11: ; preds = %for.cond1.preheader
%3 = load i32, ptr %c, align 4, !tbaa !5
%idxprom13 = sext i32 %3 to i64
%arrayidx14 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 1, i64 %idxprom13
store i32 %3, ptr %arrayidx14, align 4, !tbaa !5
br label %for.inc34
if.then19: ; preds = %for.cond1.preheader
%4 = load i32, ptr %c, align 4, !tbaa !5
%idxprom21 = sext i32 %4 to i64
%arrayidx22 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 2, i64 %idxprom21
store i32 %4, ptr %arrayidx22, align 4, !tbaa !5
br label %for.inc34
if.then27: ; preds = %for.cond1.preheader
%5 = load i32, ptr %c, align 4, !tbaa !5
%idxprom29 = sext i32 %5 to i64
%arrayidx30 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 3, i64 %idxprom29
store i32 %5, ptr %arrayidx30, align 4, !tbaa !5
br label %for.inc34
for.inc34: ; preds = %for.cond1.preheader, %if.then, %if.then19, %if.then27, %if.then11
%inc35 = add nuw nsw i32 %i.0101, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc35, %6
br i1 %cmp, label %for.cond1.preheader, label %for.cond41.preheader.preheader, !llvm.loop !10
for.cond41.preheader.preheader: ; preds = %for.inc34, %entry
br label %for.cond41.preheader
for.cond41.preheader: ; preds = %for.cond41.preheader.preheader, %for.inc79
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc79 ], [ 0, %for.cond41.preheader.preheader ]
%7 = trunc i64 %indvars.iv to i32
switch i32 %7, label %for.inc79 [
i32 0, label %for.body44.us.preheader
i32 1, label %for.body44.us104.preheader
i32 2, label %for.body44.us114.preheader
i32 3, label %for.body44.us124.preheader
]
for.body44.us124.preheader: ; preds = %for.cond41.preheader
%arrayidx48.us127 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%8 = load i32, ptr %arrayidx48.us127, align 4, !tbaa !5
%cmp49.not.us128 = icmp eq i32 %8, 1
br i1 %cmp49.not.us128, label %for.inc76.us130, label %if.then51.us129
for.body44.us114.preheader: ; preds = %for.cond41.preheader
%arrayidx48.us117 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%9 = load i32, ptr %arrayidx48.us117, align 4, !tbaa !5
%cmp49.not.us118 = icmp eq i32 %9, 1
br i1 %cmp49.not.us118, label %for.inc76.us120, label %if.then51.us119
for.body44.us104.preheader: ; preds = %for.cond41.preheader
%arrayidx48.us107 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%10 = load i32, ptr %arrayidx48.us107, align 4, !tbaa !5
%cmp49.not.us108 = icmp eq i32 %10, 1
br i1 %cmp49.not.us108, label %for.inc76.us110, label %if.then51.us109
for.body44.us.preheader: ; preds = %for.cond41.preheader
%arrayidx48.us = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 1
%11 = load i32, ptr %arrayidx48.us, align 4, !tbaa !5
%cmp49.not.us = icmp eq i32 %11, 1
br i1 %cmp49.not.us, label %for.inc76.us, label %if.then51.us
if.then51.us: ; preds = %for.body44.us.preheader
%call55.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
br label %for.inc76.us
for.inc76.us: ; preds = %if.then51.us, %for.body44.us.preheader
%arrayidx48.us.1 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%12 = load i32, ptr %arrayidx48.us.1, align 8, !tbaa !5
%cmp49.not.us.1 = icmp eq i32 %12, 2
br i1 %cmp49.not.us.1, label %for.inc76.us.1, label %if.then51.us.1
if.then51.us.1: ; preds = %for.inc76.us
%call55.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
br label %for.inc76.us.1
for.inc76.us.1: ; preds = %if.then51.us.1, %for.inc76.us
%arrayidx48.us.2 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%13 = load i32, ptr %arrayidx48.us.2, align 4, !tbaa !5
%cmp49.not.us.2 = icmp eq i32 %13, 3
br i1 %cmp49.not.us.2, label %for.inc76.us.2, label %if.then51.us.2
if.then51.us.2: ; preds = %for.inc76.us.1
%call55.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
br label %for.inc76.us.2
for.inc76.us.2: ; preds = %if.then51.us.2, %for.inc76.us.1
%arrayidx48.us.3 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%14 = load i32, ptr %arrayidx48.us.3, align 8, !tbaa !5
%cmp49.not.us.3 = icmp eq i32 %14, 4
br i1 %cmp49.not.us.3, label %for.inc76.us.3, label %if.then51.us.3
if.then51.us.3: ; preds = %for.inc76.us.2
%call55.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
br label %for.inc76.us.3
for.inc76.us.3: ; preds = %if.then51.us.3, %for.inc76.us.2
%arrayidx48.us.4 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%15 = load i32, ptr %arrayidx48.us.4, align 4, !tbaa !5
%cmp49.not.us.4 = icmp eq i32 %15, 5
br i1 %cmp49.not.us.4, label %for.inc76.us.4, label %if.then51.us.4
if.then51.us.4: ; preds = %for.inc76.us.3
%call55.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
br label %for.inc76.us.4
for.inc76.us.4: ; preds = %if.then51.us.4, %for.inc76.us.3
%arrayidx48.us.5 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%16 = load i32, ptr %arrayidx48.us.5, align 8, !tbaa !5
%cmp49.not.us.5 = icmp eq i32 %16, 6
br i1 %cmp49.not.us.5, label %for.inc76.us.5, label %if.then51.us.5
if.then51.us.5: ; preds = %for.inc76.us.4
%call55.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
br label %for.inc76.us.5
for.inc76.us.5: ; preds = %if.then51.us.5, %for.inc76.us.4
%arrayidx48.us.6 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%17 = load i32, ptr %arrayidx48.us.6, align 4, !tbaa !5
%cmp49.not.us.6 = icmp eq i32 %17, 7
br i1 %cmp49.not.us.6, label %for.inc76.us.6, label %if.then51.us.6
if.then51.us.6: ; preds = %for.inc76.us.5
%call55.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 7)
br label %for.inc76.us.6
for.inc76.us.6: ; preds = %if.then51.us.6, %for.inc76.us.5
%arrayidx48.us.7 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%18 = load i32, ptr %arrayidx48.us.7, align 8, !tbaa !5
%cmp49.not.us.7 = icmp eq i32 %18, 8
br i1 %cmp49.not.us.7, label %for.inc76.us.7, label %if.then51.us.7
if.then51.us.7: ; preds = %for.inc76.us.6
%call55.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 8)
br label %for.inc76.us.7
for.inc76.us.7: ; preds = %if.then51.us.7, %for.inc76.us.6
%arrayidx48.us.8 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%19 = load i32, ptr %arrayidx48.us.8, align 4, !tbaa !5
%cmp49.not.us.8 = icmp eq i32 %19, 9
br i1 %cmp49.not.us.8, label %for.inc76.us.8, label %if.then51.us.8
if.then51.us.8: ; preds = %for.inc76.us.7
%call55.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 9)
br label %for.inc76.us.8
for.inc76.us.8: ; preds = %if.then51.us.8, %for.inc76.us.7
%arrayidx48.us.9 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%20 = load i32, ptr %arrayidx48.us.9, align 8, !tbaa !5
%cmp49.not.us.9 = icmp eq i32 %20, 10
br i1 %cmp49.not.us.9, label %for.inc76.us.9, label %if.then51.us.9
if.then51.us.9: ; preds = %for.inc76.us.8
%call55.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 10)
br label %for.inc76.us.9
for.inc76.us.9: ; preds = %if.then51.us.9, %for.inc76.us.8
%arrayidx48.us.10 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%21 = load i32, ptr %arrayidx48.us.10, align 4, !tbaa !5
%cmp49.not.us.10 = icmp eq i32 %21, 11
br i1 %cmp49.not.us.10, label %for.inc76.us.10, label %if.then51.us.10
if.then51.us.10: ; preds = %for.inc76.us.9
%call55.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 11)
br label %for.inc76.us.10
for.inc76.us.10: ; preds = %if.then51.us.10, %for.inc76.us.9
%arrayidx48.us.11 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%22 = load i32, ptr %arrayidx48.us.11, align 8, !tbaa !5
%cmp49.not.us.11 = icmp eq i32 %22, 12
br i1 %cmp49.not.us.11, label %for.inc76.us.11, label %if.then51.us.11
if.then51.us.11: ; preds = %for.inc76.us.10
%call55.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 12)
br label %for.inc76.us.11
for.inc76.us.11: ; preds = %if.then51.us.11, %for.inc76.us.10
%arrayidx48.us.12 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 13
%23 = load i32, ptr %arrayidx48.us.12, align 4, !tbaa !5
%cmp49.not.us.12 = icmp eq i32 %23, 13
br i1 %cmp49.not.us.12, label %for.inc79, label %for.inc79.sink.split
if.then51.us109: ; preds = %for.body44.us104.preheader
%call60.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 1)
br label %for.inc76.us110
for.inc76.us110: ; preds = %if.then51.us109, %for.body44.us104.preheader
%arrayidx48.us107.1 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%24 = load i32, ptr %arrayidx48.us107.1, align 8, !tbaa !5
%cmp49.not.us108.1 = icmp eq i32 %24, 2
br i1 %cmp49.not.us108.1, label %for.inc76.us110.1, label %if.then51.us109.1
if.then51.us109.1: ; preds = %for.inc76.us110
%call60.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 2)
br label %for.inc76.us110.1
for.inc76.us110.1: ; preds = %if.then51.us109.1, %for.inc76.us110
%arrayidx48.us107.2 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%25 = load i32, ptr %arrayidx48.us107.2, align 4, !tbaa !5
%cmp49.not.us108.2 = icmp eq i32 %25, 3
br i1 %cmp49.not.us108.2, label %for.inc76.us110.2, label %if.then51.us109.2
if.then51.us109.2: ; preds = %for.inc76.us110.1
%call60.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 3)
br label %for.inc76.us110.2
for.inc76.us110.2: ; preds = %if.then51.us109.2, %for.inc76.us110.1
%arrayidx48.us107.3 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%26 = load i32, ptr %arrayidx48.us107.3, align 8, !tbaa !5
%cmp49.not.us108.3 = icmp eq i32 %26, 4
br i1 %cmp49.not.us108.3, label %for.inc76.us110.3, label %if.then51.us109.3
if.then51.us109.3: ; preds = %for.inc76.us110.2
%call60.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 4)
br label %for.inc76.us110.3
for.inc76.us110.3: ; preds = %if.then51.us109.3, %for.inc76.us110.2
%arrayidx48.us107.4 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%27 = load i32, ptr %arrayidx48.us107.4, align 4, !tbaa !5
%cmp49.not.us108.4 = icmp eq i32 %27, 5
br i1 %cmp49.not.us108.4, label %for.inc76.us110.4, label %if.then51.us109.4
if.then51.us109.4: ; preds = %for.inc76.us110.3
%call60.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 5)
br label %for.inc76.us110.4
for.inc76.us110.4: ; preds = %if.then51.us109.4, %for.inc76.us110.3
%arrayidx48.us107.5 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%28 = load i32, ptr %arrayidx48.us107.5, align 8, !tbaa !5
%cmp49.not.us108.5 = icmp eq i32 %28, 6
br i1 %cmp49.not.us108.5, label %for.inc76.us110.5, label %if.then51.us109.5
if.then51.us109.5: ; preds = %for.inc76.us110.4
%call60.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 6)
br label %for.inc76.us110.5
for.inc76.us110.5: ; preds = %if.then51.us109.5, %for.inc76.us110.4
%arrayidx48.us107.6 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%29 = load i32, ptr %arrayidx48.us107.6, align 4, !tbaa !5
%cmp49.not.us108.6 = icmp eq i32 %29, 7
br i1 %cmp49.not.us108.6, label %for.inc76.us110.6, label %if.then51.us109.6
if.then51.us109.6: ; preds = %for.inc76.us110.5
%call60.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 7)
br label %for.inc76.us110.6
for.inc76.us110.6: ; preds = %if.then51.us109.6, %for.inc76.us110.5
%arrayidx48.us107.7 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%30 = load i32, ptr %arrayidx48.us107.7, align 8, !tbaa !5
%cmp49.not.us108.7 = icmp eq i32 %30, 8
br i1 %cmp49.not.us108.7, label %for.inc76.us110.7, label %if.then51.us109.7
if.then51.us109.7: ; preds = %for.inc76.us110.6
%call60.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 8)
br label %for.inc76.us110.7
for.inc76.us110.7: ; preds = %if.then51.us109.7, %for.inc76.us110.6
%arrayidx48.us107.8 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%31 = load i32, ptr %arrayidx48.us107.8, align 4, !tbaa !5
%cmp49.not.us108.8 = icmp eq i32 %31, 9
br i1 %cmp49.not.us108.8, label %for.inc76.us110.8, label %if.then51.us109.8
if.then51.us109.8: ; preds = %for.inc76.us110.7
%call60.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 9)
br label %for.inc76.us110.8
for.inc76.us110.8: ; preds = %if.then51.us109.8, %for.inc76.us110.7
%arrayidx48.us107.9 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%32 = load i32, ptr %arrayidx48.us107.9, align 8, !tbaa !5
%cmp49.not.us108.9 = icmp eq i32 %32, 10
br i1 %cmp49.not.us108.9, label %for.inc76.us110.9, label %if.then51.us109.9
if.then51.us109.9: ; preds = %for.inc76.us110.8
%call60.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 10)
br label %for.inc76.us110.9
for.inc76.us110.9: ; preds = %if.then51.us109.9, %for.inc76.us110.8
%arrayidx48.us107.10 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%33 = load i32, ptr %arrayidx48.us107.10, align 4, !tbaa !5
%cmp49.not.us108.10 = icmp eq i32 %33, 11
br i1 %cmp49.not.us108.10, label %for.inc76.us110.10, label %if.then51.us109.10
if.then51.us109.10: ; preds = %for.inc76.us110.9
%call60.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 11)
br label %for.inc76.us110.10
for.inc76.us110.10: ; preds = %if.then51.us109.10, %for.inc76.us110.9
%arrayidx48.us107.11 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%34 = load i32, ptr %arrayidx48.us107.11, align 8, !tbaa !5
%cmp49.not.us108.11 = icmp eq i32 %34, 12
br i1 %cmp49.not.us108.11, label %for.inc76.us110.11, label %if.then51.us109.11
if.then51.us109.11: ; preds = %for.inc76.us110.10
%call60.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 12)
br label %for.inc76.us110.11
for.inc76.us110.11: ; preds = %if.then51.us109.11, %for.inc76.us110.10
%arrayidx48.us107.12 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 13
%35 = load i32, ptr %arrayidx48.us107.12, align 4, !tbaa !5
%cmp49.not.us108.12 = icmp eq i32 %35, 13
br i1 %cmp49.not.us108.12, label %for.inc79, label %for.inc79.sink.split
if.then51.us119: ; preds = %for.body44.us114.preheader
%call65.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 1)
br label %for.inc76.us120
for.inc76.us120: ; preds = %if.then51.us119, %for.body44.us114.preheader
%arrayidx48.us117.1 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%36 = load i32, ptr %arrayidx48.us117.1, align 8, !tbaa !5
%cmp49.not.us118.1 = icmp eq i32 %36, 2
br i1 %cmp49.not.us118.1, label %for.inc76.us120.1, label %if.then51.us119.1
if.then51.us119.1: ; preds = %for.inc76.us120
%call65.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 2)
br label %for.inc76.us120.1
for.inc76.us120.1: ; preds = %if.then51.us119.1, %for.inc76.us120
%arrayidx48.us117.2 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%37 = load i32, ptr %arrayidx48.us117.2, align 4, !tbaa !5
%cmp49.not.us118.2 = icmp eq i32 %37, 3
br i1 %cmp49.not.us118.2, label %for.inc76.us120.2, label %if.then51.us119.2
if.then51.us119.2: ; preds = %for.inc76.us120.1
%call65.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 3)
br label %for.inc76.us120.2
for.inc76.us120.2: ; preds = %if.then51.us119.2, %for.inc76.us120.1
%arrayidx48.us117.3 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%38 = load i32, ptr %arrayidx48.us117.3, align 8, !tbaa !5
%cmp49.not.us118.3 = icmp eq i32 %38, 4
br i1 %cmp49.not.us118.3, label %for.inc76.us120.3, label %if.then51.us119.3
if.then51.us119.3: ; preds = %for.inc76.us120.2
%call65.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 4)
br label %for.inc76.us120.3
for.inc76.us120.3: ; preds = %if.then51.us119.3, %for.inc76.us120.2
%arrayidx48.us117.4 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%39 = load i32, ptr %arrayidx48.us117.4, align 4, !tbaa !5
%cmp49.not.us118.4 = icmp eq i32 %39, 5
br i1 %cmp49.not.us118.4, label %for.inc76.us120.4, label %if.then51.us119.4
if.then51.us119.4: ; preds = %for.inc76.us120.3
%call65.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 5)
br label %for.inc76.us120.4
for.inc76.us120.4: ; preds = %if.then51.us119.4, %for.inc76.us120.3
%arrayidx48.us117.5 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%40 = load i32, ptr %arrayidx48.us117.5, align 8, !tbaa !5
%cmp49.not.us118.5 = icmp eq i32 %40, 6
br i1 %cmp49.not.us118.5, label %for.inc76.us120.5, label %if.then51.us119.5
if.then51.us119.5: ; preds = %for.inc76.us120.4
%call65.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 6)
br label %for.inc76.us120.5
for.inc76.us120.5: ; preds = %if.then51.us119.5, %for.inc76.us120.4
%arrayidx48.us117.6 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%41 = load i32, ptr %arrayidx48.us117.6, align 4, !tbaa !5
%cmp49.not.us118.6 = icmp eq i32 %41, 7
br i1 %cmp49.not.us118.6, label %for.inc76.us120.6, label %if.then51.us119.6
if.then51.us119.6: ; preds = %for.inc76.us120.5
%call65.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 7)
br label %for.inc76.us120.6
for.inc76.us120.6: ; preds = %if.then51.us119.6, %for.inc76.us120.5
%arrayidx48.us117.7 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%42 = load i32, ptr %arrayidx48.us117.7, align 8, !tbaa !5
%cmp49.not.us118.7 = icmp eq i32 %42, 8
br i1 %cmp49.not.us118.7, label %for.inc76.us120.7, label %if.then51.us119.7
if.then51.us119.7: ; preds = %for.inc76.us120.6
%call65.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 8)
br label %for.inc76.us120.7
for.inc76.us120.7: ; preds = %if.then51.us119.7, %for.inc76.us120.6
%arrayidx48.us117.8 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%43 = load i32, ptr %arrayidx48.us117.8, align 4, !tbaa !5
%cmp49.not.us118.8 = icmp eq i32 %43, 9
br i1 %cmp49.not.us118.8, label %for.inc76.us120.8, label %if.then51.us119.8
if.then51.us119.8: ; preds = %for.inc76.us120.7
%call65.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 9)
br label %for.inc76.us120.8
for.inc76.us120.8: ; preds = %if.then51.us119.8, %for.inc76.us120.7
%arrayidx48.us117.9 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%44 = load i32, ptr %arrayidx48.us117.9, align 8, !tbaa !5
%cmp49.not.us118.9 = icmp eq i32 %44, 10
br i1 %cmp49.not.us118.9, label %for.inc76.us120.9, label %if.then51.us119.9
if.then51.us119.9: ; preds = %for.inc76.us120.8
%call65.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 10)
br label %for.inc76.us120.9
for.inc76.us120.9: ; preds = %if.then51.us119.9, %for.inc76.us120.8
%arrayidx48.us117.10 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%45 = load i32, ptr %arrayidx48.us117.10, align 4, !tbaa !5
%cmp49.not.us118.10 = icmp eq i32 %45, 11
br i1 %cmp49.not.us118.10, label %for.inc76.us120.10, label %if.then51.us119.10
if.then51.us119.10: ; preds = %for.inc76.us120.9
%call65.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 11)
br label %for.inc76.us120.10
for.inc76.us120.10: ; preds = %if.then51.us119.10, %for.inc76.us120.9
%arrayidx48.us117.11 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%46 = load i32, ptr %arrayidx48.us117.11, align 8, !tbaa !5
%cmp49.not.us118.11 = icmp eq i32 %46, 12
br i1 %cmp49.not.us118.11, label %for.inc76.us120.11, label %if.then51.us119.11
if.then51.us119.11: ; preds = %for.inc76.us120.10
%call65.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 12)
br label %for.inc76.us120.11
for.inc76.us120.11: ; preds = %if.then51.us119.11, %for.inc76.us120.10
%arrayidx48.us117.12 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 13
%47 = load i32, ptr %arrayidx48.us117.12, align 4, !tbaa !5
%cmp49.not.us118.12 = icmp eq i32 %47, 13
br i1 %cmp49.not.us118.12, label %for.inc79, label %for.inc79.sink.split
if.then51.us129: ; preds = %for.body44.us124.preheader
%call70.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 1)
br label %for.inc76.us130
for.inc76.us130: ; preds = %if.then51.us129, %for.body44.us124.preheader
%arrayidx48.us127.1 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 2
%48 = load i32, ptr %arrayidx48.us127.1, align 8, !tbaa !5
%cmp49.not.us128.1 = icmp eq i32 %48, 2
br i1 %cmp49.not.us128.1, label %for.inc76.us130.1, label %if.then51.us129.1
if.then51.us129.1: ; preds = %for.inc76.us130
%call70.us.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 2)
br label %for.inc76.us130.1
for.inc76.us130.1: ; preds = %if.then51.us129.1, %for.inc76.us130
%arrayidx48.us127.2 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 3
%49 = load i32, ptr %arrayidx48.us127.2, align 4, !tbaa !5
%cmp49.not.us128.2 = icmp eq i32 %49, 3
br i1 %cmp49.not.us128.2, label %for.inc76.us130.2, label %if.then51.us129.2
if.then51.us129.2: ; preds = %for.inc76.us130.1
%call70.us.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 3)
br label %for.inc76.us130.2
for.inc76.us130.2: ; preds = %if.then51.us129.2, %for.inc76.us130.1
%arrayidx48.us127.3 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 4
%50 = load i32, ptr %arrayidx48.us127.3, align 8, !tbaa !5
%cmp49.not.us128.3 = icmp eq i32 %50, 4
br i1 %cmp49.not.us128.3, label %for.inc76.us130.3, label %if.then51.us129.3
if.then51.us129.3: ; preds = %for.inc76.us130.2
%call70.us.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 4)
br label %for.inc76.us130.3
for.inc76.us130.3: ; preds = %if.then51.us129.3, %for.inc76.us130.2
%arrayidx48.us127.4 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 5
%51 = load i32, ptr %arrayidx48.us127.4, align 4, !tbaa !5
%cmp49.not.us128.4 = icmp eq i32 %51, 5
br i1 %cmp49.not.us128.4, label %for.inc76.us130.4, label %if.then51.us129.4
if.then51.us129.4: ; preds = %for.inc76.us130.3
%call70.us.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 5)
br label %for.inc76.us130.4
for.inc76.us130.4: ; preds = %if.then51.us129.4, %for.inc76.us130.3
%arrayidx48.us127.5 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 6
%52 = load i32, ptr %arrayidx48.us127.5, align 8, !tbaa !5
%cmp49.not.us128.5 = icmp eq i32 %52, 6
br i1 %cmp49.not.us128.5, label %for.inc76.us130.5, label %if.then51.us129.5
if.then51.us129.5: ; preds = %for.inc76.us130.4
%call70.us.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 6)
br label %for.inc76.us130.5
for.inc76.us130.5: ; preds = %if.then51.us129.5, %for.inc76.us130.4
%arrayidx48.us127.6 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 7
%53 = load i32, ptr %arrayidx48.us127.6, align 4, !tbaa !5
%cmp49.not.us128.6 = icmp eq i32 %53, 7
br i1 %cmp49.not.us128.6, label %for.inc76.us130.6, label %if.then51.us129.6
if.then51.us129.6: ; preds = %for.inc76.us130.5
%call70.us.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 7)
br label %for.inc76.us130.6
for.inc76.us130.6: ; preds = %if.then51.us129.6, %for.inc76.us130.5
%arrayidx48.us127.7 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 8
%54 = load i32, ptr %arrayidx48.us127.7, align 8, !tbaa !5
%cmp49.not.us128.7 = icmp eq i32 %54, 8
br i1 %cmp49.not.us128.7, label %for.inc76.us130.7, label %if.then51.us129.7
if.then51.us129.7: ; preds = %for.inc76.us130.6
%call70.us.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 8)
br label %for.inc76.us130.7
for.inc76.us130.7: ; preds = %if.then51.us129.7, %for.inc76.us130.6
%arrayidx48.us127.8 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 9
%55 = load i32, ptr %arrayidx48.us127.8, align 4, !tbaa !5
%cmp49.not.us128.8 = icmp eq i32 %55, 9
br i1 %cmp49.not.us128.8, label %for.inc76.us130.8, label %if.then51.us129.8
if.then51.us129.8: ; preds = %for.inc76.us130.7
%call70.us.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 9)
br label %for.inc76.us130.8
for.inc76.us130.8: ; preds = %if.then51.us129.8, %for.inc76.us130.7
%arrayidx48.us127.9 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 10
%56 = load i32, ptr %arrayidx48.us127.9, align 8, !tbaa !5
%cmp49.not.us128.9 = icmp eq i32 %56, 10
br i1 %cmp49.not.us128.9, label %for.inc76.us130.9, label %if.then51.us129.9
if.then51.us129.9: ; preds = %for.inc76.us130.8
%call70.us.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 10)
br label %for.inc76.us130.9
for.inc76.us130.9: ; preds = %if.then51.us129.9, %for.inc76.us130.8
%arrayidx48.us127.10 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 11
%57 = load i32, ptr %arrayidx48.us127.10, align 4, !tbaa !5
%cmp49.not.us128.10 = icmp eq i32 %57, 11
br i1 %cmp49.not.us128.10, label %for.inc76.us130.10, label %if.then51.us129.10
if.then51.us129.10: ; preds = %for.inc76.us130.9
%call70.us.10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 11)
br label %for.inc76.us130.10
for.inc76.us130.10: ; preds = %if.then51.us129.10, %for.inc76.us130.9
%arrayidx48.us127.11 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 12
%58 = load i32, ptr %arrayidx48.us127.11, align 8, !tbaa !5
%cmp49.not.us128.11 = icmp eq i32 %58, 12
br i1 %cmp49.not.us128.11, label %for.inc76.us130.11, label %if.then51.us129.11
if.then51.us129.11: ; preds = %for.inc76.us130.10
%call70.us.11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 12)
br label %for.inc76.us130.11
for.inc76.us130.11: ; preds = %if.then51.us129.11, %for.inc76.us130.10
%arrayidx48.us127.12 = getelementptr inbounds [4 x [14 x i32]], ptr %card, i64 0, i64 %indvars.iv, i64 13
%59 = load i32, ptr %arrayidx48.us127.12, align 4, !tbaa !5
%cmp49.not.us128.12 = icmp eq i32 %59, 13
br i1 %cmp49.not.us128.12, label %for.inc79, label %for.inc79.sink.split
for.inc79.sink.split: ; preds = %for.inc76.us130.11, %for.inc76.us120.11, %for.inc76.us110.11, %for.inc76.us.11
%.str.5.sink = phi ptr [ @.str.2, %for.inc76.us.11 ], [ @.str.3, %for.inc76.us110.11 ], [ @.str.4, %for.inc76.us120.11 ], [ @.str.5, %for.inc76.us130.11 ]
%call70.us.12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.5.sink, i32 noundef 13)
br label %for.inc79
for.inc79: ; preds = %for.inc79.sink.split, %for.inc76.us130.11, %for.inc76.us120.11, %for.inc76.us110.11, %for.inc76.us.11, %for.cond41.preheader
%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.end81, label %for.cond41.preheader, !llvm.loop !12
for.end81: ; preds = %for.inc79
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 224, ptr nonnull %card) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
int n,a[1000002]={0},i,b[1000002]={0},max=0,d=0,x;
char c;
scanf("%d",&n);
while(n--){
scanf("\n%c %d",&c,&x);
if(b[x]==0 && c=='-')
max++;
else if(c=='-'){
a[x]=0;
d--;
}
else if(c=='+')
{
b[x]=1;
d++;
if(d>max)
max=d;
}
}
printf("%d\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_21496/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_21496/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"\0A%c %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [1000002 x i32], align 16
%x = alloca i32, align 4
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4000008, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000008) %b, i8 0, i64 4000008, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #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 %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%dec31 = add nsw i32 %0, -1
store i32 %dec31, ptr %n, align 4, !tbaa !5
%tobool.not32 = icmp eq i32 %0, 0
br i1 %tobool.not32, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end24
%d.034 = phi i32 [ %d.1, %if.end24 ], [ 0, %entry ]
%max.033 = phi i32 [ %max.1, %if.end24 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [1000002 x i32], ptr %b, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %2, 0
%3 = load i8, ptr %c, align 1
%cmp2 = icmp eq i8 %3, 45
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc = add nsw i32 %max.033, 1
br label %if.end24
if.else: ; preds = %while.body
br i1 %cmp2, label %if.then7, label %if.else11
if.then7: ; preds = %if.else
%dec10 = add nsw i32 %d.034, -1
br label %if.end24
if.else11: ; preds = %if.else
%cmp13 = icmp eq i8 %3, 43
br i1 %cmp13, label %if.then15, label %if.end24
if.then15: ; preds = %if.else11
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%inc18 = add nsw i32 %d.034, 1
%cmp19.not = icmp slt i32 %d.034, %max.033
%spec.select = select i1 %cmp19.not, i32 %max.033, i32 %inc18
br label %if.end24
if.end24: ; preds = %if.then15, %if.then7, %if.else11, %if.then
%max.1 = phi i32 [ %inc, %if.then ], [ %max.033, %if.then7 ], [ %max.033, %if.else11 ], [ %spec.select, %if.then15 ]
%d.1 = phi i32 [ %d.034, %if.then ], [ %dec10, %if.then7 ], [ %d.034, %if.else11 ], [ %inc18, %if.then15 ]
%4 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end24, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %max.1, %if.end24 ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4000008, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.