Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main(void) {
int a, b;
int i = 0;
scanf("%d %d", &a, &b);
for ( i; ; i++ ) {
if ( i >= ((double)(b-1) / (a-1)) ) { break; }
}
printf("%d\n", i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146833/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146833/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%conv1 = sitofp i32 %sub to double
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub2 = add nsw i32 %1, -1
%conv3 = sitofp i32 %sub2 to double
%div = fdiv double %conv1, %conv3
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ]
%conv = sitofp i32 %i.0 to double
%cmp = fcmp ugt double %div, %conv
%inc = add nuw nsw i32 %i.0, 1
br i1 %cmp, label %for.cond, label %for.end
for.end: ; preds = %for.cond
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
int b;
scanf("%d",&b);
b--;
double ans = (double)b / (a - 1);
if(ans > (int)ans){
ans++;
}
printf("%d",(int)ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146877/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146877/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %b, align 4, !tbaa !5
%conv = sitofp i32 %dec to double
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%conv2 = sitofp i32 %sub to double
%div = fdiv double %conv, %conv2
%conv3 = fptosi double %div to i32
%conv4 = sitofp i32 %conv3 to double
%cmp = fcmp ogt double %div, %conv4
%inc = fadd double %div, 1.000000e+00
%ans.0 = select i1 %cmp, double %inc, double %div
%conv6 = fptosi double %ans.0 to i32
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
int n,i,j,k;
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
if(i%2==0)
printf("%d ",i+1);
else
printf("%d ",i);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14692/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14692/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec12 = add nsw i32 %0, -1
store i32 %dec12, ptr %t, align 4, !tbaa !5
%tobool.not13 = icmp eq i32 %0, 0
br i1 %tobool.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %1, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %while.body, %for.inc
%i.011 = phi i32 [ %inc.pre-phi, %for.inc ], [ 0, %while.body ]
%rem = and i32 %i.011, 1
%cmp2 = icmp eq i32 %rem, 0
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%add = add nuw nsw i32 %i.011, 1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %for.inc
if.else: ; preds = %for.body
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.011)
%.pre = add nuw nsw i32 %i.011, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%inc.pre-phi = phi i32 [ %add, %if.then ], [ %.pre, %if.else ]
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc.pre-phi, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %while.body
%putchar = call i32 @putchar(i32 10)
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int A,a,b,i;
scanf("%d %d",&a,&b);
if(b==1){
printf("0\n");
return 0;
}
A=a;
for(i=1;A<b;A=A+a-1){
i++;
}
printf("%d\n",i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146963/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146963/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = 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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end: ; preds = %entry
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp29 = icmp slt i32 %1, %0
br i1 %cmp29, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %if.end
%add = add i32 %1, -1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.011 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.body ]
%A.010 = phi i32 [ %1, %for.body.lr.ph ], [ %sub, %for.body ]
%inc = add nuw nsw i32 %i.011, 1
%sub = add i32 %add, %A.010
%cmp2 = icmp slt i32 %sub, %0
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %if.end
%i.0.lcssa = phi i32 [ 1, %if.end ], [ %inc, %for.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 A,B,temp=1,count=0;
scanf("%d",&A);
scanf("%d",&B);
while(temp < B)
{
count++;
temp = temp - 1 + A;
}
printf("%d\n",count);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147005/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147005/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%0 = load i32, ptr %B, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 1
br i1 %cmp5, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%count.07 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%temp.06 = phi i32 [ 1, %while.body.lr.ph ], [ %add, %while.body ]
%inc = add nuw nsw i32 %count.07, 1
%sub = add nsw i32 %temp.06, -1
%add = add nsw i32 %sub, %1
%cmp = icmp slt i32 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int A, B, x, i;
scanf("%d%d", &A, &B);
i=0;
x=1;
while (x<B) {
x+=A-1;
i++;
}
printf("%d", i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147049/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147049/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %B, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 1
br i1 %cmp4, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%i.06 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%x.05 = phi i32 [ 1, %while.body.lr.ph ], [ %add, %while.body ]
%sub = add i32 %x.05, -1
%add = add i32 %sub, %1
%inc = add nuw nsw i32 %i.06, 1
%cmp = icmp slt i32 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
// AOJ 1585 String in String
// 2018.5.20 bal4u
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
int n = 0, c = gc();
do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
return n;
}
void out(int n)
{
int i;
char ob[20];
if (!n) pc('0');
else {
i = 0; while (n) ob[i++] = n%10 + '0', n/=10;
while (i--) pc(ob[i]);
}
pc('\n');
}
int str(int *f, char *s)
{
int x;
char *p = s, c;
*p++ = x = gc();
while ((c = gc()) > ' ') {
*p++ = c;
if (c != x) x = -1;
}
*p = 0;
*f = x;
return p-s;
}
#define INF 0x10101010
#define MAX_L 100005
char text[MAX_L]; int len;
char pat[MAX_L]; int wp;
int sa[MAX_L], rank[MAX_L<<1];
/* 接尾辞配列 */
// rank[i]~[i+k] と rank[j]~[j+k] を比較
int k; // comstruct_sa()内で設定
int compare_sa(int i, int j)
{
if (rank[i] != rank[j]) return rank[i] < rank[j];
return rank[i+k] < rank[j+k];
}
// for qsort()
int cmp(const void *a, const void *b)
{
int i = *(const int *)a, j = *(const int *)b;
if (rank[i] != rank[j]) return rank[i] - rank[j];
return rank[i+k] - rank[j+k];
}
// 文字列Sの接尾辞配列saを構築。 len: strlen(s)
int tmp[MAX_L];
void construct_sa(char *s, int *sa)
{
int i;
memset(rank, -1, sizeof(rank));
for(i = 0; i <= len; i++) {
sa[i] = i;
if (i < len) rank[i] = s[i];
}
for(k = 1; k <= len; k *= 2) {
qsort(sa, len+1, sizeof(int), cmp);
tmp[sa[0]] = 0;
for(i = 1; i <= len; i++) {
tmp[sa[i]] = tmp[sa[i-1]] + compare_sa(sa[i-1], sa[i]);
}
for(i = 0; i <= len; i++) rank[i] = tmp[i];
}
}
int main()
{
int Q, l, r, lo, hi, mi, ans;
int xx, xp;
len = str(&xx, text);
if (xx < 0) construct_sa(text, sa);
Q = in();
while (Q--) {
l = in(), r = in()+1, wp = str(&xp, pat);
if (wp > r-l) { pc('0'), pc('\n'); continue; }
if (wp == r-l) {
pc ('0' + (memcmp(text+l, pat, wp) == 0)), pc('\n');
continue;
}
if (xx > 0) {
if (xp < 0 || xp != xx || wp > len) { pc('0'), pc('\n'); continue; }
out(r-l+1-wp);
continue;
}
lo = 0, hi = len;
while (lo < hi) {
mi = (lo + hi) >> 1;
if (memcmp(text+sa[mi], pat, wp) < 0) lo = mi+1; else hi = mi;
}
ans = 0, r -= wp;
while (lo <= len) {
if (memcmp(text+sa[lo], pat, wp)) break;
if (l <= sa[lo] && sa[lo] <= r) ans++;
lo++;
}
out(ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147106/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147106/source.c"
target datalayout = "e-m:e-p270: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] }
@rank = dso_local local_unnamed_addr global [200010 x i32] zeroinitializer, align 16
@k = dso_local local_unnamed_addr global i32 0, align 4
@len = dso_local local_unnamed_addr global i32 0, align 4
@tmp = dso_local local_unnamed_addr global [100005 x i32] zeroinitializer, align 16
@text = dso_local global [100005 x i8] zeroinitializer, align 16
@sa = dso_local global [100005 x i32] zeroinitializer, align 16
@pat = dso_local global [100005 x i8] zeroinitializer, align 16
@wp = dso_local local_unnamed_addr global i32 0, align 4
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #11
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !9
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !14
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !15
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #11
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; 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 void @out(i32 noundef %n) local_unnamed_addr #0 {
entry:
%ob = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %ob) #11
%tobool.not = icmp eq i32 %n, 0
br i1 %tobool.not, label %if.then, label %while.body
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 !19
%_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 !20
%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) #11
br label %if.end
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 !19
store i8 48, ptr %1, align 1, !tbaa !16
br label %if.end
while.body: ; preds = %entry, %while.body
%indvars.iv38 = phi i32 [ %indvars.iv.next39, %while.body ], [ 1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%n.addr.034 = phi i32 [ %div, %while.body ], [ %n, %entry ]
%rem = srem i32 %n.addr.034, 10
%3 = trunc i32 %rem to i8
%conv = add nsw i8 %3, 48
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [20 x i8], ptr %ob, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !16
%div = sdiv i32 %n.addr.034, 10
%n.addr.034.off = add i32 %n.addr.034, 9
%tobool1.not = icmp ult i32 %n.addr.034.off, 19
%indvars.iv.next39 = add nuw i32 %indvars.iv38, 1
br i1 %tobool1.not, label %while.body4.preheader, label %while.body, !llvm.loop !21
while.body4.preheader: ; preds = %while.body
%4 = sext i32 %indvars.iv38 to i64
br label %while.body4
while.body4: ; preds = %while.body4.preheader, %putchar_unlocked.exit24
%indvars.iv40 = phi i64 [ %4, %while.body4.preheader ], [ %indvars.iv.next41, %putchar_unlocked.exit24 ]
%indvars.iv.next41 = add nsw i64 %indvars.iv40, -1
%arrayidx6 = getelementptr inbounds [20 x i8], ptr %ob, i64 0, i64 %indvars.iv.next41
%5 = load i8, ptr %arrayidx6, align 1, !tbaa !16
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i16 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 5
%7 = load ptr, ptr %_IO_write_ptr.i16, align 8, !tbaa !19
%_IO_write_end.i17 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 6
%8 = load ptr, ptr %_IO_write_end.i17, align 8, !tbaa !20
%cmp.not.i18 = icmp ult ptr %7, %8
br i1 %cmp.not.i18, label %cond.false.i22, label %cond.true.i19, !prof !15
cond.true.i19: ; preds = %while.body4
%conv7 = zext i8 %5 to i32
%call.i20 = tail call i32 @__overflow(ptr noundef nonnull %6, i32 noundef %conv7) #11
br label %putchar_unlocked.exit24
cond.false.i22: ; preds = %while.body4
%incdec.ptr.i23 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i23, ptr %_IO_write_ptr.i16, align 8, !tbaa !19
store i8 %5, ptr %7, align 1, !tbaa !16
br label %putchar_unlocked.exit24
putchar_unlocked.exit24: ; preds = %cond.true.i19, %cond.false.i22
%9 = and i64 %indvars.iv.next41, 4294967295
%tobool3.not = icmp eq i64 %9, 0
br i1 %tobool3.not, label %if.end, label %while.body4, !llvm.loop !22
if.end: ; preds = %putchar_unlocked.exit24, %cond.false.i, %cond.true.i
%10 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i25 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 5
%11 = load ptr, ptr %_IO_write_ptr.i25, align 8, !tbaa !19
%_IO_write_end.i26 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 6
%12 = load ptr, ptr %_IO_write_end.i26, align 8, !tbaa !20
%cmp.not.i27 = icmp ult ptr %11, %12
br i1 %cmp.not.i27, label %cond.false.i31, label %cond.true.i28, !prof !15
cond.true.i28: ; preds = %if.end
%call.i29 = tail call i32 @__overflow(ptr noundef nonnull %10, i32 noundef 10) #11
br label %putchar_unlocked.exit33
cond.false.i31: ; preds = %if.end
%incdec.ptr.i32 = getelementptr inbounds i8, ptr %11, i64 1
store ptr %incdec.ptr.i32, ptr %_IO_write_ptr.i25, align 8, !tbaa !19
store i8 10, ptr %11, align 1, !tbaa !16
br label %putchar_unlocked.exit33
putchar_unlocked.exit33: ; preds = %cond.true.i28, %cond.false.i31
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %ob) #11
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @str(ptr nocapture noundef writeonly %f, ptr noundef %s) 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) #11
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 ]
%conv = trunc i32 %cond.i to i8
store i8 %conv, ptr %s, align 1, !tbaa !16
br label %while.cond
while.cond: ; preds = %while.body, %getchar_unlocked.exit
%s.pn = phi ptr [ %s, %getchar_unlocked.exit ], [ %p.0, %while.body ]
%x.0 = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %spec.store.select, %while.body ]
%p.0 = getelementptr inbounds i8, ptr %s.pn, i64 1
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i16 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i16, align 8, !tbaa !9
%_IO_read_end.i17 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i17, align 8, !tbaa !14
%cmp.not.i18 = icmp ult ptr %5, %6
br i1 %cmp.not.i18, label %cond.false.i22, label %cond.true.i19, !prof !15
cond.true.i19: ; preds = %while.cond
%call.i20 = tail call i32 @__uflow(ptr noundef nonnull %4) #11
br label %getchar_unlocked.exit25
cond.false.i22: ; preds = %while.cond
%incdec.ptr.i23 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i23, ptr %_IO_read_ptr.i16, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i24 = zext i8 %7 to i32
br label %getchar_unlocked.exit25
getchar_unlocked.exit25: ; preds = %cond.true.i19, %cond.false.i22
%cond.i21 = phi i32 [ %call.i20, %cond.true.i19 ], [ %conv3.i24, %cond.false.i22 ]
%8 = trunc i32 %cond.i21 to i8
%cmp = icmp sgt i8 %8, 32
br i1 %cmp, label %while.body, label %while.end
while.body: ; preds = %getchar_unlocked.exit25
%conv3 = and i32 %cond.i21, 255
store i8 %8, ptr %p.0, align 1, !tbaa !16
%cmp7.not = icmp eq i32 %conv3, %x.0
%spec.store.select = select i1 %cmp7.not, i32 %x.0, i32 -1
br label %while.cond, !llvm.loop !23
while.end: ; preds = %getchar_unlocked.exit25
store i8 0, ptr %p.0, align 1, !tbaa !16
store i32 %x.0, ptr %f, align 4, !tbaa !24
%sub.ptr.lhs.cast = ptrtoint ptr %p.0 to i64
%sub.ptr.rhs.cast = ptrtoint ptr %s to i64
%sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
%conv9 = trunc i64 %sub.ptr.sub to i32
ret i32 %conv9
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @compare_sa(i32 noundef %i, i32 noundef %j) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !24
%idxprom1 = sext i32 %j to i64
%arrayidx2 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !24
%cmp.not = icmp eq i32 %0, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%cmp7 = icmp slt i32 %0, %1
br label %return
if.end: ; preds = %entry
%2 = load i32, ptr @k, align 4, !tbaa !24
%add = add nsw i32 %2, %i
%idxprom8 = sext i32 %add to i64
%arrayidx9 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom8
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !24
%add10 = add nsw i32 %2, %j
%idxprom11 = sext i32 %add10 to i64
%arrayidx12 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom11
%4 = load i32, ptr %arrayidx12, align 4, !tbaa !24
%cmp13 = icmp slt i32 %3, %4
br label %return
return: ; preds = %if.end, %if.then
%retval.0.in = phi i1 [ %cmp7, %if.then ], [ %cmp13, %if.end ]
%retval.0 = zext i1 %retval.0.in to i32
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !24
%1 = load i32, ptr %b, align 4, !tbaa !24
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !24
%idxprom1 = sext i32 %1 to i64
%arrayidx2 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !24
%cmp.not = icmp eq i32 %2, %3
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i32 %2, %3
br label %cleanup
if.end: ; preds = %entry
%4 = load i32, ptr @k, align 4, !tbaa !24
%add = add nsw i32 %4, %0
%idxprom7 = sext i32 %add to i64
%arrayidx8 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom7
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !24
%add9 = add nsw i32 %4, %1
%idxprom10 = sext i32 %add9 to i64
%arrayidx11 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom10
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !24
%sub12 = sub nsw i32 %5, %6
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ %sub, %if.then ], [ %sub12, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @construct_sa(ptr nocapture noundef readonly %s, ptr noundef %sa) local_unnamed_addr #4 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800040) @rank, i8 -1, i64 800040, i1 false)
%0 = load i32, ptr @len, align 4, !tbaa !24
%cmp.not70 = icmp slt i32 %0, 0
br i1 %cmp.not70, label %for.cond6.preheader.thread, label %for.body.preheader
for.body.preheader: ; preds = %entry
store i32 0, ptr %sa, align 4, !tbaa !24
%1 = load i32, ptr @len, align 4, !tbaa !24
%cmp187 = icmp sgt i32 %1, 0
br i1 %cmp187, label %for.inc, label %for.cond6.preheader
for.cond6.preheader.thread: ; preds = %entry
store i32 1, ptr @k, align 4, !tbaa !24
br label %for.end47
for.cond6.preheader: ; preds = %for.inc, %for.body.preheader
%.lcssa = phi i32 [ %1, %for.body.preheader ], [ %4, %for.inc ]
store i32 1, ptr @k, align 4, !tbaa !24
%cmp7.not76 = icmp slt i32 %.lcssa, 1
br i1 %cmp7.not76, label %for.end47, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond6.preheader
%invariant.gep = getelementptr i32, ptr %sa, i64 -1
br label %for.body9
for.inc: ; preds = %for.body.preheader, %for.inc
%indvars.iv88 = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body.preheader ]
%arrayidx3 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv88
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !16
%conv = sext i8 %2 to i32
%arrayidx5 = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %indvars.iv88
store i32 %conv, ptr %arrayidx5, align 4, !tbaa !24
%indvars.iv.next = add nuw nsw i64 %indvars.iv88, 1
%arrayidx = getelementptr inbounds i32, ptr %sa, i64 %indvars.iv.next
%3 = trunc i64 %indvars.iv.next to i32
store i32 %3, ptr %arrayidx, align 4, !tbaa !24
%4 = load i32, ptr @len, align 4, !tbaa !24
%5 = sext i32 %4 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp1, label %for.inc, label %for.cond6.preheader
for.body9: ; preds = %for.body9.preheader, %for.inc46
%6 = phi i32 [ %8, %for.inc46 ], [ %.lcssa, %for.body9.preheader ]
%add = add nsw i32 %6, 1
%conv10 = sext i32 %add to i64
tail call void @qsort(ptr noundef nonnull %sa, i64 noundef %conv10, i64 noundef 4, ptr noundef nonnull @cmp) #11
%7 = load i32, ptr %sa, align 4, !tbaa !24
%idxprom12 = sext i32 %7 to i64
%arrayidx13 = getelementptr inbounds [100005 x i32], ptr @tmp, i64 0, i64 %idxprom12
store i32 0, ptr %arrayidx13, align 4, !tbaa !24
%8 = load i32, ptr @len, align 4, !tbaa !24
%cmp15.not72 = icmp slt i32 %8, 1
br i1 %cmp15.not72, label %for.cond35.preheader, label %for.body17.lr.ph
for.body17.lr.ph: ; preds = %for.body9
%9 = load i32, ptr @k, align 4
%10 = add nuw i32 %8, 1
%wide.trip.count = zext i32 %10 to i64
br label %for.body17
for.cond35.preheader: ; preds = %compare_sa.exit, %for.body9
%cmp36.not74 = icmp slt i32 %8, 0
br i1 %cmp36.not74, label %for.inc46, label %for.body38.preheader
for.body38.preheader: ; preds = %for.cond35.preheader
%11 = add nuw i32 %8, 1
%12 = zext i32 %11 to i64
%13 = shl nuw nsw i64 %12, 2
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @rank, ptr noundef nonnull align 16 dereferenceable(1) @tmp, i64 %13, i1 false), !tbaa !24
br label %for.inc46
for.body17: ; preds = %for.body17.lr.ph, %compare_sa.exit
%indvars.iv78 = phi i64 [ 1, %for.body17.lr.ph ], [ %indvars.iv.next79, %compare_sa.exit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv78
%14 = load i32, ptr %gep, align 4, !tbaa !24
%idxprom20 = sext i32 %14 to i64
%arrayidx21 = getelementptr inbounds [100005 x i32], ptr @tmp, i64 0, i64 %idxprom20
%15 = load i32, ptr %arrayidx21, align 4, !tbaa !24
%arrayidx26 = getelementptr inbounds i32, ptr %sa, i64 %indvars.iv78
%16 = load i32, ptr %arrayidx26, align 4, !tbaa !24
%arrayidx.i = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom20
%17 = load i32, ptr %arrayidx.i, align 4, !tbaa !24
%idxprom1.i = sext i32 %16 to i64
%arrayidx2.i = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom1.i
%18 = load i32, ptr %arrayidx2.i, align 4, !tbaa !24
%cmp.not.i = icmp eq i32 %17, %18
br i1 %cmp.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %for.body17
%cmp7.i = icmp slt i32 %17, %18
br label %compare_sa.exit
if.end.i: ; preds = %for.body17
%add.i = add nsw i32 %9, %14
%idxprom8.i = sext i32 %add.i to i64
%arrayidx9.i = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom8.i
%19 = load i32, ptr %arrayidx9.i, align 4, !tbaa !24
%add10.i = add nsw i32 %9, %16
%idxprom11.i = sext i32 %add10.i to i64
%arrayidx12.i = getelementptr inbounds [200010 x i32], ptr @rank, i64 0, i64 %idxprom11.i
%20 = load i32, ptr %arrayidx12.i, align 4, !tbaa !24
%cmp13.i = icmp slt i32 %19, %20
br label %compare_sa.exit
compare_sa.exit: ; preds = %if.then.i, %if.end.i
%retval.0.in.i = phi i1 [ %cmp7.i, %if.then.i ], [ %cmp13.i, %if.end.i ]
%retval.0.i = zext i1 %retval.0.in.i to i32
%add27 = add nsw i32 %15, %retval.0.i
%arrayidx31 = getelementptr inbounds [100005 x i32], ptr @tmp, i64 0, i64 %idxprom1.i
store i32 %add27, ptr %arrayidx31, align 4, !tbaa !24
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count
br i1 %exitcond.not, label %for.cond35.preheader, label %for.body17, !llvm.loop !25
for.inc46: ; preds = %for.body38.preheader, %for.cond35.preheader
%21 = load i32, ptr @k, align 4, !tbaa !24
%mul = shl nsw i32 %21, 1
store i32 %mul, ptr @k, align 4, !tbaa !24
%cmp7.not = icmp sgt i32 %mul, %8
br i1 %cmp7.not, label %for.end47, label %for.body9, !llvm.loop !26
for.end47: ; preds = %for.inc46, %for.cond6.preheader.thread, %for.cond6.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_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 = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #11
%.pre268.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !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
%.pre268 = phi ptr [ %.pre268.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 ]
%conv.i = trunc i32 %cond.i.i to i8
store i8 %conv.i, ptr @text, align 16, !tbaa !16
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %getchar_unlocked.exit.i
%4 = phi ptr [ %.pre268, %getchar_unlocked.exit.i ], [ %8, %while.body.i ]
%s.pn.i = phi ptr [ @text, %getchar_unlocked.exit.i ], [ %p.0.i, %while.body.i ]
%x.0.i = phi i32 [ %cond.i.i, %getchar_unlocked.exit.i ], [ %spec.store.select.i, %while.body.i ]
%p.0.i = getelementptr inbounds i8, ptr %s.pn.i, i64 1
%_IO_read_ptr.i16.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i16.i, align 8, !tbaa !9
%_IO_read_end.i17.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i17.i, align 8, !tbaa !14
%cmp.not.i18.i = icmp ult ptr %5, %6
br i1 %cmp.not.i18.i, label %cond.false.i22.i, label %cond.true.i19.i, !prof !15
cond.true.i19.i: ; preds = %while.cond.i
%call.i20.i = tail call i32 @__uflow(ptr noundef nonnull %4) #11
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit25.i
cond.false.i22.i: ; preds = %while.cond.i
%incdec.ptr.i23.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i23.i, ptr %_IO_read_ptr.i16.i, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i24.i = zext i8 %7 to i32
br label %getchar_unlocked.exit25.i
getchar_unlocked.exit25.i: ; preds = %cond.false.i22.i, %cond.true.i19.i
%8 = phi ptr [ %.pre, %cond.true.i19.i ], [ %4, %cond.false.i22.i ]
%cond.i21.i = phi i32 [ %call.i20.i, %cond.true.i19.i ], [ %conv3.i24.i, %cond.false.i22.i ]
%9 = trunc i32 %cond.i21.i to i8
%cmp.i = icmp sgt i8 %9, 32
br i1 %cmp.i, label %while.body.i, label %str.exit
while.body.i: ; preds = %getchar_unlocked.exit25.i
%conv3.i = and i32 %cond.i21.i, 255
store i8 %9, ptr %p.0.i, align 1, !tbaa !16
%cmp7.not.i = icmp eq i32 %conv3.i, %x.0.i
%spec.store.select.i = select i1 %cmp7.not.i, i32 %x.0.i, i32 -1
br label %while.cond.i, !llvm.loop !23
str.exit: ; preds = %getchar_unlocked.exit25.i
store i8 0, ptr %p.0.i, align 1, !tbaa !16
%sub.ptr.lhs.cast.i = ptrtoint ptr %p.0.i to i64
%10 = trunc i64 %sub.ptr.lhs.cast.i to i32
%conv9.i = sub i32 %10, ptrtoint (ptr @text to i32)
store i32 %conv9.i, ptr @len, align 4, !tbaa !24
%cmp = icmp slt i32 %x.0.i, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %str.exit
tail call void @construct_sa(ptr noundef nonnull @text, ptr noundef nonnull @sa)
%.pre269 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %str.exit
%11 = phi ptr [ %.pre269, %if.then ], [ %8, %str.exit ]
%_IO_read_ptr.i.i102 = getelementptr inbounds %struct._IO_FILE, ptr %11, i64 0, i32 1
%12 = load ptr, ptr %_IO_read_ptr.i.i102, align 8, !tbaa !9
%_IO_read_end.i.i103 = getelementptr inbounds %struct._IO_FILE, ptr %11, i64 0, i32 2
%13 = load ptr, ptr %_IO_read_end.i.i103, align 8, !tbaa !14
%cmp.not.i.i104 = icmp ult ptr %12, %13
br i1 %cmp.not.i.i104, label %cond.false.i.i110, label %cond.true.i.i105, !prof !15
cond.true.i.i105: ; preds = %if.end
%call.i.i106 = tail call i32 @__uflow(ptr noundef nonnull %11) #11
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i.preheader
cond.false.i.i110: ; preds = %if.end
%incdec.ptr.i.i111 = getelementptr inbounds i8, ptr %12, i64 1
store ptr %incdec.ptr.i.i111, ptr %_IO_read_ptr.i.i102, align 8, !tbaa !9
%14 = load i8, ptr %12, align 1, !tbaa !16
%conv3.i.i112 = zext i8 %14 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i110, %cond.true.i.i105
%.ph280 = phi ptr [ %11, %cond.false.i.i110 ], [ %.pre14.pre.i, %cond.true.i.i105 ]
%c.0.i.ph = phi i32 [ %conv3.i.i112, %cond.false.i.i110 ], [ %call.i.i106, %cond.true.i.i105 ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%15 = phi ptr [ %19, %getchar_unlocked.exit13.i ], [ %.ph280, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %15, i64 0, i32 1
%16 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %15, i64 0, i32 2
%17 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !14
%cmp.not.i6.i = icmp ult ptr %16, %17
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !15
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %15) #11
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %16, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !9
%18 = load i8, ptr %16, align 1, !tbaa !16
%conv3.i12.i = zext i8 %18 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%19 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %15, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i109 = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i109, label %do.body.i, label %while.cond.preheader, !llvm.loop !17
while.cond.preheader: ; preds = %getchar_unlocked.exit13.i
%tobool.not265 = icmp eq i32 %add.i, 0
br i1 %tobool.not265, label %while.end78, label %while.body.lr.ph
while.body.lr.ph: ; preds = %while.cond.preheader
%cmp20 = icmp sgt i32 %x.0.i, 0
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.cond.backedge
%dec266.in = phi i32 [ %add.i, %while.body.lr.ph ], [ %dec266, %while.cond.backedge ]
%dec266 = add nsw i32 %dec266.in, -1
%20 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i113 = getelementptr inbounds %struct._IO_FILE, ptr %20, i64 0, i32 1
%21 = load ptr, ptr %_IO_read_ptr.i.i113, align 8, !tbaa !9
%_IO_read_end.i.i114 = getelementptr inbounds %struct._IO_FILE, ptr %20, i64 0, i32 2
%22 = load ptr, ptr %_IO_read_end.i.i114, align 8, !tbaa !14
%cmp.not.i.i115 = icmp ult ptr %21, %22
br i1 %cmp.not.i.i115, label %cond.false.i.i140, label %cond.true.i.i116, !prof !15
cond.true.i.i116: ; preds = %while.body
%call.i.i117 = tail call i32 @__uflow(ptr noundef nonnull %20) #11
%.pre14.pre.i118 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i122.preheader
cond.false.i.i140: ; preds = %while.body
%incdec.ptr.i.i141 = getelementptr inbounds i8, ptr %21, i64 1
store ptr %incdec.ptr.i.i141, ptr %_IO_read_ptr.i.i113, align 8, !tbaa !9
%23 = load i8, ptr %21, align 1, !tbaa !16
%conv3.i.i142 = zext i8 %23 to i32
br label %do.body.i122.preheader
do.body.i122.preheader: ; preds = %cond.false.i.i140, %cond.true.i.i116
%.ph278 = phi ptr [ %20, %cond.false.i.i140 ], [ %.pre14.pre.i118, %cond.true.i.i116 ]
%c.0.i124.ph = phi i32 [ %conv3.i.i142, %cond.false.i.i140 ], [ %call.i.i117, %cond.true.i.i116 ]
br label %do.body.i122
do.body.i122: ; preds = %do.body.i122.preheader, %getchar_unlocked.exit13.i134
%24 = phi ptr [ %28, %getchar_unlocked.exit13.i134 ], [ %.ph278, %do.body.i122.preheader ]
%n.0.i123 = phi i32 [ %add.i127, %getchar_unlocked.exit13.i134 ], [ 0, %do.body.i122.preheader ]
%c.0.i124 = phi i32 [ %cond.i9.i135, %getchar_unlocked.exit13.i134 ], [ %c.0.i124.ph, %do.body.i122.preheader ]
%mul.i125 = mul nsw i32 %n.0.i123, 10
%and.i126 = and i32 %c.0.i124, 15
%add.i127 = add nsw i32 %and.i126, %mul.i125
%_IO_read_ptr.i4.i128 = getelementptr inbounds %struct._IO_FILE, ptr %24, i64 0, i32 1
%25 = load ptr, ptr %_IO_read_ptr.i4.i128, align 8, !tbaa !9
%_IO_read_end.i5.i129 = getelementptr inbounds %struct._IO_FILE, ptr %24, i64 0, i32 2
%26 = load ptr, ptr %_IO_read_end.i5.i129, align 8, !tbaa !14
%cmp.not.i6.i130 = icmp ult ptr %25, %26
br i1 %cmp.not.i6.i130, label %cond.false.i10.i137, label %cond.true.i7.i131, !prof !15
cond.true.i7.i131: ; preds = %do.body.i122
%call.i8.i132 = tail call i32 @__uflow(ptr noundef nonnull %24) #11
%.pre.i133 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i134
cond.false.i10.i137: ; preds = %do.body.i122
%incdec.ptr.i11.i138 = getelementptr inbounds i8, ptr %25, i64 1
store ptr %incdec.ptr.i11.i138, ptr %_IO_read_ptr.i4.i128, align 8, !tbaa !9
%27 = load i8, ptr %25, align 1, !tbaa !16
%conv3.i12.i139 = zext i8 %27 to i32
br label %getchar_unlocked.exit13.i134
getchar_unlocked.exit13.i134: ; preds = %cond.false.i10.i137, %cond.true.i7.i131
%28 = phi ptr [ %.pre.i133, %cond.true.i7.i131 ], [ %24, %cond.false.i10.i137 ]
%cond.i9.i135 = phi i32 [ %call.i8.i132, %cond.true.i7.i131 ], [ %conv3.i12.i139, %cond.false.i10.i137 ]
%cmp.i136 = icmp sgt i32 %cond.i9.i135, 47
br i1 %cmp.i136, label %do.body.i122, label %in.exit143, !llvm.loop !17
in.exit143: ; preds = %getchar_unlocked.exit13.i134
%_IO_read_ptr.i.i144 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 1
%29 = load ptr, ptr %_IO_read_ptr.i.i144, align 8, !tbaa !9
%_IO_read_end.i.i145 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 2
%30 = load ptr, ptr %_IO_read_end.i.i145, align 8, !tbaa !14
%cmp.not.i.i146 = icmp ult ptr %29, %30
br i1 %cmp.not.i.i146, label %cond.false.i.i171, label %cond.true.i.i147, !prof !15
cond.true.i.i147: ; preds = %in.exit143
%call.i.i148 = tail call i32 @__uflow(ptr noundef nonnull %28) #11
%.pre14.pre.i149 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i153.preheader
cond.false.i.i171: ; preds = %in.exit143
%incdec.ptr.i.i172 = getelementptr inbounds i8, ptr %29, i64 1
store ptr %incdec.ptr.i.i172, ptr %_IO_read_ptr.i.i144, align 8, !tbaa !9
%31 = load i8, ptr %29, align 1, !tbaa !16
%conv3.i.i173 = zext i8 %31 to i32
br label %do.body.i153.preheader
do.body.i153.preheader: ; preds = %cond.false.i.i171, %cond.true.i.i147
%.ph = phi ptr [ %28, %cond.false.i.i171 ], [ %.pre14.pre.i149, %cond.true.i.i147 ]
%c.0.i155.ph = phi i32 [ %conv3.i.i173, %cond.false.i.i171 ], [ %call.i.i148, %cond.true.i.i147 ]
br label %do.body.i153
do.body.i153: ; preds = %do.body.i153.preheader, %getchar_unlocked.exit13.i165
%32 = phi ptr [ %36, %getchar_unlocked.exit13.i165 ], [ %.ph, %do.body.i153.preheader ]
%n.0.i154 = phi i32 [ %add.i158, %getchar_unlocked.exit13.i165 ], [ 0, %do.body.i153.preheader ]
%c.0.i155 = phi i32 [ %cond.i9.i166, %getchar_unlocked.exit13.i165 ], [ %c.0.i155.ph, %do.body.i153.preheader ]
%mul.i156 = mul nsw i32 %n.0.i154, 10
%and.i157 = and i32 %c.0.i155, 15
%add.i158 = add nsw i32 %and.i157, %mul.i156
%_IO_read_ptr.i4.i159 = getelementptr inbounds %struct._IO_FILE, ptr %32, i64 0, i32 1
%33 = load ptr, ptr %_IO_read_ptr.i4.i159, align 8, !tbaa !9
%_IO_read_end.i5.i160 = getelementptr inbounds %struct._IO_FILE, ptr %32, i64 0, i32 2
%34 = load ptr, ptr %_IO_read_end.i5.i160, align 8, !tbaa !14
%cmp.not.i6.i161 = icmp ult ptr %33, %34
br i1 %cmp.not.i6.i161, label %cond.false.i10.i168, label %cond.true.i7.i162, !prof !15
cond.true.i7.i162: ; preds = %do.body.i153
%call.i8.i163 = tail call i32 @__uflow(ptr noundef nonnull %32) #11
%.pre.i164 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i165
cond.false.i10.i168: ; preds = %do.body.i153
%incdec.ptr.i11.i169 = getelementptr inbounds i8, ptr %33, i64 1
store ptr %incdec.ptr.i11.i169, ptr %_IO_read_ptr.i4.i159, align 8, !tbaa !9
%35 = load i8, ptr %33, align 1, !tbaa !16
%conv3.i12.i170 = zext i8 %35 to i32
br label %getchar_unlocked.exit13.i165
getchar_unlocked.exit13.i165: ; preds = %cond.false.i10.i168, %cond.true.i7.i162
%36 = phi ptr [ %.pre.i164, %cond.true.i7.i162 ], [ %32, %cond.false.i10.i168 ]
%cond.i9.i166 = phi i32 [ %call.i8.i163, %cond.true.i7.i162 ], [ %conv3.i12.i170, %cond.false.i10.i168 ]
%cmp.i167 = icmp sgt i32 %cond.i9.i166, 47
br i1 %cmp.i167, label %do.body.i153, label %in.exit174, !llvm.loop !17
in.exit174: ; preds = %getchar_unlocked.exit13.i165
%add = add nsw i32 %add.i158, 1
%_IO_read_ptr.i.i175 = getelementptr inbounds %struct._IO_FILE, ptr %36, i64 0, i32 1
%37 = load ptr, ptr %_IO_read_ptr.i.i175, align 8, !tbaa !9
%_IO_read_end.i.i176 = getelementptr inbounds %struct._IO_FILE, ptr %36, i64 0, i32 2
%38 = load ptr, ptr %_IO_read_end.i.i176, align 8, !tbaa !14
%cmp.not.i.i177 = icmp ult ptr %37, %38
br i1 %cmp.not.i.i177, label %cond.false.i.i205, label %cond.true.i.i178, !prof !15
cond.true.i.i178: ; preds = %in.exit174
%call.i.i179 = tail call i32 @__uflow(ptr noundef nonnull %36) #11
%.pre271.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i180
cond.false.i.i205: ; preds = %in.exit174
%incdec.ptr.i.i206 = getelementptr inbounds i8, ptr %37, i64 1
store ptr %incdec.ptr.i.i206, ptr %_IO_read_ptr.i.i175, align 8, !tbaa !9
%39 = load i8, ptr %37, align 1, !tbaa !16
%conv3.i.i207 = zext i8 %39 to i32
br label %getchar_unlocked.exit.i180
getchar_unlocked.exit.i180: ; preds = %cond.false.i.i205, %cond.true.i.i178
%.pre271 = phi ptr [ %.pre271.pre, %cond.true.i.i178 ], [ %36, %cond.false.i.i205 ]
%cond.i.i181 = phi i32 [ %call.i.i179, %cond.true.i.i178 ], [ %conv3.i.i207, %cond.false.i.i205 ]
%conv.i182 = trunc i32 %cond.i.i181 to i8
store i8 %conv.i182, ptr @pat, align 16, !tbaa !16
br label %while.cond.i183
while.cond.i183: ; preds = %while.body.i198, %getchar_unlocked.exit.i180
%40 = phi ptr [ %.pre271, %getchar_unlocked.exit.i180 ], [ %44, %while.body.i198 ]
%s.pn.i184 = phi ptr [ @pat, %getchar_unlocked.exit.i180 ], [ %p.0.i186, %while.body.i198 ]
%x.0.i185 = phi i32 [ %cond.i.i181, %getchar_unlocked.exit.i180 ], [ %spec.store.select.i201, %while.body.i198 ]
%p.0.i186 = getelementptr inbounds i8, ptr %s.pn.i184, i64 1
%_IO_read_ptr.i16.i187 = getelementptr inbounds %struct._IO_FILE, ptr %40, i64 0, i32 1
%41 = load ptr, ptr %_IO_read_ptr.i16.i187, align 8, !tbaa !9
%_IO_read_end.i17.i188 = getelementptr inbounds %struct._IO_FILE, ptr %40, i64 0, i32 2
%42 = load ptr, ptr %_IO_read_end.i17.i188, align 8, !tbaa !14
%cmp.not.i18.i189 = icmp ult ptr %41, %42
br i1 %cmp.not.i18.i189, label %cond.false.i22.i202, label %cond.true.i19.i190, !prof !15
cond.true.i19.i190: ; preds = %while.cond.i183
%call.i20.i191 = tail call i32 @__uflow(ptr noundef nonnull %40) #11
%.pre270 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit25.i192
cond.false.i22.i202: ; preds = %while.cond.i183
%incdec.ptr.i23.i203 = getelementptr inbounds i8, ptr %41, i64 1
store ptr %incdec.ptr.i23.i203, ptr %_IO_read_ptr.i16.i187, align 8, !tbaa !9
%43 = load i8, ptr %41, align 1, !tbaa !16
%conv3.i24.i204 = zext i8 %43 to i32
br label %getchar_unlocked.exit25.i192
getchar_unlocked.exit25.i192: ; preds = %cond.false.i22.i202, %cond.true.i19.i190
%44 = phi ptr [ %.pre270, %cond.true.i19.i190 ], [ %40, %cond.false.i22.i202 ]
%cond.i21.i193 = phi i32 [ %call.i20.i191, %cond.true.i19.i190 ], [ %conv3.i24.i204, %cond.false.i22.i202 ]
%45 = trunc i32 %cond.i21.i193 to i8
%cmp.i194 = icmp sgt i8 %45, 32
br i1 %cmp.i194, label %while.body.i198, label %str.exit208
while.body.i198: ; preds = %getchar_unlocked.exit25.i192
%conv3.i199 = and i32 %cond.i21.i193, 255
store i8 %45, ptr %p.0.i186, align 1, !tbaa !16
%cmp7.not.i200 = icmp eq i32 %conv3.i199, %x.0.i185
%spec.store.select.i201 = select i1 %cmp7.not.i200, i32 %x.0.i185, i32 -1
br label %while.cond.i183, !llvm.loop !23
str.exit208: ; preds = %getchar_unlocked.exit25.i192
store i8 0, ptr %p.0.i186, align 1, !tbaa !16
%sub.ptr.lhs.cast.i195 = ptrtoint ptr %p.0.i186 to i64
%46 = trunc i64 %sub.ptr.lhs.cast.i195 to i32
%conv9.i197 = sub i32 %46, ptrtoint (ptr @pat to i32)
store i32 %conv9.i197, ptr @wp, align 4, !tbaa !24
%sub = sub nsw i32 %add, %add.i127
%cmp5 = icmp sgt i32 %conv9.i197, %sub
br i1 %cmp5, label %if.then6, label %if.end9
if.then6: ; preds = %str.exit208
%47 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %47, i64 0, i32 5
%48 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %47, i64 0, i32 6
%49 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %48, %49
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %if.then6
%call.i = tail call i32 @__overflow(ptr noundef nonnull %47, i32 noundef 48) #11
br label %putchar_unlocked.exit
cond.false.i: ; preds = %if.then6
%incdec.ptr.i = getelementptr inbounds i8, ptr %48, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19
store i8 48, ptr %48, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%50 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i209 = getelementptr inbounds %struct._IO_FILE, ptr %50, i64 0, i32 5
%51 = load ptr, ptr %_IO_write_ptr.i209, align 8, !tbaa !19
%_IO_write_end.i210 = getelementptr inbounds %struct._IO_FILE, ptr %50, i64 0, i32 6
%52 = load ptr, ptr %_IO_write_end.i210, align 8, !tbaa !20
%cmp.not.i211 = icmp ult ptr %51, %52
br i1 %cmp.not.i211, label %cond.false.i215, label %cond.true.i212, !prof !15
cond.true.i212: ; preds = %putchar_unlocked.exit
%call.i213 = tail call i32 @__overflow(ptr noundef nonnull %50, i32 noundef 10) #11
br label %while.cond.backedge
cond.false.i215: ; preds = %putchar_unlocked.exit
%incdec.ptr.i216 = getelementptr inbounds i8, ptr %51, i64 1
store ptr %incdec.ptr.i216, ptr %_IO_write_ptr.i209, align 8, !tbaa !19
store i8 10, ptr %51, align 1, !tbaa !16
br label %while.cond.backedge
while.cond.backedge: ; preds = %cond.false.i251, %cond.true.i248, %cond.false.i233, %cond.true.i230, %cond.false.i215, %cond.true.i212, %if.end33, %while.end77
%tobool.not = icmp eq i32 %dec266, 0
br i1 %tobool.not, label %while.end78, label %while.body, !llvm.loop !27
if.end9: ; preds = %str.exit208
%cmp11 = icmp eq i32 %conv9.i197, %sub
br i1 %cmp11, label %if.then12, label %if.end19
if.then12: ; preds = %if.end9
%idx.ext = sext i32 %add.i127 to i64
%add.ptr = getelementptr inbounds i8, ptr @text, i64 %idx.ext
%conv = sext i32 %conv9.i197 to i64
%bcmp99 = tail call i32 @bcmp(ptr nonnull %add.ptr, ptr nonnull @pat, i64 %conv)
%cmp14 = icmp eq i32 %bcmp99, 0
%add16 = select i1 %cmp14, i32 49, i32 48
%53 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i218 = getelementptr inbounds %struct._IO_FILE, ptr %53, i64 0, i32 5
%54 = load ptr, ptr %_IO_write_ptr.i218, align 8, !tbaa !19
%_IO_write_end.i219 = getelementptr inbounds %struct._IO_FILE, ptr %53, i64 0, i32 6
%55 = load ptr, ptr %_IO_write_end.i219, align 8, !tbaa !20
%cmp.not.i220 = icmp ult ptr %54, %55
br i1 %cmp.not.i220, label %cond.false.i224, label %cond.true.i221, !prof !15
cond.true.i221: ; preds = %if.then12
%call.i222 = tail call i32 @__overflow(ptr noundef nonnull %53, i32 noundef %add16) #11
br label %putchar_unlocked.exit226
cond.false.i224: ; preds = %if.then12
%conv4.i = trunc i32 %add16 to i8
%incdec.ptr.i225 = getelementptr inbounds i8, ptr %54, i64 1
store ptr %incdec.ptr.i225, ptr %_IO_write_ptr.i218, align 8, !tbaa !19
store i8 %conv4.i, ptr %54, align 1, !tbaa !16
br label %putchar_unlocked.exit226
putchar_unlocked.exit226: ; preds = %cond.true.i221, %cond.false.i224
%56 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i227 = getelementptr inbounds %struct._IO_FILE, ptr %56, i64 0, i32 5
%57 = load ptr, ptr %_IO_write_ptr.i227, align 8, !tbaa !19
%_IO_write_end.i228 = getelementptr inbounds %struct._IO_FILE, ptr %56, i64 0, i32 6
%58 = load ptr, ptr %_IO_write_end.i228, align 8, !tbaa !20
%cmp.not.i229 = icmp ult ptr %57, %58
br i1 %cmp.not.i229, label %cond.false.i233, label %cond.true.i230, !prof !15
cond.true.i230: ; preds = %putchar_unlocked.exit226
%call.i231 = tail call i32 @__overflow(ptr noundef nonnull %56, i32 noundef 10) #11
br label %while.cond.backedge
cond.false.i233: ; preds = %putchar_unlocked.exit226
%incdec.ptr.i234 = getelementptr inbounds i8, ptr %57, i64 1
store ptr %incdec.ptr.i234, ptr %_IO_write_ptr.i227, align 8, !tbaa !19
store i8 10, ptr %57, align 1, !tbaa !16
br label %while.cond.backedge
if.end19: ; preds = %if.end9
br i1 %cmp20, label %if.then22, label %if.end37
if.then22: ; preds = %if.end19
%cmp23 = icmp slt i32 %x.0.i185, 0
%cmp25.not = icmp ne i32 %x.0.i185, %x.0.i
%or.cond.not255 = or i1 %cmp23, %cmp25.not
%59 = load i32, ptr @len, align 4
%cmp28 = icmp sgt i32 %conv9.i197, %59
%or.cond100 = select i1 %or.cond.not255, i1 true, i1 %cmp28
br i1 %or.cond100, label %if.then30, label %if.end33
if.then30: ; preds = %if.then22
%60 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i236 = getelementptr inbounds %struct._IO_FILE, ptr %60, i64 0, i32 5
%61 = load ptr, ptr %_IO_write_ptr.i236, align 8, !tbaa !19
%_IO_write_end.i237 = getelementptr inbounds %struct._IO_FILE, ptr %60, i64 0, i32 6
%62 = load ptr, ptr %_IO_write_end.i237, align 8, !tbaa !20
%cmp.not.i238 = icmp ult ptr %61, %62
br i1 %cmp.not.i238, label %cond.false.i242, label %cond.true.i239, !prof !15
cond.true.i239: ; preds = %if.then30
%call.i240 = tail call i32 @__overflow(ptr noundef nonnull %60, i32 noundef 48) #11
br label %putchar_unlocked.exit244
cond.false.i242: ; preds = %if.then30
%incdec.ptr.i243 = getelementptr inbounds i8, ptr %61, i64 1
store ptr %incdec.ptr.i243, ptr %_IO_write_ptr.i236, align 8, !tbaa !19
store i8 48, ptr %61, align 1, !tbaa !16
br label %putchar_unlocked.exit244
putchar_unlocked.exit244: ; preds = %cond.true.i239, %cond.false.i242
%63 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i245 = getelementptr inbounds %struct._IO_FILE, ptr %63, i64 0, i32 5
%64 = load ptr, ptr %_IO_write_ptr.i245, align 8, !tbaa !19
%_IO_write_end.i246 = getelementptr inbounds %struct._IO_FILE, ptr %63, i64 0, i32 6
%65 = load ptr, ptr %_IO_write_end.i246, align 8, !tbaa !20
%cmp.not.i247 = icmp ult ptr %64, %65
br i1 %cmp.not.i247, label %cond.false.i251, label %cond.true.i248, !prof !15
cond.true.i248: ; preds = %putchar_unlocked.exit244
%call.i249 = tail call i32 @__overflow(ptr noundef nonnull %63, i32 noundef 10) #11
br label %while.cond.backedge
cond.false.i251: ; preds = %putchar_unlocked.exit244
%incdec.ptr.i252 = getelementptr inbounds i8, ptr %64, i64 1
store ptr %incdec.ptr.i252, ptr %_IO_write_ptr.i245, align 8, !tbaa !19
store i8 10, ptr %64, align 1, !tbaa !16
br label %while.cond.backedge
if.end33: ; preds = %if.then22
%add35 = add nsw i32 %sub, 1
%sub36 = sub i32 %add35, %conv9.i197
tail call void @out(i32 noundef %sub36)
br label %while.cond.backedge
if.end37: ; preds = %if.end19
%66 = load i32, ptr @len, align 4, !tbaa !24
%cmp39256 = icmp sgt i32 %66, 0
br i1 %cmp39256, label %while.body41.lr.ph, label %while.end
while.body41.lr.ph: ; preds = %if.end37
%conv45 = sext i32 %conv9.i197 to i64
br label %while.body41
while.body41: ; preds = %while.body41.lr.ph, %while.body41
%hi.0258 = phi i32 [ %66, %while.body41.lr.ph ], [ %hi.1, %while.body41 ]
%lo.0257 = phi i32 [ 0, %while.body41.lr.ph ], [ %lo.1, %while.body41 ]
%add42 = add nsw i32 %hi.0258, %lo.0257
%shr = ashr i32 %add42, 1
%idxprom = sext i32 %shr to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @sa, i64 0, i64 %idxprom
%67 = load i32, ptr %arrayidx, align 4, !tbaa !24
%idx.ext43 = sext i32 %67 to i64
%add.ptr44 = getelementptr inbounds i8, ptr @text, i64 %idx.ext43
%call46 = tail call i32 @memcmp(ptr noundef nonnull %add.ptr44, ptr noundef nonnull @pat, i64 noundef %conv45) #12
%cmp47 = icmp slt i32 %call46, 0
%add50 = add nsw i32 %shr, 1
%lo.1 = select i1 %cmp47, i32 %add50, i32 %lo.0257
%hi.1 = select i1 %cmp47, i32 %hi.0258, i32 %shr
%cmp39 = icmp slt i32 %lo.1, %hi.1
br i1 %cmp39, label %while.body41, label %while.end, !llvm.loop !28
while.end: ; preds = %while.body41, %if.end37
%lo.0.lcssa = phi i32 [ 0, %if.end37 ], [ %lo.1, %while.body41 ]
%sub52 = sub nsw i32 %add, %conv9.i197
%cmp54.not259 = icmp sgt i32 %lo.0.lcssa, %66
br i1 %cmp54.not259, label %while.end77, label %while.body56.lr.ph
while.body56.lr.ph: ; preds = %while.end
%conv61 = sext i32 %conv9.i197 to i64
%68 = sext i32 %lo.0.lcssa to i64
%69 = add i32 %66, 1
br label %while.body56
while.body56: ; preds = %while.body56.lr.ph, %if.end65
%indvars.iv = phi i64 [ %68, %while.body56.lr.ph ], [ %indvars.iv.next, %if.end65 ]
%ans.0261 = phi i32 [ 0, %while.body56.lr.ph ], [ %ans.1, %if.end65 ]
%arrayidx58 = getelementptr inbounds [100005 x i32], ptr @sa, i64 0, i64 %indvars.iv
%70 = load i32, ptr %arrayidx58, align 4, !tbaa !24
%idx.ext59 = sext i32 %70 to i64
%add.ptr60 = getelementptr inbounds i8, ptr @text, i64 %idx.ext59
%bcmp = tail call i32 @bcmp(ptr nonnull %add.ptr60, ptr nonnull @pat, i64 %conv61)
%tobool63.not = icmp eq i32 %bcmp, 0
br i1 %tobool63.not, label %if.end65, label %while.end77
if.end65: ; preds = %while.body56
%cmp68.not = icmp sle i32 %add.i127, %70
%cmp72.not = icmp sle i32 %70, %sub52
%or.cond101.not = select i1 %cmp68.not, i1 %cmp72.not, i1 false
%inc = zext i1 %or.cond101.not to i32
%ans.1 = add nuw nsw i32 %ans.0261, %inc
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %69, %lftr.wideiv
br i1 %exitcond.not, label %while.end77, label %while.body56, !llvm.loop !29
while.end77: ; preds = %if.end65, %while.body56, %while.end
%ans.0.lcssa = phi i32 [ 0, %while.end ], [ %ans.0261, %while.body56 ], [ %ans.1, %if.end65 ]
tail call void @out(i32 noundef %ans.0.lcssa)
br label %while.cond.backedge
while.end78: ; preds = %while.cond.backedge, %while.cond.preheader
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @memcmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #7
declare i32 @__uflow(ptr noundef) local_unnamed_addr #8
declare i32 @__overflow(ptr noundef, i32 noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #9
; 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) #10
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync 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 #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind willreturn memory(argmem: read) }
attributes #10 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #11 = { nounwind }
attributes #12 = { 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 = !{!"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 = !{!10, !6, i64 40}
!20 = !{!10, !6, i64 48}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}
!24 = !{!11, !11, i64 0}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18}
!27 = distinct !{!27, !18}
!28 = distinct !{!28, !18}
!29 = distinct !{!29, !18}
|
#include <stdio.h>
int table[8] = {0, 1, 2, 3, 5, 7, 8, 9};
int main(void) {
int id;
int b[20];
int i,n;
while(scanf("%d\n", &id) == 1) {
if(!id) break;
n = 0;
while(id > 0) {
b[n] = id % 8;
id = id / 8;
n++;
}
if((id % 8) != 0) {
b[n] = id;
n++;
}
for(i=n-1;i>=0;i--) {
printf("%d", table[b[i]]);
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147157/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147157/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@table = dso_local local_unnamed_addr global [8 x i32] [i32 0, i32 1, i32 2, i32 3, i32 5, i32 7, i32 8, i32 9], align 16
@.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:
%id = alloca i32, align 4
%b = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #4
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %b) #4
%call32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%cmp33 = icmp eq i32 %call32, 1
%0 = load i32, ptr %id, align 4
%tobool34 = icmp ne i32 %0, 0
%or.cond35 = select i1 %cmp33, i1 %tobool34, i1 false
br i1 %or.cond35, label %while.cond1.preheader, label %while.end18
while.cond1.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %8, %for.end ], [ %0, %entry ]
%cmp227 = icmp sgt i32 %1, 0
br i1 %cmp227, label %while.body3, label %while.end
while.body3: ; preds = %while.cond1.preheader, %while.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body3 ], [ 0, %while.cond1.preheader ]
%2 = phi i32 [ %div2526, %while.body3 ], [ %1, %while.cond1.preheader ]
%rem = and i32 %2, 7
%arrayidx = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv
store i32 %rem, ptr %arrayidx, align 4, !tbaa !5
%div2526 = lshr i32 %2, 3
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp2.not = icmp ult i32 %2, 8
br i1 %cmp2.not, label %while.cond1.while.end_crit_edge, label %while.body3, !llvm.loop !9
while.cond1.while.end_crit_edge: ; preds = %while.body3
%3 = trunc i64 %indvars.iv.next to i32
store i32 %div2526, ptr %id, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond1.while.end_crit_edge, %while.cond1.preheader
%.lcssa = phi i32 [ %div2526, %while.cond1.while.end_crit_edge ], [ %1, %while.cond1.preheader ]
%n.0.lcssa = phi i32 [ %3, %while.cond1.while.end_crit_edge ], [ 0, %while.cond1.preheader ]
%4 = and i32 %.lcssa, 7
%cmp5.not = icmp eq i32 %4, 0
br i1 %cmp5.not, label %if.end10, label %if.then6
if.then6: ; preds = %while.end
%idxprom7 = zext i32 %n.0.lcssa to i64
%arrayidx8 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %idxprom7
store i32 %.lcssa, ptr %arrayidx8, align 4, !tbaa !5
%inc9 = add nuw nsw i32 %n.0.lcssa, 1
br label %if.end10
if.end10: ; preds = %if.then6, %while.end
%n.1 = phi i32 [ %inc9, %if.then6 ], [ %n.0.lcssa, %while.end ]
%cmp1130 = icmp sgt i32 %n.1, 0
br i1 %cmp1130, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %if.end10
%5 = zext i32 %n.1 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv37 = phi i64 [ %5, %for.body.preheader ], [ %indvars.iv.next38, %for.body ]
%indvars.iv.next38 = add nsw i64 %indvars.iv37, -1
%arrayidx13 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv.next38
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%idxprom14 = sext i32 %6 to i64
%arrayidx15 = getelementptr inbounds [8 x i32], ptr @table, i64 0, i64 %idxprom14
%7 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%cmp11 = icmp ugt i64 %indvars.iv37, 1
br i1 %cmp11, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %if.end10
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %id)
%cmp = icmp eq i32 %call, 1
%8 = load i32, ptr %id, align 4
%tobool = icmp ne i32 %8, 0
%or.cond = select i1 %cmp, i1 %tobool, i1 false
br i1 %or.cond, label %while.cond1.preheader, label %while.end18, !llvm.loop !12
while.end18: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<string.h>
int main(){
char s[100001];
scanf("%s",s);
int len=strlen(s),i,count=0;
for(i=1;i<len;i++)
if(s[i]!=s[i-1])
count++;
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147207/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%cmp16 = icmp sgt i32 %conv, 1
br i1 %cmp16, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%.pre = load i8, ptr %s, align 16, !tbaa !5
%0 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i64 %0, 8
br i1 %min.iters.check, label %for.body.preheader23, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -8
%ind.end = or i64 %n.vec, 1
%vector.recur.init = insertelement <4 x i8> poison, i8 %.pre, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i8> [ %vector.recur.init, %vector.ph ], [ %wide.load22, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi21 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %1, align 1, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load22 = load <4 x i8>, ptr %2, align 1, !tbaa !5
%3 = shufflevector <4 x i8> %vector.recur, <4 x i8> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%4 = shufflevector <4 x i8> %wide.load, <4 x i8> %wide.load22, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%5 = icmp ne <4 x i8> %wide.load, %3
%6 = icmp ne <4 x i8> %wide.load22, %4
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = add <4 x i32> %vec.phi, %7
%10 = add <4 x i32> %vec.phi21, %8
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <4 x i8> %wide.load22, i64 3
br i1 %cmp.n, label %for.end, label %for.body.preheader23
for.body.preheader23: ; preds = %for.body.preheader, %middle.block
%scalar.recur.ph = phi i8 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body.preheader ]
%indvars.iv.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.preheader ]
%count.018.ph = phi i32 [ %12, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
for.body: ; preds = %for.body.preheader23, %for.body
%scalar.recur = phi i8 [ %13, %for.body ], [ %scalar.recur.ph, %for.body.preheader23 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader23 ]
%count.018 = phi i32 [ %spec.select, %for.body ], [ %count.018.ph, %for.body.preheader23 ]
%arrayidx = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv
%13 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp8.not = icmp ne i8 %13, %scalar.recur
%inc = zext i1 %cmp8.not to i32
%spec.select = add nuw nsw i32 %count.018, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include <stdio.h>
#include <string.h>
char S[100005];
int main(){
scanf("%s",S);
int len=strlen(S);
int i;
int ans=0;
char prev=S[0];
for(i=1;i<len;i++){
if(prev!=S[i]){ans++;}
prev=S[i];
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@S = dso_local global [100005 x i8] 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 @S)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @S) #4
%conv = trunc i64 %call1 to i32
%cmp15 = icmp sgt i32 %conv, 1
br i1 %cmp15, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call1, 4294967295
%prev.0.pre = load i8, ptr @S, align 16, !tbaa !5
%0 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i64 %0, 8
br i1 %min.iters.check, label %for.body.preheader23, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -8
%ind.end = or i64 %n.vec, 1
%vector.recur.init = insertelement <4 x i8> poison, i8 %prev.0.pre, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i8> [ %vector.recur.init, %vector.ph ], [ %wide.load22, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi21 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100005 x i8], ptr @S, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %1, align 1, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load22 = load <4 x i8>, ptr %2, align 1, !tbaa !5
%3 = shufflevector <4 x i8> %vector.recur, <4 x i8> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%4 = shufflevector <4 x i8> %wide.load, <4 x i8> %wide.load22, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%5 = icmp ne <4 x i8> %3, %wide.load
%6 = icmp ne <4 x i8> %4, %wide.load22
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = add <4 x i32> %vec.phi, %7
%10 = add <4 x i32> %vec.phi21, %8
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %10, %9
%12 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <4 x i8> %wide.load22, i64 3
br i1 %cmp.n, label %for.end, label %for.body.preheader23
for.body.preheader23: ; preds = %for.body.preheader, %middle.block
%scalar.recur.ph = phi i8 [ %vector.recur.extract, %middle.block ], [ %prev.0.pre, %for.body.preheader ]
%indvars.iv.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.preheader ]
%ans.017.ph = phi i32 [ %12, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
for.body: ; preds = %for.body.preheader23, %for.body
%scalar.recur = phi i8 [ %13, %for.body ], [ %scalar.recur.ph, %for.body.preheader23 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader23 ]
%ans.017 = phi i32 [ %spec.select, %for.body ], [ %ans.017.ph, %for.body.preheader23 ]
%arrayidx = getelementptr inbounds [100005 x i8], ptr @S, i64 0, i64 %indvars.iv
%13 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp5.not = icmp ne i8 %scalar.recur, %13
%inc = zext i1 %cmp5.not to i32
%spec.select = add nuw nsw i32 %ans.017, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
%call10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; 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.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 = { nofree nounwind "no-trapping-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 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(void) {
#ifdef DEBUG
printf("");
#endif
char c, cTmp;
int cnt = 0;
scanf("%c", &c);
while (1) {
scanf("%c", &cTmp);
#ifdef DEBUG
printf("c=%c, cTmp=%c", c, cTmp);
#endif
if (cTmp != 'B' && cTmp != 'W') {
break;
}
if (c != cTmp) {
cnt++;
}
c = cTmp;
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147294/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147294/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%c\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:
%c = alloca i8, align 1
%cTmp = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %cTmp) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
br label %while.cond
while.cond: ; preds = %if.end, %entry
%cnt.0 = phi i32 [ 0, %entry ], [ %spec.select, %if.end ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cTmp)
%0 = load i8, ptr %cTmp, align 1
switch i8 %0, label %while.end [
i8 87, label %if.end
i8 66, label %if.end
]
if.end: ; preds = %while.cond, %while.cond
%1 = load i8, ptr %c, align 1, !tbaa !5
%cmp8.not = icmp ne i8 %1, %0
%inc = zext i1 %cmp8.not to i32
%spec.select = add nuw nsw i32 %cnt.0, %inc
store i8 %0, ptr %c, align 1, !tbaa !5
br label %while.cond
while.end: ; preds = %while.cond
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %cTmp) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#pragma region kyopuro_templates
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
#include<time.h>
#include<ctype.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<62)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 20)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
#define PI 3.141592653589793238
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
void cin(ll *n){ scanf("%lld",&(*n)); }
void PriAll1(ll a[], ll n){ rep(i,0,n){ printf("%lld",a[i]); if(i!=n-1) printf(" "); }PN; }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
double POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}
ll base(ll n, ll a, ll i){return i==1?n%a:base(n/a,a,i-1);}
ll is_inArr1(ll x, ll n){ return ( x<0 || x>=n ) ? 0 : 1 ; }
ll is_inArr2(ll y, ll x, ll h, ll w){ return ( y<0 || y>=h || x<0 || x>=w ) ? 0 : 1 ; }
void lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
void lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
int cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }
int cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a<b ? 1 : 0 ) ; }
// return smallest p which meets a[p]==val :1 >=:2 >:3
ll lower_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type); return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1; }
// return biggest p which meets a[p]==val :1 <=:2 <:3
ll upper_bound( ll a[], int l, int r, ll val , int type ){ while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }
// count i which meets ai==x
ll count(ll a[], int l, int r, ll x){ int p = lower_bound(a,l,r,x,1); return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }
ll *factors[2] , fac_cnt=0 , is_factor_prepared=0;
ll factor_pre(){ rep(i,0,1){ if(is_factor_prepared++) return 0; } ll tmp=(1e6)/2+1, fac_tmp[tmp]; rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;} rep(i,1,tmp){if(fac_tmp[i]){ repp(j,3,tmp/(2*i+1)+1,2 ){ if( j*(2*i+1)<tmp ) fac_tmp[ (j*(2*i+1)-1)/2 ]=0; } }else continue;} rep(i,0,tmp){if(fac_tmp[i]){ rep(j,0,2){ factors[j] = realloc( factors[j] , sizeof(ll)*( fac_cnt +1 ) ); factors[j][j?fac_cnt++:fac_cnt]=j?0:fac_tmp[i]; } } } return 0; }
ll factor(ll n, ll new_common_plus){ factor_pre(); rep(i,0,fac_cnt){ ll cnt=0; rep(j,0,1){ while( ( cnt+= n %factors[0][i]==0 ? 1 : 0 ) && (n/=factors[0][i]) %factors[0][i]==0 ) continue; } factors[1][i]= new_common_plus==1 ? cnt : new_common_plus==2 ? max2(factors[1][i],cnt) : factors[1][i]+cnt ; if( factors[0][i]> n ) break; } return n; }
ll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n<factors[0][i]*factors[0][i] || n==factors[0][i]) break; else if(n%factors[0][i]==0) n/=n; } return n==1?0:1; }
ll *mf_arr,*inv_arr,*finv_arr,is_minv_made=0,is_mf_made=0,num_of_inv=2*1e6+10;
ll makeinv(ll n , ll mod){ rep(i,0,1){if(is_minv_made++) return 0;} inv_arr = realloc(inv_arr, sizeof(ll)*2 ); finv_arr = realloc(finv_arr, sizeof(ll)*2 ); inv_arr[1]=1;finv_arr[0]=finv_arr[1]=1; rep(i,2,n+1){ inv_arr = realloc(inv_arr, sizeof(ll)*(i+1) ); finv_arr = realloc(finv_arr, sizeof(ll)*(i+1) ); inv_arr[i]= mod - inv_arr[mod%i] * (mod / i) % mod; finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % mod; } return 0; }
ll make_mf(ll n, ll mod){ rep(i,0,1){ if(is_mf_made++) return 0; } mf_arr = realloc(mf_arr, sizeof(ll)*2 ); ll x=1; mf_arr[0]=mf_arr[1]=x; rep(i,2,n+1){ x=x*i%mod; mf_arr = realloc(mf_arr, sizeof(ll)*(i+1) ); mf_arr[i]=x; } return 0; }
ll m_inv(ll x, ll mod, ll is_fac ){ makeinv(num_of_inv,mod); return is_fac?finv_arr[x]:inv_arr[x]; }
ll m_f(ll x, ll mod){ make_mf(num_of_inv,mod); return mf_arr[x]; }
ll mod_nck(ll n, ll k, ll mod){ return m_f(n,mod)*m_inv(k,mod,1)%mod*m_inv(n-k,mod,1)%mod; }
ll m_p(ll r,ll n,ll mod){ ll t=1,s=r; while(n>0){ t = (n&1) ? t*s%mod : t; s=s*s%mod; n>>=1; } return r?t:0; }
ll m_mul2(ll a, ll b, ll mod){ return a*b%mod; }
ll m_mul3(ll a, ll b, ll c, ll mod){ return m_mul2(a*b%mod,c,mod); }
ll m_mul4(ll a, ll b, ll c, ll d, ll mod){ return m_mul3(a*b%mod,c,d,mod); }
ll m_mul5(ll a, ll b, ll c, ll d, ll e, ll mod){ return m_mul4(a*b%mod,c,d,e,mod); }
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
int cmp_string( const void * a , const void * b ) { return strcmp( (char *)a , (char *)b ); } // qsort((void*)s,n,sizeof(s[0]),int_sort );
int cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }
void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }
ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }
ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }
ll compare(ll a, ll b){ return a<b?-1:a>b?1:0; }
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ){
ll pa=((fr*)p)->a; ll qa=((fr*)q)->a; return compare(pa,qa);
}
int cmp2( const void *p, const void *q ){
ll pa=((fr*)p)->a; ll qa=((fr*)q)->a; return compare(qa,pa);
}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
void sort_partial(ll a[],int begin,int end,int is_increase){
ll *b; b = (ll *) malloc( sizeof(ll)*(end-begin) );
rep(i,begin,end) b[i-begin]=a[i];
if(is_increase) sortup(b,end-begin); else sortdown(b,end-begin);
rep(i,begin,end) a[i]=b[i-begin];
}
// ll pre_rui[1511][1511];
// void ruiseki(ll h, ll w){
// rep(i,0,h){
// rep(j,0,w){
// rui[i+1][j+1]=rui[i+1][j]+pre_rui[i][j];
// }
// rep(j,0,w){
// rui[i+1][j+1]+=rui[i][j+1];
// }
// }
// }
#pragma region AVL
/*---------------------------AVL start--------------------------------*/
//https://qiita.com/mikecat_mixc/items/e9f8248de2ae7f7a0a29
typedef struct node_AVL_set{
ll val;
int diff;
int cnt;
struct node_AVL_set *child[2];
}AVL_set;
void AVL_set_inside_rotate(AVL_set **node, int is_right){
int l = is_right==false , r = is_right==true , sign = is_right ? 1 : -1;
if((*node)->child[l] != NULL){
AVL_set* left = (*node)->child[l];
int a= (*node)->diff * sign , b= left->diff * sign ,na,nb;
if(b+1){
na=a-1-b;
nb= (a-b) ? b-1 : a-2;
}else{
na=a-1;
nb= a ? b-1 : a+b-2;
}
(*node)->diff = na * sign;
left->diff = nb * sign;
/* rotate-> */
(*node)->child[l] = (*node)->child[l]->child[r];
left->child[r] = *node;
*node = left;
}
}
int AVL_set_inside_update(AVL_set **node, ll data, int add){
if(*node == NULL){
if(add==2){
*node = malloc(sizeof(AVL_set));
(*node)->val = data;
(*node)->cnt = 1;
(*node)->diff = 0;
(*node)->child[0] = NULL;
(*node)->child[1] = NULL;
}
return add==2 ? *node != NULL : 0;
}else{
int l, delta, delta_sign; AVL_set *next_node;
if(data == (*node)->val){
if(add==2){
(*node)->cnt++;
return 0;
}else{
if( add && (*node)->cnt > 1 ){
(*node)->cnt--; return 0;
}else{
if((*node)->child[1] == NULL){
next_node = (*node)->child[0];
free(*node);
*node = next_node;
return -1;
}else if((*node)->child[0] == NULL){
next_node = (*node)->child[1];
free(*node);
*node = next_node;
return -1;
}else{
for(next_node = (*node)->child[0];
next_node->child[1] != NULL;
next_node = next_node->child[1]);
(*node)->val = next_node->val;
l=0;
delta_sign=1;
delta = AVL_set_inside_update(&(*node)->child[l], next_node->val, add);
}
}
}
}else{
l = data >= (*node)->val ? 1 : 0;
delta_sign = data < (*node)->val ? 1 : -1;
delta = AVL_set_inside_update(&(*node)->child[l], data, add);
}
if( delta ){
int orig_diff = (*node)->diff;
int do_rotate = 0, rotate_l , diff_sign , rotate_right;
(*node)->diff += delta * delta_sign;
if((*node)->diff > 1){
do_rotate = 1;
rotate_l = 0;
diff_sign = 1;
rotate_right = 1;
}else if((*node)->diff < -1){
do_rotate = 1;
rotate_l = 1;
diff_sign = -1;
rotate_right = 0;
}
if(do_rotate){
int child_diff = (*node)->child[rotate_l]->diff;
if((*node)->child[rotate_l]->diff * diff_sign < 0){
AVL_set_inside_rotate(&(*node)->child[rotate_l], !rotate_right);
}
AVL_set_inside_rotate(node, rotate_right);
return delta < 0 && child_diff != 0 ? -1 : 0;
}
if (delta > 0 && orig_diff == 0) return 1;
else if(delta < 0 && orig_diff != 0) return -1;
else return 0;
}else{
return 0;
}
}
}
void AVL_set_inside_print(const AVL_set *node, int depth){
if(node == NULL) return;
AVL_set_inside_print(node->child[1], depth + 1);
printf("%lld %d\n", node->val,node->cnt);
AVL_set_inside_print(node->child[0], depth + 1);
}
void AVL_set_inside_free(AVL_set *node){
if(node == NULL) return;
AVL_set_inside_free(node->child[0]);
AVL_set_inside_free(node->child[1]);
free(node);
}
ll AVL_set_inside_count(AVL_set *root, ll val){
AVL_set *node; node = root;
while(node){
if (val < node->val) node = node->child[0];
else if(val > node->val) node = node->child[1];
else return node->cnt;
}
return 0;
}
int AVL_set_lowcomp(ll node, ll val, int type){
if(node==val){
if(type!=3) return 0;
else return 1;
}
if(node<val) return 1;
if(node>val) return -1;
return 0;
}
// return smallest p which meets a[p]==val :1 >=:2 >:3
AVL_set* AVL_set_inside_lowerbound(AVL_set *root, ll val, int type){
AVL_set *node; node = root;
while(node){
int com=AVL_set_lowcomp(node->val,val,type);
if(com==0) return node;
if(com==1) node = node->child[1];
if(com==-1){
AVL_set *small;
small=AVL_set_inside_lowerbound(node->child[0],val,type);
if(type==1){
return small;
}else{
if(small!=NULL) return small;
else return node;
}
}
}
return node;
}
int AVL_set_upcomp(ll node, ll val, int type){
if(node==val){
if(type!=3) return 0;
else return -1;
}
if(node<val) return 1;
if(node>val) return -1;
return 0;
}
// return biggest p which meets a[p]==val :1 <=:2 <:3
AVL_set* AVL_set_inside_upperbound(AVL_set *root, ll val, int type){
AVL_set *node; node = root;
while(node){
int com=AVL_set_upcomp(node->val,val,type);
if(com==0) return node;
if(com==-1) node = node->child[0];
if(com==1){
AVL_set *big;
big=AVL_set_inside_upperbound(node->child[1],val,type);
if(type==1){
return big;
}else{
if(big!=NULL) return big;
else return node;
}
}
}
return node;
}
ll AVL_set_inside_minmax(AVL_set *root, int type){
while(root->child[type] !=NULL) root= root->child[type];
return root->val;
}
void AVL_set_inside_swap(AVL_set **node1, AVL_set **node2){
AVL_set *tmp; tmp=*node1; *node1=*node2; *node2=tmp;
}
#define set_MAX_SIZE 514511
ll set_main( int command , int set_num , ll val ,ll option){
static bool set_is_init=false;
static AVL_set *set_pointer[set_MAX_SIZE];
static ll set_siz[set_MAX_SIZE];
if(!set_is_init){ set_is_init=true; rep(i,0,set_MAX_SIZE){ *(set_pointer+i) = NULL; set_siz[i]=0; } }
if(command==-1){ AVL_set_inside_print( set_pointer[set_num] ,0); }
if(command==1){ AVL_set_inside_count(set_pointer[set_num],val) ? 1 : set_siz[set_num]++; AVL_set_inside_update( &set_pointer[set_num] , val , 2 ); }
if(command==2){ return AVL_set_inside_count(set_pointer[set_num],val); }
if(command==3){ ( AVL_set_inside_count(set_pointer[set_num],val) > 1 ) ? 1 : set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val,1); }
if(command==4){ set_siz[set_num]--; AVL_set_inside_update( &set_pointer[set_num] , val , 0 ); }
if(command==5){ set_siz[set_num]=0; AVL_set_inside_free( set_pointer[set_num] ); set_pointer[set_num] = NULL; }
if(command==6){ return set_siz[set_num]; }
if(command==7){ return AVL_set_inside_minmax(set_pointer[set_num],1); }
if(command==8){ return AVL_set_inside_minmax(set_pointer[set_num],0); }
if(command==9){ AVL_set_inside_swap(&set_pointer[set_num],&set_pointer[val]); }
if(10<=command&&command<=12){
AVL_set *lowbound = AVL_set_inside_lowerbound(set_pointer[set_num],val,command-9);
if(lowbound==NULL) return option;
else return lowbound->val;
}
if(13<=command&&command<=15){
AVL_set *upbound = AVL_set_inside_upperbound(set_pointer[set_num],val,command-12);
if(upbound==NULL) return option;
else return upbound->val;
}
return 0;
}
void set_print(int set_num){ set_main(-1,set_num,0,0); }
void set_insert(int set_num, ll val){ set_main(1,set_num,val,0); }
ll set_count(int set_num, ll val){ return set_main(2,set_num,val,0); }
void set_erase(int set_num, ll val, int is_all){ if(is_all) set_main(4,set_num,val,0); else set_main(3,set_num,val,0); }
void set_clear(int set_num){ set_main(5,set_num,0,0); }
ll set_size(int set_num){ return set_main(6,set_num,0,0); }
ll set_max(int set_num){ return set_main(7,set_num,0,0); }
ll set_min(int set_num){ return set_main(8,set_num,0,0); }
void set_swap(int set_num1, int set_num2){ set_main(9,set_num1,set_num2,0); }
// return smallest p which meets a[p]==val :1 >=:2 >:3
ll set_lowerbound(int set_num, ll val, int type, ll error){
return set_main(9+type,set_num,val,error);
}
// return biggest p which meets a[p]==val :1 <=:2 <:3
ll set_upperbound(int set_num, ll val, int type, ll error){
return set_main(12+type,set_num,val,error);
}
/*
insert *
size *
clear *
erase *
count *
max *
min *
swap *
begin x
end x
merge source の要素のキーと等価なキーの要素がある場合、その要素は source から抽出されない
lower_bound *
upper_bound *
*/
// ll map_main()
/*---------------------------AVL start--------------------------------*/
#pragma endregion AVL
#pragma endregion kyopuro_templates
#pragma region seg_tree
ll seg_e_max(){ return -INF; }
ll seg_e_min(){ return INF; }
ll seg_e_sum(){ return 0; }
ll seg_e_gcd(){ return 0; }
ll seg_op_max(ll a, ll b){ return max2(a,b); }
ll seg_op_min(ll a, ll b){ return min2(a,b); }
ll seg_op_sum(ll a, ll b){ return a+b; }
ll seg_op_gcd(ll a, ll b){ return gcd(a,b); }
typedef struct seg_tree seg;
typedef struct seg_tree {
int _n;
ll *node;
ll (*op)(ll, ll);
ll (*e)(void);
ll (*get)(seg*, int);
ll (*prod)(seg*, int, int);
void (*update)(seg*, int, ll);
} seg;
ll seg_get(seg *S, int x) {
return S->node[S->_n / 2 + x];
}
ll seg_prod_inner(seg *S, int l, int r, int x, int from, int to) {
if (l <= from && to <= r ) return S->node[x];
if (r < from || to < l ) return S->e();
return S->op(
seg_prod_inner(S, l, r, 2 * x + 1, from, (from + to) / 2),
seg_prod_inner(S, l, r, 2 * x + 2, (from + to) / 2 + 1, to)
);
}
ll seg_prod(seg *S, int l, int r) {
return seg_prod_inner(S, l, r, 0, 0, S->_n / 2);
}
void seg_update(seg *S, int x, ll val) {
ll c = S->_n / 2 + x;
S->node[c] = val;
while (c > 0) {
c--; c /= 2;
S->node[c] = S->op(S->node[2 * (c + 1)], S->node[2 * (c + 1) - 1]);
}
}
seg *seg_init(int n, ll a[], ll (*op)(ll,ll), ll(*e)()) {
seg *ret = malloc(sizeof(seg));
int x = 1;
ret->_n = 0;
while (x < n) {
ret->_n += x;
x *= 2;
}
ret->_n += x;
ret->node = (ll *)malloc(ret->_n * sizeof(ll));
ret->op = op;
ret->e = e;
ret->get = seg_get;
ret->prod = seg_prod;
ret->update = seg_update;
rep (i,0,x) {
if (i < n) ret->node[x- 1 + i] = a[i];
else ret->node[x - 1 + i] = ret->e();
}
while (x /= 2) {
rep (i,0,x) {
int p = 2 * (x + i);
ret->node[x + i - 1] = ret->op(ret->node[p], ret->node[p - 1]);
}
}
return ret;
}
#pragma endregion seg_tree
typedef struct vector vector;
typedef struct vector {
int n, max, data_size;
void *data;
void (*push)(vector*, void*);
void (*set)(vector*, int, void*);
ll (*get)(vector*, int);
// ll (*g_ll)(vector*, int);
// int (*g_int)(vector*, int);
double (*get_double)(vector*, int);
int (*size)(vector*);
} vector;
void vector_push(vector *v, void *x) {
if (v->n == v->max) {
v->max++;
// v->max *= 2;
// v->max *= 3;
// v->max /= 2;
// v->max+=10;
assert((v->data = realloc(v->data, v->max * v->data_size)) != NULL);
}
memcpy(v->data + v->data_size * v->n, x, v->data_size);
v->n++;
}
void vector_set(vector *v, int idx, void *x)
{
memcpy(v->data + v->data_size * idx, x, v->data_size);
}
void *vector_get_internal(vector *v, int idx) {
return (v->data + v->data_size * idx);
}
ll vector_get(vector *v, int idx){
assert(v->data_size!=sizeof(double));
return *(ll*)vector_get_internal(v, idx);
}
// ll vector_get_ll(vector *v, int idx){
// assert(v->data_size==sizeof(ll));
// return *(ll*)vector_get(v, idx);
// }
// int vector_get_int(vector *v, int idx){
// assert(v->data_size==sizeof(int));
// return *(int*)vector_get(v, idx);
// }
double vector_get_double(vector *v, int idx){
assert(v->data_size==sizeof(double));
return *(double*)vector_get(v, idx);
}
int vector_size(vector *v) {
return v->n;
}
vector *vector_init(int n, int data_size) {
vector *ret = (vector *)malloc(sizeof(vector));
ret->n = 0;
// ret->n = n;
ret->max = n;
ret->data_size = data_size;
ret->data = malloc(n * data_size);
ret->push=vector_push;
ret->set=vector_set;
ret->size=vector_size;
// ret->g_ll = vector_get_ll;
// ret->g_int = vector_get_int;
// ret->g_double = vector_get_double;
ret->get = vector_get;
ret->get_double = vector_get_double;
memset(ret->data, 0, n * ret->data_size);
return ret;
}
typedef struct graph graph;
typedef struct graph {
vector **vec_to;
vector **vec_cost;
int *ed_cnt;
void (*push)(graph*, int, int, ll, bool);
int (*to)(graph*, int, int);
ll (*cost)(graph*, int, int);
double (*cost_double)(graph*, int, int);
} graph;
void graph_push(graph *g, int from, int to, ll cost, bool is_dir) {
g->vec_to[from]->push( g->vec_to[from] , (void*)&to);
g->vec_cost[from]->push( g->vec_cost[from] , (void*)&cost);
g->ed_cnt[from]++;
if(is_dir==false){
g->vec_to[to]->push( g->vec_to[to] , (void*)&from);
g->vec_cost[to]->push( g->vec_cost[to] , (void*)&cost);
g->ed_cnt[to]++;
}
}
int graph_to(graph *g, int from, int idx){
return g->vec_to[from]->get(g->vec_to[from], idx);
}
ll graph_cost(graph *g, int from, int idx){
return g->vec_to[from]->get(g->vec_to[from], idx);
}
double graph_cost_double(graph *g, int from, int idx){
return g->vec_to[from]->get_double(g->vec_to[from], idx);
}
graph *graph_init(int n, int data_size) {
graph *ret = (graph *)malloc(sizeof(graph));
ret->vec_to = (vector **)malloc(n * sizeof(vector*));
ret->vec_cost = (vector **)malloc(n * sizeof(vector*));
ret->ed_cnt = (int *)malloc(n * sizeof(int));
rep(i,0,n){
(ret->vec_to[i]) = vector_init(4, sizeof(int));
}
rep(i,0,n){
(ret->vec_cost[i]) = vector_init(4, sizeof(data_size));
}
ret->push = graph_push;
ret->to = graph_to;
ret->cost = graph_cost;
ret->cost_double = graph_cost_double;
return ret;
}
ll ans[115115];
void solve(){
// fgets(s,sizeof(s),stdin);
ll n,m;
// ll ans=0;
cin(&n);
cin(&m);
graph *g=graph_init(n,8);
ll a,b;
rep(i,0,m){
cin(&a);
cin(&b);
a--; b--;
// g->to[a]->push( g->to[a] ,&b);
g->push(g,a,b,1,0);
}
ll q[115115];
rep(i,0,115115) q[i]=-1;
ll head=0,tail=0;
q[tail++]=0;
ans[0]=1;
while(q[head]!=-1){
ll from=q[head];
rep(i,0,g->ed_cnt[from]){
ll to=g->to(g,from,i);
if(ans[to]) continue;
ans[to]=from+1;
q[tail++]=to;
}
head++;
}
rep(i,0,n){
if(ans[i]==0){
NO; return;
}
}
YES;
rep(i,1,n) printf("%lld\n",ans[i]);
}
int main(void){
ll T=1;
// cin(&T);
rep(i,0,T){ solve(); }
return 0;
}
/*
while (ng + 1 < ok) {
ll p = ng + (ok - ng) / 2;
ll cnt = 0;
rep(i,0,n){
cnt += (a[i] + p - 1) / p - 1;
}
if (cnt <= k) ok = p; else ng = p;
}
*/
// 10^18 2^60 3^38 5^26
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147337/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147337/source.c"
target datalayout = "e-m:e-p270: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_AVL_set = type { i64, i32, i32, [2 x ptr] }
%struct.seg_tree = type { i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.vector = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.graph = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@fac_cnt = dso_local local_unnamed_addr global i64 0, align 8
@is_factor_prepared = dso_local local_unnamed_addr global i64 0, align 8
@factors = dso_local local_unnamed_addr global [2 x ptr] zeroinitializer, align 16
@is_minv_made = dso_local local_unnamed_addr global i64 0, align 8
@is_mf_made = dso_local local_unnamed_addr global i64 0, align 8
@num_of_inv = dso_local local_unnamed_addr global i64 2000010, align 8
@inv_arr = dso_local local_unnamed_addr global ptr null, align 8
@finv_arr = dso_local local_unnamed_addr global ptr null, align 8
@mf_arr = dso_local local_unnamed_addr global ptr null, align 8
@.str.3 = private unnamed_addr constant [9 x i8] c"%lld %d\0A\00", align 1
@set_main.set_is_init = internal unnamed_addr global i1 false, align 1
@set_main.set_pointer = internal global [514511 x ptr] zeroinitializer, align 16
@set_main.set_siz = internal unnamed_addr global [514511 x i64] zeroinitializer, align 16
@.str.4 = private unnamed_addr constant [60 x i8] c"(v->data = realloc(v->data, v->max * v->data_size)) != NULL\00", align 1
@.str.5 = private unnamed_addr constant [63 x i8] c"/data/TheStack_IR/OJ_Samples/Collated/C/Source_147337/source.c\00", align 1
@__PRETTY_FUNCTION__.vector_push = private unnamed_addr constant [35 x i8] c"void vector_push(vector *, void *)\00", align 1
@.str.6 = private unnamed_addr constant [29 x i8] c"v->data_size!=sizeof(double)\00", align 1
@__PRETTY_FUNCTION__.vector_get = private unnamed_addr constant [29 x i8] c"ll vector_get(vector *, int)\00", align 1
@.str.7 = private unnamed_addr constant [29 x i8] c"v->data_size==sizeof(double)\00", align 1
@__PRETTY_FUNCTION__.vector_get_double = private unnamed_addr constant [40 x i8] c"double vector_get_double(vector *, int)\00", align 1
@ans = dso_local local_unnamed_addr global [115115 x i64] zeroinitializer, align 16
@.str.10 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.11 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @cin(ptr noundef %n) local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %n)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @PriAll1(ptr nocapture noundef readonly %a, i64 noundef %n) local_unnamed_addr #2 {
entry:
%cmp9 = icmp sgt i64 %n, 0
br i1 %cmp9, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%sub = add nsw i64 %n, -1
br label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.010 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.010
%0 = load i64, ptr %arrayidx, align 8, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %0)
%cmp1.not = icmp eq i64 %i.010, %sub
br i1 %cmp1.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%putchar8 = tail call i32 @putchar(i32 32)
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%inc = add nuw nsw i64 %i.010, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smin.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #4 {
entry:
%cmp.not = icmp slt i64 %a, %b
%cmp1.not = icmp slt i64 %a, %c
%or.cond = or i1 %cmp.not, %cmp1.not
%cond = tail call i64 @llvm.smax.i64(i64 %b, i64 %c)
%cond6 = select i1 %or.cond, i64 %cond, i64 %a
ret i64 %cond6
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @minn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 4611686018427387904, i64 4611686018427387904>, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ <i64 4611686018427387904, i64 4611686018427387904>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi7, <2 x i64> %wide.load8)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.05.ph = phi i64 [ 4611686018427387904, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ 4611686018427387904, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%b.05 = phi i64 [ %cond.i, %for.body ], [ %b.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smin.i64(i64 %b.05, i64 %6)
%inc = add nuw nsw i64 %i.06, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @maxn(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #5 {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 -4611686018427387904, i64 -4611686018427387904>, %vector.ph ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ <i64 -4611686018427387904, i64 -4611686018427387904>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %a, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi7, <2 x i64> %wide.load8)
%index.next = add nuw i64 %index, 4
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %2, <2 x i64> %3)
%5 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.05.ph = phi i64 [ -4611686018427387904, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%b.0.lcssa = phi i64 [ -4611686018427387904, %entry ], [ %5, %middle.block ], [ %cond.i, %for.body ]
ret i64 %b.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%b.05 = phi i64 [ %cond.i, %for.body ], [ %b.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %b.05, i64 %6)
%inc = add nuw nsw i64 %i.06, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !16
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @POW(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%cmp3 = icmp sgt i64 %b, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%c.04.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil
%c.04.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %c.04.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %c.04.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !17
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%c.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %c.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%c.04 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %c.04, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !19
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local double @POW_d(double noundef %a, double noundef %b) local_unnamed_addr #6 {
entry:
%cmp4 = fcmp ogt double %b, 0.000000e+00
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%c.0.lcssa = phi double [ 1.000000e+00, %entry ], [ %mul, %for.body ]
ret double %c.0.lcssa
for.body: ; preds = %entry, %for.body
%i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%c.05 = phi double [ %mul, %for.body ], [ 1.000000e+00, %entry ]
%mul = fmul double %c.05, %a
%inc = add nuw nsw i64 %i.06, 1
%conv = sitofp i64 %inc to double
%cmp = fcmp olt double %conv, %b
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !20
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
%div = sdiv i64 %a, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_MOD1(i64 noundef %n) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%n.nonneg = sub i64 0, %n
%0 = urem i64 %n.nonneg, 1000000007
%1 = add nsw i64 %0, %n
%mul = sub i64 1000000007, %1
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, 1000000007
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @mod_p(i64 noundef %n, i64 noundef %p) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %cond.true, label %cond.end
cond.true: ; preds = %entry
%div7 = sdiv i64 %n, %p
%add = sub i64 1, %div7
%mul = mul nsw i64 %add, %p
br label %cond.end
cond.end: ; preds = %entry, %cond.true
%cond = phi i64 [ %mul, %cond.true ], [ 0, %entry ]
%add1 = add nsw i64 %cond, %n
%rem = srem i64 %add1, %p
ret i64 %rem
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @change_into_num(ptr nocapture noundef readonly %s, i64 noundef %len, i64 noundef %p) local_unnamed_addr #8 {
entry:
%tobool.not11 = icmp eq i64 %p, 0
br i1 %tobool.not11, label %cond.end, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %p, -2
br label %cond.false
cond.false: ; preds = %cond.false.preheader, %POW.exit
%indvar = phi i64 [ 0, %cond.false.preheader ], [ %indvar.next, %POW.exit ]
%p.tr13 = phi i64 [ %p, %cond.false.preheader ], [ %sub, %POW.exit ]
%accumulator.tr12 = phi i64 [ 0, %cond.false.preheader ], [ %add, %POW.exit ]
%1 = xor i64 %indvar, -1
%2 = add i64 %1, %p
%sub = add nsw i64 %p.tr13, -1
%cmp3.i = icmp sgt i64 %p.tr13, 1
br i1 %cmp3.i, label %for.body.i.preheader, label %POW.exit
for.body.i.preheader: ; preds = %cond.false
%3 = sub i64 %0, %indvar
%xtraiter = and i64 %2, 7
%4 = icmp ult i64 %3, 7
br i1 %4, label %POW.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %2, -8
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%c.04.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %mul.i.7, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.7, %for.body.i ]
%mul.i.7 = mul i64 %c.04.i, 100000000
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %POW.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !19
POW.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%mul.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%c.04.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %mul.i.7, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %POW.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil
%c.04.i.epil = phi i64 [ %mul.i.epil, %for.body.i.epil ], [ %c.04.i.unr, %POW.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %POW.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul nsw i64 %c.04.i.epil, 10
%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 %POW.exit, label %for.body.i.epil, !llvm.loop !21
POW.exit: ; preds = %POW.exit.loopexit.unr-lcssa, %for.body.i.epil, %cond.false
%c.0.lcssa.i = phi i64 [ 1, %cond.false ], [ %mul.i.lcssa.ph, %POW.exit.loopexit.unr-lcssa ], [ %mul.i.epil, %for.body.i.epil ]
%sub1 = sub nsw i64 %len, %p.tr13
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %sub1
%5 = load i8, ptr %arrayidx, align 1, !tbaa !22
%conv = sext i8 %5 to i64
%sub2 = add nsw i64 %conv, -48
%mul = mul nsw i64 %sub2, %c.0.lcssa.i
%add = add nsw i64 %mul, %accumulator.tr12
%tobool.not = icmp eq i64 %sub, 0
%indvar.next = add i64 %indvar, 1
br i1 %tobool.not, label %cond.end, label %cond.false
cond.end: ; preds = %POW.exit, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %POW.exit ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @digits(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%accumulator.tr = phi i64 [ 0, %entry ], [ %add, %tailrecurse ]
%a.tr = phi i64 [ %a, %entry ], [ %div, %tailrecurse ]
%div = sdiv i64 %a.tr, %b
%tobool.not = icmp eq i64 %div, 0
%add = add nuw nsw i64 %accumulator.tr, 1
br i1 %tobool.not, label %cond.end, label %tailrecurse
cond.end: ; preds = %tailrecurse
ret i64 %add
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @base(i64 noundef %n, i64 noundef %a, i64 noundef %i) local_unnamed_addr #6 {
entry:
%cmp5 = icmp eq i64 %i, 1
br i1 %cmp5, label %cond.true, label %cond.false.preheader
cond.false.preheader: ; preds = %entry
%0 = add i64 %i, 3
%1 = add i64 %i, -2
%xtraiter = and i64 %0, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %cond.false.prol.loopexit, label %cond.false.prol
cond.false.prol: ; preds = %cond.false.preheader, %cond.false.prol
%i.tr7.prol = phi i64 [ %sub.prol, %cond.false.prol ], [ %i, %cond.false.preheader ]
%n.tr6.prol = phi i64 [ %div.prol, %cond.false.prol ], [ %n, %cond.false.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %cond.false.prol ], [ 0, %cond.false.preheader ]
%div.prol = sdiv i64 %n.tr6.prol, %a
%sub.prol = add nsw i64 %i.tr7.prol, -1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %cond.false.prol.loopexit, label %cond.false.prol, !llvm.loop !23
cond.false.prol.loopexit: ; preds = %cond.false.prol, %cond.false.preheader
%div.lcssa.unr = phi i64 [ undef, %cond.false.preheader ], [ %div.prol, %cond.false.prol ]
%i.tr7.unr = phi i64 [ %i, %cond.false.preheader ], [ %sub.prol, %cond.false.prol ]
%n.tr6.unr = phi i64 [ %n, %cond.false.preheader ], [ %div.prol, %cond.false.prol ]
%2 = icmp ult i64 %1, 3
br i1 %2, label %cond.true, label %cond.false
cond.true: ; preds = %cond.false.prol.loopexit, %cond.false, %entry
%n.tr.lcssa = phi i64 [ %n, %entry ], [ %div.lcssa.unr, %cond.false.prol.loopexit ], [ %div.3, %cond.false ]
%rem = srem i64 %n.tr.lcssa, %a
ret i64 %rem
cond.false: ; preds = %cond.false.prol.loopexit, %cond.false
%i.tr7 = phi i64 [ %sub.3, %cond.false ], [ %i.tr7.unr, %cond.false.prol.loopexit ]
%n.tr6 = phi i64 [ %div.3, %cond.false ], [ %n.tr6.unr, %cond.false.prol.loopexit ]
%div = sdiv i64 %n.tr6, %a
%div.1 = sdiv i64 %div, %a
%div.2 = sdiv i64 %div.1, %a
%div.3 = sdiv i64 %div.2, %a
%sub.3 = add nsw i64 %i.tr7, -4
%cmp.3 = icmp eq i64 %sub.3, 1
br i1 %cmp.3, label %cond.true, label %cond.false
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @is_inArr1(i64 noundef %x, i64 noundef %n) local_unnamed_addr #7 {
entry:
%cmp = icmp sgt i64 %x, -1
%cmp1 = icmp slt i64 %x, %n
%.not = and i1 %cmp, %cmp1
%conv = zext i1 %.not to i64
ret i64 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @is_inArr2(i64 noundef %y, i64 noundef %x, i64 noundef %h, i64 noundef %w) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %y, 0
br i1 %cmp, label %lor.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%cmp1 = icmp sge i64 %y, %h
%cmp3 = icmp slt i64 %x, 0
%or.cond = or i1 %cmp3, %cmp1
br i1 %or.cond, label %lor.end, label %lor.rhs
lor.rhs: ; preds = %lor.lhs.false
%cmp4 = icmp slt i64 %x, %w
%0 = zext i1 %cmp4 to i64
br label %lor.end
lor.end: ; preds = %lor.rhs, %lor.lhs.false, %entry
%not. = phi i64 [ 0, %lor.lhs.false ], [ 0, %entry ], [ %0, %lor.rhs ]
ret i64 %not.
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_lower(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !24
%1 = load i32, ptr %r, align 4, !tbaa !24
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%cmp1 = icmp slt i64 %am, %val
%l.r = select i1 %cmp1, ptr %l, ptr %r
%cmp6.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp6.not, ptr %r, ptr %l
%l.sink = select i1 %cmp, ptr %l.r, ptr %r.l
store i32 %div, ptr %l.sink, align 4, !tbaa !24
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @lr_upper(ptr nocapture noundef %l, ptr nocapture noundef %r, i64 noundef %am, i64 noundef %val, i32 noundef %type) local_unnamed_addr #9 {
entry:
%cmp = icmp slt i32 %type, 3
%0 = load i32, ptr %l, align 4, !tbaa !24
%1 = load i32, ptr %r, align 4, !tbaa !24
%add3 = add nsw i32 %1, %0
%div4 = sdiv i32 %add3, 2
%cmp1.not = icmp sgt i64 %am, %val
%r.l = select i1 %cmp1.not, ptr %r, ptr %l
%cmp6 = icmp slt i64 %am, %val
%l.r = select i1 %cmp6, ptr %l, ptr %r
%l.sink = select i1 %cmp, ptr %r.l, ptr %l.r
store i32 %div4, ptr %l.sink, align 4, !tbaa !24
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_lower(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sge i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp sgt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @cmp_upper(i64 noundef %a, i64 noundef %b, i32 noundef %type) local_unnamed_addr #7 {
entry:
switch i32 %type, label %cond.false6 [
i32 1, label %cond.true
i32 2, label %cond.true3
]
cond.true: ; preds = %entry
%cmp1 = icmp eq i64 %a, %b
br label %cond.end10
cond.true3: ; preds = %entry
%cmp4.not = icmp sle i64 %a, %b
br label %cond.end10
cond.false6: ; preds = %entry
%cmp7 = icmp slt i64 %a, %b
br label %cond.end10
cond.end10: ; preds = %cond.true3, %cond.false6, %cond.true
%cond11.in = phi i1 [ %cmp1, %cond.true ], [ %cmp4.not, %cond.true3 ], [ %cmp7, %cond.false6 ]
%cond11 = zext i1 %cond11.in to i32
ret i32 %cond11
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub34 = sub nsw i32 %r, %l
%cmp35 = icmp sgt i32 %sub34, 1
br i1 %cmp35, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select51, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.i.us = icmp slt i64 %0, %val
%spec.select = select i1 %cmp1.i.us, i32 %div.us, i32 %l.addr.0
%spec.select51 = select i1 %cmp1.i.us, i32 %r.addr.0, i32 %div.us
%sub.us = sub nsw i32 %spec.select51, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !26
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select53, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.not.i = icmp sgt i64 %1, %val
%spec.select52 = select i1 %cmp6.not.i, i32 %l.addr.2, i32 %div
%spec.select53 = select i1 %cmp6.not.i, i32 %div, i32 %r.addr.2
%sub = sub nsw i32 %spec.select53, %spec.select52
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !26
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select51, %while.body.us ], [ %spec.select53, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select52, %while.body ]
%idxprom1 = sext i32 %l.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_lower.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i17 = icmp eq i64 %2, %val
br i1 %cmp1.i17, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom345 = sext i32 %r.addr.0..lcssa to i64
%arrayidx446 = getelementptr inbounds i64, ptr %a, i64 %idxprom345
%3 = load i64, ptr %arrayidx446, align 8, !tbaa !5
%cmp1.i23 = icmp eq i64 %3, %val
br label %cmp_lower.exit26
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp slt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread47, label %cond.end9
cond.false.thread47: ; preds = %cond.true3.i
%idxprom348 = sext i32 %r.addr.0..lcssa to i64
%arrayidx449 = getelementptr inbounds i64, ptr %a, i64 %idxprom348
%4 = load i64, ptr %arrayidx449, align 8, !tbaa !5
%cmp4.not.i19 = icmp sge i64 %4, %val
br label %cmp_lower.exit26
cmp_lower.exit: ; preds = %while.end
%cmp7.i = icmp sgt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_lower.exit
%idxprom3 = sext i32 %r.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i25 = icmp sgt i64 %5, %val
br label %cmp_lower.exit26
cmp_lower.exit26: ; preds = %cond.false.thread, %cond.false.thread47, %cond.false
%cond11.in.i20 = phi i1 [ %cmp1.i23, %cond.false.thread ], [ %cmp4.not.i19, %cond.false.thread47 ], [ %cmp7.i25, %cond.false ]
%6 = sext i32 %r.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i20, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_lower.exit, %cmp_lower.exit26
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_lower.exit ], [ %.pre, %cmp_lower.exit26 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @upper_bound(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %val, i32 noundef %type) local_unnamed_addr #8 {
entry:
%sub33 = sub nsw i32 %r, %l
%cmp34 = icmp sgt i32 %sub33, 1
br i1 %cmp34, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp.i = icmp slt i32 %type, 3
br i1 %cmp.i, label %while.body.us, label %while.body
while.body.us: ; preds = %while.body.lr.ph, %while.body.us
%l.addr.0 = phi i32 [ %spec.select, %while.body.us ], [ %l, %while.body.lr.ph ]
%r.addr.0 = phi i32 [ %spec.select50, %while.body.us ], [ %r, %while.body.lr.ph ]
%add.us = add nsw i32 %l.addr.0, %r.addr.0
%div.us = sdiv i32 %add.us, 2
%idxprom.us = sext i32 %div.us to i64
%arrayidx.us = getelementptr inbounds i64, ptr %a, i64 %idxprom.us
%0 = load i64, ptr %arrayidx.us, align 8, !tbaa !5
%cmp1.not.i.us = icmp sgt i64 %0, %val
%spec.select = select i1 %cmp1.not.i.us, i32 %l.addr.0, i32 %div.us
%spec.select50 = select i1 %cmp1.not.i.us, i32 %div.us, i32 %r.addr.0
%sub.us = sub nsw i32 %spec.select50, %spec.select
%cmp.us = icmp sgt i32 %sub.us, 1
br i1 %cmp.us, label %while.body.us, label %while.end, !llvm.loop !27
while.body: ; preds = %while.body.lr.ph, %while.body
%l.addr.2 = phi i32 [ %spec.select51, %while.body ], [ %l, %while.body.lr.ph ]
%r.addr.2 = phi i32 [ %spec.select52, %while.body ], [ %r, %while.body.lr.ph ]
%add = add nsw i32 %l.addr.2, %r.addr.2
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp6.i = icmp slt i64 %1, %val
%spec.select51 = select i1 %cmp6.i, i32 %div, i32 %l.addr.2
%spec.select52 = select i1 %cmp6.i, i32 %r.addr.2, i32 %div
%sub = sub nsw i32 %spec.select52, %spec.select51
%cmp = icmp sgt i32 %sub, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !27
while.end: ; preds = %while.body, %while.body.us, %entry
%r.addr.0..lcssa = phi i32 [ %r, %entry ], [ %spec.select50, %while.body.us ], [ %spec.select52, %while.body ]
%l.addr.0..lcssa = phi i32 [ %l, %entry ], [ %spec.select, %while.body.us ], [ %spec.select51, %while.body ]
%idxprom1 = sext i32 %r.addr.0..lcssa to i64
%arrayidx2 = getelementptr inbounds i64, ptr %a, i64 %idxprom1
%2 = load i64, ptr %arrayidx2, align 8, !tbaa !5
switch i32 %type, label %cmp_upper.exit [
i32 1, label %cond.true.i
i32 2, label %cond.true3.i
]
cond.true.i: ; preds = %while.end
%cmp1.i = icmp eq i64 %2, %val
br i1 %cmp1.i, label %cond.end9, label %cond.false.thread
cond.false.thread: ; preds = %cond.true.i
%idxprom344 = sext i32 %l.addr.0..lcssa to i64
%arrayidx445 = getelementptr inbounds i64, ptr %a, i64 %idxprom344
%3 = load i64, ptr %arrayidx445, align 8, !tbaa !5
%cmp1.i22 = icmp eq i64 %3, %val
br label %cmp_upper.exit25
cond.true3.i: ; preds = %while.end
%cmp4.not.i.not = icmp sgt i64 %2, %val
br i1 %cmp4.not.i.not, label %cond.false.thread46, label %cond.end9
cond.false.thread46: ; preds = %cond.true3.i
%idxprom347 = sext i32 %l.addr.0..lcssa to i64
%arrayidx448 = getelementptr inbounds i64, ptr %a, i64 %idxprom347
%4 = load i64, ptr %arrayidx448, align 8, !tbaa !5
%cmp4.not.i18 = icmp sle i64 %4, %val
br label %cmp_upper.exit25
cmp_upper.exit: ; preds = %while.end
%cmp7.i = icmp slt i64 %2, %val
br i1 %cmp7.i, label %cond.end9, label %cond.false
cond.false: ; preds = %cmp_upper.exit
%idxprom3 = sext i32 %l.addr.0..lcssa to i64
%arrayidx4 = getelementptr inbounds i64, ptr %a, i64 %idxprom3
%5 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%cmp7.i24 = icmp slt i64 %5, %val
br label %cmp_upper.exit25
cmp_upper.exit25: ; preds = %cond.false.thread, %cond.false.thread46, %cond.false
%cond11.in.i19 = phi i1 [ %cmp1.i22, %cond.false.thread ], [ %cmp4.not.i18, %cond.false.thread46 ], [ %cmp7.i24, %cond.false ]
%6 = sext i32 %l.addr.0..lcssa to i64
%.pre = select i1 %cond11.in.i19, i64 %6, i64 -1
br label %cond.end9
cond.end9: ; preds = %cond.true3.i, %cond.true.i, %cmp_upper.exit, %cmp_upper.exit25
%conv.pre-phi = phi i64 [ %idxprom1, %cmp_upper.exit ], [ %.pre, %cmp_upper.exit25 ], [ %idxprom1, %cond.true.i ], [ %idxprom1, %cond.true3.i ]
ret i64 %conv.pre-phi
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @count(ptr nocapture noundef readonly %a, i32 noundef %l, i32 noundef %r, i64 noundef %x) local_unnamed_addr #8 {
entry:
%sub34.i = sub nsw i32 %r, %l
%cmp35.i = icmp sgt i32 %sub34.i, 1
br i1 %cmp35.i, label %while.body.us.i, label %while.end.i
while.body.us.i: ; preds = %entry, %while.body.us.i
%l.addr.0.i = phi i32 [ %spec.select.i, %while.body.us.i ], [ %l, %entry ]
%r.addr.0.i = phi i32 [ %spec.select51.i, %while.body.us.i ], [ %r, %entry ]
%add.us.i = add nsw i32 %r.addr.0.i, %l.addr.0.i
%div.us.i = sdiv i32 %add.us.i, 2
%idxprom.us.i = sext i32 %div.us.i to i64
%arrayidx.us.i = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i
%0 = load i64, ptr %arrayidx.us.i, align 8, !tbaa !5
%cmp1.i.us.i = icmp slt i64 %0, %x
%spec.select.i = select i1 %cmp1.i.us.i, i32 %div.us.i, i32 %l.addr.0.i
%spec.select51.i = select i1 %cmp1.i.us.i, i32 %r.addr.0.i, i32 %div.us.i
%sub.us.i = sub nsw i32 %spec.select51.i, %spec.select.i
%cmp.us.i = icmp sgt i32 %sub.us.i, 1
br i1 %cmp.us.i, label %while.body.us.i, label %while.end.i, !llvm.loop !26
while.end.i: ; preds = %while.body.us.i, %entry
%r.addr.0..lcssa.i = phi i32 [ %r, %entry ], [ %spec.select51.i, %while.body.us.i ]
%l.addr.0..lcssa.i = phi i32 [ %l, %entry ], [ %spec.select.i, %while.body.us.i ]
%idxprom1.i = sext i32 %l.addr.0..lcssa.i to i64
%arrayidx2.i = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i
%1 = load i64, ptr %arrayidx2.i, align 8, !tbaa !5
%cmp1.i17.i = icmp eq i64 %1, %x
br i1 %cmp1.i17.i, label %lower_bound.exit, label %cond.false.thread.i
cond.false.thread.i: ; preds = %while.end.i
%idxprom345.i = sext i32 %r.addr.0..lcssa.i to i64
%arrayidx446.i = getelementptr inbounds i64, ptr %a, i64 %idxprom345.i
%2 = load i64, ptr %arrayidx446.i, align 8, !tbaa !5
%cmp1.i23.i = icmp eq i64 %2, %x
%.pre.i = select i1 %cmp1.i23.i, i64 %idxprom345.i, i64 -1
br label %lower_bound.exit
lower_bound.exit: ; preds = %while.end.i, %cond.false.thread.i
%conv.pre-phi.i = phi i64 [ %.pre.i, %cond.false.thread.i ], [ %idxprom1.i, %while.end.i ]
%conv = trunc i64 %conv.pre-phi.i to i32
%cmp = icmp eq i32 %conv, -1
br i1 %cmp, label %cond.end, label %cond.false
cond.false: ; preds = %lower_bound.exit
%sub33.i = sub nsw i32 %r, %conv
%cmp34.i = icmp sgt i32 %sub33.i, 1
br i1 %cmp34.i, label %while.body.us.i18, label %while.end.i9
while.body.us.i18: ; preds = %cond.false, %while.body.us.i18
%l.addr.0.i19 = phi i32 [ %spec.select.i25, %while.body.us.i18 ], [ %conv, %cond.false ]
%r.addr.0.i20 = phi i32 [ %spec.select50.i, %while.body.us.i18 ], [ %r, %cond.false ]
%add.us.i21 = add nsw i32 %r.addr.0.i20, %l.addr.0.i19
%div.us.i22 = sdiv i32 %add.us.i21, 2
%idxprom.us.i23 = sext i32 %div.us.i22 to i64
%arrayidx.us.i24 = getelementptr inbounds i64, ptr %a, i64 %idxprom.us.i23
%3 = load i64, ptr %arrayidx.us.i24, align 8, !tbaa !5
%cmp1.not.i.us.i = icmp sgt i64 %3, %x
%spec.select.i25 = select i1 %cmp1.not.i.us.i, i32 %l.addr.0.i19, i32 %div.us.i22
%spec.select50.i = select i1 %cmp1.not.i.us.i, i32 %div.us.i22, i32 %r.addr.0.i20
%sub.us.i26 = sub nsw i32 %spec.select50.i, %spec.select.i25
%cmp.us.i27 = icmp sgt i32 %sub.us.i26, 1
br i1 %cmp.us.i27, label %while.body.us.i18, label %while.end.i9, !llvm.loop !27
while.end.i9: ; preds = %while.body.us.i18, %cond.false
%r.addr.0..lcssa.i10 = phi i32 [ %r, %cond.false ], [ %spec.select50.i, %while.body.us.i18 ]
%l.addr.0..lcssa.i11 = phi i32 [ %conv, %cond.false ], [ %spec.select.i25, %while.body.us.i18 ]
%idxprom1.i12 = sext i32 %r.addr.0..lcssa.i10 to i64
%arrayidx2.i13 = getelementptr inbounds i64, ptr %a, i64 %idxprom1.i12
%4 = load i64, ptr %arrayidx2.i13, align 8, !tbaa !5
%cmp1.i.i = icmp eq i64 %4, %x
br i1 %cmp1.i.i, label %upper_bound.exit, label %cond.false.thread.i14
cond.false.thread.i14: ; preds = %while.end.i9
%idxprom344.i = sext i32 %l.addr.0..lcssa.i11 to i64
%arrayidx445.i = getelementptr inbounds i64, ptr %a, i64 %idxprom344.i
%5 = load i64, ptr %arrayidx445.i, align 8, !tbaa !5
%cmp1.i22.i = icmp eq i64 %5, %x
%.pre.i15 = select i1 %cmp1.i22.i, i64 %idxprom344.i, i64 -1
br label %upper_bound.exit
upper_bound.exit: ; preds = %while.end.i9, %cond.false.thread.i14
%conv.pre-phi.i16 = phi i64 [ %.pre.i15, %cond.false.thread.i14 ], [ %idxprom1.i12, %while.end.i9 ]
%reass.sub = sub nsw i64 %conv.pre-phi.i16, %conv.pre-phi.i
%add = add nsw i64 %reass.sub, 1
br label %cond.end
cond.end: ; preds = %lower_bound.exit, %upper_bound.exit
%cond = phi i64 [ %add, %upper_bound.exit ], [ 0, %lower_bound.exit ]
ret i64 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i64 @factor_pre() local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @is_factor_prepared, align 8, !tbaa !5
%inc = add nsw i64 %0, 1
store i64 %inc, ptr @is_factor_prepared, align 8, !tbaa !5
%tobool.not = icmp eq i64 %0, 0
br i1 %tobool.not, label %for.body6.peel.next, label %return
for.body6.peel.next: ; preds = %entry
%1 = tail call ptr @llvm.stacksave.p0()
%vla116 = alloca [500001 x i64], align 16
store i64 2, ptr %vla116, align 16, !tbaa !5
br label %vector.body
vector.body: ; preds = %vector.body, %for.body6.peel.next
%index = phi i64 [ 0, %for.body6.peel.next ], [ %index.next.1, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 1, i64 2>, %for.body6.peel.next ], [ %vec.ind.next.1, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = shl nuw nsw <2 x i64> %vec.ind, <i64 1, i64 1>
%step.add = shl <2 x i64> %vec.ind, <i64 1, i64 1>
%3 = or <2 x i64> %2, <i64 1, i64 1>
%4 = add <2 x i64> %step.add, <i64 5, i64 5>
%5 = getelementptr inbounds i64, ptr %vla116, i64 %offset.idx
store <2 x i64> %3, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i64, ptr %5, i64 2
store <2 x i64> %4, ptr %6, align 8, !tbaa !5
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%offset.idx.1 = or i64 %index, 5
%7 = shl nuw nsw <2 x i64> %vec.ind.next, <i64 1, i64 1>
%step.add.1 = shl <2 x i64> %vec.ind.next, <i64 1, i64 1>
%8 = or <2 x i64> %7, <i64 1, i64 1>
%9 = add <2 x i64> %step.add.1, <i64 5, i64 5>
%10 = getelementptr inbounds i64, ptr %vla116, i64 %offset.idx.1
store <2 x i64> %8, ptr %10, align 8, !tbaa !5
%11 = getelementptr inbounds i64, ptr %10, i64 2
store <2 x i64> %9, ptr %11, align 8, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 8
%vec.ind.next.1 = add <2 x i64> %vec.ind, <i64 8, i64 8>
%12 = icmp eq i64 %index.next.1, 500000
br i1 %12, label %for.body16, label %vector.body, !llvm.loop !28
for.body16: ; preds = %vector.body, %for.inc43
%i12.0124 = phi i64 [ %inc44, %for.inc43 ], [ 1, %vector.body ]
%arrayidx17 = getelementptr inbounds i64, ptr %vla116, i64 %i12.0124
%13 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%tobool18.not = icmp eq i64 %13, 0
br i1 %tobool18.not, label %for.inc43, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body16
%mul21 = shl nuw nsw i64 %i12.0124, 1
%add22 = or i64 %mul21, 1
%div = udiv i64 500001, %add22
%cmp24.not122 = icmp ugt i64 %add22, 166667
br i1 %cmp24.not122, label %for.inc43, label %for.body26
for.body26: ; preds = %for.cond20.preheader, %for.inc38
%j.0123 = phi i64 [ %add39, %for.inc38 ], [ 3, %for.cond20.preheader ]
%mul29 = mul nuw nsw i64 %j.0123, %add22
%cmp30 = icmp ult i64 %mul29, 500001
br i1 %cmp30, label %if.then31, label %for.inc38
if.then31: ; preds = %for.body26
%14 = trunc i64 %mul29 to i32
%div35.lhs.trunc = add nsw i32 %14, -1
%div35120 = sdiv i32 %div35.lhs.trunc, 2
%div35.sext = zext i32 %div35120 to i64
%arrayidx36 = getelementptr inbounds i64, ptr %vla116, i64 %div35.sext
store i64 0, ptr %arrayidx36, align 8, !tbaa !5
br label %for.inc38
for.inc38: ; preds = %for.body26, %if.then31
%add39 = add nuw nsw i64 %j.0123, 2
%cmp24.not = icmp ugt i64 %add39, %div
br i1 %cmp24.not, label %for.inc43, label %for.body26, !llvm.loop !30
for.inc43: ; preds = %for.inc38, %for.cond20.preheader, %for.body16
%inc44 = add nuw nsw i64 %i12.0124, 1
%exitcond128.not = icmp eq i64 %inc44, 500001
br i1 %exitcond128.not, label %for.body51, label %for.body16, !llvm.loop !31
for.cond.cleanup50: ; preds = %for.inc83
tail call void @llvm.stackrestore.p0(ptr %1)
br label %return
for.body51: ; preds = %for.inc43, %for.inc83
%i47.0126 = phi i64 [ %inc84, %for.inc83 ], [ 0, %for.inc43 ]
%arrayidx52 = getelementptr inbounds i64, ptr %vla116, i64 %i47.0126
%15 = load i64, ptr %arrayidx52, align 8, !tbaa !5
%tobool53.not = icmp eq i64 %15, 0
br i1 %tobool53.not, label %for.inc83, label %cond.end75.1
cond.end75.1: ; preds = %for.body51
%16 = load ptr, ptr @factors, align 16, !tbaa !32
%17 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%add61 = shl i64 %17, 3
%mul62 = add i64 %add61, 8
%call = tail call ptr @realloc(ptr noundef %16, i64 noundef %mul62) #36
store ptr %call, ptr @factors, align 16, !tbaa !32
%18 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx77 = getelementptr inbounds i64, ptr %call, i64 %18
store i64 %15, ptr %arrayidx77, align 8, !tbaa !5
%19 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !32
%add61.1 = shl i64 %18, 3
%mul62.1 = add i64 %add61.1, 8
%call.1 = tail call ptr @realloc(ptr noundef %19, i64 noundef %mul62.1) #36
store ptr %call.1, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8, !tbaa !32
%20 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%inc73.1 = add nsw i64 %20, 1
store i64 %inc73.1, ptr @fac_cnt, align 8, !tbaa !5
%arrayidx77.1 = getelementptr inbounds i64, ptr %call.1, i64 %20
store i64 0, ptr %arrayidx77.1, align 8, !tbaa !5
br label %for.inc83
for.inc83: ; preds = %cond.end75.1, %for.body51
%inc84 = add nuw nsw i64 %i47.0126, 1
%exitcond129.not = icmp eq i64 %inc84, 500001
br i1 %exitcond129.not, label %for.cond.cleanup50, label %for.body51, !llvm.loop !34
return: ; preds = %entry, %for.cond.cleanup50
ret i64 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #11
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #12
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #11
; Function Attrs: nounwind uwtable
define dso_local i64 @factor(i64 noundef %n, i64 noundef %new_common_plus) local_unnamed_addr #10 {
entry:
%call = tail call i64 @factor_pre()
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp52 = icmp sgt i64 %0, 0
br i1 %cmp52, label %for.cond1.preheader.lr.ph, label %cleanup30
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load ptr, ptr @factors, align 16, !tbaa !32
%2 = load ptr, ptr getelementptr inbounds ([2 x ptr], ptr @factors, i64 0, i64 1), align 8
br label %for.cond1.preheader
for.cond: ; preds = %cond.end22
%inc29 = add nuw nsw i64 %i.054, 1
%3 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp = icmp slt i64 %inc29, %3
br i1 %cmp, label %for.cond1.preheader, label %cleanup30, !llvm.loop !35
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond
%i.054 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %inc29, %for.cond ]
%n.addr.053 = phi i64 [ %n, %for.cond1.preheader.lr.ph ], [ %n.addr.3, %for.cond ]
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %i.054
%4 = load i64, ptr %arrayidx, align 8, !tbaa !5
br label %while.cond
while.cond: ; preds = %for.cond1.preheader, %land.rhs
%n.addr.2 = phi i64 [ %div, %land.rhs ], [ %n.addr.053, %for.cond1.preheader ]
%cnt.1 = phi i64 [ %add, %land.rhs ], [ 0, %for.cond1.preheader ]
%rem = srem i64 %n.addr.2, %4
%div = sdiv i64 %n.addr.2, %4
%cmp5 = icmp eq i64 %rem, 0
%conv = zext i1 %cmp5 to i64
%add = add nuw nsw i64 %cnt.1, %conv
%tobool.not = icmp eq i64 %add, 0
br i1 %tobool.not, label %for.inc, label %land.rhs
land.rhs: ; preds = %while.cond
%rem8 = srem i64 %div, %4
%cmp9 = icmp eq i64 %rem8, 0
br i1 %cmp9, label %while.cond, label %for.inc, !llvm.loop !36
for.inc: ; preds = %land.rhs, %while.cond
%n.addr.3 = phi i64 [ %div, %land.rhs ], [ %n.addr.2, %while.cond ]
switch i64 %new_common_plus, label %cond.false18 [
i64 1, label %cond.end22
i64 2, label %cond.true15
]
cond.true15: ; preds = %for.inc
%arrayidx16 = getelementptr inbounds i64, ptr %2, i64 %i.054
%5 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%cond.i = tail call i64 @llvm.smax.i64(i64 %5, i64 %add)
br label %cond.end22
cond.false18: ; preds = %for.inc
%arrayidx19 = getelementptr inbounds i64, ptr %2, i64 %i.054
%6 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%add20 = add nsw i64 %6, %add
br label %cond.end22
cond.end22: ; preds = %for.inc, %cond.true15, %cond.false18
%cond23 = phi i64 [ %cond.i, %cond.true15 ], [ %add20, %cond.false18 ], [ %add, %for.inc ]
%arrayidx24 = getelementptr inbounds i64, ptr %2, i64 %i.054
store i64 %cond23, ptr %arrayidx24, align 8, !tbaa !5
%7 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp26.not = icmp sgt i64 %7, %n.addr.3
br i1 %cmp26.not, label %cleanup30, label %for.cond
cleanup30: ; preds = %cond.end22, %for.cond, %entry
%n.addr.4 = phi i64 [ %n, %entry ], [ %n.addr.3, %for.cond ], [ %n.addr.3, %cond.end22 ]
ret i64 %n.addr.4
}
; Function Attrs: nounwind uwtable
define dso_local i64 @judge_prime(i64 noundef %n) local_unnamed_addr #10 {
entry:
%call = tail call i64 @factor_pre()
%0 = load i64, ptr @fac_cnt, align 8, !tbaa !5
%cmp20 = icmp sgt i64 %0, 0
br i1 %cmp20, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%1 = load ptr, ptr @factors, align 16, !tbaa !32
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.else
%i.022 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %if.else ]
%n.addr.021 = phi i64 [ %n, %for.body.lr.ph ], [ %spec.select, %if.else ]
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %i.022
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%mul = mul nsw i64 %2, %2
%cmp2 = icmp slt i64 %n.addr.021, %mul
%cmp4 = icmp eq i64 %n.addr.021, %2
%or.cond = or i1 %cmp4, %cmp2
br i1 %or.cond, label %cleanup, label %if.else
if.else: ; preds = %for.body
%rem = srem i64 %n.addr.021, %2
%cmp6 = icmp eq i64 %rem, 0
%spec.select = select i1 %cmp6, i64 1, i64 %n.addr.021
%inc = add nuw nsw i64 %i.022, 1
%exitcond.not = icmp eq i64 %inc, %0
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !37
cleanup: ; preds = %if.else, %for.body, %entry
%n.addr.0.lcssa = phi i64 [ %n, %entry ], [ %n.addr.021, %for.body ], [ %spec.select, %if.else ]
%cmp9 = icmp ne i64 %n.addr.0.lcssa, 1
%conv = zext i1 %cmp9 to i64
ret i64 %conv
}
; Function Attrs: nounwind uwtable
define dso_local i64 @makeinv(i64 noundef %n, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @is_minv_made, align 8, !tbaa !5
%inc = add nsw i64 %0, 1
store i64 %inc, ptr @is_minv_made, align 8, !tbaa !5
%tobool.not = icmp eq i64 %0, 0
br i1 %tobool.not, label %for.end, label %return
for.end: ; preds = %entry
%1 = load ptr, ptr @inv_arr, align 8, !tbaa !32
%call = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %1, i64 noundef 16) #36
store ptr %call, ptr @inv_arr, align 8, !tbaa !32
%2 = load ptr, ptr @finv_arr, align 8, !tbaa !32
%call2 = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %2, i64 noundef 16) #36
store ptr %call2, ptr @finv_arr, align 8, !tbaa !32
%3 = load ptr, ptr @inv_arr, align 8, !tbaa !32
%arrayidx = getelementptr inbounds i64, ptr %3, i64 1
store i64 1, ptr %arrayidx, align 8, !tbaa !5
%arrayidx3 = getelementptr inbounds i64, ptr %call2, i64 1
store i64 1, ptr %arrayidx3, align 8, !tbaa !5
store i64 1, ptr %call2, align 8, !tbaa !5
%cmp7.not43 = icmp slt i64 %n, 2
br i1 %cmp7.not43, label %return, label %for.body9
for.body9: ; preds = %for.end, %for.body9
%4 = phi ptr [ %6, %for.body9 ], [ %3, %for.end ]
%i5.044 = phi i64 [ %add10, %for.body9 ], [ 2, %for.end ]
%add10 = add nuw nsw i64 %i5.044, 1
%mul = shl i64 %add10, 3
%call11 = tail call ptr @realloc(ptr noundef nonnull %4, i64 noundef %mul) #36
store ptr %call11, ptr @inv_arr, align 8, !tbaa !32
%5 = load ptr, ptr @finv_arr, align 8, !tbaa !32
%call14 = tail call ptr @realloc(ptr noundef %5, i64 noundef %mul) #36
store ptr %call14, ptr @finv_arr, align 8, !tbaa !32
%6 = load ptr, ptr @inv_arr, align 8, !tbaa !32
%rem = srem i64 %mod, %i5.044
%arrayidx15 = getelementptr inbounds i64, ptr %6, i64 %rem
%7 = load i64, ptr %arrayidx15, align 8, !tbaa !5
%div = sdiv i64 %mod, %i5.044
%mul16 = mul nsw i64 %div, %7
%rem17 = srem i64 %mul16, %mod
%sub = sub nsw i64 %mod, %rem17
%arrayidx18 = getelementptr inbounds i64, ptr %6, i64 %i5.044
store i64 %sub, ptr %arrayidx18, align 8, !tbaa !5
%8 = getelementptr i64, ptr %call14, i64 %i5.044
%arrayidx20 = getelementptr i64, ptr %8, i64 -1
%9 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%mul22 = mul nsw i64 %9, %sub
%rem23 = srem i64 %mul22, %mod
store i64 %rem23, ptr %8, align 8, !tbaa !5
%exitcond.not = icmp eq i64 %i5.044, %n
br i1 %exitcond.not, label %return, label %for.body9, !llvm.loop !38
return: ; preds = %for.body9, %for.end, %entry
ret i64 0
}
; Function Attrs: nounwind uwtable
define dso_local i64 @make_mf(i64 noundef %n, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @is_mf_made, align 8, !tbaa !5
%inc = add nsw i64 %0, 1
store i64 %inc, ptr @is_mf_made, align 8, !tbaa !5
%tobool.not = icmp eq i64 %0, 0
br i1 %tobool.not, label %for.end, label %return
for.end: ; preds = %entry
%1 = load ptr, ptr @mf_arr, align 8, !tbaa !32
%call = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %1, i64 noundef 16) #36
store ptr %call, ptr @mf_arr, align 8, !tbaa !32
%arrayidx = getelementptr inbounds i64, ptr %call, i64 1
store i64 1, ptr %arrayidx, align 8, !tbaa !5
store i64 1, ptr %call, align 8, !tbaa !5
%cmp5.not24 = icmp slt i64 %n, 2
br i1 %cmp5.not24, label %return, label %for.body7
for.body7: ; preds = %for.end, %for.body7
%2 = phi ptr [ %call10, %for.body7 ], [ %call, %for.end ]
%i3.026 = phi i64 [ %add8, %for.body7 ], [ 2, %for.end ]
%x.025 = phi i64 [ %rem, %for.body7 ], [ 1, %for.end ]
%mul = mul nsw i64 %i3.026, %x.025
%rem = srem i64 %mul, %mod
%add8 = add nuw nsw i64 %i3.026, 1
%mul9 = shl i64 %add8, 3
%call10 = tail call ptr @realloc(ptr noundef nonnull %2, i64 noundef %mul9) #36
%arrayidx11 = getelementptr inbounds i64, ptr %call10, i64 %i3.026
store i64 %rem, ptr %arrayidx11, align 8, !tbaa !5
%exitcond.not = icmp eq i64 %i3.026, %n
br i1 %exitcond.not, label %return.loopexit, label %for.body7, !llvm.loop !39
return.loopexit: ; preds = %for.body7
store ptr %call10, ptr @mf_arr, align 8, !tbaa !32
br label %return
return: ; preds = %return.loopexit, %for.end, %entry
ret i64 0
}
; Function Attrs: nounwind uwtable
define dso_local i64 @m_inv(i64 noundef %x, i64 noundef %mod, i64 noundef %is_fac) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%call = tail call i64 @makeinv(i64 noundef %0, i64 noundef %mod)
%tobool.not = icmp eq i64 %is_fac, 0
%inv_arr.val = load ptr, ptr @inv_arr, align 8
%finv_arr.val = load ptr, ptr @finv_arr, align 8
%.pn = select i1 %tobool.not, ptr %inv_arr.val, ptr %finv_arr.val
%cond.in = getelementptr inbounds i64, ptr %.pn, i64 %x
%cond = load i64, ptr %cond.in, align 8, !tbaa !5
ret i64 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i64 @m_f(i64 noundef %x, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%1 = load i64, ptr @is_mf_made, align 8, !tbaa !5
%inc.i = add nsw i64 %1, 1
store i64 %inc.i, ptr @is_mf_made, align 8, !tbaa !5
%tobool.not.i = icmp eq i64 %1, 0
%.pre = load ptr, ptr @mf_arr, align 8, !tbaa !32
br i1 %tobool.not.i, label %for.end.i, label %make_mf.exit
for.end.i: ; preds = %entry
%call.i = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %.pre, i64 noundef 16) #36
store ptr %call.i, ptr @mf_arr, align 8, !tbaa !32
%arrayidx.i = getelementptr inbounds i64, ptr %call.i, i64 1
store i64 1, ptr %arrayidx.i, align 8, !tbaa !5
store i64 1, ptr %call.i, align 8, !tbaa !5
%cmp5.not24.i = icmp slt i64 %0, 2
br i1 %cmp5.not24.i, label %make_mf.exit, label %for.body7.i
for.body7.i: ; preds = %for.end.i, %for.body7.i
%2 = phi ptr [ %call10.i, %for.body7.i ], [ %call.i, %for.end.i ]
%i3.026.i = phi i64 [ %add8.i, %for.body7.i ], [ 2, %for.end.i ]
%x.025.i = phi i64 [ %rem.i, %for.body7.i ], [ 1, %for.end.i ]
%mul.i = mul nsw i64 %x.025.i, %i3.026.i
%rem.i = srem i64 %mul.i, %mod
%add8.i = add nuw nsw i64 %i3.026.i, 1
%mul9.i = shl i64 %add8.i, 3
%call10.i = tail call ptr @realloc(ptr noundef nonnull %2, i64 noundef %mul9.i) #36
%arrayidx11.i = getelementptr inbounds i64, ptr %call10.i, i64 %i3.026.i
store i64 %rem.i, ptr %arrayidx11.i, align 8, !tbaa !5
%exitcond.not.i = icmp eq i64 %i3.026.i, %0
br i1 %exitcond.not.i, label %return.loopexit.i, label %for.body7.i, !llvm.loop !39
return.loopexit.i: ; preds = %for.body7.i
store ptr %call10.i, ptr @mf_arr, align 8, !tbaa !32
br label %make_mf.exit
make_mf.exit: ; preds = %entry, %for.end.i, %return.loopexit.i
%3 = phi ptr [ %.pre, %entry ], [ %call.i, %for.end.i ], [ %call10.i, %return.loopexit.i ]
%arrayidx = getelementptr inbounds i64, ptr %3, i64 %x
%4 = load i64, ptr %arrayidx, align 8, !tbaa !5
ret i64 %4
}
; Function Attrs: nounwind uwtable
define dso_local i64 @mod_nck(i64 noundef %n, i64 noundef %k, i64 noundef %mod) local_unnamed_addr #10 {
entry:
%0 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%1 = load i64, ptr @is_mf_made, align 8, !tbaa !5
%inc.i.i = add nsw i64 %1, 1
store i64 %inc.i.i, ptr @is_mf_made, align 8, !tbaa !5
%tobool.not.i.i = icmp eq i64 %1, 0
%.pre.i = load ptr, ptr @mf_arr, align 8, !tbaa !32
br i1 %tobool.not.i.i, label %for.end.i.i, label %m_f.exit
for.end.i.i: ; preds = %entry
%call.i.i = tail call dereferenceable_or_null(16) ptr @realloc(ptr noundef %.pre.i, i64 noundef 16) #36
store ptr %call.i.i, ptr @mf_arr, align 8, !tbaa !32
%arrayidx.i.i = getelementptr inbounds i64, ptr %call.i.i, i64 1
store i64 1, ptr %arrayidx.i.i, align 8, !tbaa !5
store i64 1, ptr %call.i.i, align 8, !tbaa !5
%cmp5.not24.i.i = icmp slt i64 %0, 2
br i1 %cmp5.not24.i.i, label %m_f.exit, label %for.body7.i.i
for.body7.i.i: ; preds = %for.end.i.i, %for.body7.i.i
%2 = phi ptr [ %call10.i.i, %for.body7.i.i ], [ %call.i.i, %for.end.i.i ]
%i3.026.i.i = phi i64 [ %add8.i.i, %for.body7.i.i ], [ 2, %for.end.i.i ]
%x.025.i.i = phi i64 [ %rem.i.i, %for.body7.i.i ], [ 1, %for.end.i.i ]
%mul.i.i = mul nsw i64 %x.025.i.i, %i3.026.i.i
%rem.i.i = srem i64 %mul.i.i, %mod
%add8.i.i = add nuw nsw i64 %i3.026.i.i, 1
%mul9.i.i = shl i64 %add8.i.i, 3
%call10.i.i = tail call ptr @realloc(ptr noundef nonnull %2, i64 noundef %mul9.i.i) #36
%arrayidx11.i.i = getelementptr inbounds i64, ptr %call10.i.i, i64 %i3.026.i.i
store i64 %rem.i.i, ptr %arrayidx11.i.i, align 8, !tbaa !5
%exitcond.not.i.i = icmp eq i64 %i3.026.i.i, %0
br i1 %exitcond.not.i.i, label %return.loopexit.i.i, label %for.body7.i.i, !llvm.loop !39
return.loopexit.i.i: ; preds = %for.body7.i.i
store ptr %call10.i.i, ptr @mf_arr, align 8, !tbaa !32
br label %m_f.exit
m_f.exit: ; preds = %entry, %for.end.i.i, %return.loopexit.i.i
%3 = phi ptr [ %.pre.i, %entry ], [ %call.i.i, %for.end.i.i ], [ %call10.i.i, %return.loopexit.i.i ]
%arrayidx.i = getelementptr inbounds i64, ptr %3, i64 %n
%4 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%5 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%call.i = tail call i64 @makeinv(i64 noundef %5, i64 noundef %mod)
%finv_arr.val.i = load ptr, ptr @finv_arr, align 8
%cond.in.i = getelementptr inbounds i64, ptr %finv_arr.val.i, i64 %k
%cond.i = load i64, ptr %cond.in.i, align 8, !tbaa !5
%mul = mul nsw i64 %cond.i, %4
%rem = srem i64 %mul, %mod
%sub = sub nsw i64 %n, %k
%6 = load i64, ptr @num_of_inv, align 8, !tbaa !5
%call.i11 = tail call i64 @makeinv(i64 noundef %6, i64 noundef %mod)
%finv_arr.val.i13 = load ptr, ptr @finv_arr, align 8
%cond.in.i14 = getelementptr inbounds i64, ptr %finv_arr.val.i13, i64 %sub
%cond.i15 = load i64, ptr %cond.in.i14, align 8, !tbaa !5
%mul3 = mul nsw i64 %cond.i15, %rem
%rem4 = srem i64 %mul3, %mod
ret i64 %rem4
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @m_p(i64 noundef %r, i64 noundef %n, i64 noundef %mod) local_unnamed_addr #6 {
entry:
%cmp16 = icmp sgt i64 %n, 0
br i1 %cmp16, label %while.body, label %while.end
while.body: ; preds = %entry, %cond.end
%s.019 = phi i64 [ %rem2, %cond.end ], [ %r, %entry ]
%t.018 = phi i64 [ %cond, %cond.end ], [ 1, %entry ]
%n.addr.017 = phi i64 [ %shr, %cond.end ], [ %n, %entry ]
%and = and i64 %n.addr.017, 1
%tobool.not = icmp eq i64 %and, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.true: ; preds = %while.body
%mul = mul nsw i64 %s.019, %t.018
%rem = srem i64 %mul, %mod
br label %cond.end
cond.end: ; preds = %while.body, %cond.true
%cond = phi i64 [ %rem, %cond.true ], [ %t.018, %while.body ]
%mul1 = mul nsw i64 %s.019, %s.019
%rem2 = srem i64 %mul1, %mod
%shr = lshr i64 %n.addr.017, 1
%cmp.not = icmp ult i64 %n.addr.017, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !40
while.end: ; preds = %cond.end, %entry
%t.0.lcssa = phi i64 [ 1, %entry ], [ %cond, %cond.end ]
%tobool3.not = icmp eq i64 %r, 0
%cond7 = select i1 %tobool3.not, i64 0, i64 %t.0.lcssa
ret i64 %cond7
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul2(i64 noundef %a, i64 noundef %b, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul3(i64 noundef %a, i64 noundef %b, i64 noundef %c, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
%mul.i = mul nsw i64 %rem, %c
%rem.i = srem i64 %mul.i, %mod
ret i64 %rem.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul4(i64 noundef %a, i64 noundef %b, i64 noundef %c, i64 noundef %d, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
%mul.i = mul nsw i64 %rem, %c
%rem.i = srem i64 %mul.i, %mod
%mul.i.i = mul nsw i64 %rem.i, %d
%rem.i.i = srem i64 %mul.i.i, %mod
ret i64 %rem.i.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @m_mul5(i64 noundef %a, i64 noundef %b, i64 noundef %c, i64 noundef %d, i64 noundef %e, i64 noundef %mod) local_unnamed_addr #7 {
entry:
%mul = mul nsw i64 %b, %a
%rem = srem i64 %mul, %mod
%mul.i = mul nsw i64 %rem, %c
%rem.i = srem i64 %mul.i, %mod
%mul.i.i = mul nsw i64 %rem.i, %d
%rem.i.i = srem i64 %mul.i.i, %mod
%mul.i.i.i = mul nsw i64 %rem.i.i, %e
%rem.i.i.i = srem i64 %mul.i.i.i, %mod
ret i64 %rem.i.i.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #13 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #13 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_string(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #14 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #37
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #15
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #13 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !22
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !22
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #38
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #16
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @downll) #38
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_string(i32 noundef %n, i32 noundef %size, ptr noundef %s) local_unnamed_addr #2 {
entry:
%0 = zext i32 %size to i64
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %s, i64 noundef %conv, i64 noundef %0, ptr noundef nonnull @cmp_string) #38
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_char(ptr noundef %s) local_unnamed_addr #2 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #37
tail call void @qsort(ptr noundef %s, i64 noundef %call, i64 noundef 1, ptr noundef nonnull @cmp_char) #38
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #15
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_string(i64 noundef %n, i64 noundef %size, ptr nocapture noundef readonly %s) local_unnamed_addr #17 {
entry:
%cmp8 = icmp sgt i64 %n, 1
br i1 %cmp8, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %entry, %for.body
%i.010 = phi i64 [ %inc2, %for.body ], [ 1, %entry ]
%ans.09 = phi i64 [ %spec.select, %for.body ], [ 1, %entry ]
%0 = mul nsw i64 %i.010, %size
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %0
%sub = add nsw i64 %i.010, -1
%1 = mul nsw i64 %sub, %size
%arrayidx1 = getelementptr inbounds i8, ptr %s, i64 %1
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %arrayidx1) #37
%tobool.not = icmp ne i32 %call, 0
%inc = zext i1 %tobool.not to i64
%spec.select = add nuw nsw i64 %ans.09, %inc
%inc2 = add nuw nsw i64 %i.010, 1
%exitcond.not = icmp eq i64 %inc2, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !41
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @unique_num(i64 noundef %n, ptr nocapture noundef readonly %a) local_unnamed_addr #8 {
entry:
%cmp9 = icmp sgt i64 %n, 1
br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = add i64 %n, -1
%min.iters.check = icmp ult i64 %n, 5
br i1 %min.iters.check, label %for.body.preheader16, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -4
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ <i64 1, i64 0>, %vector.ph ], [ %9, %vector.body ]
%vec.phi12 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds i64, ptr %a, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load13 = load <2 x i64>, ptr %2, align 8, !tbaa !5
%3 = getelementptr i64, ptr %1, i64 -1
%wide.load14 = load <2 x i64>, ptr %3, align 8, !tbaa !5
%4 = getelementptr i64, ptr %1, i64 1
%wide.load15 = load <2 x i64>, ptr %4, align 8, !tbaa !5
%5 = icmp ne <2 x i64> %wide.load, %wide.load14
%6 = icmp ne <2 x i64> %wide.load13, %wide.load15
%7 = zext <2 x i1> %5 to <2 x i64>
%8 = zext <2 x i1> %6 to <2 x i64>
%9 = add <2 x i64> %vec.phi, %7
%10 = add <2 x i64> %vec.phi12, %8
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !42
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %10, %9
%12 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader16
for.body.preheader16: ; preds = %for.body.preheader, %middle.block
%i.011.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%ans.010.ph = phi i64 [ 1, %for.body.preheader ], [ %12, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ans.0.lcssa
for.body: ; preds = %for.body.preheader16, %for.body
%i.011 = phi i64 [ %inc3, %for.body ], [ %i.011.ph, %for.body.preheader16 ]
%ans.010 = phi i64 [ %spec.select, %for.body ], [ %ans.010.ph, %for.body.preheader16 ]
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.011
%13 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx1 = getelementptr i64, ptr %arrayidx, i64 -1
%14 = load i64, ptr %arrayidx1, align 8, !tbaa !5
%cmp2.not = icmp ne i64 %13, %14
%inc = zext i1 %cmp2.not to i64
%spec.select = add nuw nsw i64 %ans.010, %inc
%inc3 = add nuw nsw i64 %i.011, 1
%exitcond.not = icmp eq i64 %inc3, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !43
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @compare(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%cmp = icmp slt i64 %a, %b
%cmp1 = icmp sgt i64 %a, %b
%0 = zext i1 %cmp1 to i64
%cond2 = select i1 %cmp, i64 -1, i64 %0
ret i64 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp1(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #13 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !44
%1 = load i64, ptr %q, align 8, !tbaa !44
%cmp.i = icmp slt i64 %0, %1
%cmp1.i = icmp sgt i64 %0, %1
%2 = zext i1 %cmp1.i to i32
%conv = select i1 %cmp.i, i32 -1, i32 %2
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp2(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #13 {
entry:
%0 = load i64, ptr %p, align 8, !tbaa !44
%1 = load i64, ptr %q, align 8, !tbaa !44
%cmp.i = icmp slt i64 %1, %0
%cmp1.i = icmp sgt i64 %1, %0
%2 = zext i1 %cmp1.i to i32
%conv = select i1 %cmp.i, i32 -1, i32 %2
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp1) #38
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @strsortdown(ptr noundef %a, i32 noundef %n) local_unnamed_addr #2 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 16, ptr noundef nonnull @cmp2) #38
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_partial(ptr nocapture noundef %a, i32 noundef %begin, i32 noundef %end, i32 noundef %is_increase) local_unnamed_addr #2 {
entry:
%sub = sub nsw i32 %end, %begin
%conv = sext i32 %sub to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #39
%cmp45 = icmp slt i32 %begin, %end
br i1 %cmp45, label %for.body.preheader, label %for.cond.cleanup15.critedge
for.body.preheader: ; preds = %entry
%conv2 = sext i32 %end to i64
%conv1 = sext i32 %begin to i64
%0 = shl nsw i64 %conv1, 3
%scevgep = getelementptr i8, ptr %a, i64 %0
%1 = sub nsw i64 %conv2, %conv1
%2 = shl nsw i64 %1, 3
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %call, ptr align 8 %scevgep, i64 %2, i1 false), !tbaa !5
%tobool.not = icmp eq i32 %is_increase, 0
%downll.upll = select i1 %tobool.not, ptr @downll, ptr @upll
tail call void @qsort(ptr noundef %call, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull %downll.upll) #38
%3 = shl nsw i64 %conv1, 3
%scevgep49 = getelementptr i8, ptr %a, i64 %3
%4 = sub nsw i64 %conv2, %conv1
%5 = shl nsw i64 %4, 3
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %scevgep49, ptr align 8 %call, i64 %5, i1 false), !tbaa !5
br label %for.cond.cleanup15
for.cond.cleanup15.critedge: ; preds = %entry
%tobool.not.c = icmp eq i32 %is_increase, 0
%downll.upll.c = select i1 %tobool.not.c, ptr @downll, ptr @upll
tail call void @qsort(ptr noundef %call, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull %downll.upll.c) #38
br label %for.cond.cleanup15
for.cond.cleanup15: ; preds = %for.cond.cleanup15.critedge, %for.body.preheader
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 #18
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @AVL_set_inside_rotate(ptr nocapture noundef %node, i32 noundef %is_right) local_unnamed_addr #19 {
entry:
%cmp = icmp eq i32 %is_right, 0
%cmp1 = icmp eq i32 %is_right, 1
%cond = select i1 %cmp, i32 -1, i32 1
%0 = load ptr, ptr %node, align 8, !tbaa !32
%idxprom = zext i1 %cmp to i64
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%cmp3.not = icmp eq ptr %1, null
br i1 %cmp3.not, label %if.end43, label %if.then
if.then: ; preds = %entry
%diff = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 1
%2 = load i32, ptr %diff, align 8, !tbaa !46
%mul = mul nsw i32 %2, %cond
%diff8 = getelementptr inbounds %struct.node_AVL_set, ptr %1, i64 0, i32 1
%3 = load i32, ptr %diff8, align 8, !tbaa !46
%mul9 = mul nsw i32 %3, %cond
%tobool10.not = icmp eq i32 %mul9, -1
br i1 %tobool10.not, label %if.else, label %if.then11
if.then11: ; preds = %if.then
%4 = xor i32 %mul9, -1
%tobool14.not = icmp eq i32 %2, %3
%sub15 = add nsw i32 %mul9, -1
%sub16 = add nsw i32 %mul, -2
%cond17 = select i1 %tobool14.not, i32 %sub16, i32 %sub15
br label %if.end
if.else: ; preds = %if.then
%tobool19.not = icmp eq i32 %2, 0
%cond26 = select i1 %tobool19.not, i32 -3, i32 -2
br label %if.end
if.end: ; preds = %if.else, %if.then11
%.pn = phi i32 [ %4, %if.then11 ], [ -1, %if.else ]
%nb.0 = phi i32 [ %cond17, %if.then11 ], [ %cond26, %if.else ]
%na.0 = add i32 %.pn, %mul
%mul27 = mul nsw i32 %na.0, %cond
store i32 %mul27, ptr %diff, align 8, !tbaa !46
%mul29 = mul nsw i32 %nb.0, %cond
store i32 %mul29, ptr %diff8, align 8, !tbaa !46
%idxprom35 = zext i1 %cmp1 to i64
%arrayidx36 = getelementptr inbounds %struct.node_AVL_set, ptr %1, i64 0, i32 3, i64 %idxprom35
%5 = load ptr, ptr %arrayidx36, align 8, !tbaa !32
store ptr %5, ptr %arrayidx, align 8, !tbaa !32
%6 = load ptr, ptr %node, align 8, !tbaa !32
store ptr %6, ptr %arrayidx36, align 8, !tbaa !32
store ptr %1, ptr %node, align 8, !tbaa !32
br label %if.end43
if.end43: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @AVL_set_inside_update(ptr nocapture noundef %node, i64 noundef %data, i32 noundef %add) local_unnamed_addr #10 {
entry:
%0 = load ptr, ptr %node, align 8, !tbaa !32
%cmp = icmp eq ptr %0, null
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%cmp1 = icmp eq i32 %add, 2
br i1 %cmp1, label %if.then2, label %return
if.then2: ; preds = %if.then
%call = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #39
store ptr %call, ptr %node, align 8, !tbaa !32
store i64 %data, ptr %call, align 8, !tbaa !48
%cnt = getelementptr inbounds %struct.node_AVL_set, ptr %call, i64 0, i32 2
store i32 1, ptr %cnt, align 4, !tbaa !49
%diff = getelementptr inbounds %struct.node_AVL_set, ptr %call, i64 0, i32 1
store i32 0, ptr %diff, align 8, !tbaa !46
%child = getelementptr inbounds %struct.node_AVL_set, ptr %call, i64 0, i32 3
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %child, i8 0, i64 16, i1 false)
br label %return
if.else: ; preds = %entry
%1 = load i64, ptr %0, align 8, !tbaa !48
%cmp8 = icmp eq i64 %1, %data
br i1 %cmp8, label %if.then10, label %if.else56
if.then10: ; preds = %if.else
switch i32 %add, label %land.lhs.true [
i32 2, label %if.then13
i32 0, label %if.else21
]
if.then13: ; preds = %if.then10
%cnt14 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 2
%2 = load i32, ptr %cnt14, align 4, !tbaa !49
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %cnt14, align 4, !tbaa !49
br label %return
land.lhs.true: ; preds = %if.then10
%cnt16 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 2
%3 = load i32, ptr %cnt16, align 4, !tbaa !49
%cmp17 = icmp sgt i32 %3, 1
br i1 %cmp17, label %if.then19, label %if.else21
if.then19: ; preds = %land.lhs.true
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %cnt16, align 4, !tbaa !49
br label %return
if.else21: ; preds = %if.then10, %land.lhs.true
%child22 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3
%arrayidx23 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3, i64 1
%4 = load ptr, ptr %arrayidx23, align 8, !tbaa !32
%cmp24 = icmp eq ptr %4, null
%5 = load ptr, ptr %child22, align 8, !tbaa !32
br i1 %cmp24, label %if.then26, label %if.else29
if.then26: ; preds = %if.else21
tail call void @free(ptr noundef nonnull %0) #38
store ptr %5, ptr %node, align 8, !tbaa !32
br label %return
if.else29: ; preds = %if.else21
%cmp32 = icmp eq ptr %5, null
br i1 %cmp32, label %if.then34, label %for.cond
if.then34: ; preds = %if.else29
tail call void @free(ptr noundef nonnull %0) #38
store ptr %4, ptr %node, align 8, !tbaa !32
br label %return
for.cond: ; preds = %if.else29, %for.cond
%next_node.0 = phi ptr [ %6, %for.cond ], [ %5, %if.else29 ]
%arrayidx41 = getelementptr inbounds %struct.node_AVL_set, ptr %next_node.0, i64 0, i32 3, i64 1
%6 = load ptr, ptr %arrayidx41, align 8, !tbaa !32
%cmp42.not = icmp eq ptr %6, null
br i1 %cmp42.not, label %for.end, label %for.cond, !llvm.loop !50
for.end: ; preds = %for.cond
%7 = load i64, ptr %next_node.0, align 8, !tbaa !48
store i64 %7, ptr %0, align 8, !tbaa !48
%8 = load i64, ptr %next_node.0, align 8, !tbaa !48
%call51 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %child22, i64 noundef %8, i32 noundef %add), !range !51
br label %if.end69
if.else56: ; preds = %if.else
%cmp58.not = icmp sle i64 %1, %data
%cmp62 = icmp sgt i64 %1, %data
%cond64 = select i1 %cmp62, i32 1, i32 -1
%idxprom66 = zext i1 %cmp58.not to i64
%arrayidx67 = getelementptr inbounds %struct.node_AVL_set, ptr %0, i64 0, i32 3, i64 %idxprom66
%call68 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx67, i64 noundef %data, i32 noundef %add), !range !51
br label %if.end69
if.end69: ; preds = %if.else56, %for.end
%delta.0 = phi i32 [ %call51, %for.end ], [ %call68, %if.else56 ]
%delta_sign.0 = phi i32 [ 1, %for.end ], [ %cond64, %if.else56 ]
%tobool70.not = icmp eq i32 %delta.0, 0
br i1 %tobool70.not, label %return, label %if.then71
if.then71: ; preds = %if.end69
%9 = load ptr, ptr %node, align 8, !tbaa !32
%diff72 = getelementptr inbounds %struct.node_AVL_set, ptr %9, i64 0, i32 1
%10 = load i32, ptr %diff72, align 8, !tbaa !46
%mul = mul nsw i32 %delta_sign.0, %delta.0
%add74 = add nsw i32 %10, %mul
store i32 %add74, ptr %diff72, align 8, !tbaa !46
%cmp76 = icmp sgt i32 %add74, 1
br i1 %cmp76, label %if.then87, label %if.else79
if.else79: ; preds = %if.then71
%cmp81 = icmp slt i32 %add74, -1
br i1 %cmp81, label %if.then87, label %if.end110
if.then87: ; preds = %if.else79, %if.then71
%rotate_l.0.ph = phi i64 [ 0, %if.then71 ], [ 1, %if.else79 ]
%diff_sign.0.ph = phi i32 [ 1, %if.then71 ], [ -1, %if.else79 ]
%cmp.i197 = xor i1 %cmp76, true
%arrayidx90 = getelementptr inbounds %struct.node_AVL_set, ptr %9, i64 0, i32 3, i64 %rotate_l.0.ph
%11 = load ptr, ptr %arrayidx90, align 8, !tbaa !32
%diff91 = getelementptr inbounds %struct.node_AVL_set, ptr %11, i64 0, i32 1
%12 = load i32, ptr %diff91, align 8, !tbaa !46
%mul96 = mul nsw i32 %12, %diff_sign.0.ph
%cmp97 = icmp slt i32 %mul96, 0
br i1 %cmp97, label %if.then99, label %if.end104
if.then99: ; preds = %if.then87
%cond.i = select i1 %cmp76, i32 -1, i32 1
%idxprom.i = zext i1 %cmp76 to i64
%arrayidx.i = getelementptr inbounds %struct.node_AVL_set, ptr %11, i64 0, i32 3, i64 %idxprom.i
%13 = load ptr, ptr %arrayidx.i, align 8, !tbaa !32
%cmp3.not.i = icmp eq ptr %13, null
br i1 %cmp3.not.i, label %if.end104, label %if.then.i
if.then.i: ; preds = %if.then99
%mul.i = mul nsw i32 %12, %cond.i
%diff8.i = getelementptr inbounds %struct.node_AVL_set, ptr %13, i64 0, i32 1
%14 = load i32, ptr %diff8.i, align 8, !tbaa !46
%mul9.i = mul nsw i32 %14, %cond.i
%tobool10.not.i = icmp eq i32 %mul9.i, -1
br i1 %tobool10.not.i, label %if.else.i, label %if.then11.i
if.then11.i: ; preds = %if.then.i
%15 = xor i32 %mul9.i, -1
%tobool14.not.i = icmp eq i32 %12, %14
%sub15.i = add nsw i32 %mul9.i, -1
%sub16.i = add nsw i32 %mul.i, -2
%cond17.i = select i1 %tobool14.not.i, i32 %sub16.i, i32 %sub15.i
br label %if.end.i
if.else.i: ; preds = %if.then.i
%tobool19.not.i = icmp eq i32 %12, 0
%cond26.i = select i1 %tobool19.not.i, i32 -3, i32 -2
br label %if.end.i
if.end.i: ; preds = %if.else.i, %if.then11.i
%.pn.i = phi i32 [ %15, %if.then11.i ], [ -1, %if.else.i ]
%nb.0.i = phi i32 [ %cond17.i, %if.then11.i ], [ %cond26.i, %if.else.i ]
%na.0.i = add i32 %.pn.i, %mul.i
%mul27.i = mul nsw i32 %na.0.i, %cond.i
store i32 %mul27.i, ptr %diff91, align 8, !tbaa !46
%mul29.i = mul nsw i32 %nb.0.i, %cond.i
store i32 %mul29.i, ptr %diff8.i, align 8, !tbaa !46
%idxprom35.i = zext i1 %cmp.i197 to i64
%arrayidx36.i = getelementptr inbounds %struct.node_AVL_set, ptr %13, i64 0, i32 3, i64 %idxprom35.i
%16 = load ptr, ptr %arrayidx36.i, align 8, !tbaa !32
store ptr %16, ptr %arrayidx.i, align 8, !tbaa !32
%17 = load ptr, ptr %arrayidx90, align 8, !tbaa !32
store ptr %17, ptr %arrayidx36.i, align 8, !tbaa !32
store ptr %13, ptr %arrayidx90, align 8, !tbaa !32
%.pre = load ptr, ptr %node, align 8, !tbaa !32
br label %if.end104
if.end104: ; preds = %if.end.i, %if.then99, %if.then87
%18 = phi ptr [ %.pre, %if.end.i ], [ %9, %if.then99 ], [ %9, %if.then87 ]
%cond.i199 = select i1 %cmp76, i32 1, i32 -1
%idxprom.i200 = zext i1 %cmp.i197 to i64
%arrayidx.i201 = getelementptr inbounds %struct.node_AVL_set, ptr %18, i64 0, i32 3, i64 %idxprom.i200
%19 = load ptr, ptr %arrayidx.i201, align 8, !tbaa !32
%cmp3.not.i202 = icmp eq ptr %19, null
br i1 %cmp3.not.i202, label %AVL_set_inside_rotate.exit225, label %if.then.i203
if.then.i203: ; preds = %if.end104
%diff.i204 = getelementptr inbounds %struct.node_AVL_set, ptr %18, i64 0, i32 1
%20 = load i32, ptr %diff.i204, align 8, !tbaa !46
%mul.i205 = mul nsw i32 %20, %cond.i199
%diff8.i206 = getelementptr inbounds %struct.node_AVL_set, ptr %19, i64 0, i32 1
%21 = load i32, ptr %diff8.i206, align 8, !tbaa !46
%mul9.i207 = mul nsw i32 %21, %cond.i199
%tobool10.not.i208 = icmp eq i32 %mul9.i207, -1
br i1 %tobool10.not.i208, label %if.else.i222, label %if.then11.i209
if.then11.i209: ; preds = %if.then.i203
%22 = xor i32 %mul9.i207, -1
%tobool14.not.i210 = icmp eq i32 %20, %21
%sub15.i211 = add nsw i32 %mul9.i207, -1
%sub16.i212 = add nsw i32 %mul.i205, -2
%cond17.i213 = select i1 %tobool14.not.i210, i32 %sub16.i212, i32 %sub15.i211
br label %if.end.i214
if.else.i222: ; preds = %if.then.i203
%tobool19.not.i223 = icmp eq i32 %20, 0
%cond26.i224 = select i1 %tobool19.not.i223, i32 -3, i32 -2
br label %if.end.i214
if.end.i214: ; preds = %if.else.i222, %if.then11.i209
%.pn.i215 = phi i32 [ %22, %if.then11.i209 ], [ -1, %if.else.i222 ]
%nb.0.i216 = phi i32 [ %cond17.i213, %if.then11.i209 ], [ %cond26.i224, %if.else.i222 ]
%na.0.i217 = add i32 %.pn.i215, %mul.i205
%mul27.i218 = mul nsw i32 %na.0.i217, %cond.i199
store i32 %mul27.i218, ptr %diff.i204, align 8, !tbaa !46
%mul29.i219 = mul nsw i32 %nb.0.i216, %cond.i199
store i32 %mul29.i219, ptr %diff8.i206, align 8, !tbaa !46
%idxprom35.i220 = zext i1 %cmp76 to i64
%arrayidx36.i221 = getelementptr inbounds %struct.node_AVL_set, ptr %19, i64 0, i32 3, i64 %idxprom35.i220
%23 = load ptr, ptr %arrayidx36.i221, align 8, !tbaa !32
store ptr %23, ptr %arrayidx.i201, align 8, !tbaa !32
%24 = load ptr, ptr %node, align 8, !tbaa !32
store ptr %24, ptr %arrayidx36.i221, align 8, !tbaa !32
store ptr %19, ptr %node, align 8, !tbaa !32
br label %AVL_set_inside_rotate.exit225
AVL_set_inside_rotate.exit225: ; preds = %if.end104, %if.end.i214
%cmp105 = icmp slt i32 %delta.0, 0
%cmp107 = icmp ne i32 %12, 0
%25 = and i1 %cmp105, %cmp107
%cond109 = sext i1 %25 to i32
br label %return
if.end110: ; preds = %if.else79
%cmp111 = icmp sgt i32 %delta.0, 0
%cmp114 = icmp eq i32 %10, 0
%or.cond = and i1 %cmp111, %cmp114
br i1 %or.cond, label %return, label %if.else117
if.else117: ; preds = %if.end110
%cmp118 = icmp slt i32 %delta.0, 0
%cmp121 = icmp ne i32 %10, 0
%or.cond134 = and i1 %cmp118, %cmp121
%. = sext i1 %or.cond134 to i32
br label %return
return: ; preds = %if.then13, %if.then19, %if.then26, %if.then34, %if.else117, %if.end110, %AVL_set_inside_rotate.exit225, %if.end69, %if.then2, %if.then
%retval.2 = phi i32 [ 1, %if.then2 ], [ 0, %if.then ], [ 0, %if.then13 ], [ 0, %if.then19 ], [ -1, %if.then26 ], [ -1, %if.then34 ], [ %cond109, %AVL_set_inside_rotate.exit225 ], [ 1, %if.end110 ], [ %., %if.else117 ], [ 0, %if.end69 ]
ret i32 %retval.2
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #20
; Function Attrs: nofree nounwind uwtable
define dso_local void @AVL_set_inside_print(ptr noundef readonly %node, i32 noundef %depth) local_unnamed_addr #2 {
entry:
%cmp9 = icmp eq ptr %node, null
br i1 %cmp9, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%depth.tr11 = phi i32 [ %add, %if.end ], [ %depth, %entry ]
%node.tr10 = phi ptr [ %3, %if.end ], [ %node, %entry ]
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node.tr10, i64 0, i32 3
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %node.tr10, i64 0, i32 3, i64 1
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%add = add nsw i32 %depth.tr11, 1
tail call void @AVL_set_inside_print(ptr noundef %0, i32 noundef %add)
%1 = load i64, ptr %node.tr10, align 8, !tbaa !48
%cnt = getelementptr inbounds %struct.node_AVL_set, ptr %node.tr10, i64 0, i32 2
%2 = load i32, ptr %cnt, align 4, !tbaa !49
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %1, i32 noundef %2)
%3 = load ptr, ptr %child, align 8, !tbaa !32
%cmp = icmp eq ptr %3, null
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @AVL_set_inside_free(ptr noundef %node) local_unnamed_addr #10 {
entry:
%cmp = icmp eq ptr %node, null
br i1 %cmp, label %common.ret6, label %if.end
common.ret6: ; preds = %entry, %if.end
ret void
if.end: ; preds = %entry
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node, i64 0, i32 3
%0 = load ptr, ptr %child, align 8, !tbaa !32
tail call void @AVL_set_inside_free(ptr noundef %0)
%arrayidx2 = getelementptr inbounds %struct.node_AVL_set, ptr %node, i64 0, i32 3, i64 1
%1 = load ptr, ptr %arrayidx2, align 8, !tbaa !32
tail call void @AVL_set_inside_free(ptr noundef %1)
tail call void @free(ptr noundef nonnull %node) #38
br label %common.ret6
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @AVL_set_inside_count(ptr noundef readonly %root, i64 noundef %val) local_unnamed_addr #21 {
entry:
%tobool.not16 = icmp eq ptr %root, null
br i1 %tobool.not16, label %cleanup, label %while.body
while.body: ; preds = %entry, %if.end8
%node.017 = phi ptr [ %node.1, %if.end8 ], [ %root, %entry ]
%0 = load i64, ptr %node.017, align 8, !tbaa !48
%cmp = icmp sgt i64 %0, %val
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %while.body
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node.017, i64 0, i32 3
br label %if.end8
if.else: ; preds = %while.body
%cmp3 = icmp slt i64 %0, %val
br i1 %cmp3, label %if.then4, label %if.else7
if.then4: ; preds = %if.else
%arrayidx6 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017, i64 0, i32 3, i64 1
br label %if.end8
if.else7: ; preds = %if.else
%cnt = getelementptr inbounds %struct.node_AVL_set, ptr %node.017, i64 0, i32 2
%1 = load i32, ptr %cnt, align 4, !tbaa !49
%conv = sext i32 %1 to i64
br label %cleanup
if.end8: ; preds = %if.then4, %if.then
%node.1.in = phi ptr [ %child, %if.then ], [ %arrayidx6, %if.then4 ]
%node.1 = load ptr, ptr %node.1.in, align 8, !tbaa !32
%tobool.not = icmp eq ptr %node.1, null
br i1 %tobool.not, label %cleanup, label %while.body, !llvm.loop !52
cleanup: ; preds = %if.end8, %entry, %if.else7
%retval.0 = phi i64 [ %conv, %if.else7 ], [ 0, %entry ], [ 0, %if.end8 ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @AVL_set_lowcomp(i64 noundef %node, i64 noundef %val, i32 noundef %type) local_unnamed_addr #7 {
entry:
%cmp = icmp eq i64 %node, %val
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%cmp1.not = icmp eq i32 %type, 3
%. = zext i1 %cmp1.not to i32
br label %return
if.end: ; preds = %entry
%cmp3 = icmp slt i64 %node, %val
br i1 %cmp3, label %return, label %if.end5
if.end5: ; preds = %if.end
%cmp6 = icmp sgt i64 %node, %val
%.13 = sext i1 %cmp6 to i32
br label %return
return: ; preds = %if.end5, %if.end, %if.then
%retval.0 = phi i32 [ %., %if.then ], [ 1, %if.end ], [ %.13, %if.end5 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @AVL_set_inside_lowerbound(ptr noundef readonly %root, i64 noundef %val, i32 noundef %type) local_unnamed_addr #22 {
entry:
%tobool.not42 = icmp eq ptr %root, null
br i1 %tobool.not42, label %common.ret50, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%cmp1.not.i = icmp eq i32 %type, 3
%..i = zext i1 %cmp1.not.i to i32
br label %while.body
while.body: ; preds = %while.body.lr.ph, %cleanup16
%node.043 = phi ptr [ %root, %while.body.lr.ph ], [ %2, %cleanup16 ]
%0 = load i64, ptr %node.043, align 8, !tbaa !48
%cmp.i = icmp eq i64 %0, %val
br i1 %cmp.i, label %AVL_set_lowcomp.exit, label %if.end.i
if.end.i: ; preds = %while.body
%cmp3.i = icmp slt i64 %0, %val
br i1 %cmp3.i, label %cleanup16, label %if.end5.i
if.end5.i: ; preds = %if.end.i
%cmp6.i = icmp sgt i64 %0, %val
%.13.i = sext i1 %cmp6.i to i32
br label %AVL_set_lowcomp.exit
AVL_set_lowcomp.exit: ; preds = %while.body, %if.end5.i
%retval.0.i = phi i32 [ %.13.i, %if.end5.i ], [ %..i, %while.body ]
switch i32 %retval.0.i, label %if.then6 [
i32 0, label %common.ret50
i32 1, label %cleanup16
]
common.ret50: ; preds = %entry, %cleanup16, %AVL_set_lowcomp.exit, %if.then6
%common.ret50.op = phi ptr [ %retval.1, %if.then6 ], [ null, %entry ], [ %node.043, %AVL_set_lowcomp.exit ], [ null, %cleanup16 ]
ret ptr %common.ret50.op
if.then6: ; preds = %AVL_set_lowcomp.exit
%child7 = getelementptr inbounds %struct.node_AVL_set, ptr %node.043, i64 0, i32 3
%1 = load ptr, ptr %child7, align 8, !tbaa !32
%call9 = tail call ptr @AVL_set_inside_lowerbound(ptr noundef %1, i64 noundef %val, i32 noundef %type)
%cmp10 = icmp eq i32 %type, 1
%cmp12.not = icmp eq ptr %call9, null
%node.1.call9 = select i1 %cmp12.not, ptr %node.043, ptr %call9
%retval.1 = select i1 %cmp10, ptr %call9, ptr %node.1.call9
br label %common.ret50
cleanup16: ; preds = %if.end.i, %AVL_set_lowcomp.exit
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %node.043, i64 0, i32 3, i64 1
%2 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%tobool.not = icmp eq ptr %2, null
br i1 %tobool.not, label %common.ret50, label %while.body, !llvm.loop !53
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @AVL_set_upcomp(i64 noundef %node, i64 noundef %val, i32 noundef %type) local_unnamed_addr #7 {
entry:
%cmp = icmp eq i64 %node, %val
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%cmp1.not = icmp eq i32 %type, 3
%. = sext i1 %cmp1.not to i32
br label %return
if.end: ; preds = %entry
%cmp3 = icmp slt i64 %node, %val
br i1 %cmp3, label %return, label %if.end5
if.end5: ; preds = %if.end
%cmp6 = icmp sgt i64 %node, %val
%.13 = sext i1 %cmp6 to i32
br label %return
return: ; preds = %if.end5, %if.end, %if.then
%retval.0 = phi i32 [ %., %if.then ], [ 1, %if.end ], [ %.13, %if.end5 ]
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @AVL_set_inside_upperbound(ptr noundef readonly %root, i64 noundef %val, i32 noundef %type) local_unnamed_addr #22 {
entry:
%tobool.not40 = icmp eq ptr %root, null
br i1 %tobool.not40, label %common.ret48, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%cmp1.not.i = icmp eq i32 %type, 3
br label %while.body
while.body: ; preds = %while.body.lr.ph, %cleanup16
%node.041 = phi ptr [ %root, %while.body.lr.ph ], [ %node.1.ph, %cleanup16 ]
%0 = load i64, ptr %node.041, align 8, !tbaa !48
%cmp.i = icmp eq i64 %0, %val
br i1 %cmp.i, label %AVL_set_upcomp.exit, label %if.end.i
if.end.i: ; preds = %while.body
%cmp3.i = icmp slt i64 %0, %val
br i1 %cmp3.i, label %if.then6, label %if.end5.i
if.end5.i: ; preds = %if.end.i
%cmp6.i = icmp sgt i64 %0, %val
br label %AVL_set_upcomp.exit
AVL_set_upcomp.exit: ; preds = %while.body, %if.end5.i
%retval.0.i.in = phi i1 [ %cmp6.i, %if.end5.i ], [ %cmp1.not.i, %while.body ]
%retval.0.i = sext i1 %retval.0.i.in to i32
switch i32 %retval.0.i, label %cleanup16 [
i32 0, label %common.ret48
i32 -1, label %if.then3
]
if.then3: ; preds = %AVL_set_upcomp.exit
%child = getelementptr inbounds %struct.node_AVL_set, ptr %node.041, i64 0, i32 3
%1 = load ptr, ptr %child, align 8, !tbaa !32
br label %cleanup16
common.ret48: ; preds = %entry, %cleanup16, %AVL_set_upcomp.exit, %if.then6
%common.ret48.op = phi ptr [ %retval.1, %if.then6 ], [ null, %entry ], [ %node.041, %AVL_set_upcomp.exit ], [ null, %cleanup16 ]
ret ptr %common.ret48.op
if.then6: ; preds = %if.end.i
%arrayidx8 = getelementptr inbounds %struct.node_AVL_set, ptr %node.041, i64 0, i32 3, i64 1
%2 = load ptr, ptr %arrayidx8, align 8, !tbaa !32
%call9 = tail call ptr @AVL_set_inside_upperbound(ptr noundef %2, i64 noundef %val, i32 noundef %type)
%cmp10 = icmp eq i32 %type, 1
%cmp12.not = icmp eq ptr %call9, null
%node.1.call9 = select i1 %cmp12.not, ptr %node.041, ptr %call9
%retval.1 = select i1 %cmp10, ptr %call9, ptr %node.1.call9
br label %common.ret48
cleanup16: ; preds = %if.then3, %AVL_set_upcomp.exit
%node.1.ph = phi ptr [ %node.041, %AVL_set_upcomp.exit ], [ %1, %if.then3 ]
%tobool.not = icmp eq ptr %node.1.ph, null
br i1 %tobool.not, label %common.ret48, label %while.body, !llvm.loop !54
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @AVL_set_inside_minmax(ptr nocapture noundef readonly %root, i32 noundef %type) local_unnamed_addr #21 {
entry:
%idxprom = sext i32 %type to i64
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%root.addr.0 = phi ptr [ %root, %entry ], [ %0, %while.cond ]
%arrayidx = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0, i64 0, i32 3, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !55
while.end: ; preds = %while.cond
%1 = load i64, ptr %root.addr.0, align 8, !tbaa !48
ret i64 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @AVL_set_inside_swap(ptr nocapture noundef %node1, ptr nocapture noundef %node2) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr %node1, align 8, !tbaa !32
%1 = load ptr, ptr %node2, align 8, !tbaa !32
store ptr %1, ptr %node1, align 8, !tbaa !32
store ptr %0, ptr %node2, align 8, !tbaa !32
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i64 @set_main(i32 noundef %command, i32 noundef %set_num, i64 noundef %val, i64 noundef %option) local_unnamed_addr #10 {
entry:
%.b152 = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152, label %if.end, label %if.then
if.then: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
switch i32 %command, label %if.end79 [
i32 -1, label %if.then2
i32 1, label %if.then6
i32 2, label %if.then18
i32 3, label %if.then24
i32 4, label %if.end.if.then40_crit_edge
i32 5, label %if.end.if.then49_crit_edge
i32 6, label %if.end.if.then58_crit_edge
i32 7, label %if.end.if.then63_crit_edge
i32 8, label %if.end.if.then69_crit_edge
i32 9, label %if.end.if.then75_crit_edge
]
if.end.if.then40_crit_edge: ; preds = %if.end
%.pre210 = sext i32 %set_num to i64
br label %if.then40
if.end.if.then49_crit_edge: ; preds = %if.end
%.pre211 = sext i32 %set_num to i64
br label %if.then49
if.end.if.then58_crit_edge: ; preds = %if.end
%.pre212 = sext i32 %set_num to i64
br label %if.then58
if.end.if.then63_crit_edge: ; preds = %if.end
%.pre213 = sext i32 %set_num to i64
br label %if.then63
if.end.if.then69_crit_edge: ; preds = %if.end
%.pre214 = sext i32 %set_num to i64
br label %if.then69
if.end.if.then75_crit_edge: ; preds = %if.end
%.pre215 = sext i32 %set_num to i64
br label %if.then75
if.then2: ; preds = %if.end
%idxprom = sext i32 %set_num to i64
%arrayidx3 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx3, align 8, !tbaa !32
tail call void @AVL_set_inside_print(ptr noundef %0, i32 noundef 0)
br label %return
if.then6: ; preds = %if.end
%idxprom7 = sext i32 %set_num to i64
%arrayidx8 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom7
%1 = load ptr, ptr %arrayidx8, align 8, !tbaa !32
%tobool.not16.i = icmp eq ptr %1, null
br i1 %tobool.not16.i, label %cond.false, label %while.body.i
while.body.i: ; preds = %if.then6, %if.end8.i
%node.017.i = phi ptr [ %node.1.i, %if.end8.i ], [ %1, %if.then6 ]
%2 = load i64, ptr %node.017.i, align 8, !tbaa !48
%cmp.i = icmp sgt i64 %2, %val
br i1 %cmp.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %while.body.i
%child.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i, i64 0, i32 3
br label %if.end8.i
if.else.i: ; preds = %while.body.i
%cmp3.i = icmp slt i64 %2, %val
br i1 %cmp3.i, label %if.then4.i, label %AVL_set_inside_count.exit
if.then4.i: ; preds = %if.else.i
%arrayidx6.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i, i64 0, i32 3, i64 1
br label %if.end8.i
if.end8.i: ; preds = %if.then4.i, %if.then.i
%node.1.in.i = phi ptr [ %child.i, %if.then.i ], [ %arrayidx6.i, %if.then4.i ]
%node.1.i = load ptr, ptr %node.1.in.i, align 8, !tbaa !32
%tobool.not.i = icmp eq ptr %node.1.i, null
br i1 %tobool.not.i, label %cond.false, label %while.body.i, !llvm.loop !52
AVL_set_inside_count.exit: ; preds = %if.else.i
%cnt.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i, i64 0, i32 2
%3 = load i32, ptr %cnt.i, align 4, !tbaa !49
%tobool9.not = icmp eq i32 %3, 0
br i1 %tobool9.not, label %cond.false, label %cond.end
cond.false: ; preds = %if.end8.i, %if.then6, %AVL_set_inside_count.exit
%arrayidx11 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom7
%4 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%inc12 = add nsw i64 %4, 1
store i64 %inc12, ptr %arrayidx11, align 8, !tbaa !5
br label %cond.end
cond.end: ; preds = %AVL_set_inside_count.exit, %cond.false
%call15 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx8, i64 noundef %val, i32 noundef 2), !range !51
br label %if.end79
if.then18: ; preds = %if.end
%.pre = sext i32 %set_num to i64
%arrayidx20 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre
%5 = load ptr, ptr %arrayidx20, align 8, !tbaa !32
%tobool.not16.i153 = icmp eq ptr %5, null
br i1 %tobool.not16.i153, label %return, label %while.body.i154
while.body.i154: ; preds = %if.then18, %if.end8.i165
%node.017.i155 = phi ptr [ %node.1.i167, %if.end8.i165 ], [ %5, %if.then18 ]
%6 = load i64, ptr %node.017.i155, align 8, !tbaa !48
%cmp.i156 = icmp sgt i64 %6, %val
br i1 %cmp.i156, label %if.then.i169, label %if.else.i157
if.then.i169: ; preds = %while.body.i154
%child.i170 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i155, i64 0, i32 3
br label %if.end8.i165
if.else.i157: ; preds = %while.body.i154
%cmp3.i158 = icmp slt i64 %6, %val
br i1 %cmp3.i158, label %if.then4.i163, label %if.else7.i159
if.then4.i163: ; preds = %if.else.i157
%arrayidx6.i164 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i155, i64 0, i32 3, i64 1
br label %if.end8.i165
if.else7.i159: ; preds = %if.else.i157
%cnt.i160 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i155, i64 0, i32 2
%7 = load i32, ptr %cnt.i160, align 4, !tbaa !49
%conv.i161 = sext i32 %7 to i64
br label %return
if.end8.i165: ; preds = %if.then4.i163, %if.then.i169
%node.1.in.i166 = phi ptr [ %child.i170, %if.then.i169 ], [ %arrayidx6.i164, %if.then4.i163 ]
%node.1.i167 = load ptr, ptr %node.1.in.i166, align 8, !tbaa !32
%tobool.not.i168 = icmp eq ptr %node.1.i167, null
br i1 %tobool.not.i168, label %return, label %while.body.i154, !llvm.loop !52
if.then24: ; preds = %if.end
%.pre209 = sext i32 %set_num to i64
%arrayidx26 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre209
%8 = load ptr, ptr %arrayidx26, align 8, !tbaa !32
%tobool.not16.i172 = icmp eq ptr %8, null
br i1 %tobool.not16.i172, label %cond.false30, label %while.body.i173
while.body.i173: ; preds = %if.then24, %if.end8.i184
%node.017.i174 = phi ptr [ %node.1.i186, %if.end8.i184 ], [ %8, %if.then24 ]
%9 = load i64, ptr %node.017.i174, align 8, !tbaa !48
%cmp.i175 = icmp sgt i64 %9, %val
br i1 %cmp.i175, label %if.then.i188, label %if.else.i176
if.then.i188: ; preds = %while.body.i173
%child.i189 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i174, i64 0, i32 3
br label %if.end8.i184
if.else.i176: ; preds = %while.body.i173
%cmp3.i177 = icmp slt i64 %9, %val
br i1 %cmp3.i177, label %if.then4.i182, label %AVL_set_inside_count.exit190
if.then4.i182: ; preds = %if.else.i176
%arrayidx6.i183 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i174, i64 0, i32 3, i64 1
br label %if.end8.i184
if.end8.i184: ; preds = %if.then4.i182, %if.then.i188
%node.1.in.i185 = phi ptr [ %child.i189, %if.then.i188 ], [ %arrayidx6.i183, %if.then4.i182 ]
%node.1.i186 = load ptr, ptr %node.1.in.i185, align 8, !tbaa !32
%tobool.not.i187 = icmp eq ptr %node.1.i186, null
br i1 %tobool.not.i187, label %cond.false30, label %while.body.i173, !llvm.loop !52
AVL_set_inside_count.exit190: ; preds = %if.else.i176
%cnt.i179 = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i174, i64 0, i32 2
%10 = load i32, ptr %cnt.i179, align 4, !tbaa !49
%cmp28 = icmp sgt i32 %10, 1
br i1 %cmp28, label %cond.end33, label %cond.false30
cond.false30: ; preds = %if.end8.i184, %if.then24, %AVL_set_inside_count.exit190
%arrayidx32 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre209
%11 = load i64, ptr %arrayidx32, align 8, !tbaa !5
%dec = add nsw i64 %11, -1
store i64 %dec, ptr %arrayidx32, align 8, !tbaa !5
br label %cond.end33
cond.end33: ; preds = %AVL_set_inside_count.exit190, %cond.false30
%call37 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx26, i64 noundef %val, i32 noundef 1), !range !51
switch i32 %command, label %if.end79 [
i32 4, label %if.then40
i32 5, label %if.then49
i32 6, label %if.then58
i32 7, label %if.then63
i32 8, label %if.then69
i32 9, label %if.then75
]
if.then40: ; preds = %if.end.if.then40_crit_edge, %cond.end33
%idxprom41.pre-phi = phi i64 [ %.pre210, %if.end.if.then40_crit_edge ], [ %.pre209, %cond.end33 ]
%arrayidx42 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom41.pre-phi
%12 = load i64, ptr %arrayidx42, align 8, !tbaa !5
%dec43 = add nsw i64 %12, -1
store i64 %dec43, ptr %arrayidx42, align 8, !tbaa !5
%arrayidx45 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom41.pre-phi
%call46 = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx45, i64 noundef %val, i32 noundef 0), !range !51
br label %return
if.then49: ; preds = %if.end.if.then49_crit_edge, %cond.end33
%idxprom50.pre-phi = phi i64 [ %.pre211, %if.end.if.then49_crit_edge ], [ %.pre209, %cond.end33 ]
%arrayidx51 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom50.pre-phi
store i64 0, ptr %arrayidx51, align 8, !tbaa !5
%arrayidx53 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom50.pre-phi
%13 = load ptr, ptr %arrayidx53, align 8, !tbaa !32
tail call void @AVL_set_inside_free(ptr noundef %13)
store ptr null, ptr %arrayidx53, align 8, !tbaa !32
br label %return
if.then58: ; preds = %if.end.if.then58_crit_edge, %cond.end33
%idxprom59.pre-phi = phi i64 [ %.pre212, %if.end.if.then58_crit_edge ], [ %.pre209, %cond.end33 ]
%arrayidx60 = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom59.pre-phi
%14 = load i64, ptr %arrayidx60, align 8, !tbaa !5
br label %return
if.then63: ; preds = %if.end.if.then63_crit_edge, %cond.end33
%idxprom64.pre-phi = phi i64 [ %.pre213, %if.end.if.then63_crit_edge ], [ %.pre209, %cond.end33 ]
%arrayidx65 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom64.pre-phi
%15 = load ptr, ptr %arrayidx65, align 8, !tbaa !32
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %if.then63
%root.addr.0.i = phi ptr [ %15, %if.then63 ], [ %16, %while.cond.i ]
%arrayidx.i = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i, i64 0, i32 3, i64 1
%16 = load ptr, ptr %arrayidx.i, align 8, !tbaa !32
%cmp.not.i = icmp eq ptr %16, null
br i1 %cmp.not.i, label %AVL_set_inside_minmax.exit, label %while.cond.i, !llvm.loop !55
AVL_set_inside_minmax.exit: ; preds = %while.cond.i
%17 = load i64, ptr %root.addr.0.i, align 8, !tbaa !48
br label %return
if.then69: ; preds = %if.end.if.then69_crit_edge, %cond.end33
%idxprom70.pre-phi = phi i64 [ %.pre214, %if.end.if.then69_crit_edge ], [ %.pre209, %cond.end33 ]
%arrayidx71 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom70.pre-phi
%18 = load ptr, ptr %arrayidx71, align 8, !tbaa !32
br label %while.cond.i191
while.cond.i191: ; preds = %while.cond.i191, %if.then69
%root.addr.0.i192 = phi ptr [ %18, %if.then69 ], [ %19, %while.cond.i191 ]
%arrayidx.i193 = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i192, i64 0, i32 3, i64 0
%19 = load ptr, ptr %arrayidx.i193, align 8, !tbaa !32
%cmp.not.i194 = icmp eq ptr %19, null
br i1 %cmp.not.i194, label %AVL_set_inside_minmax.exit195, label %while.cond.i191, !llvm.loop !55
AVL_set_inside_minmax.exit195: ; preds = %while.cond.i191
%20 = load i64, ptr %root.addr.0.i192, align 8, !tbaa !48
br label %return
if.then75: ; preds = %if.end.if.then75_crit_edge, %cond.end33
%idxprom76.pre-phi = phi i64 [ %.pre215, %if.end.if.then75_crit_edge ], [ %.pre209, %cond.end33 ]
%arrayidx77 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom76.pre-phi
%arrayidx78 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %val
%21 = load ptr, ptr %arrayidx77, align 8, !tbaa !32
%22 = load ptr, ptr %arrayidx78, align 8, !tbaa !32
store ptr %22, ptr %arrayidx77, align 8, !tbaa !32
store ptr %21, ptr %arrayidx78, align 8, !tbaa !32
br label %return
if.end79: ; preds = %cond.end, %if.end, %cond.end33
%23 = add i32 %command, -10
%or.cond = icmp ult i32 %23, 3
br i1 %or.cond, label %if.then82, label %if.end89
if.then82: ; preds = %if.end79
%idxprom83 = sext i32 %set_num to i64
%arrayidx84 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom83
%24 = load ptr, ptr %arrayidx84, align 8, !tbaa !32
%sub = add nsw i32 %command, -9
%call85 = tail call ptr @AVL_set_inside_lowerbound(ptr noundef %24, i64 noundef %val, i32 noundef %sub)
%cmp86 = icmp eq ptr %call85, null
br i1 %cmp86, label %return, label %if.else
if.else: ; preds = %if.then82
%25 = load i64, ptr %call85, align 8, !tbaa !48
br label %return
if.end89: ; preds = %if.end79
%26 = add i32 %command, -13
%or.cond104 = icmp ult i32 %26, 3
br i1 %or.cond104, label %if.then93, label %return
if.then93: ; preds = %if.end89
%idxprom94 = sext i32 %set_num to i64
%arrayidx95 = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom94
%27 = load ptr, ptr %arrayidx95, align 8, !tbaa !32
%sub96 = add nsw i32 %command, -12
%call97 = tail call ptr @AVL_set_inside_upperbound(ptr noundef %27, i64 noundef %val, i32 noundef %sub96)
%cmp98 = icmp eq ptr %call97, null
br i1 %cmp98, label %return, label %if.else100
if.else100: ; preds = %if.then93
%28 = load i64, ptr %call97, align 8, !tbaa !48
br label %return
return: ; preds = %if.end8.i165, %if.then49, %if.then40, %if.then2, %if.then75, %if.else7.i159, %if.then18, %if.end89, %if.else100, %if.then93, %if.else, %if.then82, %AVL_set_inside_minmax.exit195, %AVL_set_inside_minmax.exit, %if.then58
%retval.2 = phi i64 [ %14, %if.then58 ], [ %17, %AVL_set_inside_minmax.exit ], [ %20, %AVL_set_inside_minmax.exit195 ], [ %25, %if.else ], [ %option, %if.then82 ], [ %28, %if.else100 ], [ %option, %if.then93 ], [ 0, %if.end89 ], [ %conv.i161, %if.else7.i159 ], [ 0, %if.then18 ], [ 0, %if.then75 ], [ 0, %if.then2 ], [ 0, %if.then40 ], [ 0, %if.then49 ], [ 0, %if.end8.i165 ]
ret i64 %retval.2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @set_print(i32 noundef %set_num) local_unnamed_addr #2 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%idxprom.i = sext i32 %set_num to i64
%arrayidx3.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom.i
%0 = load ptr, ptr %arrayidx3.i, align 8, !tbaa !32
tail call void @AVL_set_inside_print(ptr noundef %0, i32 noundef 0)
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @set_insert(i32 noundef %set_num, i64 noundef %val) local_unnamed_addr #10 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%idxprom7.i = sext i32 %set_num to i64
%arrayidx8.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %idxprom7.i
%0 = load ptr, ptr %arrayidx8.i, align 8, !tbaa !32
%tobool.not16.i.i = icmp eq ptr %0, null
br i1 %tobool.not16.i.i, label %cond.false.i, label %while.body.i.i
while.body.i.i: ; preds = %if.end.i, %if.end8.i.i
%node.017.i.i = phi ptr [ %node.1.i.i, %if.end8.i.i ], [ %0, %if.end.i ]
%1 = load i64, ptr %node.017.i.i, align 8, !tbaa !48
%cmp.i.i = icmp sgt i64 %1, %val
br i1 %cmp.i.i, label %if.then.i.i, label %if.else.i.i
if.then.i.i: ; preds = %while.body.i.i
%child.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i.i, i64 0, i32 3
br label %if.end8.i.i
if.else.i.i: ; preds = %while.body.i.i
%cmp3.i.i = icmp slt i64 %1, %val
br i1 %cmp3.i.i, label %if.then4.i.i, label %AVL_set_inside_count.exit.i
if.then4.i.i: ; preds = %if.else.i.i
%arrayidx6.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i.i, i64 0, i32 3, i64 1
br label %if.end8.i.i
if.end8.i.i: ; preds = %if.then4.i.i, %if.then.i.i
%node.1.in.i.i = phi ptr [ %child.i.i, %if.then.i.i ], [ %arrayidx6.i.i, %if.then4.i.i ]
%node.1.i.i = load ptr, ptr %node.1.in.i.i, align 8, !tbaa !32
%tobool.not.i.i = icmp eq ptr %node.1.i.i, null
br i1 %tobool.not.i.i, label %cond.false.i, label %while.body.i.i, !llvm.loop !52
AVL_set_inside_count.exit.i: ; preds = %if.else.i.i
%cnt.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i.i, i64 0, i32 2
%2 = load i32, ptr %cnt.i.i, align 4, !tbaa !49
%tobool9.not.i = icmp eq i32 %2, 0
br i1 %tobool9.not.i, label %cond.false.i, label %set_main.exit
cond.false.i: ; preds = %if.end8.i.i, %AVL_set_inside_count.exit.i, %if.end.i
%arrayidx11.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %idxprom7.i
%3 = load i64, ptr %arrayidx11.i, align 8, !tbaa !5
%inc12.i = add nsw i64 %3, 1
store i64 %inc12.i, ptr %arrayidx11.i, align 8, !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %AVL_set_inside_count.exit.i, %cond.false.i
%call15.i = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx8.i, i64 noundef %val, i32 noundef 2), !range !51
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @set_count(i32 noundef %set_num, i64 noundef %val) local_unnamed_addr #23 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%.pre.i = sext i32 %set_num to i64
%arrayidx20.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre.i
%0 = load ptr, ptr %arrayidx20.i, align 8, !tbaa !32
%tobool.not16.i153.i = icmp eq ptr %0, null
br i1 %tobool.not16.i153.i, label %set_main.exit, label %while.body.i154.i
while.body.i154.i: ; preds = %if.end.i, %if.end8.i165.i
%node.017.i155.i = phi ptr [ %node.1.i167.i, %if.end8.i165.i ], [ %0, %if.end.i ]
%1 = load i64, ptr %node.017.i155.i, align 8, !tbaa !48
%cmp.i156.i = icmp sgt i64 %1, %val
br i1 %cmp.i156.i, label %if.then.i169.i, label %if.else.i157.i
if.then.i169.i: ; preds = %while.body.i154.i
%child.i170.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i155.i, i64 0, i32 3
br label %if.end8.i165.i
if.else.i157.i: ; preds = %while.body.i154.i
%cmp3.i158.i = icmp slt i64 %1, %val
br i1 %cmp3.i158.i, label %if.then4.i163.i, label %if.else7.i159.i
if.then4.i163.i: ; preds = %if.else.i157.i
%arrayidx6.i164.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i155.i, i64 0, i32 3, i64 1
br label %if.end8.i165.i
if.else7.i159.i: ; preds = %if.else.i157.i
%cnt.i160.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i155.i, i64 0, i32 2
%2 = load i32, ptr %cnt.i160.i, align 4, !tbaa !49
%conv.i161.i = sext i32 %2 to i64
br label %set_main.exit
if.end8.i165.i: ; preds = %if.then4.i163.i, %if.then.i169.i
%node.1.in.i166.i = phi ptr [ %child.i170.i, %if.then.i169.i ], [ %arrayidx6.i164.i, %if.then4.i163.i ]
%node.1.i167.i = load ptr, ptr %node.1.in.i166.i, align 8, !tbaa !32
%tobool.not.i168.i = icmp eq ptr %node.1.i167.i, null
br i1 %tobool.not.i168.i, label %set_main.exit, label %while.body.i154.i, !llvm.loop !52
set_main.exit: ; preds = %if.end8.i165.i, %if.end.i, %if.else7.i159.i
%retval.2.i = phi i64 [ %conv.i161.i, %if.else7.i159.i ], [ 0, %if.end.i ], [ 0, %if.end8.i165.i ]
ret i64 %retval.2.i
}
; Function Attrs: nounwind uwtable
define dso_local void @set_erase(i32 noundef %set_num, i64 noundef %val, i32 noundef %is_all) local_unnamed_addr #10 {
entry:
%tobool.not = icmp eq i32 %is_all, 0
%.b152.i4 = load i1, ptr @set_main.set_is_init, align 1
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %entry
br i1 %.b152.i4, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %if.then
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %if.then, %if.then.i
%.pre210.i = sext i32 %set_num to i64
%arrayidx42.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre210.i
%0 = load i64, ptr %arrayidx42.i, align 8, !tbaa !5
%dec43.i = add nsw i64 %0, -1
store i64 %dec43.i, ptr %arrayidx42.i, align 8, !tbaa !5
%arrayidx45.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre210.i
%call46.i = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx45.i, i64 noundef %val, i32 noundef 0), !range !51
br label %if.end
if.else: ; preds = %entry
br i1 %.b152.i4, label %if.end.i, label %if.then.i5
if.then.i5: ; preds = %if.else
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i5, %if.else
%.pre209.i = sext i32 %set_num to i64
%arrayidx26.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre209.i
%1 = load ptr, ptr %arrayidx26.i, align 8, !tbaa !32
%tobool.not16.i172.i = icmp eq ptr %1, null
br i1 %tobool.not16.i172.i, label %cond.false30.i, label %while.body.i173.i
while.body.i173.i: ; preds = %if.end.i, %if.end8.i184.i
%node.017.i174.i = phi ptr [ %node.1.i186.i, %if.end8.i184.i ], [ %1, %if.end.i ]
%2 = load i64, ptr %node.017.i174.i, align 8, !tbaa !48
%cmp.i175.i = icmp sgt i64 %2, %val
br i1 %cmp.i175.i, label %if.then.i188.i, label %if.else.i176.i
if.then.i188.i: ; preds = %while.body.i173.i
%child.i189.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i174.i, i64 0, i32 3
br label %if.end8.i184.i
if.else.i176.i: ; preds = %while.body.i173.i
%cmp3.i177.i = icmp slt i64 %2, %val
br i1 %cmp3.i177.i, label %if.then4.i182.i, label %AVL_set_inside_count.exit190.i
if.then4.i182.i: ; preds = %if.else.i176.i
%arrayidx6.i183.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i174.i, i64 0, i32 3, i64 1
br label %if.end8.i184.i
if.end8.i184.i: ; preds = %if.then4.i182.i, %if.then.i188.i
%node.1.in.i185.i = phi ptr [ %child.i189.i, %if.then.i188.i ], [ %arrayidx6.i183.i, %if.then4.i182.i ]
%node.1.i186.i = load ptr, ptr %node.1.in.i185.i, align 8, !tbaa !32
%tobool.not.i187.i = icmp eq ptr %node.1.i186.i, null
br i1 %tobool.not.i187.i, label %cond.false30.i, label %while.body.i173.i, !llvm.loop !52
AVL_set_inside_count.exit190.i: ; preds = %if.else.i176.i
%cnt.i179.i = getelementptr inbounds %struct.node_AVL_set, ptr %node.017.i174.i, i64 0, i32 2
%3 = load i32, ptr %cnt.i179.i, align 4, !tbaa !49
%cmp28.i = icmp sgt i32 %3, 1
br i1 %cmp28.i, label %set_main.exit6, label %cond.false30.i
cond.false30.i: ; preds = %if.end8.i184.i, %AVL_set_inside_count.exit190.i, %if.end.i
%arrayidx32.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre209.i
%4 = load i64, ptr %arrayidx32.i, align 8, !tbaa !5
%dec.i = add nsw i64 %4, -1
store i64 %dec.i, ptr %arrayidx32.i, align 8, !tbaa !5
br label %set_main.exit6
set_main.exit6: ; preds = %AVL_set_inside_count.exit190.i, %cond.false30.i
%call37.i = tail call i32 @AVL_set_inside_update(ptr noundef nonnull %arrayidx26.i, i64 noundef %val, i32 noundef 1), !range !51
br label %if.end
if.end: ; preds = %set_main.exit6, %set_main.exit
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @set_clear(i32 noundef %set_num) local_unnamed_addr #10 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%.pre211.i = sext i32 %set_num to i64
%arrayidx51.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre211.i
store i64 0, ptr %arrayidx51.i, align 8, !tbaa !5
%arrayidx53.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre211.i
%0 = load ptr, ptr %arrayidx53.i, align 8, !tbaa !32
tail call void @AVL_set_inside_free(ptr noundef %0)
store ptr null, ptr %arrayidx53.i, align 8, !tbaa !32
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @set_size(i32 noundef %set_num) local_unnamed_addr #24 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%.pre212.i = sext i32 %set_num to i64
%arrayidx60.i = getelementptr inbounds [514511 x i64], ptr @set_main.set_siz, i64 0, i64 %.pre212.i
%0 = load i64, ptr %arrayidx60.i, align 8, !tbaa !5
ret i64 %0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @set_max(i32 noundef %set_num) local_unnamed_addr #23 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%.pre213.i = sext i32 %set_num to i64
%arrayidx65.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre213.i
%0 = load ptr, ptr %arrayidx65.i, align 8, !tbaa !32
br label %while.cond.i.i
while.cond.i.i: ; preds = %while.cond.i.i, %if.end.i
%root.addr.0.i.i = phi ptr [ %0, %if.end.i ], [ %1, %while.cond.i.i ]
%arrayidx.i.i = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i.i, i64 0, i32 3, i64 1
%1 = load ptr, ptr %arrayidx.i.i, align 8, !tbaa !32
%cmp.not.i.i = icmp eq ptr %1, null
br i1 %cmp.not.i.i, label %set_main.exit, label %while.cond.i.i, !llvm.loop !55
set_main.exit: ; preds = %while.cond.i.i
%2 = load i64, ptr %root.addr.0.i.i, align 8, !tbaa !48
ret i64 %2
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @set_min(i32 noundef %set_num) local_unnamed_addr #23 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %if.end.i
if.end.i: ; preds = %if.then.i, %entry
%.pre214.i = sext i32 %set_num to i64
%arrayidx71.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre214.i
%0 = load ptr, ptr %arrayidx71.i, align 8, !tbaa !32
br label %while.cond.i191.i
while.cond.i191.i: ; preds = %while.cond.i191.i, %if.end.i
%root.addr.0.i192.i = phi ptr [ %0, %if.end.i ], [ %1, %while.cond.i191.i ]
%arrayidx.i193.i = getelementptr inbounds %struct.node_AVL_set, ptr %root.addr.0.i192.i, i64 0, i32 3, i64 0
%1 = load ptr, ptr %arrayidx.i193.i, align 8, !tbaa !32
%cmp.not.i194.i = icmp eq ptr %1, null
br i1 %cmp.not.i194.i, label %set_main.exit, label %while.cond.i191.i, !llvm.loop !55
set_main.exit: ; preds = %while.cond.i191.i
%2 = load i64, ptr %root.addr.0.i192.i, align 8, !tbaa !48
ret i64 %2
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @set_swap(i32 noundef %set_num1, i32 noundef %set_num2) local_unnamed_addr #24 {
entry:
%.b152.i = load i1, ptr @set_main.set_is_init, align 1
br i1 %.b152.i, label %set_main.exit, label %if.then.i
if.then.i: ; preds = %entry
store i1 true, ptr @set_main.set_is_init, align 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_pointer, i8 0, i64 4116088, i1 false), !tbaa !32
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4116088) @set_main.set_siz, i8 0, i64 4116088, i1 false), !tbaa !5
br label %set_main.exit
set_main.exit: ; preds = %entry, %if.then.i
%conv = sext i32 %set_num2 to i64
%.pre215.i = sext i32 %set_num1 to i64
%arrayidx77.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %.pre215.i
%arrayidx78.i = getelementptr inbounds [514511 x ptr], ptr @set_main.set_pointer, i64 0, i64 %conv
%0 = load ptr, ptr %arrayidx77.i, align 8, !tbaa !32
%1 = load ptr, ptr %arrayidx78.i, align 8, !tbaa !32
store ptr %1, ptr %arrayidx77.i, align 8, !tbaa !32
store ptr %0, ptr %arrayidx78.i, align 8, !tbaa !32
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i64 @set_lowerbound(i32 noundef %set_num, i64 noundef %val, i32 noundef %type, i64 noundef %error) local_unnamed_addr #10 {
entry:
%add = add nsw i32 %type, 9
%call = tail call i64 @set_main(i32 noundef %add, i32 noundef %set_num, i64 noundef %val, i64 noundef %error)
ret i64 %call
}
; Function Attrs: nounwind uwtable
define dso_local i64 @set_upperbound(i32 noundef %set_num, i64 noundef %val, i32 noundef %type, i64 noundef %error) local_unnamed_addr #10 {
entry:
%add = add nsw i32 %type, 12
%call = tail call i64 @set_main(i32 noundef %add, i32 noundef %set_num, i64 noundef %val, i64 noundef %error)
ret i64 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_e_max() local_unnamed_addr #7 {
entry:
ret i64 -4611686018427387904
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_e_min() local_unnamed_addr #7 {
entry:
ret i64 4611686018427387904
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_e_sum() local_unnamed_addr #7 {
entry:
ret i64 0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_e_gcd() local_unnamed_addr #7 {
entry:
ret i64 0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_op_max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond.i = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond.i
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_op_min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #4 {
entry:
%cond.i = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @seg_op_sum(i64 noundef %a, i64 noundef %b) local_unnamed_addr #7 {
entry:
%add = add nsw i64 %b, %a
ret i64 %add
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @seg_op_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #6 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %gcd.exit, label %cond.true.i
cond.true.i: ; preds = %entry, %cond.true.i
%b.tr6.i = phi i64 [ %rem.i, %cond.true.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %cond.true.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %cond.true.i
gcd.exit: ; preds = %cond.true.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %cond.true.i ]
ret i64 %a.tr.lcssa.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i64 @seg_get(ptr nocapture noundef readonly %S, i32 noundef %x) #25 {
entry:
%node = getelementptr inbounds %struct.seg_tree, ptr %S, i64 0, i32 1
%0 = load ptr, ptr %node, align 8, !tbaa !56
%1 = load i32, ptr %S, align 8, !tbaa !58
%div = sdiv i32 %1, 2
%add = add nsw i32 %div, %x
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds i64, ptr %0, i64 %idxprom
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
ret i64 %2
}
; Function Attrs: nounwind uwtable
define dso_local i64 @seg_prod_inner(ptr noundef %S, i32 noundef %l, i32 noundef %r, i32 noundef %x, i32 noundef %from, i32 noundef %to) local_unnamed_addr #10 {
entry:
%cmp.not = icmp sgt i32 %l, %from
%cmp1.not = icmp sgt i32 %to, %r
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %if.end, label %if.then
if.then: ; preds = %entry
%node = getelementptr inbounds %struct.seg_tree, ptr %S, i64 0, i32 1
%0 = load ptr, ptr %node, align 8, !tbaa !56
%idxprom = sext i32 %x to i64
%arrayidx = getelementptr inbounds i64, ptr %0, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !5
br label %common.ret36
if.end: ; preds = %entry
%cmp2 = icmp slt i32 %r, %from
%cmp3 = icmp slt i32 %to, %l
%or.cond35 = or i1 %cmp2, %cmp3
br i1 %or.cond35, label %if.then4, label %if.end5
if.then4: ; preds = %if.end
%e = getelementptr inbounds %struct.seg_tree, ptr %S, i64 0, i32 3
%2 = load ptr, ptr %e, align 8, !tbaa !59
%call = tail call i64 %2() #38
br label %common.ret36
common.ret36: ; preds = %if.then4, %if.then, %if.end5
%common.ret36.op = phi i64 [ %call14, %if.end5 ], [ %1, %if.then ], [ %call, %if.then4 ]
ret i64 %common.ret36.op
if.end5: ; preds = %if.end
%op = getelementptr inbounds %struct.seg_tree, ptr %S, i64 0, i32 2
%3 = load ptr, ptr %op, align 8, !tbaa !60
%mul = shl nsw i32 %x, 1
%add = or i32 %mul, 1
%add6 = add nsw i32 %to, %from
%div = sdiv i32 %add6, 2
%call7 = tail call i64 @seg_prod_inner(ptr noundef %S, i32 noundef %l, i32 noundef %r, i32 noundef %add, i32 noundef %from, i32 noundef %div)
%add9 = add nsw i32 %mul, 2
%add12 = add nsw i32 %div, 1
%call13 = tail call i64 @seg_prod_inner(ptr noundef %S, i32 noundef %l, i32 noundef %r, i32 noundef %add9, i32 noundef %add12, i32 noundef %to)
%call14 = tail call i64 %3(i64 noundef %call7, i64 noundef %call13) #38
br label %common.ret36
}
; Function Attrs: nounwind uwtable
define dso_local i64 @seg_prod(ptr noundef %S, i32 noundef %l, i32 noundef %r) #10 {
entry:
%0 = load i32, ptr %S, align 8, !tbaa !58
%div = sdiv i32 %0, 2
%call = tail call i64 @seg_prod_inner(ptr noundef nonnull %S, i32 noundef %l, i32 noundef %r, i32 noundef 0, i32 noundef 0, i32 noundef %div)
ret i64 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @seg_update(ptr nocapture noundef readonly %S, i32 noundef %x, i64 noundef %val) #10 {
entry:
%0 = load i32, ptr %S, align 8, !tbaa !58
%div = sdiv i32 %0, 2
%add = add nsw i32 %div, %x
%conv = sext i32 %add to i64
%node = getelementptr inbounds %struct.seg_tree, ptr %S, i64 0, i32 1
%1 = load ptr, ptr %node, align 8, !tbaa !56
%arrayidx = getelementptr inbounds i64, ptr %1, i64 %conv
store i64 %val, ptr %arrayidx, align 8, !tbaa !5
%cmp24 = icmp sgt i32 %add, 0
br i1 %cmp24, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%op = getelementptr inbounds %struct.seg_tree, ptr %S, i64 0, i32 2
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%2 = phi ptr [ %1, %while.body.lr.ph ], [ %7, %while.body ]
%c.025 = phi i64 [ %conv, %while.body.lr.ph ], [ %div223, %while.body ]
%dec = add nsw i64 %c.025, -1
%div223 = lshr i64 %dec, 1
%3 = load ptr, ptr %op, align 8, !tbaa !60
%add4 = and i64 %dec, -2
%4 = getelementptr i64, ptr %2, i64 %add4
%arrayidx5 = getelementptr i64, ptr %4, i64 2
%5 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%sub = or i64 %dec, 1
%arrayidx9 = getelementptr inbounds i64, ptr %2, i64 %sub
%6 = load i64, ptr %arrayidx9, align 8, !tbaa !5
%call = tail call i64 %3(i64 noundef %5, i64 noundef %6) #38
%7 = load ptr, ptr %node, align 8, !tbaa !56
%arrayidx11 = getelementptr inbounds i64, ptr %7, i64 %div223
store i64 %call, ptr %arrayidx11, align 8, !tbaa !5
%cmp.not = icmp ult i64 %dec, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !61
while.end: ; preds = %while.body, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local ptr @seg_init(i32 noundef %n, ptr nocapture noundef readonly %a, ptr noundef %op, ptr noundef %e) local_unnamed_addr #10 {
entry:
%call = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #39
%cmp93 = icmp sgt i32 %n, 1
br i1 %cmp93, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%0 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.094 = phi i32 [ %mul, %while.body ], [ 1, %entry ]
%add = add nsw i32 %0, %x.094
%mul = shl nsw i32 %x.094, 1
%cmp = icmp slt i32 %mul, %n
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !62
while.end: ; preds = %while.body, %entry
%1 = phi i32 [ 0, %entry ], [ %add, %while.body ]
%x.0.lcssa = phi i32 [ 1, %entry ], [ %mul, %while.body ]
%add3 = add nsw i32 %1, %x.0.lcssa
store i32 %add3, ptr %call, align 8, !tbaa !58
%conv = sext i32 %add3 to i64
%mul5 = shl nsw i64 %conv, 3
%call6 = tail call noalias ptr @malloc(i64 noundef %mul5) #39
%node = getelementptr inbounds %struct.seg_tree, ptr %call, i64 0, i32 1
store ptr %call6, ptr %node, align 8, !tbaa !56
%op7 = getelementptr inbounds %struct.seg_tree, ptr %call, i64 0, i32 2
store ptr %op, ptr %op7, align 8, !tbaa !60
%e8 = getelementptr inbounds %struct.seg_tree, ptr %call, i64 0, i32 3
store ptr %e, ptr %e8, align 8, !tbaa !59
%get = getelementptr inbounds %struct.seg_tree, ptr %call, i64 0, i32 4
store ptr @seg_get, ptr %get, align 8, !tbaa !63
%prod = getelementptr inbounds %struct.seg_tree, ptr %call, i64 0, i32 5
store ptr @seg_prod, ptr %prod, align 8, !tbaa !64
%update = getelementptr inbounds %struct.seg_tree, ptr %call, i64 0, i32 6
store ptr @seg_update, ptr %update, align 8, !tbaa !65
%conv12 = sext i32 %n to i64
%sub22 = add nsw i32 %x.0.lcssa, -1
%conv23 = sext i32 %sub22 to i64
%invariant.gep = getelementptr i64, ptr %call6, i64 %conv23
%2 = tail call i32 @llvm.umax.i32(i32 %x.0.lcssa, i32 1)
%umax = zext i32 %2 to i64
br label %for.body
while.cond26.preheader: ; preds = %for.inc
%x.1.off103 = add i32 %x.0.lcssa, 1
%tobool.not104 = icmp ult i32 %x.1.off103, 3
br i1 %tobool.not104, label %while.end55, label %for.cond29.preheader.lr.ph
for.cond29.preheader.lr.ph: ; preds = %while.cond26.preheader
%invariant.gep98 = getelementptr i64, ptr %call6, i64 -1
br label %for.cond29.preheader
for.body: ; preds = %while.end, %for.inc
%i.095 = phi i64 [ 0, %while.end ], [ %inc, %for.inc ]
%cmp13 = icmp slt i64 %i.095, %conv12
br i1 %cmp13, label %if.then, label %if.else
if.then: ; preds = %for.body
%arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.095
%3 = load i64, ptr %arrayidx, align 8, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%call20 = tail call i64 %e() #38
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%.sink = phi i64 [ %3, %if.then ], [ %call20, %if.else ]
%gep97 = getelementptr i64, ptr %invariant.gep, i64 %i.095
store i64 %.sink, ptr %gep97, align 8, !tbaa !5
%inc = add nuw nsw i64 %i.095, 1
%exitcond.not = icmp eq i64 %inc, %umax
br i1 %exitcond.not, label %while.cond26.preheader, label %for.body, !llvm.loop !66
while.cond26.loopexit: ; preds = %for.body34, %for.cond29.preheader
%x.1.off = add nsw i32 %div105, 1
%tobool.not = icmp ult i32 %x.1.off, 3
br i1 %tobool.not, label %while.end55, label %for.cond29.preheader, !llvm.loop !67
for.cond29.preheader: ; preds = %for.cond29.preheader.lr.ph, %while.cond26.loopexit
%div105.in = phi i32 [ %x.0.lcssa, %for.cond29.preheader.lr.ph ], [ %div105, %while.cond26.loopexit ]
%div105 = sdiv i32 %div105.in, 2
%conv30 = sext i32 %div105 to i64
%cmp31100 = icmp sgt i32 %div105.in, 1
br i1 %cmp31100, label %for.body34, label %while.cond26.loopexit
for.body34: ; preds = %for.cond29.preheader, %for.body34
%i28.0101 = phi i64 [ %inc53, %for.body34 ], [ 0, %for.cond29.preheader ]
%add36 = add nsw i64 %i28.0101, %conv30
%add36.tr = trunc i64 %add36 to i32
%conv38 = shl i32 %add36.tr, 1
%idxprom = sext i32 %conv38 to i64
%arrayidx41 = getelementptr inbounds i64, ptr %call6, i64 %idxprom
%4 = load i64, ptr %arrayidx41, align 8, !tbaa !5
%sub43 = add nsw i32 %conv38, -1
%idxprom44 = sext i32 %sub43 to i64
%arrayidx45 = getelementptr inbounds i64, ptr %call6, i64 %idxprom44
%5 = load i64, ptr %arrayidx45, align 8, !tbaa !5
%call46 = tail call i64 %op(i64 noundef %4, i64 noundef %5) #38
%gep99 = getelementptr i64, ptr %invariant.gep98, i64 %add36
store i64 %call46, ptr %gep99, align 8, !tbaa !5
%inc53 = add nuw nsw i64 %i28.0101, 1
%exitcond106.not = icmp eq i64 %inc53, %conv30
br i1 %exitcond106.not, label %while.cond26.loopexit, label %for.body34, !llvm.loop !68
while.end55: ; preds = %while.cond26.loopexit, %while.cond26.preheader
ret ptr %call
}
; Function Attrs: nounwind uwtable
define dso_local void @vector_push(ptr nocapture noundef %v, ptr nocapture noundef readonly %x) #10 {
entry:
%0 = load i32, ptr %v, align 8, !tbaa !69
%max = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 1
%1 = load i32, ptr %max, align 4, !tbaa !71
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %entry.if.end7_crit_edge
entry.if.end7_crit_edge: ; preds = %entry
%data8.phi.trans.insert = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 3
%.pre = load ptr, ptr %data8.phi.trans.insert, align 8, !tbaa !72
br label %if.end7
if.then: ; preds = %entry
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %max, align 4, !tbaa !71
%data = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 3
%2 = load ptr, ptr %data, align 8, !tbaa !72
%data_size = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 2
%3 = load i32, ptr %data_size, align 8, !tbaa !73
%mul = mul nsw i32 %3, %inc
%conv = sext i32 %mul to i64
%call = tail call ptr @realloc(ptr noundef %2, i64 noundef %conv) #36
store ptr %call, ptr %data, align 8, !tbaa !72
%cmp4.not = icmp eq ptr %call, null
br i1 %cmp4.not, label %if.else, label %if.then.if.end7_crit_edge
if.then.if.end7_crit_edge: ; preds = %if.then
%.pre27 = load i32, ptr %v, align 8, !tbaa !69
br label %if.end7
if.else: ; preds = %if.then
tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 498, ptr noundef nonnull @__PRETTY_FUNCTION__.vector_push) #40
unreachable
if.end7: ; preds = %if.then.if.end7_crit_edge, %entry.if.end7_crit_edge
%4 = phi i32 [ %0, %entry.if.end7_crit_edge ], [ %.pre27, %if.then.if.end7_crit_edge ]
%5 = phi ptr [ %.pre, %entry.if.end7_crit_edge ], [ %call, %if.then.if.end7_crit_edge ]
%data_size9 = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 2
%6 = load i32, ptr %data_size9, align 8, !tbaa !73
%mul11 = mul nsw i32 %4, %6
%idx.ext = sext i32 %mul11 to i64
%add.ptr = getelementptr inbounds i8, ptr %5, i64 %idx.ext
%conv13 = sext i32 %6 to i64
tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %add.ptr, ptr align 1 %x, i64 %conv13, i1 false)
%7 = load i32, ptr %v, align 8, !tbaa !69
%inc15 = add nsw i32 %7, 1
store i32 %inc15, ptr %v, align 8, !tbaa !69
ret void
}
; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #26
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #27
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @vector_set(ptr nocapture noundef readonly %v, i32 noundef %idx, ptr nocapture noundef readonly %x) #28 {
entry:
%data = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 3
%0 = load ptr, ptr %data, align 8, !tbaa !72
%data_size = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 2
%1 = load i32, ptr %data_size, align 8, !tbaa !73
%mul = mul nsw i32 %1, %idx
%idx.ext = sext i32 %mul to i64
%add.ptr = getelementptr inbounds i8, ptr %0, i64 %idx.ext
%conv = sext i32 %1 to i64
tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %add.ptr, ptr align 1 %x, i64 %conv, i1 false)
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local ptr @vector_get_internal(ptr nocapture noundef readonly %v, i32 noundef %idx) local_unnamed_addr #13 {
entry:
%data = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 3
%0 = load ptr, ptr %data, align 8, !tbaa !72
%data_size = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 2
%1 = load i32, ptr %data_size, align 8, !tbaa !73
%mul = mul nsw i32 %1, %idx
%idx.ext = sext i32 %mul to i64
%add.ptr = getelementptr inbounds i8, ptr %0, i64 %idx.ext
ret ptr %add.ptr
}
; Function Attrs: nounwind uwtable
define dso_local i64 @vector_get(ptr nocapture noundef readonly %v, i32 noundef %idx) #10 {
entry:
%data_size = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 2
%0 = load i32, ptr %data_size, align 8, !tbaa !73
%cmp.not = icmp eq i32 %0, 8
br i1 %cmp.not, label %if.else, label %if.end
if.else: ; preds = %entry
tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.5, i32 noundef 513, ptr noundef nonnull @__PRETTY_FUNCTION__.vector_get) #40
unreachable
if.end: ; preds = %entry
%data.i = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 3
%1 = load ptr, ptr %data.i, align 8, !tbaa !72
%mul.i = mul nsw i32 %0, %idx
%idx.ext.i = sext i32 %mul.i to i64
%add.ptr.i = getelementptr inbounds i8, ptr %1, i64 %idx.ext.i
%2 = load i64, ptr %add.ptr.i, align 8, !tbaa !5
ret i64 %2
}
; Function Attrs: noreturn nounwind uwtable
define dso_local double @vector_get_double(ptr nocapture noundef readonly %v, i32 %idx) #29 {
entry:
%data_size = getelementptr inbounds %struct.vector, ptr %v, i64 0, i32 2
%0 = load i32, ptr %data_size, align 8, !tbaa !73
%cmp = icmp eq i32 %0, 8
br i1 %cmp, label %if.else.i, label %if.else
if.else: ; preds = %entry
tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.5, i32 noundef 525, ptr noundef nonnull @__PRETTY_FUNCTION__.vector_get_double) #40
unreachable
if.else.i: ; preds = %entry
tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.5, i32 noundef 513, ptr noundef nonnull @__PRETTY_FUNCTION__.vector_get) #40
unreachable
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @vector_size(ptr nocapture noundef readonly %v) #13 {
entry:
%0 = load i32, ptr %v, align 8, !tbaa !69
ret i32 %0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @vector_init(i32 noundef %n, i32 noundef %data_size) local_unnamed_addr #30 {
entry:
%call = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #39
store i32 0, ptr %call, align 8, !tbaa !69
%max = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 1
store i32 %n, ptr %max, align 4, !tbaa !71
%data_size2 = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 2
store i32 %data_size, ptr %data_size2, align 8, !tbaa !73
%mul = mul nsw i32 %data_size, %n
%conv = sext i32 %mul to i64
%calloc = tail call ptr @calloc(i64 1, i64 %conv)
%data = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 3
store ptr %calloc, ptr %data, align 8, !tbaa !72
%push = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 4
store ptr @vector_push, ptr %push, align 8, !tbaa !74
%set = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 5
store ptr @vector_set, ptr %set, align 8, !tbaa !75
%size = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 8
store ptr @vector_size, ptr %size, align 8, !tbaa !76
%get = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 6
store ptr @vector_get, ptr %get, align 8, !tbaa !77
%get_double = getelementptr inbounds %struct.vector, ptr %call, i64 0, i32 7
store ptr @vector_get_double, ptr %get_double, align 8, !tbaa !78
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #31
; Function Attrs: nounwind uwtable
define dso_local void @graph_push(ptr nocapture noundef readonly %g, i32 noundef %from, i32 noundef %to, i64 noundef %cost, i1 noundef zeroext %is_dir) #10 {
entry:
%from.addr = alloca i32, align 4
%to.addr = alloca i32, align 4
%cost.addr = alloca i64, align 8
store i32 %from, ptr %from.addr, align 4, !tbaa !24
store i32 %to, ptr %to.addr, align 4, !tbaa !24
store i64 %cost, ptr %cost.addr, align 8, !tbaa !5
%0 = load ptr, ptr %g, align 8, !tbaa !79
%idxprom = sext i32 %from to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%push = getelementptr inbounds %struct.vector, ptr %1, i64 0, i32 4
%2 = load ptr, ptr %push, align 8, !tbaa !74
call void %2(ptr noundef %1, ptr noundef nonnull %to.addr) #38
%vec_cost = getelementptr inbounds %struct.graph, ptr %g, i64 0, i32 1
%3 = load ptr, ptr %vec_cost, align 8, !tbaa !81
%arrayidx5 = getelementptr inbounds ptr, ptr %3, i64 %idxprom
%4 = load ptr, ptr %arrayidx5, align 8, !tbaa !32
%push6 = getelementptr inbounds %struct.vector, ptr %4, i64 0, i32 4
%5 = load ptr, ptr %push6, align 8, !tbaa !74
call void %5(ptr noundef %4, ptr noundef nonnull %cost.addr) #38
%ed_cnt = getelementptr inbounds %struct.graph, ptr %g, i64 0, i32 2
%6 = load ptr, ptr %ed_cnt, align 8, !tbaa !82
%arrayidx11 = getelementptr inbounds i32, ptr %6, i64 %idxprom
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !24
%inc = add nsw i32 %7, 1
store i32 %inc, ptr %arrayidx11, align 4, !tbaa !24
br i1 %is_dir, label %if.end, label %if.then
if.then: ; preds = %entry
%8 = load ptr, ptr %g, align 8, !tbaa !79
%9 = load i32, ptr %to.addr, align 4, !tbaa !24
%idxprom14 = sext i32 %9 to i64
%arrayidx15 = getelementptr inbounds ptr, ptr %8, i64 %idxprom14
%10 = load ptr, ptr %arrayidx15, align 8, !tbaa !32
%push16 = getelementptr inbounds %struct.vector, ptr %10, i64 0, i32 4
%11 = load ptr, ptr %push16, align 8, !tbaa !74
call void %11(ptr noundef %10, ptr noundef nonnull %from.addr) #38
%12 = load ptr, ptr %vec_cost, align 8, !tbaa !81
%13 = load i32, ptr %to.addr, align 4, !tbaa !24
%idxprom21 = sext i32 %13 to i64
%arrayidx22 = getelementptr inbounds ptr, ptr %12, i64 %idxprom21
%14 = load ptr, ptr %arrayidx22, align 8, !tbaa !32
%push23 = getelementptr inbounds %struct.vector, ptr %14, i64 0, i32 4
%15 = load ptr, ptr %push23, align 8, !tbaa !74
call void %15(ptr noundef %14, ptr noundef nonnull %cost.addr) #38
%16 = load ptr, ptr %ed_cnt, align 8, !tbaa !82
%17 = load i32, ptr %to.addr, align 4, !tbaa !24
%idxprom28 = sext i32 %17 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %16, i64 %idxprom28
%18 = load i32, ptr %arrayidx29, align 4, !tbaa !24
%inc30 = add nsw i32 %18, 1
store i32 %inc30, ptr %arrayidx29, align 4, !tbaa !24
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @graph_to(ptr nocapture noundef readonly %g, i32 noundef %from, i32 noundef %idx) #10 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !79
%idxprom = sext i32 %from to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%get = getelementptr inbounds %struct.vector, ptr %1, i64 0, i32 6
%2 = load ptr, ptr %get, align 8, !tbaa !77
%call = tail call i64 %2(ptr noundef %1, i32 noundef %idx) #38
%conv = trunc i64 %call to i32
ret i32 %conv
}
; Function Attrs: nounwind uwtable
define dso_local i64 @graph_cost(ptr nocapture noundef readonly %g, i32 noundef %from, i32 noundef %idx) #10 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !79
%idxprom = sext i32 %from to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%get = getelementptr inbounds %struct.vector, ptr %1, i64 0, i32 6
%2 = load ptr, ptr %get, align 8, !tbaa !77
%call = tail call i64 %2(ptr noundef %1, i32 noundef %idx) #38
ret i64 %call
}
; Function Attrs: nounwind uwtable
define dso_local double @graph_cost_double(ptr nocapture noundef readonly %g, i32 noundef %from, i32 noundef %idx) #10 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !79
%idxprom = sext i32 %from to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !32
%get_double = getelementptr inbounds %struct.vector, ptr %1, i64 0, i32 7
%2 = load ptr, ptr %get_double, align 8, !tbaa !78
%call = tail call double %2(ptr noundef %1, i32 noundef %idx) #38
ret double %call
}
; Function Attrs: nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @graph_init(i32 noundef %n, i32 %data_size) local_unnamed_addr #32 {
entry:
%call = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #39
%conv = sext i32 %n to i64
%mul = shl nsw i64 %conv, 3
%call1 = tail call noalias ptr @malloc(i64 noundef %mul) #39
store ptr %call1, ptr %call, align 8, !tbaa !79
%call4 = tail call noalias ptr @malloc(i64 noundef %mul) #39
%vec_cost = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 1
store ptr %call4, ptr %vec_cost, align 8, !tbaa !81
%mul6 = shl nsw i64 %conv, 2
%call7 = tail call noalias ptr @malloc(i64 noundef %mul6) #39
%ed_cnt = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 2
store ptr %call7, ptr %ed_cnt, align 8, !tbaa !82
%cmp52 = icmp sgt i32 %n, 0
br i1 %cmp52, label %for.body, label %for.cond.cleanup17
for.cond13.preheader: ; preds = %for.body
br i1 %cmp52, label %for.body18, label %for.cond.cleanup17
for.body: ; preds = %entry, %for.body
%i.053 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%call.i = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #39
store i32 0, ptr %call.i, align 8, !tbaa !69
%max.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 1
store i32 4, ptr %max.i, align 4, !tbaa !71
%data_size2.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 2
store i32 4, ptr %data_size2.i, align 8, !tbaa !73
%calloc.i = tail call dereferenceable_or_null(16) ptr @calloc(i64 1, i64 16)
%data.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 3
store ptr %calloc.i, ptr %data.i, align 8, !tbaa !72
%push.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 4
store ptr @vector_push, ptr %push.i, align 8, !tbaa !74
%set.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 5
store ptr @vector_set, ptr %set.i, align 8, !tbaa !75
%size.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 8
store ptr @vector_size, ptr %size.i, align 8, !tbaa !76
%get.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 6
store ptr @vector_get, ptr %get.i, align 8, !tbaa !77
%get_double.i = getelementptr inbounds %struct.vector, ptr %call.i, i64 0, i32 7
store ptr @vector_get_double, ptr %get_double.i, align 8, !tbaa !78
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %i.053
store ptr %call.i, ptr %arrayidx, align 8, !tbaa !32
%inc = add nuw nsw i64 %i.053, 1
%exitcond.not = icmp eq i64 %inc, %conv
br i1 %exitcond.not, label %for.cond13.preheader, label %for.body, !llvm.loop !83
for.cond.cleanup17: ; preds = %for.body18, %entry, %for.cond13.preheader
%push = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 3
store ptr @graph_push, ptr %push, align 8, !tbaa !84
%to = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 4
store ptr @graph_to, ptr %to, align 8, !tbaa !85
%cost = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 5
store ptr @graph_cost, ptr %cost, align 8, !tbaa !86
%cost_double = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 6
store ptr @graph_cost_double, ptr %cost_double, align 8, !tbaa !87
ret ptr %call
for.body18: ; preds = %for.cond13.preheader, %for.body18
%i12.055 = phi i64 [ %inc23, %for.body18 ], [ 0, %for.cond13.preheader ]
%call.i42 = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #39
store i32 0, ptr %call.i42, align 8, !tbaa !69
%max.i43 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 1
store i32 4, ptr %max.i43, align 4, !tbaa !71
%data_size2.i44 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 2
store i32 4, ptr %data_size2.i44, align 8, !tbaa !73
%calloc.i45 = tail call dereferenceable_or_null(16) ptr @calloc(i64 1, i64 16)
%data.i46 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 3
store ptr %calloc.i45, ptr %data.i46, align 8, !tbaa !72
%push.i47 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 4
store ptr @vector_push, ptr %push.i47, align 8, !tbaa !74
%set.i48 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 5
store ptr @vector_set, ptr %set.i48, align 8, !tbaa !75
%size.i49 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 8
store ptr @vector_size, ptr %size.i49, align 8, !tbaa !76
%get.i50 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 6
store ptr @vector_get, ptr %get.i50, align 8, !tbaa !77
%get_double.i51 = getelementptr inbounds %struct.vector, ptr %call.i42, i64 0, i32 7
store ptr @vector_get_double, ptr %get_double.i51, align 8, !tbaa !78
%arrayidx21 = getelementptr inbounds ptr, ptr %call4, i64 %i12.055
store ptr %call.i42, ptr %arrayidx21, align 8, !tbaa !32
%inc23 = add nuw nsw i64 %i12.055, 1
%exitcond56.not = icmp eq i64 %inc23, %conv
br i1 %exitcond56.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !88
}
; Function Attrs: nounwind uwtable
define dso_local void @solve() local_unnamed_addr #10 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
%q = alloca [115115 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #38
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #38
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call.i103 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i64, ptr %n, align 8, !tbaa !5
%conv = trunc i64 %0 to i32
%call = call ptr @graph_init(i32 noundef %conv, i32 poison)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #38
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #38
%1 = load i64, ptr %m, align 8, !tbaa !5
%cmp106 = icmp sgt i64 %1, 0
br i1 %cmp106, label %for.body.lr.ph, label %for.cond21.preheader.lr.ph
for.body.lr.ph: ; preds = %entry
%push = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 3
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.0107 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%call.i104 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call.i105 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%2 = load i64, ptr %a, align 8, !tbaa !5
%dec = add nsw i64 %2, -1
store i64 %dec, ptr %a, align 8, !tbaa !5
%3 = load i64, ptr %b, align 8, !tbaa !5
%dec2 = add nsw i64 %3, -1
store i64 %dec2, ptr %b, align 8, !tbaa !5
%4 = load ptr, ptr %push, align 8, !tbaa !84
%conv3 = trunc i64 %dec to i32
%conv4 = trunc i64 %dec2 to i32
call void %4(ptr noundef %call, i32 noundef %conv3, i32 noundef %conv4, i64 noundef 1, i1 noundef zeroext false) #38
%inc = add nuw nsw i64 %i.0107, 1
%5 = load i64, ptr %m, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %5
br i1 %cmp, label %for.body, label %for.cond21.preheader.lr.ph, !llvm.loop !89
for.cond21.preheader.lr.ph: ; preds = %for.body, %entry
call void @llvm.lifetime.start.p0(i64 920920, ptr nonnull %q) #38
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(920920) %q, i8 -1, i64 920920, i1 false), !tbaa !5
store i64 0, ptr %q, align 16, !tbaa !5
store i64 1, ptr @ans, align 16, !tbaa !5
%ed_cnt = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 2
%to28 = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 4
%.pre = load ptr, ptr %ed_cnt, align 8, !tbaa !82
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.cond21.preheader.lr.ph, %for.cond.cleanup26
%6 = phi ptr [ %.pre, %for.cond21.preheader.lr.ph ], [ %10, %for.cond.cleanup26 ]
%7 = phi i64 [ 0, %for.cond21.preheader.lr.ph ], [ %11, %for.cond.cleanup26 ]
%tail.0116 = phi i64 [ 1, %for.cond21.preheader.lr.ph ], [ %tail.1.lcssa, %for.cond.cleanup26 ]
%head.0115 = phi i64 [ 0, %for.cond21.preheader.lr.ph ], [ %inc41, %for.cond.cleanup26 ]
%arrayidx22109 = getelementptr inbounds i32, ptr %6, i64 %7
%8 = load i32, ptr %arrayidx22109, align 4, !tbaa !24
%cmp24111 = icmp sgt i32 %8, 0
br i1 %cmp24111, label %for.body27.lr.ph, label %for.cond.cleanup26
for.body27.lr.ph: ; preds = %for.cond21.preheader
%conv29 = trunc i64 %7 to i32
%add = add nuw nsw i64 %7, 1
br label %for.body27
for.cond43.preheader: ; preds = %for.cond.cleanup26
%9 = load i64, ptr %n, align 8, !tbaa !5
%cmp44.not117 = icmp sgt i64 %9, 0
br i1 %cmp44.not117, label %for.body47, label %for.end58
for.cond.cleanup26: ; preds = %cleanup, %for.cond21.preheader
%10 = phi ptr [ %6, %for.cond21.preheader ], [ %14, %cleanup ]
%tail.1.lcssa = phi i64 [ %tail.0116, %for.cond21.preheader ], [ %tail.2, %cleanup ]
%inc41 = add nuw nsw i64 %head.0115, 1
%arrayidx16 = getelementptr inbounds [115115 x i64], ptr %q, i64 0, i64 %inc41
%11 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%cmp17.not = icmp eq i64 %11, -1
br i1 %cmp17.not, label %for.cond43.preheader, label %for.cond21.preheader, !llvm.loop !90
for.body27: ; preds = %for.body27.lr.ph, %cleanup
%i20.0113 = phi i64 [ 0, %for.body27.lr.ph ], [ %inc38, %cleanup ]
%tail.1112 = phi i64 [ %tail.0116, %for.body27.lr.ph ], [ %tail.2, %cleanup ]
%12 = load ptr, ptr %to28, align 8, !tbaa !85
%conv30 = trunc i64 %i20.0113 to i32
%call31 = call i32 %12(ptr noundef nonnull %call, i32 noundef %conv29, i32 noundef %conv30) #38
%conv32 = sext i32 %call31 to i64
%arrayidx33 = getelementptr inbounds [115115 x i64], ptr @ans, i64 0, i64 %conv32
%13 = load i64, ptr %arrayidx33, align 8, !tbaa !5
%tobool.not = icmp eq i64 %13, 0
br i1 %tobool.not, label %if.end, label %cleanup
if.end: ; preds = %for.body27
store i64 %add, ptr %arrayidx33, align 8, !tbaa !5
%inc35 = add nsw i64 %tail.1112, 1
%arrayidx36 = getelementptr inbounds [115115 x i64], ptr %q, i64 0, i64 %tail.1112
store i64 %conv32, ptr %arrayidx36, align 8, !tbaa !5
br label %cleanup
cleanup: ; preds = %for.body27, %if.end
%tail.2 = phi i64 [ %inc35, %if.end ], [ %tail.1112, %for.body27 ]
%inc38 = add nuw nsw i64 %i20.0113, 1
%14 = load ptr, ptr %ed_cnt, align 8, !tbaa !82
%arrayidx22 = getelementptr inbounds i32, ptr %14, i64 %7
%15 = load i32, ptr %arrayidx22, align 4, !tbaa !24
%conv23 = sext i32 %15 to i64
%cmp24 = icmp slt i64 %inc38, %conv23
br i1 %cmp24, label %for.body27, label %for.cond.cleanup26, !llvm.loop !91
for.cond43: ; preds = %for.body47
%inc55 = add nuw nsw i64 %i42.0118, 1
%exitcond.not = icmp eq i64 %inc55, %9
br i1 %exitcond.not, label %for.end58, label %for.body47, !llvm.loop !92
for.body47: ; preds = %for.cond43.preheader, %for.cond43
%i42.0118 = phi i64 [ %inc55, %for.cond43 ], [ 0, %for.cond43.preheader ]
%arrayidx48 = getelementptr inbounds [115115 x i64], ptr @ans, i64 0, i64 %i42.0118
%16 = load i64, ptr %arrayidx48, align 8, !tbaa !5
%cmp49 = icmp eq i64 %16, 0
br i1 %cmp49, label %if.then51, label %for.cond43
if.then51: ; preds = %for.body47
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup72
for.end58: ; preds = %for.cond43, %for.cond43.preheader
%puts102 = call i32 @puts(ptr nonnull dereferenceable(1) @str.11)
%17 = load i64, ptr %n, align 8, !tbaa !5
%cmp62119 = icmp sgt i64 %17, 1
br i1 %cmp62119, label %for.body65, label %cleanup72
for.body65: ; preds = %for.end58, %for.body65
%i60.0120 = phi i64 [ %inc69, %for.body65 ], [ 1, %for.end58 ]
%arrayidx66 = getelementptr inbounds [115115 x i64], ptr @ans, i64 0, i64 %i60.0120
%18 = load i64, ptr %arrayidx66, align 8, !tbaa !5
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i64 noundef %18)
%inc69 = add nuw nsw i64 %i60.0120, 1
%19 = load i64, ptr %n, align 8, !tbaa !5
%cmp62 = icmp slt i64 %inc69, %19
br i1 %cmp62, label %for.body65, label %cleanup72, !llvm.loop !93
cleanup72: ; preds = %for.body65, %for.end58, %if.then51
call void @llvm.lifetime.end.p0(i64 920920, ptr nonnull %q) #38
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #38
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #38
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #38
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #38
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
tail call void @solve()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #33
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #34
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #34
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #33
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #34
; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #35
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #34
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #34
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #34
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #34
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #34
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #12 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #13 = { 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 #14 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #15 = { 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 #16 = { 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 #17 = { nofree 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 #18 = { 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 #19 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #20 = { 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 #21 = { 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 #22 = { 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 #23 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #24 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #25 = { mustprogress nofree norecurse nosync 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 #26 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #27 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #28 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #29 = { noreturn nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #30 = { 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 #31 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #32 = { nofree nounwind 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 #33 = { nofree nounwind }
attributes #34 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #35 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #36 = { nounwind allocsize(1) }
attributes #37 = { nounwind willreturn memory(read) }
attributes #38 = { nounwind }
attributes #39 = { nounwind allocsize(0) }
attributes #40 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10, !12, !13}
!16 = distinct !{!16, !10, !13, !12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !18}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !18}
!24 = !{!25, !25, i64 0}
!25 = !{!"int", !7, i64 0}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10, !29, !12, !13}
!29 = !{!"llvm.loop.peeled.count", i32 1}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !10}
!32 = !{!33, !33, i64 0}
!33 = !{!"any pointer", !7, i64 0}
!34 = distinct !{!34, !10}
!35 = distinct !{!35, !10}
!36 = distinct !{!36, !10}
!37 = distinct !{!37, !10}
!38 = distinct !{!38, !10}
!39 = distinct !{!39, !10}
!40 = distinct !{!40, !10}
!41 = distinct !{!41, !10}
!42 = distinct !{!42, !10, !12, !13}
!43 = distinct !{!43, !10, !13, !12}
!44 = !{!45, !6, i64 0}
!45 = !{!"", !6, i64 0, !6, i64 8}
!46 = !{!47, !25, i64 8}
!47 = !{!"node_AVL_set", !6, i64 0, !25, i64 8, !25, i64 12, !7, i64 16}
!48 = !{!47, !6, i64 0}
!49 = !{!47, !25, i64 12}
!50 = distinct !{!50, !10}
!51 = !{i32 -1, i32 2}
!52 = distinct !{!52, !10}
!53 = distinct !{!53, !10}
!54 = distinct !{!54, !10}
!55 = distinct !{!55, !10}
!56 = !{!57, !33, i64 8}
!57 = !{!"seg_tree", !25, i64 0, !33, i64 8, !33, i64 16, !33, i64 24, !33, i64 32, !33, i64 40, !33, i64 48}
!58 = !{!57, !25, i64 0}
!59 = !{!57, !33, i64 24}
!60 = !{!57, !33, i64 16}
!61 = distinct !{!61, !10}
!62 = distinct !{!62, !10}
!63 = !{!57, !33, i64 32}
!64 = !{!57, !33, i64 40}
!65 = !{!57, !33, i64 48}
!66 = distinct !{!66, !10}
!67 = distinct !{!67, !10}
!68 = distinct !{!68, !10}
!69 = !{!70, !25, i64 0}
!70 = !{!"vector", !25, i64 0, !25, i64 4, !25, i64 8, !33, i64 16, !33, i64 24, !33, i64 32, !33, i64 40, !33, i64 48, !33, i64 56}
!71 = !{!70, !25, i64 4}
!72 = !{!70, !33, i64 16}
!73 = !{!70, !25, i64 8}
!74 = !{!70, !33, i64 24}
!75 = !{!70, !33, i64 32}
!76 = !{!70, !33, i64 56}
!77 = !{!70, !33, i64 40}
!78 = !{!70, !33, i64 48}
!79 = !{!80, !33, i64 0}
!80 = !{!"graph", !33, i64 0, !33, i64 8, !33, i64 16, !33, i64 24, !33, i64 32, !33, i64 40, !33, i64 48}
!81 = !{!80, !33, i64 8}
!82 = !{!80, !33, i64 16}
!83 = distinct !{!83, !10}
!84 = !{!80, !33, i64 24}
!85 = !{!80, !33, i64 32}
!86 = !{!80, !33, i64 40}
!87 = !{!80, !33, i64 48}
!88 = distinct !{!88, !10}
!89 = distinct !{!89, !10}
!90 = distinct !{!90, !10}
!91 = distinct !{!91, !10}
!92 = distinct !{!92, !10}
!93 = distinct !{!93, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define SIZE 100000
#define rep(i, N) for (i = 0; i < N; i++) //制御変数iを用いてN回転
#define array(N, t) (t*)calloc(N, sizeof(t)) //t型N要素の1次元配列を動的確保後0クリア(freeを忘れずに)
#define zero(a); {int iter; rep(iter, sizeof(a)/sizeof((a)[0])) (a)[iter]=0;} //1次元配列aのゼロ初期化?
typedef long long ll;
void print_log(); //とりあえず文字を出力してどこまで実行できているか確認(for debug)
void printa_int(int *a, int size); //int型の1次元配列aを出力(for debug)
typedef struct node {
int data;
struct node *next;
} Node;
Node *list[SIZE];
Node* add_node(int i, int data) {
if (!list[i]) {
list[i] = (Node*)malloc(sizeof(Node*));
list[i]->data = data;
} else {
Node *t;
t = list[i];
list[i] = (Node*)malloc(sizeof(Node*));
list[i]->data = data;
list[i]->next = t;
}
return list[i];
}
void free_node(Node* head) {
Node *prev = NULL, *t = head;
while (t) {
prev = t;
t = t->next;
free(prev);
}
}
void printl_int(int size);
int q[SIZE]; //queue
int q_head = 0, q_tail = 0;
int queue_empty() {
return q_head == q_tail;
}
int queue_full() {
return (q_head - 1) % SIZE == q_tail % SIZE;
}
void enqueue(int data) {
if (queue_full()) {
printf("full!\n");
return;
}
q[q_tail++] = data;
q_tail %= SIZE;
}
int dequeue() {
if (queue_empty()) {
printf("empty!\n");
return -444444;
}
int data = q[q_head++];
q_head %= SIZE;
return data;
}
int main() {
int i, N, M, A, B;
int *ms, prev;
Node *t;
scanf("%d %d", &N, &M);
ms = array(N, int);
rep(i, N) {
list[i] = NULL;
ms[i] = -1;
}
rep(i, M) {
scanf("%d %d", &A, &B);
list[A - 1] = add_node(A - 1, B - 1);
list[B - 1] = add_node(B - 1, A - 1);
}
ms[0] = 0;
prev = 0;
for (t = list[0]; t; t = t->next) {
enqueue(t->data);
ms[t->data] = prev;
}
while (!queue_empty()) {
prev = dequeue();
for (t = list[prev]; t; t = t->next) {
if (ms[t->data] != -1) continue;
enqueue(t->data);
ms[t->data] = prev;
}
}
rep(i, N) {
if (!i) printf("Yes\n");
else printf("%d\n", ms[i] + 1);
}
free(ms);
return 0;
}
void print_log() {
printf("===finish!===\n");
}
void printa_int(int *a, int size) {
int i;
printf("[");
for (i = 0; i < size; i++)
printf("%d, ", a[i]);
printf("]\n");
}
void printl_int(int size) {
int i;
Node *t;
rep(i, size) {
printf("[%d] ", i);
for (t = list[i]; t; t = t->next) printf("%d, ", t->data);
printf("\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147380/source.c"
target datalayout = "e-m:e-p270: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 }
@list = dso_local local_unnamed_addr global [100000 x ptr] zeroinitializer, align 16
@q_head = dso_local local_unnamed_addr global i32 0, align 4
@q_tail = dso_local local_unnamed_addr global i32 0, align 4
@q = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c"%d, \00", align 1
@.str.9 = private unnamed_addr constant [6 x i8] c"[%d] \00", align 1
@str = private unnamed_addr constant [6 x i8] c"full!\00", align 1
@str.11 = private unnamed_addr constant [7 x i8] c"empty!\00", align 1
@str.12 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.13 = private unnamed_addr constant [14 x i8] c"===finish!===\00", align 1
@str.14 = private unnamed_addr constant [2 x i8] c"]\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local ptr @add_node(i32 noundef %i, i32 noundef %data) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds [100000 x ptr], ptr @list, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%tobool.not = icmp eq ptr %0, null
%call = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
br i1 %tobool.not, label %if.then, label %if.else
if.then: ; preds = %entry
store i32 %data, ptr %call, align 8, !tbaa !9
br label %if.end
if.else: ; preds = %entry
%next = getelementptr inbounds %struct.node, ptr %call, i64 0, i32 1
store ptr %0, ptr %next, align 8, !tbaa !12
br label %if.end
if.end: ; preds = %if.else, %if.then
store ptr %call, ptr %arrayidx, align 8
ret ptr %call
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1
; 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 @free_node(ptr noundef %head) local_unnamed_addr #3 {
entry:
%tobool.not3 = icmp eq ptr %head, null
br i1 %tobool.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%t.04 = phi ptr [ %0, %while.body ], [ %head, %entry ]
%next = getelementptr inbounds %struct.node, ptr %t.04, i64 0, i32 1
%0 = load ptr, ptr %next, align 8, !tbaa !12
tail call void @free(ptr noundef nonnull %t.04) #12
%tobool.not = icmp eq ptr %0, null
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
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: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @queue_empty() local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !15
%1 = load i32, ptr @q_tail, align 4, !tbaa !15
%cmp = icmp eq i32 %0, %1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @queue_full() local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !15
%sub = add nsw i32 %0, -1
%rem = srem i32 %sub, 100000
%1 = load i32, ptr @q_tail, align 4, !tbaa !15
%rem1 = srem i32 %1, 100000
%cmp = icmp eq i32 %rem, %rem1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @enqueue(i32 noundef %data) local_unnamed_addr #6 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !15
%sub.i = add nsw i32 %0, -1
%rem.i = srem i32 %sub.i, 100000
%1 = load i32, ptr @q_tail, align 4, !tbaa !15
%rem1.i = srem i32 %1, 100000
%cmp.i.not = icmp eq i32 %rem.i, %rem1.i
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %return
if.end: ; preds = %entry
%inc = add nsw i32 %1, 1
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @q, i64 0, i64 %idxprom
store i32 %data, ptr %arrayidx, align 4, !tbaa !15
%rem = srem i32 %inc, 100000
store i32 %rem, ptr @q_tail, align 4, !tbaa !15
br label %return
return: ; preds = %if.end, %if.then
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 i32 @dequeue() local_unnamed_addr #6 {
entry:
%0 = load i32, ptr @q_head, align 4, !tbaa !15
%1 = load i32, ptr @q_tail, align 4, !tbaa !15
%cmp.i.not = icmp eq i32 %0, %1
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.11)
br label %return
if.end: ; preds = %entry
%inc = add nsw i32 %0, 1
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @q, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !15
%rem = srem i32 %inc, 100000
store i32 %rem, ptr @q_head, align 4, !tbaa !15
br label %return
return: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ -444444, %if.then ], [ %2, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #12
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !15
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #13
%cmp122 = icmp sgt i32 %0, 0
br i1 %cmp122, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 3
call void @llvm.memset.p0.i64(ptr nonnull align 16 @list, i8 0, i64 %2, i1 false), !tbaa !5
%3 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr align 4 %call1, i8 -1, i64 %3, i1 false), !tbaa !15
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%4 = load i32, ptr %M, align 4, !tbaa !15
%cmp6124 = icmp sgt i32 %4, 0
br i1 %cmp6124, label %for.body8, label %for.end23
for.body8: ; preds = %for.cond5.preheader, %add_node.exit98
%i.1125 = phi i32 [ %inc22, %add_node.exit98 ], [ 0, %for.cond5.preheader ]
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %A, ptr noundef nonnull %B)
%5 = load i32, ptr %A, align 4, !tbaa !15
%sub = add nsw i32 %5, -1
%6 = load i32, ptr %B, align 4, !tbaa !15
%sub10 = add nsw i32 %6, -1
%idxprom.i = sext i32 %sub to i64
%arrayidx.i = getelementptr inbounds [100000 x ptr], ptr @list, i64 0, i64 %idxprom.i
%7 = load ptr, ptr %arrayidx.i, align 8, !tbaa !5
%tobool.not.i = icmp eq ptr %7, null
%call.i = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
br i1 %tobool.not.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body8
store i32 %sub10, ptr %call.i, align 8, !tbaa !9
br label %add_node.exit
if.else.i: ; preds = %for.body8
%next.i = getelementptr inbounds %struct.node, ptr %call.i, i64 0, i32 1
store ptr %7, ptr %next.i, align 8, !tbaa !12
br label %add_node.exit
add_node.exit: ; preds = %if.then.i, %if.else.i
store ptr %call.i, ptr %arrayidx.i, align 8, !tbaa !5
%idxprom.i91 = sext i32 %sub10 to i64
%arrayidx.i92 = getelementptr inbounds [100000 x ptr], ptr @list, i64 0, i64 %idxprom.i91
%8 = load ptr, ptr %arrayidx.i92, align 8, !tbaa !5
%tobool.not.i93 = icmp eq ptr %8, null
%call.i94 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
br i1 %tobool.not.i93, label %if.then.i97, label %if.else.i95
if.then.i97: ; preds = %add_node.exit
store i32 %sub, ptr %call.i94, align 8, !tbaa !9
br label %add_node.exit98
if.else.i95: ; preds = %add_node.exit
%next.i96 = getelementptr inbounds %struct.node, ptr %call.i94, i64 0, i32 1
store ptr %8, ptr %next.i96, align 8, !tbaa !12
br label %add_node.exit98
add_node.exit98: ; preds = %if.then.i97, %if.else.i95
store ptr %call.i94, ptr %arrayidx.i92, align 8, !tbaa !5
%inc22 = add nuw nsw i32 %i.1125, 1
%9 = load i32, ptr %M, align 4, !tbaa !15
%cmp6 = icmp slt i32 %inc22, %9
br i1 %cmp6, label %for.body8, label %for.end23, !llvm.loop !16
for.end23: ; preds = %add_node.exit98, %for.cond5.preheader
store i32 0, ptr %call1, align 4, !tbaa !15
%t.0126 = load ptr, ptr @list, align 16, !tbaa !5
%tobool.not127 = icmp eq ptr %t.0126, null
%.pre141 = load i32, ptr @q_head, align 4, !tbaa !15
%.pre142 = load i32, ptr @q_tail, align 4, !tbaa !15
br i1 %tobool.not127, label %while.cond.preheader, label %for.body26
while.cond.preheader: ; preds = %enqueue.exit, %for.end23
%10 = phi i32 [ %.pre142, %for.end23 ], [ %15, %enqueue.exit ]
%11 = phi i32 [ %.pre141, %for.end23 ], [ %16, %enqueue.exit ]
%cmp.i.not132 = icmp eq i32 %11, %10
br i1 %cmp.i.not132, label %for.cond52.preheader, label %if.end.i103
for.body26: ; preds = %for.end23, %enqueue.exit
%12 = phi i32 [ %15, %enqueue.exit ], [ %.pre142, %for.end23 ]
%13 = phi i32 [ %16, %enqueue.exit ], [ %.pre141, %for.end23 ]
%t.0128 = phi ptr [ %t.0, %enqueue.exit ], [ %t.0126, %for.end23 ]
%sub.i.i = add nsw i32 %13, -1
%rem.i.i = srem i32 %sub.i.i, 100000
%rem1.i.i = srem i32 %12, 100000
%cmp.i.not.i = icmp eq i32 %rem.i.i, %rem1.i.i
br i1 %cmp.i.not.i, label %if.then.i101, label %if.end.i
if.then.i101: ; preds = %for.body26
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%.pre = load i32, ptr @q_head, align 4, !tbaa !15
%.pre139 = load i32, ptr @q_tail, align 4, !tbaa !15
br label %enqueue.exit
if.end.i: ; preds = %for.body26
%14 = load i32, ptr %t.0128, align 8, !tbaa !9
%inc.i = add nsw i32 %12, 1
%idxprom.i99 = sext i32 %12 to i64
%arrayidx.i100 = getelementptr inbounds [100000 x i32], ptr @q, i64 0, i64 %idxprom.i99
store i32 %14, ptr %arrayidx.i100, align 4, !tbaa !15
%rem.i = srem i32 %inc.i, 100000
store i32 %rem.i, ptr @q_tail, align 4, !tbaa !15
br label %enqueue.exit
enqueue.exit: ; preds = %if.then.i101, %if.end.i
%15 = phi i32 [ %.pre139, %if.then.i101 ], [ %rem.i, %if.end.i ]
%16 = phi i32 [ %.pre, %if.then.i101 ], [ %13, %if.end.i ]
%17 = load i32, ptr %t.0128, align 8, !tbaa !9
%idxprom28 = sext i32 %17 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %call1, i64 %idxprom28
store i32 0, ptr %arrayidx29, align 4, !tbaa !15
%next = getelementptr inbounds %struct.node, ptr %t.0128, i64 0, i32 1
%t.0 = load ptr, ptr %next, align 8, !tbaa !5
%tobool.not = icmp eq ptr %t.0, null
br i1 %tobool.not, label %while.cond.preheader, label %for.body26, !llvm.loop !17
while.cond.loopexit.loopexit: ; preds = %for.inc49
%.pre143 = load i32, ptr @q_head, align 4, !tbaa !15
%.pre144 = load i32, ptr @q_tail, align 4, !tbaa !15
br label %while.cond.loopexit
while.cond.loopexit: ; preds = %while.cond.loopexit.loopexit, %if.end.i103
%18 = phi i32 [ %.pre144, %while.cond.loopexit.loopexit ], [ %21, %if.end.i103 ]
%19 = phi i32 [ %.pre143, %while.cond.loopexit.loopexit ], [ %rem.i107, %if.end.i103 ]
%cmp.i.not = icmp eq i32 %19, %18
br i1 %cmp.i.not, label %for.cond52.preheader, label %if.end.i103, !llvm.loop !18
for.cond52.preheader: ; preds = %while.cond.loopexit, %while.cond.preheader
%20 = load i32, ptr %N, align 4, !tbaa !15
%cmp53133 = icmp sgt i32 %20, 0
br i1 %cmp53133, label %for.inc63.peel, label %for.end65
for.inc63.peel: ; preds = %for.cond52.preheader
%puts.peel = call i32 @puts(ptr nonnull dereferenceable(1) @str.12)
%.pre145 = load i32, ptr %N, align 4, !tbaa !15
%cmp53.peel = icmp sgt i32 %.pre145, 1
br i1 %cmp53.peel, label %for.inc63, label %for.end65
if.end.i103: ; preds = %while.cond.preheader, %while.cond.loopexit
%21 = phi i32 [ %18, %while.cond.loopexit ], [ %10, %while.cond.preheader ]
%22 = phi i32 [ %19, %while.cond.loopexit ], [ %11, %while.cond.preheader ]
%inc.i104 = add nsw i32 %22, 1
%idxprom.i105 = sext i32 %22 to i64
%arrayidx.i106 = getelementptr inbounds [100000 x i32], ptr @q, i64 0, i64 %idxprom.i105
%23 = load i32, ptr %arrayidx.i106, align 4, !tbaa !15
%rem.i107 = srem i32 %inc.i104, 100000
store i32 %rem.i107, ptr @q_head, align 4, !tbaa !15
%idxprom35 = sext i32 %23 to i64
%arrayidx36 = getelementptr inbounds [100000 x ptr], ptr @list, i64 0, i64 %idxprom35
%t.1129 = load ptr, ptr %arrayidx36, align 8, !tbaa !5
%tobool38.not130 = icmp eq ptr %t.1129, null
br i1 %tobool38.not130, label %while.cond.loopexit, label %for.body39
for.body39: ; preds = %if.end.i103, %for.inc49
%t.1131 = phi ptr [ %t.1, %for.inc49 ], [ %t.1129, %if.end.i103 ]
%24 = load i32, ptr %t.1131, align 8, !tbaa !9
%idxprom41 = sext i32 %24 to i64
%arrayidx42 = getelementptr inbounds i32, ptr %call1, i64 %idxprom41
%25 = load i32, ptr %arrayidx42, align 4, !tbaa !15
%cmp43.not = icmp eq i32 %25, -1
br i1 %cmp43.not, label %if.end, label %for.inc49
if.end: ; preds = %for.body39
%26 = load i32, ptr @q_head, align 4, !tbaa !15
%sub.i.i110 = add nsw i32 %26, -1
%rem.i.i111 = srem i32 %sub.i.i110, 100000
%27 = load i32, ptr @q_tail, align 4, !tbaa !15
%rem1.i.i112 = srem i32 %27, 100000
%cmp.i.not.i113 = icmp eq i32 %rem.i.i111, %rem1.i.i112
br i1 %cmp.i.not.i113, label %if.then.i119, label %if.end.i114
if.then.i119: ; preds = %if.end
%puts.i120 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %enqueue.exit121
if.end.i114: ; preds = %if.end
%inc.i115 = add nsw i32 %27, 1
%idxprom.i116 = sext i32 %27 to i64
%arrayidx.i117 = getelementptr inbounds [100000 x i32], ptr @q, i64 0, i64 %idxprom.i116
store i32 %24, ptr %arrayidx.i117, align 4, !tbaa !15
%rem.i118 = srem i32 %inc.i115, 100000
store i32 %rem.i118, ptr @q_tail, align 4, !tbaa !15
br label %enqueue.exit121
enqueue.exit121: ; preds = %if.then.i119, %if.end.i114
%28 = load i32, ptr %t.1131, align 8, !tbaa !9
%idxprom47 = sext i32 %28 to i64
%arrayidx48 = getelementptr inbounds i32, ptr %call1, i64 %idxprom47
store i32 %23, ptr %arrayidx48, align 4, !tbaa !15
br label %for.inc49
for.inc49: ; preds = %for.body39, %enqueue.exit121
%next50 = getelementptr inbounds %struct.node, ptr %t.1131, i64 0, i32 1
%t.1 = load ptr, ptr %next50, align 8, !tbaa !5
%tobool38.not = icmp eq ptr %t.1, null
br i1 %tobool38.not, label %while.cond.loopexit.loopexit, label %for.body39, !llvm.loop !19
for.inc63: ; preds = %for.inc63.peel, %for.inc63
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc63 ], [ 1, %for.inc63.peel ]
%arrayidx60 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%29 = load i32, ptr %arrayidx60, align 4, !tbaa !15
%add = add nsw i32 %29, 1
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %add)
%.pre146 = load i32, ptr %N, align 4, !tbaa !15
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%30 = sext i32 %.pre146 to i64
%cmp53 = icmp slt i64 %indvars.iv.next, %30
br i1 %cmp53, label %for.inc63, label %for.end65, !llvm.loop !20
for.end65: ; preds = %for.inc63, %for.inc63.peel, %for.cond52.preheader
call void @free(ptr noundef %call1) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #8
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_log() local_unnamed_addr #6 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.13)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printa_int(ptr nocapture noundef readonly %a, i32 noundef %size) local_unnamed_addr #6 {
entry:
%putchar = tail call i32 @putchar(i32 91)
%cmp5 = icmp sgt i32 %size, 0
br i1 %cmp5, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !15
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !22
for.end: ; preds = %for.body, %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.14)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printl_int(i32 noundef %size) local_unnamed_addr #6 {
entry:
%cmp15 = icmp sgt i32 %size, 0
br i1 %cmp15, label %for.body.preheader, label %for.end6
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.end ]
%0 = trunc i64 %indvars.iv to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %0)
%arrayidx = getelementptr inbounds [100000 x ptr], ptr @list, i64 0, i64 %indvars.iv
%t.012 = load ptr, ptr %arrayidx, align 8, !tbaa !5
%tobool.not13 = icmp eq ptr %t.012, null
br i1 %tobool.not13, label %for.end, label %for.body2
for.body2: ; preds = %for.body, %for.body2
%t.014 = phi ptr [ %t.0, %for.body2 ], [ %t.012, %for.body ]
%1 = load i32, ptr %t.014, align 8, !tbaa !9
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %1)
%next = getelementptr inbounds %struct.node, ptr %t.014, i64 0, i32 1
%t.0 = load ptr, ptr %next, align 8, !tbaa !5
%tobool.not = icmp eq ptr %t.0, null
br i1 %tobool.not, label %for.end, label %for.body2, !llvm.loop !23
for.end: ; preds = %for.body2, %for.body
%putchar = tail call i32 @putchar(i32 10)
%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.end6, label %for.body, !llvm.loop !24
for.end6: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #9
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #10
attributes #0 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn 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 #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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind }
attributes #10 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind }
attributes #13 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!11, !11, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14, !21}
!21 = !{!"llvm.loop.peeled.count", i32 1}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
|
#include<stdio.h>
int kazu=0;
int merge(int A[],int left,int mid,int right){
int n1=mid-left;
int n2=right-mid;
int i,j,k;
int Le[250001];
int Ri[250001];
for(i=0;i<=n1-1;i++) Le[i]=A[left+i];
for(i=0;i<=n2-1;i++) Ri[i]=A[mid+i];
Le[n1]=1000000001;
Ri[n2]=1000000001;
i=0;
j=0;
for(k=left;k<=right-1;k++){
kazu++;
if(Le[i]<=Ri[j]){
A[k]=Le[i];
i++;
}
else {
A[k]=Ri[j];
j++;
}
}
}
int mergeSort(int A[], int left, int right)
{
int mid;
if(left+1<right)
{
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
int main(void)
{
int i,n;
int S[500000];
scanf("%d",&n);
for(i=0;i<=n-1;i++) scanf("%d",&S[i]);
mergeSort(S,0,n);
for(i=0;i<=n-1;i++)
{
if(i) printf(" ");
printf("%d",S[i]);
}
printf("\n%d\n",kazu);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147423/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147423/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@kazu = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%Le = alloca [250001 x i32], align 16
%Ri = alloca [250001 x i32], align 16
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
call void @llvm.lifetime.start.p0(i64 1000004, ptr nonnull %Le) #7
call void @llvm.lifetime.start.p0(i64 1000004, ptr nonnull %Ri) #7
%cmp.not.not70 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not70, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %Le, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%cmp7.not.not72 = icmp sgt i32 %sub1, 0
br i1 %cmp7.not.not72, label %for.body8.preheader, label %for.end16
for.body8.preheader: ; preds = %for.cond5.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep80 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %Ri, ptr noundef nonnull align 4 dereferenceable(1) %scevgep80, i64 %13, i1 false), !tbaa !5
br label %for.end16
for.end16: ; preds = %for.body8.preheader, %for.cond5.preheader
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250001 x i32], ptr %Le, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%idxprom19 = sext i32 %sub1 to i64
%arrayidx20 = getelementptr inbounds [250001 x i32], ptr %Ri, i64 0, i64 %idxprom19
store i32 1000000001, ptr %arrayidx20, align 4, !tbaa !5
%cmp23.not.not74 = icmp slt i32 %left, %right
br i1 %cmp23.not.not74, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end16
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %14, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%j.076 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%i.275 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%15 = load i32, ptr @kazu, align 4, !tbaa !5
%inc25 = add nsw i32 %15, 1
store i32 %inc25, ptr @kazu, align 4, !tbaa !5
%idxprom26 = zext i32 %i.275 to i64
%arrayidx27 = getelementptr inbounds [250001 x i32], ptr %Le, i64 0, i64 %idxprom26
%16 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.076 to i64
%arrayidx29 = getelementptr inbounds [250001 x i32], ptr %Ri, i64 0, i64 %idxprom28
%17 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sle i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc35 = zext i1 %cmp30.not to i32
%i.3 = add nuw nsw i32 %i.275, %inc35
%not.cmp30.not = xor i1 %cmp30.not, true
%inc40 = zext i1 %not.cmp30.not to i32
%j.1 = add nuw nsw i32 %j.076, %inc40
%18 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body24, !llvm.loop !9
for.end43: ; preds = %for.body24, %for.end16
call void @llvm.lifetime.end.p0(i64 1000004, ptr nonnull %Ri) #7
call void @llvm.lifetime.end.p0(i64 1000004, ptr nonnull %Le) #7
ret i32 undef
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret14
common.ret14: ; preds = %entry, %if.then
ret i32 undef
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
%call = tail call i32 @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
%call2 = tail call i32 @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%call3 = tail call i32 @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret14
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not21 = icmp sgt i32 %0, 0
br i1 %cmp.not.not21, 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 [500000 x i32], ptr %S, 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.next, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%call2 = call i32 @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp5.not.not23 = icmp sgt i32 %3, 0
br i1 %cmp5.not.not23, label %if.end.peel, label %for.end13
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %S, align 16, !tbaa !5
%call10.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp5.not.not.peel = icmp sgt i32 %4, 1
br i1 %cmp5.not.not.peel, label %if.end, label %for.end13
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx9 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv27
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp5.not.not = icmp slt i64 %indvars.iv.next28, %7
br i1 %cmp5.not.not, label %if.end, label %for.end13, !llvm.loop !12
for.end13: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @kazu, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#define MAX 500000
#define INFTY 2000000000
int L[(MAX/2)+2],R[(MAX/2)+2],count;
void merge(int A[],int n,int left,int mid,int right){
int i,j,k,n1,n2;
n1 = mid - left;
n2 = right - mid;
for (i = 0;i<n1;i++){
L[i] = A[left + i];
}
for (i = 0;i<n2;i++){
R[i] = A[mid + i];
}
L[n1] = INFTY;
R[n2] = INFTY;
i = 0;
j = 0;
for (k = left; k < right;k++){
count++;
if (L[i] <= R[j]){
A[k] = L[i];
i = i + 1;
}
else{
A[k] = R[j];
j = j + 1;
}
}
}
void mergeSort(int A[],int n,int left,int right){
int mid;
if (left+1 < right){
mid = (left + right)/2;
mergeSort(A,n, left, mid);
mergeSort(A,n, mid, right);
merge(A,n, left, mid, right);
}
}
int main(){
int A[MAX], n, i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
if(A[i] >= INFTY) return 1;
}
mergeSort(A,n,0,n);
for(i=0;i<n;i++){
if(i >= 1) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147467/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147467/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A90 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %A, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !15
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count86 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%i.274 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.274 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %add37
%not.cmp27.not = xor i1 %cmp27.not, true
%add32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.274, %add32
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A14 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body6.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body6.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !22
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count81.i
br i1 %cmp.n25, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck16, %for.body6.preheader.i, %middle.block18
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body6.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter31 = and i64 %wide.trip.count81.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block18, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%i.274.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.073.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.274.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.073.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add37.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %add37.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%add32.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.274.i, %add32.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
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
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end
for.cond: ; preds = %for.body
%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 !26
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %3, 1999999999
br i1 %cmp4, label %cleanup, label %for.cond
for.end: ; preds = %for.cond, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.cond ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp633 = icmp sgt i32 %4, 0
br i1 %cmp633, label %if.end11.peel, label %for.end17
if.end11.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call14.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp6.peel = icmp sgt i32 %5, 1
br i1 %cmp6.peel, label %if.end11, label %for.end17
if.end11: ; preds = %if.end11.peel, %if.end11
%indvars.iv37 = phi i64 [ %indvars.iv.next38, %if.end11 ], [ 1, %if.end11.peel ]
%putchar29 = call i32 @putchar(i32 32)
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv37
%6 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp6 = icmp slt i64 %indvars.iv.next38, %8
br i1 %cmp6, label %if.end11, label %for.end17, !llvm.loop !27
for.end17: ; preds = %if.end11, %if.end11.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
br label %cleanup
cleanup: ; preds = %for.body, %for.end17
%retval.0 = phi i32 [ 0, %for.end17 ], [ 1, %for.body ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
ret i32 %retval.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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28}
!28 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int pro(int n);
int repitition(int t);
int main()
{
int t;
//printf("%d is the value of t :\n", t);
scanf("%d",&t);
if(0 < t < 51){
int abhi = repitition(t);
}
else
return 0;
return 0;
}
int pro(int n)
{
int n1 = n, abhi = n;
int i;
for(n1;n1>0;n1--)
{
for( i = 0;i<n1;i++)
{
printf("%c",40);
}
for(int j = 0;j<n1;j++)
{
printf("%c",41);
}
for(int a = abhi - n1;a > 0;a--)
{
printf("%c",40);
printf("%c",41);
}
printf("\n");
}
}
int repitition(int t)
{
for(int i=0; i<t;i++)
{
int n;
scanf("%d",&n);
if(n<51)
{
int abhi = pro(n);
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14751/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14751/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%call3 = call i32 @repitition(i32 noundef %0)
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 uwtable
define dso_local i32 @repitition(i32 noundef %t) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%cmp4 = icmp sgt i32 %t, 0
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end, %entry
ret i32 undef
for.body: ; preds = %entry, %if.end
%i.05 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 50
br i1 %or.cond, label %for.cond1.preheader.i, label %if.end
for.cond1.preheader.i: ; preds = %for.body, %for.cond.cleanup13.i
%n1.042.i = phi i32 [ %dec21.i, %for.cond.cleanup13.i ], [ %0, %for.body ]
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%i.036.i = phi i32 [ 0, %for.cond1.preheader.i ], [ %inc.i, %for.body3.i ]
%putchar35.i = call i32 @putchar(i32 40)
%inc.i = add nuw nsw i32 %i.036.i, 1
%exitcond.not.i = icmp eq i32 %inc.i, %n1.042.i
br i1 %exitcond.not.i, label %for.body6.i, label %for.body3.i, !llvm.loop !9
for.cond.cleanup.i: ; preds = %for.body6.i
%sub.i = sub nuw nsw i32 %0, %n1.042.i
%cmp1239.not.i = icmp eq i32 %sub.i, 0
br i1 %cmp1239.not.i, label %for.cond.cleanup13.i, label %for.body14.i
for.body6.i: ; preds = %for.body3.i, %for.body6.i
%j.038.i = phi i32 [ %inc9.i, %for.body6.i ], [ 0, %for.body3.i ]
%putchar34.i = call i32 @putchar(i32 41)
%inc9.i = add nuw nsw i32 %j.038.i, 1
%exitcond43.not.i = icmp eq i32 %inc9.i, %n1.042.i
br i1 %exitcond43.not.i, label %for.cond.cleanup.i, label %for.body6.i, !llvm.loop !11
for.cond.cleanup13.i: ; preds = %for.body14.i, %for.cond.cleanup.i
%putchar.i = call i32 @putchar(i32 10)
%dec21.i = add nsw i32 %n1.042.i, -1
%cmp.i = icmp sgt i32 %n1.042.i, 1
br i1 %cmp.i, label %for.cond1.preheader.i, label %if.end, !llvm.loop !12
for.body14.i: ; preds = %for.cond.cleanup.i, %for.body14.i
%a.040.i = phi i32 [ %dec.i, %for.body14.i ], [ %sub.i, %for.cond.cleanup.i ]
%putchar32.i = call i32 @putchar(i32 40)
%putchar33.i = call i32 @putchar(i32 41)
%dec.i = add nsw i32 %a.040.i, -1
%cmp12.i = icmp sgt i32 %a.040.i, 1
br i1 %cmp12.i, label %for.body14.i, label %for.cond.cleanup13.i, !llvm.loop !13
if.end: ; preds = %for.cond.cleanup13.i, %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%inc = add nuw nsw i32 %i.05, 1
%exitcond.not = icmp eq i32 %inc, %t
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; 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 @pro(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %n, 0
br i1 %cmp41, label %for.cond1.preheader, label %for.end22
for.cond1.preheader: ; preds = %entry, %for.cond.cleanup13
%n1.042 = phi i32 [ %dec21, %for.cond.cleanup13 ], [ %n, %entry ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%i.036 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%putchar35 = tail call i32 @putchar(i32 40)
%inc = add nuw nsw i32 %i.036, 1
%exitcond.not = icmp eq i32 %inc, %n1.042
br i1 %exitcond.not, label %for.body6, label %for.body3, !llvm.loop !9
for.cond.cleanup: ; preds = %for.body6
%sub = sub nuw nsw i32 %n, %n1.042
%cmp1239.not = icmp eq i32 %sub, 0
br i1 %cmp1239.not, label %for.cond.cleanup13, label %for.body14
for.body6: ; preds = %for.body3, %for.body6
%j.038 = phi i32 [ %inc9, %for.body6 ], [ 0, %for.body3 ]
%putchar34 = tail call i32 @putchar(i32 41)
%inc9 = add nuw nsw i32 %j.038, 1
%exitcond43.not = icmp eq i32 %inc9, %n1.042
br i1 %exitcond43.not, label %for.cond.cleanup, label %for.body6, !llvm.loop !11
for.cond.cleanup13: ; preds = %for.body14, %for.cond.cleanup
%putchar = tail call i32 @putchar(i32 10)
%dec21 = add nsw i32 %n1.042, -1
%cmp = icmp sgt i32 %n1.042, 1
br i1 %cmp, label %for.cond1.preheader, label %for.end22, !llvm.loop !12
for.body14: ; preds = %for.cond.cleanup, %for.body14
%a.040 = phi i32 [ %dec, %for.body14 ], [ %sub, %for.cond.cleanup ]
%putchar32 = tail call i32 @putchar(i32 40)
%putchar33 = tail call i32 @putchar(i32 41)
%dec = add nsw i32 %a.040, -1
%cmp12 = icmp sgt i32 %a.040, 1
br i1 %cmp12, label %for.body14, label %for.cond.cleanup13, !llvm.loop !13
for.end22: ; preds = %for.cond.cleanup13, %entry
ret i32 undef
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
void merge(int [],int,int,int);
void mergeSort(int [],int,int);
int cnt,n;
int L[MAX/2+2],R[MAX/2+2];
int main()
{
int S[MAX],i;
cnt=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
mergeSort(S,0,n);
for(i=0;i<n;i++){
if(i!=0) printf(" ");
printf("%d",S[i]);
}
printf("\n%d\n",cnt);
return 0;
}
void merge(int S[], int left, int mid,int right){
int i,j,k;
int n1 = mid - left;
int n2 = right - mid;
//L[0...n1], R[0...n2] を生成
for(i=0;i<n1;i++) L[i] = S[left + i];
for(i=0;i<n2;i++) R[i] = S[mid + i];
L[n1]=R[n2]=SENTINEL;
i=0;
j=0;
for(k=left;k<right;k++){
cnt++;
if(L[i]<=R[j]){
S[k]=L[i++];
}
else{
S[k]=R[j++];
}
}
}
void mergeSort(int *S, int left, int right){
int mid,i;
if(left+1<right){
mid=(left + right)/2;
mergeSort(S, left, mid);
mergeSort(S, mid, right);
merge(S, left, mid, right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147553/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147553/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #6
store i32 0, ptr @cnt, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %S, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv26
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, 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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %S, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%S12 = ptrtoint ptr %S to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %S, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %S, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %S12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !16
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %S, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %S12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !18
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count79.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter29 = and i64 %wide.trip.count79.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !19
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !20
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !21
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count84.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @cnt, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc28.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %inc28.i
%38 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !22
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %S, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%S88 = ptrtoint ptr %S to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %S88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !23
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !24
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %S, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %S88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !25
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !26
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !27
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !28
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count84 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @cnt, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%not.cmp27.not = xor i1 %cmp27.not, true
%inc28 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc28
%38 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !22
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
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}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10, !14, !15}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !10, !14}
!21 = distinct !{!21, !10, !14}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !14, !15}
!24 = distinct !{!24, !17}
!25 = distinct !{!25, !10, !14, !15}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !10, !14}
!28 = distinct !{!28, !10, !14}
|
#include <stdio.h>
#define MAX 500000
#define INFTY 1000000001
int L[MAX], R[MAX], count = 0;
void merge(int *A, int left, int mid, int right) {
int i, j, k;
int n1 = mid - left;
int n2 = right - mid;
//L[0...n1], R[0...n2] を生成
for (i = 0; i < n1; i++)
L[i] = A[left + i];
for (i = 0; i < n2; i++)
R[i] = A[mid + i];
L[n1] = INFTY;
R[n2] = INFTY;
i = 0;
j = 0;
for (k = left; k < right; k++) {
count++;
if (L[i] <= R[j]) {
A[k] = L[i];
i++;
} else {
A[k] = R[j];
j++;
}
}
}
void mergeSort(int *A, int left, int right) {
if (left+1 < right) {
int mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
void print_array(int *A, int N) {
int i;
for(i = 0; i < N - 1; i++) {
printf("%d ", A[i]);
}
printf("%d\n", A[i]);
}
int main() {
int A[MAX], n, i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &A[i]);
}
mergeSort(A, 0, n);
print_array(A, n);
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147597/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@L = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A90 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %A, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !15
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count86 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%i.274 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.274 to i64
%arrayidx24 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%not.cmp27.not = xor i1 %cmp27.not, true
%inc32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.274, %inc32
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !22
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count81.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter29 = and i64 %wide.trip.count81.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 1000000001, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 1000000001, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%i.274.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.073.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.274.i to i64
%arrayidx24.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.073.i to i64
%arrayidx26.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc37.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %inc37.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc32.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.274.i, %inc32.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_array(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #2 {
entry:
%sub = add i32 %N, -1
%cmp8 = icmp sgt i32 %N, 1
br i1 %cmp8, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !26
for.end.loopexit: ; preds = %for.body
%1 = zext i32 %sub to i64
br label %for.end
for.end: ; preds = %entry, %for.end.loopexit
%i.0.lcssa = phi i64 [ %1, %for.end.loopexit ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %i.0.lcssa
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !27
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp8.i = icmp sgt i32 %3, 1
br i1 %cmp8.i, label %for.body.preheader.i, label %print_array.exit
for.body.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %3, -1
%wide.trip.count.i = zext i32 %sub.i to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %print_array.exit, label %for.body.i, !llvm.loop !26
print_array.exit: ; preds = %for.body.i, %for.end
%i.0.lcssa.i = phi i64 [ 0, %for.end ], [ %wide.trip.count.i, %for.body.i ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %i.0.lcssa.i
%5 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%call3.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%6 = load i32, ptr @count, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
|
#include <stdio.h>
#include <stdlib.h>
int cnt=0;
void merge(int A[], int left, int mid, int right){
int n1, n2, i, j, k;
int *L, *R;
n1 = mid - left;
n2 = right - mid;
L = (int *)malloc( sizeof( int ) * n1+100 );
R = (int *)malloc( sizeof( int ) * n2+100 );
// int L[n1+1], R[n2+1];
for(i=0; i<n1; i++){
L[i] = A[left+i];
}
for(i=0; i<n2; i++){
R[i] = A[mid+i];
}
L[n1] = 10000000000000000;
R[n2] = 10000000000000000;
i = 0;
j = 0;
for(k=left; k<right; k++){
if(L[i]<=R[j]){
A[k] = L[i];
i++;
}else{
A[k] = R[j];
j++;
}
cnt++;
}
free( L );
free( R );
}
void mergesort(int A[], int left, int right){
int mid;
if(left+1<right){
mid = (left + right)/2;
mergesort(A, left, mid);
mergesort(A, mid, right);
merge(A, left, mid, right);
}
}
int main(){
int A[500000];
int left, mid, right, n, i;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &A[i]);
}
left = 0;
right = n;
mergesort(A, left, right);
for(i=0; i<n; i++){
if(i!=0){
printf(" ");
}
printf("%d", A[i]);
}
printf("\n%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147669/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147669/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%conv = sext i32 %sub to i64
%mul = shl nsw i64 %conv, 2
%add = add nsw i64 %mul, 100
%call = tail call noalias ptr @malloc(i64 noundef %add) #8
%conv2 = sext i32 %sub1 to i64
%mul3 = shl nsw i64 %conv2, 2
%add4 = add nsw i64 %mul3, 100
%call5 = tail call noalias ptr @malloc(i64 noundef %add4) #8
%cmp86 = icmp sgt i32 %sub, 0
br i1 %cmp86, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body.preheader, %entry
%cmp1188 = icmp sgt i32 %sub1, 0
br i1 %cmp1188, label %for.body13.preheader, label %for.end21
for.body13.preheader: ; preds = %for.cond10.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep96 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep96, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %conv
store i32 1874919424, ptr %arrayidx23, align 4, !tbaa !5
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %conv2
store i32 1874919424, ptr %arrayidx25, align 4, !tbaa !5
%cmp2790 = icmp slt i32 %left, %right
br i1 %cmp2790, label %for.body29.preheader, label %for.end49
for.body29.preheader: ; preds = %for.end21
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body29
for.body29: ; preds = %for.body29.preheader, %for.body29
%indvars.iv = phi i64 [ %14, %for.body29.preheader ], [ %indvars.iv.next, %for.body29 ]
%i.293 = phi i32 [ 0, %for.body29.preheader ], [ %i.3, %for.body29 ]
%j.092 = phi i32 [ 0, %for.body29.preheader ], [ %j.1, %for.body29 ]
%idxprom30 = zext i32 %i.293 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call, i64 %idxprom30
%15 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%idxprom32 = zext i32 %j.092 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %call5, i64 %idxprom32
%16 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp sgt i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc45 = zext i1 %cmp34.not to i32
%j.1 = add nuw nsw i32 %j.092, %inc45
%not.cmp34.not = xor i1 %cmp34.not, true
%inc40 = zext i1 %not.cmp34.not to i32
%i.3 = add nuw nsw i32 %i.293, %inc40
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%18 = load i32, ptr @cnt, align 4, !tbaa !5
%inc46 = add nsw i32 %18, 1
store i32 %inc46, ptr @cnt, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end49, label %for.body29, !llvm.loop !9
for.end49: ; preds = %for.body29, %for.end21
tail call void @free(ptr noundef nonnull %call) #9
tail call void @free(ptr noundef nonnull %call5) #9
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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr 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: nounwind uwtable
define dso_local void @mergesort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergesort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv26
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !12
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #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
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
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 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 = { 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 #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: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#include<string.h>
#define max 1000000
void merge(int [],int ,int ,int );
void mergeSort(int [],int ,int );
int count = 0,newA[max];
int main(){
int i,j,A[max],left,right,n;
scanf("%d",&n);
for(i = 0;i < n;i++){
scanf("%d",&A[i]);
}
left = 0;
right = n;
mergeSort(A,left,right);
for(i = 0;i < n-1;i++){
printf("%d ",A[i]);
}
printf("%d\n",A[n-1]);
printf("%d\n",count);
return 0;
}
void mergeSort(int A[],int left, int right){
int mid = 0;
if((left + 1) < right){
mid = (left + right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
void merge(int A[],int left,int mid,int right){
int n1,n2,i,j,k;
n1 = mid - left;
n2 = right - mid;
int L[n1+1],R[n2+1];
for(i = 0;i < n1;i++){
L[i] = A[left+i];
}
for(i = 0;i < n2;i++){
R[i] = A[mid+i];
}
L[n1] = 1000000000;
R[n2] = 1000000000;
i = 0;
j = 0;
for(k = left;k < right;k++){
if(L[i] <= R[j]){
A[k] = L[i];
i++;
}
else{
A[k] = R[j];
j++;
}
count++;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147711/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147711/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@newA = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [1000000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %A) #6
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
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [1000000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub23 = add nsw i32 %3, -1
%.pre = sext i32 %sub23 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %indvars.iv30
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %A) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp72 = icmp sgt i32 %sub, 0
br i1 %cmp72, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp874 = icmp sgt i32 %sub1, 0
br i1 %cmp874, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep82 = getelementptr i8, ptr %A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep82, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond7.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 1000000000, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 1000000000, ptr %arrayidx21, align 4, !tbaa !5
%cmp2376 = icmp slt i32 %left, %right
br i1 %cmp2376, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end17
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.279 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.078 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%idxprom25 = zext i32 %i.279 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom27 = zext i32 %j.078 to i64
%arrayidx28 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom27
%18 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29.not = icmp sgt i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc39 = zext i1 %cmp29.not to i32
%j.1 = add nuw nsw i32 %j.078, %inc39
%not.cmp29.not = xor i1 %cmp29.not, true
%inc34 = zext i1 %not.cmp29.not to i32
%i.3 = add nuw nsw i32 %i.279, %inc34
%19 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%20 = load i32, ptr @count, align 4, !tbaa !5
%inc40 = add nsw i32 %20, 1
store i32 %inc40, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body24, !llvm.loop !12
for.end43: ; preds = %for.body24, %for.end17
ret void
}
; 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) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 <stdlib.h>
#define N 500000
#define A 1000000000
int res=0;
void mergesort(int *,int,int);
void merge(int *,int,int,int);
int main(){
int i,n,S[N];
scanf("%d",&n);
if(n>N){
printf("error\n");
exit(1);
}
for(i=0 ; i<n ; i++){
scanf("%d",&S[i]);
}
mergesort(S,0,n);
for(i=0 ; i<n-1 ;i++){
printf("%d " ,S[i]);
}
printf("%d",S[n-1]);
printf("\n%d\n",res);
return 0;
}
void mergesort(int *S,int left,int right){
int mid;
if(left+1 < right){
mid = (left+right)/2;
mergesort(S,left,mid);
mergesort(S,mid,right);
merge(S,left,mid,right);
}
}
void merge(int *S,int left,int mid,int right){
int n1=mid-left,n2=right-mid,i,j,k;
int L[n1+1],R[n2+1];
for(i=0 ; i<n1 ; i++){
L[i]=S[left + i];
}
for(i=0 ; i<n2 ; i++){
R[i]=S[mid + i];
}
L[n1]=A;
R[n2]=A;
i=0;
j=0;
for(k=left ; k<right ; k++){
res++;
if(L[i]<=R[j]){
S[k]=L[i];
i++;
}
else{
S[k]=R[j];
j++;
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147755/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147755/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@res = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@str = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 500000
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp223 = icmp sgt i32 %0, 0
br i1 %cmp223, label %for.body, label %for.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call3 = 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
%cmp2 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%.lcssa = phi i32 [ %0, %for.cond.preheader ], [ %1, %for.body ]
call void @mergesort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp526 = icmp sgt i32 %3, 1
br i1 %cmp526, label %for.body6, label %for.end.for.end12_crit_edge
for.end.for.end12_crit_edge: ; preds = %for.end
%sub25 = add nsw i32 %3, -1
%.pre = sext i32 %sub25 to i64
br label %for.end12
for.body6: ; preds = %for.end, %for.body6
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv32
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp5 = icmp slt i64 %indvars.iv.next33, %6
br i1 %cmp5, label %for.body6, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.body6, %for.end.for.end12_crit_edge
%idxprom14.pre-phi = phi i64 [ %.pre, %for.end.for.end12_crit_edge ], [ %6, %for.body6 ]
%arrayidx15 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %idxprom14.pre-phi
%7 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%8 = load i32, ptr @res, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %S, i32 noundef %left, i32 noundef %right) local_unnamed_addr #4 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %S, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %S, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %S, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %S, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #4 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp72 = icmp sgt i32 %sub, 0
br i1 %cmp72, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %S, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp874 = icmp sgt i32 %sub1, 0
br i1 %cmp874, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep82 = getelementptr i8, ptr %S, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep82, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond7.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 1000000000, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 1000000000, ptr %arrayidx21, align 4, !tbaa !5
%cmp2376 = icmp slt i32 %left, %right
br i1 %cmp2376, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end17
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.279 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.078 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%17 = load i32, ptr @res, align 4, !tbaa !5
%inc25 = add nsw i32 %17, 1
store i32 %inc25, ptr @res, align 4, !tbaa !5
%idxprom26 = zext i32 %i.279 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %idxprom26
%18 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.078 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom28
%19 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sgt i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc40 = zext i1 %cmp30.not to i32
%j.1 = add nuw nsw i32 %j.078, %inc40
%not.cmp30.not = xor i1 %cmp30.not, true
%inc35 = zext i1 %not.cmp30.not to i32
%i.3 = add nuw nsw i32 %i.279, %inc35
%20 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body24, !llvm.loop !12
for.end43: ; preds = %for.body24, %for.end17
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define iin(x) scanf("%d", &x)
#define lin(x) scanf("%lld", &x)
#define fin(x) scanf("%lf", &x)
#define iout(x) printf("%d", x)
#define lout(x) printf("%d", x)
#define fout(x) printf("%.10f", x)
#define _ putchar(' ')
#define endl puts("")
#define reps(i, x, n) for(i = (x); i < (n); i++)
#define rep(i, n) reps(i, 0, n)
int cnt = 0;
void merge(int A[], int left, int mid, int right) {
int n1 = mid - left;
int n2 = right - mid;
int L[500001], R[500001];
int i, j, k;
rep(i, n1) L[i] = A[left+i];
rep(i, n2) R[i] = A[mid+i];
L[n1] = 2000000000;
R[n2] = 2000000000;
i = 0, j = 0;
reps(k, left, right) {
cnt++;
if(L[i] <= R[j]) {
A[k] = L[i];
i++;
} else {
A[k] = R[j];
j++;
}
}
}
void mergeSort(int A[], int left, int right) {
if(left + 1 < right) {
int mid = (left + right) / 2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
int main() {
int n; iin(n);
int A[500001];
int i;
rep(i, n) iin(A[i]);
mergeSort(A, 0, n);
rep(i, n) {
if(i) _;
iout(A[i]);
}
endl;
iout(cnt),endl;
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147799/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [500001 x i32], align 16
%R = alloca [500001 x i32], align 16
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %L) #6
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %R) #6
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500001 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500001 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%15 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 1
store i32 %inc22, ptr @cnt, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [500001 x i32], ptr %L, i64 0, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [500001 x i32], ptr %R, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc32
%not.cmp27.not = xor i1 %cmp27.not, true
%inc37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%18 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !9
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %R) #6
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %L) #6
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%A = alloca [500001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %A) #6
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, 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 [500001 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp326 = icmp sgt i32 %3, 0
br i1 %cmp326, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %if.end ], [ 1, %if.end.peel ]
%5 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i = call noundef i32 @putc(i32 noundef 32, ptr noundef %5)
%arrayidx7 = getelementptr inbounds [500001 x i32], ptr %A, i64 0, i64 %indvars.iv30
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %8
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !14
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%9 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i22 = call noundef i32 @putc(i32 noundef 10, ptr noundef %9)
%10 = load i32, ptr @cnt, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10)
%11 = load ptr, ptr @stdout, align 8, !tbaa !12
%call.i23 = call noundef i32 @putc(i32 noundef 10, ptr noundef %11)
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#define MAX 500000
#define INFTY 2000000000
int cou=0;
void merge(int A[],int left,int mid,int right){
int n1=mid-left,n2=right-mid;
int i,j,L[MAX/2+2],R[MAX/2+2],k;
for(i=0;i<n1;i++)L[i]=A[left+i];
for(i=0;i<n2;i++)R[i]=A[mid+i];
L[n1]=R[n2]=INFTY;
i=j=0;
for(k=left;k<right;k++){
cou++;
if(L[i]<=R[j]){A[k]=L[i];i++;}
else {A[k]=R[j];j++;}
}
}
void mergeSort(int A[],int left,int right){
int mid;
if(left+1 < right){
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
int main(){
int i,n,S[MAX];
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&S[i]);
mergeSort(S,0,n);
for(i=0;i<n;i++){
printf("%d",S[i]);
if(i!=n-1)printf(" ");
}
printf("\n%d\n",cou);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147849/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147849/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cou = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [250002 x i32], align 16
%R = alloca [250002 x i32], align 16
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
call void @llvm.lifetime.start.p0(i64 1000008, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 1000008, ptr nonnull %R) #7
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr %R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr %L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%15 = load i32, ptr @cou, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 1
store i32 %inc22, ptr @cou, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr %L, i64 0, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr %R, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc32
%not.cmp27.not = xor i1 %cmp27.not, true
%inc37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%18 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !9
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 1000008, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 1000008, ptr nonnull %L) #7
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv26, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @cou, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
void mergeSort(int, int);
void merge(int, int, int);
int n, c=0;
int S[500000];
int main(){
int i;
scanf("%d",&n);
if( n<1 || 500000<n ) exit(1);
for( i=0 ; i<n ; i++ ){
scanf("%d",&S[i]);
if( S[i]<0 || 1000000000<S[i] ) exit(2);
}
mergeSort(0, n);
for( i=0 ; i<n ; i++ ){
if(i == n-1){
printf("%d\n",S[i]);
}
else{
printf("%d ",S[i]);
}
}
printf("%d\n",c);
return 0;
}
void mergeSort(int left, int right){
int mid;
if( left+1 < right ){
mid = (left + right)/2;
mergeSort(left, mid);
mergeSort(mid, right);
merge(left, mid, right);
}
}
void merge(int left, int mid, int right){
int i,j, k;
int n1 = mid - left;
int n2 = right - mid;
int L[n1+1];
int R[n2+1];
for( i=0 ; i<n1 ; i++ ){
L[i] = S[left+i];
}
for( i=0 ; i<n2 ; i++ ){
R[i] = S[mid+i];
}
L[n1] = INT_MAX;
R[n2] = INT_MAX;
i=0;
j=0;
for( k=left ; k<right ; k++ ){
if(L[i] < R[j]){
S[k] = L[i];
i++;
}
else{
S[k] = R[j];
j++;
}
c++;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147892/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147892/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@S = dso_local global [500000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: 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
%1 = add i32 %0, -500001
%or.cond = icmp ult i32 %1, -500000
br i1 %or.cond, label %if.then, label %for.body
if.then: ; preds = %entry
tail call void @exit(i32 noundef 1) #7
unreachable
for.cond: ; preds = %for.body
%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
%cmp2 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%or.cond40 = icmp ugt i32 %4, 1000000000
br i1 %or.cond40, label %if.then11, label %for.cond
if.then11: ; preds = %for.body
tail call void @exit(i32 noundef 2) #7
unreachable
for.end: ; preds = %for.cond
tail call void @mergeSort(i32 noundef 0, i32 noundef %2)
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp1444 = icmp sgt i32 %5, 0
br i1 %cmp1444, label %for.body15, label %for.end27
for.body15: ; preds = %for.end, %for.body15
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body15 ], [ 0, %for.end ]
%6 = phi i32 [ %9, %for.body15 ], [ %5, %for.end ]
%sub = add nsw i32 %6, -1
%7 = zext i32 %sub to i64
%cmp16 = icmp eq i64 %indvars.iv48, %7
%arrayidx19 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv48
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp16, ptr @.str.1, ptr @.str.2
%call20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %8)
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%9 = load i32, ptr @n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp14 = icmp slt i64 %indvars.iv.next49, %10
br i1 %cmp14, label %for.body15, label %for.end27, !llvm.loop !11
for.end27: ; preds = %for.body15, %for.end
%11 = load i32, ptr @c, align 4, !tbaa !5
%call28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret10
common.ret10: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(i32 noundef %div, i32 noundef %right)
tail call void @merge(i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret10
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #4 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp69 = icmp sgt i32 %sub, 0
br i1 %cmp69, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr @S, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp871 = icmp sgt i32 %sub1, 0
br i1 %cmp871, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep81 = getelementptr i8, ptr @S, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep81, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond7.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 2147483647, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 2147483647, ptr %arrayidx21, align 4, !tbaa !5
%cmp2374 = icmp slt i32 %left, %right
br i1 %cmp2374, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.end17
%c.promoted = load i32, ptr @c, align 4, !tbaa !5
%16 = sext i32 %left to i64
%17 = add i32 %c.promoted, %right
%wide.trip.count = sext i32 %right to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.278 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.077 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%idxprom25 = zext i32 %i.278 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %idxprom25
%18 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom27 = zext i32 %j.077 to i64
%arrayidx28 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom27
%19 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29 = icmp sge i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc39 = zext i1 %cmp29 to i32
%j.1 = add nuw nsw i32 %j.077, %inc39
%not.cmp29 = xor i1 %cmp29, true
%inc34 = zext i1 %not.cmp29 to i32
%i.3 = add nuw nsw i32 %i.278, %inc34
%20 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.end43_crit_edge, label %for.body24, !llvm.loop !12
for.cond22.for.end43_crit_edge: ; preds = %for.body24
%21 = sub i32 %17, %left
store i32 %21, ptr @c, align 4, !tbaa !5
br label %for.end43
for.end43: ; preds = %for.cond22.for.end43_crit_edge, %for.end17
ret void
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { nofree nounwind "no-trapping-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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int n,t;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
int i,j,suma,sumb,tot,ma,mb;
int arr[1001]={0};
for(i=1;i<=n;i++)scanf("%d",arr+i);
i=2,j=n;
sumb=mb,tot=1;
suma=ma=arr[1];
while(i<=j){
if(i<=j)tot++;
while(i<=j&&mb<=ma){
sumb+=arr[j];
mb+=arr[j--];
}
ma=0;
if(i<=j)tot++;
while(i<=j&&ma<=mb){
suma+=arr[i];
ma+=arr[i++];
}
mb=0;
}
printf("%d %d %d\n",tot,suma,sumb);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14795/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14795/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
%arr = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec90 = add nsw i32 %0, -1
store i32 %dec90, ptr %t, align 4, !tbaa !5
%tobool.not91 = icmp eq i32 %0, 0
br i1 %tobool.not91, label %while.end37, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx = getelementptr inbounds [1001 x i32], ptr %arr, i64 0, i64 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.end35
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %arr) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %arr, i8 0, i64 4004, i1 false)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not62 = icmp slt i32 %1, 1
br i1 %cmp.not62, label %while.end35, label %for.body
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %while.body ]
%add.ptr = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4.not80 = icmp slt i32 %2, 2
br i1 %cmp4.not80, label %while.end35, label %while.cond8.preheader
while.cond3.loopexit.loopexit: ; preds = %while.body26
%4 = trunc i64 %indvars.iv.next99 to i32
br label %while.cond3.loopexit
while.cond3.loopexit: ; preds = %while.cond3.loopexit.loopexit, %10
%i.2.lcssa = phi i32 [ %i.181, %10 ], [ %4, %while.cond3.loopexit.loopexit ]
%suma.1.lcssa = phi i32 [ %suma.083, %10 ], [ %add29, %while.cond3.loopexit.loopexit ]
%ma.1.lcssa = phi i32 [ 0, %10 ], [ %add33, %while.cond3.loopexit.loopexit ]
%cmp4.not = icmp sgt i32 %i.2.lcssa, %j.1.lcssa108
br i1 %cmp4.not, label %while.end35, label %while.cond8.preheader, !llvm.loop !11
while.cond8.preheader: ; preds = %for.end, %while.cond3.loopexit
%ma.086 = phi i32 [ %ma.1.lcssa, %while.cond3.loopexit ], [ %.pre, %for.end ]
%tot.085 = phi i32 [ %spec.select, %while.cond3.loopexit ], [ 1, %for.end ]
%sumb.084 = phi i32 [ %sumb.1.lcssa110, %while.cond3.loopexit ], [ 0, %for.end ]
%suma.083 = phi i32 [ %suma.1.lcssa, %while.cond3.loopexit ], [ %.pre, %for.end ]
%j.082 = phi i32 [ %j.1.lcssa108, %while.cond3.loopexit ], [ %2, %for.end ]
%i.181 = phi i32 [ %i.2.lcssa, %while.cond3.loopexit ], [ 2, %for.end ]
%cmp1064 = icmp sgt i32 %ma.086, -1
br i1 %cmp1064, label %while.body11.preheader, label %while.end.thread
while.body11.preheader: ; preds = %while.cond8.preheader
%5 = sext i32 %j.082 to i64
%6 = sext i32 %i.181 to i64
br label %while.body11
while.body11: ; preds = %while.body11.preheader, %while.body11
%indvars.iv95 = phi i64 [ %5, %while.body11.preheader ], [ %indvars.iv.next96, %while.body11 ]
%mb.267 = phi i32 [ 0, %while.body11.preheader ], [ %add16, %while.body11 ]
%sumb.166 = phi i32 [ %sumb.084, %while.body11.preheader ], [ %add, %while.body11 ]
%arrayidx12 = getelementptr inbounds [1001 x i32], ptr %arr, i64 0, i64 %indvars.iv95
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%add = add nsw i32 %7, %sumb.166
%indvars.iv.next96 = add nsw i64 %indvars.iv95, -1
%add16 = add nsw i32 %7, %mb.267
%cmp9 = icmp sgt i64 %indvars.iv95, %6
%cond.fr = freeze i1 %cmp9
%cmp10 = icmp sle i32 %add16, %ma.086
%8 = select i1 %cond.fr, i1 %cmp10, i1 false
br i1 %8, label %while.body11, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body11
%9 = trunc i64 %indvars.iv.next96 to i32
br i1 %cond.fr, label %while.end.thread, label %10
while.end.thread: ; preds = %while.cond8.preheader, %while.end
%mb.2.lcssa113 = phi i32 [ %add16, %while.end ], [ 0, %while.cond8.preheader ]
%sumb.1.lcssa111 = phi i32 [ %add, %while.end ], [ %sumb.084, %while.cond8.preheader ]
%j.1.lcssa109 = phi i32 [ %9, %while.end ], [ %j.082, %while.cond8.preheader ]
br label %10
10: ; preds = %while.end, %while.end.thread
%mb.2.lcssa112 = phi i32 [ %mb.2.lcssa113, %while.end.thread ], [ %add16, %while.end ]
%sumb.1.lcssa110 = phi i32 [ %sumb.1.lcssa111, %while.end.thread ], [ %add, %while.end ]
%j.1.lcssa108 = phi i32 [ %j.1.lcssa109, %while.end.thread ], [ %9, %while.end ]
%11 = phi i32 [ 2, %while.end.thread ], [ 1, %while.end ]
%spec.select = add nuw nsw i32 %11, %tot.085
%cmp2272 = icmp sle i32 %i.181, %j.1.lcssa108
%cmp2473 = icmp sgt i32 %mb.2.lcssa112, -1
%12 = select i1 %cmp2272, i1 %cmp2473, i1 false
br i1 %12, label %while.body26.preheader, label %while.cond3.loopexit
while.body26.preheader: ; preds = %10
%13 = sext i32 %i.181 to i64
%14 = sext i32 %j.1.lcssa108 to i64
br label %while.body26
while.body26: ; preds = %while.body26.preheader, %while.body26
%indvars.iv98 = phi i64 [ %13, %while.body26.preheader ], [ %indvars.iv.next99, %while.body26 ]
%ma.176 = phi i32 [ 0, %while.body26.preheader ], [ %add33, %while.body26 ]
%suma.175 = phi i32 [ %suma.083, %while.body26.preheader ], [ %add29, %while.body26 ]
%arrayidx28 = getelementptr inbounds [1001 x i32], ptr %arr, i64 0, i64 %indvars.iv98
%15 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add29 = add nsw i32 %15, %suma.175
%indvars.iv.next99 = add nsw i64 %indvars.iv98, 1
%add33 = add nsw i32 %15, %ma.176
%cmp22 = icmp slt i64 %indvars.iv98, %14
%cmp24 = icmp sle i32 %add33, %mb.2.lcssa112
%16 = select i1 %cmp22, i1 %cmp24, i1 false
br i1 %16, label %while.body26, label %while.cond3.loopexit.loopexit, !llvm.loop !13
while.end35: ; preds = %while.cond3.loopexit, %while.body, %for.end
%suma.0.lcssa = phi i32 [ %.pre, %for.end ], [ 0, %while.body ], [ %suma.1.lcssa, %while.cond3.loopexit ]
%sumb.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %while.body ], [ %sumb.1.lcssa110, %while.cond3.loopexit ]
%tot.0.lcssa = phi i32 [ 1, %for.end ], [ 1, %while.body ], [ %spec.select, %while.cond3.loopexit ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %tot.0.lcssa, i32 noundef %suma.0.lcssa, i32 noundef %sumb.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %arr) #4
%17 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %17, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %17, 0
br i1 %tobool.not, label %while.end37, label %while.body, !llvm.loop !14
while.end37: ; preds = %while.end35, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define N 500000
int cnt=0;
int a[N];
void merge(int left,int mid,int right){
int L[N/2];
int R[N/2];
int i,j,idx;
for(i=left;i<=mid;i++)
L[i-left]=a[i];
for(i=mid+1;i<=right;i++)
R[i-mid-1]=a[i];
i=0; j=0; idx=left;
while(i<=(mid-left) && j<=(right-mid-1)){
if(L[i] < R[j]){
a[idx++]=L[i++];
}
else {
a[idx++]=R[j++];
}
cnt++;
}
while(i<=(mid-left)){
a[idx++]=L[i++];
cnt++;
}
while(j<=(right-mid-1)){
a[idx++]=R[j++];
cnt++;
}
return;
}
void mergeSort(int left,int right){
int mid=(left+right)/2;
if(left < right){
mergeSort(left,mid);
mergeSort(mid+1,right);
merge(left,mid,right);
}
return;
}
int main(){
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
mergeSort(0,n-1);
for(i=0;i<n-1;i++)
printf("%d ",a[i]);
printf("%d\n",a[n-1]);
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147993/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147993/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@a = dso_local global [500000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [250000 x i32], align 16
%R = alloca [250000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %R) #7
%cmp.not95 = icmp sgt i32 %left, %mid
br i1 %cmp.not95, label %for.cond3.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr @a, i64 %1
%2 = sub i32 %mid, %left
%3 = zext i32 %2 to i64
%4 = shl nuw nsw i64 %3, 2
%5 = add nuw nsw i64 %4, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %5, i1 false), !tbaa !5
br label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body.preheader, %entry
%cmp4.not.not97 = icmp slt i32 %mid, %right
br i1 %cmp4.not.not97, label %for.body5.preheader, label %while.cond.preheader
for.body5.preheader: ; preds = %for.cond3.preheader
%6 = sext i32 %mid to i64
%wide.trip.count = sext i32 %right to i64
%7 = sub nsw i64 %wide.trip.count, %6
%min.iters.check = icmp ult i64 %7, 12
br i1 %min.iters.check, label %for.body5.preheader175, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body5.preheader
%8 = xor i64 %6, -1
%9 = add nsw i64 %8, %wide.trip.count
%.not = icmp ult i64 %9, 2147483648
br i1 %.not, label %vector.ph, label %for.body5.preheader175
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %7, -8
%ind.end = add nsw i64 %n.vec, %6
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx150 = add i64 %index, %6
%10 = add nsw i64 %offset.idx150, 1
%11 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %10
%wide.load = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load151 = load <4 x i32>, ptr %12, align 4, !tbaa !5
%sext = shl i64 %index, 32
%13 = ashr exact i64 %sext, 32
%14 = getelementptr inbounds [250000 x i32], ptr %R, i64 0, i64 %13
store <4 x i32> %wide.load, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds i32, ptr %14, i64 4
store <4 x i32> %wide.load151, ptr %15, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %while.cond.preheader, label %for.body5.preheader175
for.body5.preheader175: ; preds = %vector.scevcheck, %for.body5.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %6, %vector.scevcheck ], [ %6, %for.body5.preheader ], [ %ind.end, %middle.block ]
%17 = sub nsw i64 %wide.trip.count, %indvars.iv.ph
%xtraiter = and i64 %17, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body5.prol.loopexit, label %for.body5.prol
for.body5.prol: ; preds = %for.body5.preheader175
%indvars.iv.next.prol = add nsw i64 %indvars.iv.ph, 1
%arrayidx7.prol = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %indvars.iv.next.prol
%18 = load i32, ptr %arrayidx7.prol, align 4, !tbaa !5
%19 = trunc i64 %indvars.iv.ph to i32
%sub9.prol = sub i32 %19, %mid
%idxprom10.prol = sext i32 %sub9.prol to i64
%arrayidx11.prol = getelementptr inbounds [250000 x i32], ptr %R, i64 0, i64 %idxprom10.prol
store i32 %18, ptr %arrayidx11.prol, align 4, !tbaa !5
br label %for.body5.prol.loopexit
for.body5.prol.loopexit: ; preds = %for.body5.prol, %for.body5.preheader175
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body5.preheader175 ], [ %indvars.iv.next.prol, %for.body5.prol ]
%20 = sub nsw i64 0, %wide.trip.count
%21 = xor i64 %indvars.iv.ph, %20
%22 = icmp eq i64 %21, -1
br i1 %22, label %while.cond.preheader, label %for.body5
while.cond.preheader: ; preds = %for.body5.prol.loopexit, %for.body5, %middle.block, %for.cond3.preheader
%23 = xor i32 %mid, -1
%sub18 = add i32 %23, %right
%sub15 = sub nsw i32 %mid, %left
%cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
%24 = or i32 %sub15, %sub18
%or.cond102.not = icmp sgt i32 %24, -1
br i1 %or.cond102.not, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%25 = sext i32 %left to i64
br label %while.body
for.body5: ; preds = %for.body5.prol.loopexit, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body5 ], [ %indvars.iv.unr, %for.body5.prol.loopexit ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %indvars.iv.next
%26 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv to i32
%sub9 = sub i32 %27, %mid
%idxprom10 = sext i32 %sub9 to i64
%arrayidx11 = getelementptr inbounds [250000 x i32], ptr %R, i64 0, i64 %idxprom10
store i32 %26, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%arrayidx7.1 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %indvars.iv.next.1
%28 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%29 = trunc i64 %indvars.iv.next to i32
%sub9.1 = sub i32 %29, %mid
%idxprom10.1 = sext i32 %sub9.1 to i64
%arrayidx11.1 = getelementptr inbounds [250000 x i32], ptr %R, i64 0, i64 %idxprom10.1
store i32 %28, ptr %arrayidx11.1, align 4, !tbaa !5
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %while.cond.preheader, label %for.body5, !llvm.loop !13
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv126 = phi i64 [ %25, %while.body.preheader ], [ %indvars.iv.next127, %while.body ]
%j.0105 = phi i32 [ 0, %while.body.preheader ], [ %j.1, %while.body ]
%i.2104 = phi i32 [ 0, %while.body.preheader ], [ %i.3, %while.body ]
%inc3799103 = phi i32 [ %cnt.promoted, %while.body.preheader ], [ %inc37, %while.body ]
%idxprom20 = zext i32 %i.2104 to i64
%arrayidx21 = getelementptr inbounds [250000 x i32], ptr %L, i64 0, i64 %idxprom20
%30 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%idxprom22 = zext i32 %j.0105 to i64
%arrayidx23 = getelementptr inbounds [250000 x i32], ptr %R, i64 0, i64 %idxprom22
%31 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp slt i32 %30, %31
%.sink = tail call i32 @llvm.smin.i32(i32 %30, i32 %31)
%inc25 = zext i1 %cmp24 to i32
%i.3 = add nuw nsw i32 %i.2104, %inc25
%not.cmp24 = xor i1 %cmp24, true
%inc31 = zext i1 %not.cmp24 to i32
%j.1 = add nuw nsw i32 %j.0105, %inc31
%32 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %indvars.iv126
store i32 %.sink, ptr %32, align 4
%indvars.iv.next127 = add i64 %indvars.iv126, 1
%inc37 = add nsw i32 %inc3799103, 1
%cmp16.not = icmp sgt i32 %i.3, %sub15
%cmp19.not = icmp sgt i32 %j.1, %sub18
%or.cond = select i1 %cmp16.not, i1 true, i1 %cmp19.not
br i1 %or.cond, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !14
while.cond.while.end_crit_edge: ; preds = %while.body
%33 = trunc i64 %indvars.iv.next127 to i32
store i32 %inc37, ptr @cnt, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %while.cond.preheader
%cnt.promoted110 = phi i32 [ %inc37, %while.cond.while.end_crit_edge ], [ %cnt.promoted, %while.cond.preheader ]
%i.2.lcssa = phi i32 [ %i.3, %while.cond.while.end_crit_edge ], [ 0, %while.cond.preheader ]
%j.0.lcssa = phi i32 [ %j.1, %while.cond.while.end_crit_edge ], [ 0, %while.cond.preheader ]
%idx.0.lcssa = phi i32 [ %33, %while.cond.while.end_crit_edge ], [ %left, %while.cond.preheader ]
%cmp40.not112 = icmp sgt i32 %i.2.lcssa, %sub15
br i1 %cmp40.not112, label %while.cond50.preheader, label %while.body41.preheader
while.body41.preheader: ; preds = %while.end
%34 = sext i32 %idx.0.lcssa to i64
%35 = shl nsw i64 %34, 2
%scevgep129 = getelementptr i8, ptr @a, i64 %35
%36 = sext i32 %i.2.lcssa to i64
%37 = shl nsw i64 %36, 2
%scevgep130 = getelementptr i8, ptr %L, i64 %37
%38 = add i32 %i.2.lcssa, %left
%39 = sub i32 %mid, %38
%40 = zext i32 %39 to i64
%41 = shl nuw nsw i64 %40, 2
%42 = add nuw nsw i64 %41, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep129, ptr noundef nonnull align 4 dereferenceable(1) %scevgep130, i64 %42, i1 false), !tbaa !5
%43 = add i32 %mid, 1
%44 = sub i32 %43, %left
%45 = add i32 %i.2.lcssa, %left
%46 = sub i32 %mid, %45
%47 = zext i32 %46 to i64
%48 = add nuw nsw i64 %47, 1
%min.iters.check154 = icmp ult i32 %46, 3
br i1 %min.iters.check154, label %while.body41.preheader169, label %vector.ph155
vector.ph155: ; preds = %while.body41.preheader
%n.vec157 = and i64 %48, 8589934588
%ind.end158 = add nsw i64 %n.vec157, %36
%49 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %34, i64 0
%50 = insertelement <2 x i32> <i32 poison, i32 0>, i32 %cnt.promoted110, i64 0
br label %vector.body161
vector.body161: ; preds = %vector.body161, %vector.ph155
%index162 = phi i64 [ 0, %vector.ph155 ], [ %index.next166, %vector.body161 ]
%vec.phi = phi <2 x i64> [ %49, %vector.ph155 ], [ %51, %vector.body161 ]
%vec.phi163 = phi <2 x i64> [ zeroinitializer, %vector.ph155 ], [ %52, %vector.body161 ]
%vec.phi164 = phi <2 x i32> [ %50, %vector.ph155 ], [ %53, %vector.body161 ]
%vec.phi165 = phi <2 x i32> [ zeroinitializer, %vector.ph155 ], [ %54, %vector.body161 ]
%51 = add <2 x i64> %vec.phi, <i64 1, i64 1>
%52 = add <2 x i64> %vec.phi163, <i64 1, i64 1>
%53 = add <2 x i32> %vec.phi164, <i32 1, i32 1>
%54 = add <2 x i32> %vec.phi165, <i32 1, i32 1>
%index.next166 = add nuw i64 %index162, 4
%55 = icmp eq i64 %index.next166, %n.vec157
br i1 %55, label %middle.block152, label %vector.body161, !llvm.loop !15
middle.block152: ; preds = %vector.body161
%bin.rdx167 = add <2 x i32> %54, %53
%56 = tail call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx167)
%bin.rdx = add <2 x i64> %52, %51
%57 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n160 = icmp eq i64 %48, %n.vec157
br i1 %cmp.n160, label %while.cond38.while.cond50.preheader_crit_edge, label %while.body41.preheader169
while.body41.preheader169: ; preds = %while.body41.preheader, %middle.block152
%indvars.iv133.ph = phi i64 [ %36, %while.body41.preheader ], [ %ind.end158, %middle.block152 ]
%indvars.iv131.ph = phi i64 [ %34, %while.body41.preheader ], [ %57, %middle.block152 ]
%inc48111113.ph = phi i32 [ %cnt.promoted110, %while.body41.preheader ], [ %56, %middle.block152 ]
br label %while.body41
while.cond38.while.cond50.preheader_crit_edge: ; preds = %while.body41, %middle.block152
%indvars.iv.next132.lcssa = phi i64 [ %57, %middle.block152 ], [ %indvars.iv.next132, %while.body41 ]
%inc48.lcssa = phi i32 [ %56, %middle.block152 ], [ %inc48, %while.body41 ]
%58 = trunc i64 %indvars.iv.next132.lcssa to i32
store i32 %inc48.lcssa, ptr @cnt, align 4, !tbaa !5
br label %while.cond50.preheader
while.cond50.preheader: ; preds = %while.cond38.while.cond50.preheader_crit_edge, %while.end
%cnt.promoted117 = phi i32 [ %inc48.lcssa, %while.cond38.while.cond50.preheader_crit_edge ], [ %cnt.promoted110, %while.end ]
%idx.2.lcssa = phi i32 [ %58, %while.cond38.while.cond50.preheader_crit_edge ], [ %idx.0.lcssa, %while.end ]
%cmp53.not119 = icmp sgt i32 %j.0.lcssa, %sub18
br i1 %cmp53.not119, label %while.end62, label %while.body54.preheader
while.body54.preheader: ; preds = %while.cond50.preheader
%59 = sext i32 %idx.2.lcssa to i64
%60 = shl nsw i64 %59, 2
%scevgep139 = getelementptr i8, ptr @a, i64 %60
%61 = sext i32 %j.0.lcssa to i64
%62 = shl nsw i64 %61, 2
%scevgep140 = getelementptr i8, ptr %R, i64 %62
%63 = xor i32 %j.0.lcssa, -1
%64 = add i32 %63, %right
%65 = sub i32 %64, %mid
%66 = zext i32 %65 to i64
%67 = shl nuw nsw i64 %66, 2
%68 = add nuw nsw i64 %67, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep139, ptr noundef nonnull align 4 dereferenceable(1) %scevgep140, i64 %68, i1 false), !tbaa !5
%69 = add i32 %cnt.promoted117, %right
%70 = add i32 %j.0.lcssa, %mid
%71 = sub i32 %69, %70
store i32 %71, ptr @cnt, align 4, !tbaa !5
br label %while.end62
while.body41: ; preds = %while.body41.preheader169, %while.body41
%indvars.iv133 = phi i64 [ %indvars.iv.next134, %while.body41 ], [ %indvars.iv133.ph, %while.body41.preheader169 ]
%indvars.iv131 = phi i64 [ %indvars.iv.next132, %while.body41 ], [ %indvars.iv131.ph, %while.body41.preheader169 ]
%inc48111113 = phi i32 [ %inc48, %while.body41 ], [ %inc48111113.ph, %while.body41.preheader169 ]
%indvars.iv.next134 = add nsw i64 %indvars.iv133, 1
%indvars.iv.next132 = add nsw i64 %indvars.iv131, 1
%inc48 = add nsw i32 %inc48111113, 1
%lftr.wideiv = trunc i64 %indvars.iv.next134 to i32
%exitcond138.not = icmp eq i32 %44, %lftr.wideiv
br i1 %exitcond138.not, label %while.cond38.while.cond50.preheader_crit_edge, label %while.body41, !llvm.loop !16
while.end62: ; preds = %while.body54.preheader, %while.cond50.preheader
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %L) #7
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %left, i32 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp slt i32 %left, %right
br i1 %cmp, label %if.then, label %common.ret10
common.ret10: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add = add nsw i32 %right, %left
%div = sdiv i32 %add, 2
tail call void @mergeSort(i32 noundef %left, i32 noundef %div)
%add1 = add nsw i32 %div, 1
tail call void @mergeSort(i32 noundef %add1, i32 noundef %right)
tail call void @merge(i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret10
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @mergeSort(i32 noundef 0, i32 noundef %sub)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp425 = icmp sgt i32 %3, 1
br i1 %cmp425, label %for.body5, label %for.end.for.end11_crit_edge
for.end.for.end11_crit_edge: ; preds = %for.end
%sub324 = add nsw i32 %3, -1
%.pre = sext i32 %sub324 to i64
br label %for.end11
for.body5: ; preds = %for.end, %for.body5
%indvars.iv31 = phi i64 [ %indvars.iv.next32, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %indvars.iv31
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub3 = add nsw i32 %5, -1
%6 = sext i32 %sub3 to i64
%cmp4 = icmp slt i64 %indvars.iv.next32, %6
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !18
for.end11: ; preds = %for.body5, %for.end.for.end11_crit_edge
%idxprom13.pre-phi = phi i64 [ %.pre, %for.end.for.end11_crit_edge ], [ %6, %for.body5 ]
%arrayidx14 = getelementptr inbounds [500000 x i32], ptr @a, i64 0, i64 %idxprom13.pre-phi
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) #6
attributes #0 = { nofree 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 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include <stdio.h>
#define MAX 1000000001
void mergesort(int *,int ,int );
void merge(int *,int ,int ,int );
int count=0,n,Left[250001],Right[250001],i,n1,n2;
int main(void){
int S[500000];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&S[i]);
mergesort(S,0,n);
for(i=0;i<n;i++){
printf("%d",S[i]);
if(i!=n-1)printf(" ");
}
printf("\n%d\n",count);
return 0;
}
void mergesort(int *S,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergesort(S,left,mid);
mergesort(S,mid,right);
merge(S,left,mid,right);
}
}
void merge(int *S,int left,int mid,int right){
int j,k;
n1=mid-left;n2=right-mid;
for(i=0;i<n1;i++)
Left[i]=S[left+i];//not include mid
for(i=0;i<n2;i++)
Right[i]=S[mid+i];//include mid
Left[n1]=MAX;
Right[n2]=MAX;
for(i=0,j=0,k=left;k<right;k++){
if(Left[j]>Right[i])S[k]=Right[i++];
else S[k]=Left[j++];
}
count+=right-left;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148035/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148035/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@n1 = dso_local local_unnamed_addr global i32 0, align 4
@n2 = dso_local local_unnamed_addr global i32 0, align 4
@Left = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
@Right = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #6
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%storemerge18 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%idxprom = sext i32 %storemerge18 to i64
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %idxprom
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%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.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
call void @mergesort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
store i32 0, ptr @i, align 4, !tbaa !5
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp319 = icmp sgt i32 %3, 0
br i1 %cmp319, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%storemerge1620 = phi i32 [ %inc11, %for.inc10 ], [ 0, %for.end ]
%idxprom5 = sext i32 %storemerge1620 to i64
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr @i, align 4, !tbaa !5
%6 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%cmp8.not = icmp eq i32 %5, %sub
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr @i, align 4, !tbaa !5
%.pre22 = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %6, %for.body4 ], [ %.pre22, %if.then ]
%8 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%inc11 = add nsw i32 %8, 1
store i32 %inc11, ptr @i, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc11, %7
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, 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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %S, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %S, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %S, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
store i32 %sub.i, ptr @n1, align 4, !tbaa !5
%sub1.i = sub i32 %right, %div
store i32 %sub1.i, ptr @n2, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
%cmp59.i = icmp sgt i32 %sub.i, 0
br i1 %cmp59.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 28
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nuw nsw i64 %wide.trip.count.i, 2
%scevgep = getelementptr i8, ptr @Left, i64 %1
%2 = add nsw i64 %0, %wide.trip.count.i
%3 = shl nsw i64 %2, 2
%scevgep12 = getelementptr i8, ptr %S, i64 %3
%bound1 = icmp ugt ptr %scevgep, @i
%found.conflict = and i1 %bound1, icmp ugt (ptr getelementptr inbounds (i32, ptr @i, i64 1), ptr @Left)
%bound0 = icmp ugt ptr %scevgep12, @Left
%bound113 = icmp ult ptr %invariant.gep.i, %scevgep
%found.conflict14 = and i1 %bound0, %bound113
%conflict.rdx = or i1 %found.conflict, %found.conflict14
%bound015 = icmp ugt ptr %scevgep12, @i
%bound116 = icmp ult ptr %invariant.gep.i, getelementptr inbounds (i32, ptr @i, i64 1)
%found.conflict17 = and i1 %bound015, %bound116
%conflict.rdx18 = or i1 %conflict.rdx, %found.conflict17
br i1 %conflict.rdx18, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5, !alias.scope !12
%5 = getelementptr i32, ptr %4, i64 4
%wide.load20 = load <4 x i32>, ptr %5, align 4, !tbaa !5, !alias.scope !12
%6 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5, !alias.scope !15, !noalias !17
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load20, ptr %7, align 16, !tbaa !5, !alias.scope !15, !noalias !17
%8 = bitcast <4 x i64> %vec.ind to <8 x i32>
%9 = extractelement <8 x i32> %8, i64 6
%10 = add i32 %9, 5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %vector.body
store i32 %10, ptr @i, align 4, !tbaa !5, !alias.scope !22, !noalias !12
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%12 = xor i64 %indvars.iv.i.ph, -1
%13 = add nsw i64 %12, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%14 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.i.prol
store i32 %14, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%15 = trunc i64 %indvars.iv.next.i.prol to i32
store i32 %15, ptr @i, align 4, !tbaa !5
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !23
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%16 = icmp ult i64 %13, 3
br i1 %16, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
store i32 0, ptr @i, align 4, !tbaa !5
%cmp561.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp561.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%17 = sext i32 %div to i64
%wide.trip.count72.i = zext i32 %sub1.i to i64
%invariant.gep79.i = getelementptr i32, ptr %S, i64 %17
%min.iters.check36 = icmp ult i32 %sub1.i, 28
br i1 %min.iters.check36, label %for.body6.i.preheader, label %vector.memcheck21
vector.memcheck21: ; preds = %for.body6.preheader.i
%18 = shl nuw nsw i64 %wide.trip.count72.i, 2
%scevgep22 = getelementptr i8, ptr @Right, i64 %18
%19 = add nsw i64 %17, %wide.trip.count72.i
%20 = shl nsw i64 %19, 2
%scevgep23 = getelementptr i8, ptr %S, i64 %20
%bound124 = icmp ugt ptr %scevgep22, @i
%found.conflict25 = and i1 %bound124, icmp ugt (ptr getelementptr inbounds (i32, ptr @i, i64 1), ptr @Right)
%bound026 = icmp ugt ptr %scevgep23, @Right
%bound127 = icmp ult ptr %invariant.gep79.i, %scevgep22
%found.conflict28 = and i1 %bound026, %bound127
%conflict.rdx29 = or i1 %found.conflict25, %found.conflict28
%bound030 = icmp ugt ptr %scevgep23, @i
%bound131 = icmp ult ptr %invariant.gep79.i, getelementptr inbounds (i32, ptr @i, i64 1)
%found.conflict32 = and i1 %bound030, %bound131
%conflict.rdx33 = or i1 %conflict.rdx29, %found.conflict32
br i1 %conflict.rdx33, label %for.body6.i.preheader, label %vector.ph37
vector.ph37: ; preds = %vector.memcheck21
%n.vec39 = and i64 %wide.trip.count72.i, 4294967288
br label %vector.body42
vector.body42: ; preds = %vector.body42, %vector.ph37
%index43 = phi i64 [ 0, %vector.ph37 ], [ %index.next50, %vector.body42 ]
%vec.ind44 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph37 ], [ %vec.ind.next47, %vector.body42 ]
%21 = getelementptr i32, ptr %invariant.gep79.i, i64 %index43
%wide.load48 = load <4 x i32>, ptr %21, align 4, !tbaa !5, !alias.scope !25
%22 = getelementptr i32, ptr %21, i64 4
%wide.load49 = load <4 x i32>, ptr %22, align 4, !tbaa !5, !alias.scope !25
%23 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %index43
store <4 x i32> %wide.load48, ptr %23, align 16, !tbaa !5, !alias.scope !28, !noalias !30
%24 = getelementptr inbounds i32, ptr %23, i64 4
store <4 x i32> %wide.load49, ptr %24, align 16, !tbaa !5, !alias.scope !28, !noalias !30
%25 = bitcast <4 x i64> %vec.ind44 to <8 x i32>
%26 = extractelement <8 x i32> %25, i64 6
%27 = add i32 %26, 5
%index.next50 = add nuw i64 %index43, 8
%vec.ind.next47 = add <4 x i64> %vec.ind44, <i64 8, i64 8, i64 8, i64 8>
%28 = icmp eq i64 %index.next50, %n.vec39
br i1 %28, label %middle.block34, label %vector.body42, !llvm.loop !32
middle.block34: ; preds = %vector.body42
store i32 %27, ptr @i, align 4, !tbaa !5, !alias.scope !33, !noalias !25
%cmp.n41 = icmp eq i64 %n.vec39, %wide.trip.count72.i
br i1 %cmp.n41, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck21, %for.body6.preheader.i, %middle.block34
%indvars.iv68.i.ph = phi i64 [ 0, %vector.memcheck21 ], [ 0, %for.body6.preheader.i ], [ %n.vec39, %middle.block34 ]
%29 = xor i64 %indvars.iv68.i.ph, -1
%30 = add nsw i64 %29, %wide.trip.count72.i
%xtraiter51 = and i64 %wide.trip.count72.i, 3
%lcmp.mod52.not = icmp eq i64 %xtraiter51, 0
br i1 %lcmp.mod52.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv68.i.prol = phi i64 [ %indvars.iv.next69.i.prol, %for.body6.i.prol ], [ %indvars.iv68.i.ph, %for.body6.i.preheader ]
%prol.iter53 = phi i64 [ %prol.iter53.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep80.i.prol = getelementptr i32, ptr %invariant.gep79.i, i64 %indvars.iv68.i.prol
%31 = load i32, ptr %gep80.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv68.i.prol
store i32 %31, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next69.i.prol = add nuw nsw i64 %indvars.iv68.i.prol, 1
%32 = trunc i64 %indvars.iv.next69.i.prol to i32
store i32 %32, ptr @i, align 4, !tbaa !5
%prol.iter53.next = add i64 %prol.iter53, 1
%prol.iter53.cmp.not = icmp eq i64 %prol.iter53.next, %xtraiter51
br i1 %prol.iter53.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !34
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv68.i.unr = phi i64 [ %indvars.iv68.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next69.i.prol, %for.body6.i.prol ]
%33 = icmp ult i64 %30, 3
br i1 %33, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%34 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.i
store i32 %34, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%35 = trunc i64 %indvars.iv.next.i to i32
store i32 %35, ptr @i, align 4, !tbaa !5
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%36 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.next.i
store i32 %36, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%37 = trunc i64 %indvars.iv.next.i.1 to i32
store i32 %37, ptr @i, align 4, !tbaa !5
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%38 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.next.i.1
store i32 %38, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%39 = trunc i64 %indvars.iv.next.i.2 to i32
store i32 %39, ptr @i, align 4, !tbaa !5
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%40 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.next.i.2
store i32 %40, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%41 = trunc i64 %indvars.iv.next.i.3 to i32
store i32 %41, ptr @i, align 4, !tbaa !5
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !35
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv68.i = phi i64 [ %indvars.iv.next69.i.3, %for.body6.i ], [ %indvars.iv68.i.unr, %for.body6.i.prol.loopexit ]
%gep80.i = getelementptr i32, ptr %invariant.gep79.i, i64 %indvars.iv68.i
%42 = load i32, ptr %gep80.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv68.i
store i32 %42, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next69.i = add nuw nsw i64 %indvars.iv68.i, 1
%43 = trunc i64 %indvars.iv.next69.i to i32
store i32 %43, ptr @i, align 4, !tbaa !5
%gep80.i.1 = getelementptr i32, ptr %invariant.gep79.i, i64 %indvars.iv.next69.i
%44 = load i32, ptr %gep80.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv.next69.i
store i32 %44, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next69.i.1 = add nuw nsw i64 %indvars.iv68.i, 2
%45 = trunc i64 %indvars.iv.next69.i.1 to i32
store i32 %45, ptr @i, align 4, !tbaa !5
%gep80.i.2 = getelementptr i32, ptr %invariant.gep79.i, i64 %indvars.iv.next69.i.1
%46 = load i32, ptr %gep80.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv.next69.i.1
store i32 %46, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next69.i.2 = add nuw nsw i64 %indvars.iv68.i, 3
%47 = trunc i64 %indvars.iv.next69.i.2 to i32
store i32 %47, ptr @i, align 4, !tbaa !5
%gep80.i.3 = getelementptr i32, ptr %invariant.gep79.i, i64 %indvars.iv.next69.i.2
%48 = load i32, ptr %gep80.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv.next69.i.2
store i32 %48, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next69.i.3 = add nuw nsw i64 %indvars.iv68.i, 4
%49 = trunc i64 %indvars.iv.next69.i.3 to i32
store i32 %49, ptr @i, align 4, !tbaa !5
%exitcond73.not.i.3 = icmp eq i64 %indvars.iv.next69.i.3, %wide.trip.count72.i
br i1 %exitcond73.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !36
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block34, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %idxprom15.i
store i32 1000000001, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %idxprom17.i
store i32 1000000001, ptr %arrayidx18.i, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
%50 = sext i32 %left to i64
%wide.trip.count77.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.inc37.i, %for.end14.i
%indvars.iv74.i = phi i64 [ %50, %for.end14.i ], [ %indvars.iv.next75.i, %for.inc37.i ]
%j.064.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.inc37.i ]
%idxprom22.i = sext i32 %j.064.i to i64
%arrayidx23.i = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %idxprom22.i
%51 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%52 = load i32, ptr @i, align 4, !tbaa !5
%idxprom24.i = sext i32 %52 to i64
%arrayidx25.i = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %idxprom24.i
%53 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp26.i = icmp sgt i32 %51, %53
br i1 %cmp26.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body21.i
%inc27.i = add nsw i32 %52, 1
store i32 %inc27.i, ptr @i, align 4, !tbaa !5
br label %for.inc37.i
if.else.i: ; preds = %for.body21.i
%inc32.i = add nsw i32 %j.064.i, 1
br label %for.inc37.i
for.inc37.i: ; preds = %if.else.i, %if.then.i
%.sink.i = phi i32 [ %53, %if.then.i ], [ %51, %if.else.i ]
%j.1.i = phi i32 [ %j.064.i, %if.then.i ], [ %inc32.i, %if.else.i ]
%54 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv74.i
store i32 %.sink.i, ptr %54, align 4
%indvars.iv.next75.i = add nsw i64 %indvars.iv74.i, 1
%exitcond78.not.i = icmp eq i64 %indvars.iv.next75.i, %wide.trip.count77.i
br i1 %exitcond78.not.i, label %merge.exit, label %for.body21.i, !llvm.loop !37
merge.exit: ; preds = %for.inc37.i
%sub40.i = sub i32 %right, %left
%55 = load i32, ptr @count, align 4, !tbaa !5
%add41.i = add nsw i32 %sub40.i, %55
store i32 %add41.i, ptr @count, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %merge.exit, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %S, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #4 {
entry:
%sub = sub nsw i32 %mid, %left
store i32 %sub, ptr @n1, align 4, !tbaa !5
%sub1 = sub i32 %right, %mid
store i32 %sub1, ptr @n2, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %sub, 0
br i1 %cmp59, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub, 28
br i1 %min.iters.check, label %for.body.preheader121, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nuw nsw i64 %wide.trip.count, 2
%scevgep = getelementptr i8, ptr @Left, i64 %1
%2 = add nsw i64 %0, %wide.trip.count
%3 = shl nsw i64 %2, 2
%scevgep81 = getelementptr i8, ptr %S, i64 %3
%bound1 = icmp ugt ptr %scevgep, @i
%found.conflict = and i1 %bound1, icmp ugt (ptr getelementptr inbounds (i32, ptr @i, i64 1), ptr @Left)
%bound0 = icmp ugt ptr %scevgep81, @Left
%bound182 = icmp ult ptr %invariant.gep, %scevgep
%found.conflict83 = and i1 %bound0, %bound182
%conflict.rdx = or i1 %found.conflict, %found.conflict83
%bound084 = icmp ugt ptr %scevgep81, @i
%bound185 = icmp ult ptr %invariant.gep, getelementptr inbounds (i32, ptr @i, i64 1)
%found.conflict86 = and i1 %bound084, %bound185
%conflict.rdx87 = or i1 %conflict.rdx, %found.conflict86
br i1 %conflict.rdx87, label %for.body.preheader121, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5, !alias.scope !38
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5, !alias.scope !38
%6 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5, !alias.scope !41, !noalias !43
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5, !alias.scope !41, !noalias !43
%8 = bitcast <4 x i64> %vec.ind to <8 x i32>
%9 = extractelement <8 x i32> %8, i64 6
%10 = add i32 %9, 5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !45
middle.block: ; preds = %vector.body
store i32 %10, ptr @i, align 4, !tbaa !5, !alias.scope !46, !noalias !38
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader121
for.body.preheader121: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%12 = xor i64 %indvars.iv.ph, -1
%13 = add nsw i64 %12, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader121, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader121 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader121 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%14 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.prol
store i32 %14, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%15 = trunc i64 %indvars.iv.next.prol to i32
store i32 %15, ptr @i, align 4, !tbaa !5
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !47
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader121
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader121 ], [ %indvars.iv.next.prol, %for.body.prol ]
%16 = icmp ult i64 %13, 3
br i1 %16, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
store i32 0, ptr @i, align 4, !tbaa !5
%cmp561 = icmp sgt i32 %sub1, 0
br i1 %cmp561, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%17 = sext i32 %mid to i64
%wide.trip.count72 = zext i32 %sub1 to i64
%invariant.gep79 = getelementptr i32, ptr %S, i64 %17
%min.iters.check105 = icmp ult i32 %sub1, 28
br i1 %min.iters.check105, label %for.body6.preheader120, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%18 = shl nuw nsw i64 %wide.trip.count72, 2
%scevgep91 = getelementptr i8, ptr @Right, i64 %18
%19 = add nsw i64 %17, %wide.trip.count72
%20 = shl nsw i64 %19, 2
%scevgep92 = getelementptr i8, ptr %S, i64 %20
%bound193 = icmp ugt ptr %scevgep91, @i
%found.conflict94 = and i1 %bound193, icmp ugt (ptr getelementptr inbounds (i32, ptr @i, i64 1), ptr @Right)
%bound095 = icmp ugt ptr %scevgep92, @Right
%bound196 = icmp ult ptr %invariant.gep79, %scevgep91
%found.conflict97 = and i1 %bound095, %bound196
%conflict.rdx98 = or i1 %found.conflict94, %found.conflict97
%bound099 = icmp ugt ptr %scevgep92, @i
%bound1100 = icmp ult ptr %invariant.gep79, getelementptr inbounds (i32, ptr @i, i64 1)
%found.conflict101 = and i1 %bound099, %bound1100
%conflict.rdx102 = or i1 %conflict.rdx98, %found.conflict101
br i1 %conflict.rdx102, label %for.body6.preheader120, label %vector.ph106
vector.ph106: ; preds = %vector.memcheck90
%n.vec108 = and i64 %wide.trip.count72, 4294967288
br label %vector.body111
vector.body111: ; preds = %vector.body111, %vector.ph106
%index112 = phi i64 [ 0, %vector.ph106 ], [ %index.next119, %vector.body111 ]
%vec.ind113 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph106 ], [ %vec.ind.next116, %vector.body111 ]
%21 = getelementptr i32, ptr %invariant.gep79, i64 %index112
%wide.load117 = load <4 x i32>, ptr %21, align 4, !tbaa !5, !alias.scope !48
%22 = getelementptr i32, ptr %21, i64 4
%wide.load118 = load <4 x i32>, ptr %22, align 4, !tbaa !5, !alias.scope !48
%23 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %index112
store <4 x i32> %wide.load117, ptr %23, align 16, !tbaa !5, !alias.scope !51, !noalias !53
%24 = getelementptr inbounds i32, ptr %23, i64 4
store <4 x i32> %wide.load118, ptr %24, align 16, !tbaa !5, !alias.scope !51, !noalias !53
%25 = bitcast <4 x i64> %vec.ind113 to <8 x i32>
%26 = extractelement <8 x i32> %25, i64 6
%27 = add i32 %26, 5
%index.next119 = add nuw i64 %index112, 8
%vec.ind.next116 = add <4 x i64> %vec.ind113, <i64 8, i64 8, i64 8, i64 8>
%28 = icmp eq i64 %index.next119, %n.vec108
br i1 %28, label %middle.block103, label %vector.body111, !llvm.loop !55
middle.block103: ; preds = %vector.body111
store i32 %27, ptr @i, align 4, !tbaa !5, !alias.scope !56, !noalias !48
%cmp.n110 = icmp eq i64 %n.vec108, %wide.trip.count72
br i1 %cmp.n110, label %for.end14, label %for.body6.preheader120
for.body6.preheader120: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block103
%indvars.iv68.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec108, %middle.block103 ]
%29 = xor i64 %indvars.iv68.ph, -1
%30 = add nsw i64 %29, %wide.trip.count72
%xtraiter122 = and i64 %wide.trip.count72, 3
%lcmp.mod123.not = icmp eq i64 %xtraiter122, 0
br i1 %lcmp.mod123.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader120, %for.body6.prol
%indvars.iv68.prol = phi i64 [ %indvars.iv.next69.prol, %for.body6.prol ], [ %indvars.iv68.ph, %for.body6.preheader120 ]
%prol.iter124 = phi i64 [ %prol.iter124.next, %for.body6.prol ], [ 0, %for.body6.preheader120 ]
%gep80.prol = getelementptr i32, ptr %invariant.gep79, i64 %indvars.iv68.prol
%31 = load i32, ptr %gep80.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv68.prol
store i32 %31, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next69.prol = add nuw nsw i64 %indvars.iv68.prol, 1
%32 = trunc i64 %indvars.iv.next69.prol to i32
store i32 %32, ptr @i, align 4, !tbaa !5
%prol.iter124.next = add i64 %prol.iter124, 1
%prol.iter124.cmp.not = icmp eq i64 %prol.iter124.next, %xtraiter122
br i1 %prol.iter124.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !57
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader120
%indvars.iv68.unr = phi i64 [ %indvars.iv68.ph, %for.body6.preheader120 ], [ %indvars.iv.next69.prol, %for.body6.prol ]
%33 = icmp ult i64 %30, 3
br i1 %33, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%34 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv
store i32 %34, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%35 = trunc i64 %indvars.iv.next to i32
store i32 %35, ptr @i, align 4, !tbaa !5
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%36 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.next
store i32 %36, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%37 = trunc i64 %indvars.iv.next.1 to i32
store i32 %37, ptr @i, align 4, !tbaa !5
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%38 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.next.1
store i32 %38, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%39 = trunc i64 %indvars.iv.next.2 to i32
store i32 %39, ptr @i, align 4, !tbaa !5
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%40 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %indvars.iv.next.2
store i32 %40, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%41 = trunc i64 %indvars.iv.next.3 to i32
store i32 %41, ptr @i, align 4, !tbaa !5
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !58
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv68 = phi i64 [ %indvars.iv.next69.3, %for.body6 ], [ %indvars.iv68.unr, %for.body6.prol.loopexit ]
%gep80 = getelementptr i32, ptr %invariant.gep79, i64 %indvars.iv68
%42 = load i32, ptr %gep80, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv68
store i32 %42, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%43 = trunc i64 %indvars.iv.next69 to i32
store i32 %43, ptr @i, align 4, !tbaa !5
%gep80.1 = getelementptr i32, ptr %invariant.gep79, i64 %indvars.iv.next69
%44 = load i32, ptr %gep80.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv.next69
store i32 %44, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 2
%45 = trunc i64 %indvars.iv.next69.1 to i32
store i32 %45, ptr @i, align 4, !tbaa !5
%gep80.2 = getelementptr i32, ptr %invariant.gep79, i64 %indvars.iv.next69.1
%46 = load i32, ptr %gep80.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv.next69.1
store i32 %46, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next69.2 = add nuw nsw i64 %indvars.iv68, 3
%47 = trunc i64 %indvars.iv.next69.2 to i32
store i32 %47, ptr @i, align 4, !tbaa !5
%gep80.3 = getelementptr i32, ptr %invariant.gep79, i64 %indvars.iv.next69.2
%48 = load i32, ptr %gep80.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %indvars.iv.next69.2
store i32 %48, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next69.3 = add nuw nsw i64 %indvars.iv68, 4
%49 = trunc i64 %indvars.iv.next69.3 to i32
store i32 %49, ptr @i, align 4, !tbaa !5
%exitcond73.not.3 = icmp eq i64 %indvars.iv.next69.3, %wide.trip.count72
br i1 %exitcond73.not.3, label %for.end14, label %for.body6, !llvm.loop !59
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block103, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
store i32 0, ptr @i, align 4, !tbaa !5
%cmp2063 = icmp slt i32 %left, %right
br i1 %cmp2063, label %for.body21.preheader, label %for.end39
for.body21.preheader: ; preds = %for.end14
%50 = sext i32 %left to i64
%wide.trip.count77 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.inc37
%indvars.iv74 = phi i64 [ %50, %for.body21.preheader ], [ %indvars.iv.next75, %for.inc37 ]
%j.064 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.inc37 ]
%idxprom22 = sext i32 %j.064 to i64
%arrayidx23 = getelementptr inbounds [250001 x i32], ptr @Left, i64 0, i64 %idxprom22
%51 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%52 = load i32, ptr @i, align 4, !tbaa !5
%idxprom24 = sext i32 %52 to i64
%arrayidx25 = getelementptr inbounds [250001 x i32], ptr @Right, i64 0, i64 %idxprom24
%53 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %51, %53
br i1 %cmp26, label %if.then, label %if.else
if.then: ; preds = %for.body21
%inc27 = add nsw i32 %52, 1
store i32 %inc27, ptr @i, align 4, !tbaa !5
br label %for.inc37
if.else: ; preds = %for.body21
%inc32 = add nsw i32 %j.064, 1
br label %for.inc37
for.inc37: ; preds = %if.then, %if.else
%.sink = phi i32 [ %53, %if.then ], [ %51, %if.else ]
%j.1 = phi i32 [ %j.064, %if.then ], [ %inc32, %if.else ]
%54 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv74
store i32 %.sink, ptr %54, align 4
%indvars.iv.next75 = add nsw i64 %indvars.iv74, 1
%exitcond78.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count77
br i1 %exitcond78.not, label %for.end39, label %for.body21, !llvm.loop !37
for.end39: ; preds = %for.inc37, %for.end14
%sub40 = sub i32 %right, %left
%55 = load i32, ptr @count, align 4, !tbaa !5
%add41 = add nsw i32 %sub40, %55
store i32 %add41, ptr @count, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(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, 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 }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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 = distinct !{!13, !14}
!14 = distinct !{!14, !"LVerDomain"}
!15 = !{!16}
!16 = distinct !{!16, !14}
!17 = !{!18, !13}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !10, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = !{!18}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = !{!26}
!26 = distinct !{!26, !27}
!27 = distinct !{!27, !"LVerDomain"}
!28 = !{!29}
!29 = distinct !{!29, !27}
!30 = !{!31, !26}
!31 = distinct !{!31, !27}
!32 = distinct !{!32, !10, !20, !21}
!33 = !{!31}
!34 = distinct !{!34, !24}
!35 = distinct !{!35, !10, !20}
!36 = distinct !{!36, !10, !20}
!37 = distinct !{!37, !10}
!38 = !{!39}
!39 = distinct !{!39, !40}
!40 = distinct !{!40, !"LVerDomain"}
!41 = !{!42}
!42 = distinct !{!42, !40}
!43 = !{!44, !39}
!44 = distinct !{!44, !40}
!45 = distinct !{!45, !10, !20, !21}
!46 = !{!44}
!47 = distinct !{!47, !24}
!48 = !{!49}
!49 = distinct !{!49, !50}
!50 = distinct !{!50, !"LVerDomain"}
!51 = !{!52}
!52 = distinct !{!52, !50}
!53 = !{!54, !49}
!54 = distinct !{!54, !50}
!55 = distinct !{!55, !10, !20, !21}
!56 = !{!54}
!57 = distinct !{!57, !24}
!58 = distinct !{!58, !10, !20}
!59 = distinct !{!59, !10, !20}
|
#include<stdio.h>
#include<stdlib.h>
#define SENTINEL 1000000000
int count=0;
void merge(int A[],int left,int mid,int right){
int n1,n2,i,j,k;
int *L,*R;
n1=mid-left;
n2=right-mid;
L=(int *)malloc(sizeof(int)*(n1+1));
R=(int *)malloc(sizeof(int)*(n2+1));
for(i=0;i<=n1-1;i++){
L[i]=A[left+i];
}
for(j=0;j<=n2-1;j++){
R[j]=A[mid+j];
}
L[n1]=SENTINEL;
R[n2]=SENTINEL;
i=0;
j=0;
for(k=left;k<=right-1;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
count++;
}
else{
A[k]=R[j];
j++;
count++;
}
}
free(L);
free(R);
}
void mergeSort(int A[],int left,int right){
int i,mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
int main(){
int A[500000];
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
mergeSort(A,0,n);
for(i=0;i<n;i++){
printf("%d",A[i]);
if(i<n-1)printf(" ");
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148079/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148079/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #8
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #8
%cmp.not.not90 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not90, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body.preheader, %entry
%cmp13.not.not92 = icmp sgt i32 %sub1, 0
br i1 %cmp13.not.not92, label %for.body15.preheader, label %for.end23
for.body15.preheader: ; preds = %for.cond11.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep100 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep100, i64 %13, i1 false), !tbaa !5
br label %for.end23
for.end23: ; preds = %for.body15.preheader, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call, i64 %idxprom24
store i32 1000000000, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %call5, i64 %idxprom26
store i32 1000000000, ptr %arrayidx27, align 4, !tbaa !5
%cmp30.not.not94 = icmp slt i32 %left, %right
br i1 %cmp30.not.not94, label %for.body32.preheader, label %for.end53
for.body32.preheader: ; preds = %for.end23
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body32
for.body32: ; preds = %for.body32.preheader, %for.body32
%indvars.iv = phi i64 [ %14, %for.body32.preheader ], [ %indvars.iv.next, %for.body32 ]
%i.197 = phi i32 [ 0, %for.body32.preheader ], [ %i.2, %for.body32 ]
%j.196 = phi i32 [ 0, %for.body32.preheader ], [ %j.2, %for.body32 ]
%idxprom33 = zext i32 %i.197 to i64
%arrayidx34 = getelementptr inbounds i32, ptr %call, i64 %idxprom33
%15 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%idxprom35 = zext i32 %j.196 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %call5, i64 %idxprom35
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37.not = icmp sgt i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc49 = zext i1 %cmp37.not to i32
%j.2 = add nuw nsw i32 %j.196, %inc49
%not.cmp37.not = xor i1 %cmp37.not, true
%inc43 = zext i1 %not.cmp37.not to i32
%i.2 = add nuw nsw i32 %i.197, %inc43
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end53, label %for.body32, !llvm.loop !9
for.end53: ; preds = %for.body32, %for.end23
tail call void @free(ptr noundef nonnull %call) #9
tail call void @free(ptr noundef nonnull %call5) #9
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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr 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: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, 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 [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 0
br i1 %cmp324, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv28
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp8 = icmp slt i64 %indvars.iv28, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar21 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.inc10, %for.end
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #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
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
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 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 = { 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 #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: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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 <limits.h>
long c = 0;
void merge(long *a, long left, long mid, long right){
long n1, n2, i, j, k;
n1 = mid - left;
n2 = right - mid;
long l[n1 + 1], r[n2 + 1];
for(i = 0; i < n1; ++i) l[i] = a[left + i];
for(i = 0; i < n2; ++i) r[i] = a[mid + i];
l[n1] = LONG_MAX;
r[n2] = LONG_MAX;
i = 0;
j = 0;
for(k = left; k < right; ++k){
if(l[i] <= r[j]) a[k] = l[i++];
else a[k] = r[j++];
c++;
}
}
void merge_sort(long *a, long left, long right){
if(left + 1 < right){
long mid = (left + right) / 2;
merge_sort(a, left, mid);
merge_sort(a, mid, right);
merge(a, left, mid, right);
}
}
int main(){
long n, s[500000], i, j;
scanf("%ld", &n);
for(i = 0; i < n; ++i) scanf("%ld", s + i);
merge_sort(s, 0, n);
for(i = 0; i < n; ++i) printf(i != 0 ? " %ld" : "%ld", s[i]);
printf("\n%ld\n", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148136/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148136/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i64 0, align 8
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c" %ld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"\0A%ld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %a, i64 noundef %left, i64 noundef %mid, i64 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %mid, %left
%sub1 = sub nsw i64 %right, %mid
%add = add nsw i64 %sub, 1
%vla = alloca i64, i64 %add, align 16
%add2 = add nsw i64 %sub1, 1
%vla3 = alloca i64, i64 %add2, align 16
%cmp59 = icmp sgt i64 %sub, 0
br i1 %cmp59, label %for.body.preheader, label %for.cond6.preheader
for.body.preheader: ; preds = %entry
%invariant.gep = getelementptr i64, ptr %a, i64 %left
%0 = sub i64 %mid, %left
%1 = shl i64 %0, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla, ptr align 8 %invariant.gep, i64 %1, i1 false), !tbaa !5
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body.preheader, %entry
%cmp763 = icmp sgt i64 %sub1, 0
br i1 %cmp763, label %for.body8.preheader, label %for.end14
for.body8.preheader: ; preds = %for.cond6.preheader
%invariant.gep61 = getelementptr i64, ptr %a, i64 %mid
%2 = sub i64 %right, %mid
%3 = shl i64 %2, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla3, ptr align 8 %invariant.gep61, i64 %3, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body8.preheader, %for.cond6.preheader
%arrayidx15 = getelementptr inbounds i64, ptr %vla, i64 %sub
store i64 9223372036854775807, ptr %arrayidx15, align 8, !tbaa !5
%arrayidx16 = getelementptr inbounds i64, ptr %vla3, i64 %sub1
store i64 9223372036854775807, ptr %arrayidx16, align 8, !tbaa !5
%cmp1865 = icmp slt i64 %left, %right
br i1 %cmp1865, label %for.body19, label %for.end32
for.body19: ; preds = %for.end14, %for.body19
%i.268 = phi i64 [ %i.3, %for.body19 ], [ 0, %for.end14 ]
%j.067 = phi i64 [ %j.1, %for.body19 ], [ 0, %for.end14 ]
%k.066 = phi i64 [ %inc31, %for.body19 ], [ %left, %for.end14 ]
%arrayidx20 = getelementptr inbounds i64, ptr %vla, i64 %i.268
%4 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%arrayidx21 = getelementptr inbounds i64, ptr %vla3, i64 %j.067
%5 = load i64, ptr %arrayidx21, align 8, !tbaa !5
%cmp22.not = icmp sgt i64 %4, %5
%.sink = tail call i64 @llvm.smin.i64(i64 %4, i64 %5)
%inc26 = zext i1 %cmp22.not to i64
%j.1 = add nuw nsw i64 %j.067, %inc26
%not.cmp22.not = xor i1 %cmp22.not, true
%inc23 = zext i1 %not.cmp22.not to i64
%i.3 = add nuw nsw i64 %i.268, %inc23
%6 = getelementptr inbounds i64, ptr %a, i64 %k.066
store i64 %.sink, ptr %6, align 8
%7 = load i64, ptr @c, align 8, !tbaa !5
%inc29 = add nsw i64 %7, 1
store i64 %inc29, ptr @c, align 8, !tbaa !5
%inc31 = add nsw i64 %k.066, 1
%exitcond.not = icmp eq i64 %inc31, %right
br i1 %exitcond.not, label %for.end32, label %for.body19, !llvm.loop !9
for.end32: ; preds = %for.body19, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge_sort(ptr noundef %a, i64 noundef %left, i64 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i64 %left, 1
%cmp = icmp slt i64 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i64 %right, %left
%div = sdiv i64 %add1, 2
tail call void @merge_sort(ptr noundef %a, i64 noundef %left, i64 noundef %div)
tail call void @merge_sort(ptr noundef %a, i64 noundef %div, i64 noundef %right)
tail call void @merge(ptr noundef %a, i64 noundef %left, i64 noundef %div, i64 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i64, align 8
%s = alloca [500000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp18 = icmp sgt i64 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.019 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i64, ptr %s, i64 %i.019
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%inc = add nuw nsw i64 %i.019, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %1, %for.body ]
call void @merge_sort(ptr noundef nonnull %s, i64 noundef 0, i64 noundef %.lcssa)
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp420 = icmp sgt i64 %2, 0
br i1 %cmp420, label %for.body5.preheader, label %for.end10
for.body5.preheader: ; preds = %for.end
%3 = load i64, ptr %s, align 16, !tbaa !5
%call7.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %3)
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp4.peel = icmp sgt i64 %4, 1
br i1 %cmp4.peel, label %for.body5, label %for.end10
for.body5: ; preds = %for.body5.preheader, %for.body5
%i.121 = phi i64 [ %inc9, %for.body5 ], [ 1, %for.body5.preheader ]
%arrayidx = getelementptr inbounds [500000 x i64], ptr %s, i64 0, i64 %i.121
%5 = load i64, ptr %arrayidx, align 8, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %5)
%inc9 = add nuw nsw i64 %i.121, 1
%6 = load i64, ptr %n, align 8, !tbaa !5
%cmp4 = icmp slt i64 %inc9, %6
br i1 %cmp4, label %for.body5, label %for.end10, !llvm.loop !12
for.end10: ; preds = %for.body5, %for.body5.preheader, %for.end
%7 = load i64, ptr @c, align 8, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %7)
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %s) #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 #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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define INFTY 999999999
int count;
void merge(int *A,int left,int mid,int right){
int n1=(mid-left);
int n2=(right-mid);
int *L,*R;
L=(int*)malloc(sizeof(int)*(n1+1));
R=(int*)malloc(sizeof(int)*(n2+1));
for(int i=0;i<n1;i++){
L[i]=A[left+i];
}
for(int i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1]=INFTY;
R[n2]=INFTY;
int i=0,j=0;
for(int k=left;k<(right);k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}else{
A[k]=R[j];
j++;
}
count++;
}
}
void mergeSort(int *A,int left,int right){
int mid;
if((left+1)<right){
mid=((left+right)/2);
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
int main(){
int N;
int *S;
count=0;
scanf("%d",&N);
S=(int*)malloc(sizeof(int)*N);
for(int i=0;i<N;i++){
scanf("%d",&S[i]);
}
mergeSort(S,0,N);
for(int i=0;i<N;i++){
printf("%d",S[i]);
if(i==(N-1)){
printf("\n");
}else{
printf(" ");
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148200/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #7
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #7
%cmp86 = icmp sgt i32 %sub, 0
br i1 %cmp86, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body.preheader, %entry
%cmp1288 = icmp sgt i32 %sub1, 0
br i1 %cmp1288, label %for.body15.preheader, label %for.cond.cleanup14
for.body15.preheader: ; preds = %for.cond11.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep96 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep96, i64 %13, i1 false), !tbaa !5
br label %for.cond.cleanup14
for.cond.cleanup14: ; preds = %for.body15.preheader, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call, i64 %idxprom24
store i32 999999999, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %call5, i64 %idxprom26
store i32 999999999, ptr %arrayidx27, align 4, !tbaa !5
%cmp3090 = icmp slt i32 %left, %right
br i1 %cmp3090, label %for.body33.preheader, label %for.cond.cleanup32
for.body33.preheader: ; preds = %for.cond.cleanup14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body33
for.cond.cleanup32: ; preds = %for.body33, %for.cond.cleanup14
ret void
for.body33: ; preds = %for.body33.preheader, %for.body33
%indvars.iv = phi i64 [ %14, %for.body33.preheader ], [ %indvars.iv.next, %for.body33 ]
%j.092 = phi i32 [ 0, %for.body33.preheader ], [ %j.1, %for.body33 ]
%i28.091 = phi i32 [ 0, %for.body33.preheader ], [ %i28.1, %for.body33 ]
%idxprom34 = zext i32 %i28.091 to i64
%arrayidx35 = getelementptr inbounds i32, ptr %call, i64 %idxprom34
%15 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%idxprom36 = zext i32 %j.092 to i64
%arrayidx37 = getelementptr inbounds i32, ptr %call5, i64 %idxprom36
%16 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%cmp38.not = icmp sle i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc44 = zext i1 %cmp38.not to i32
%i28.1 = add nuw nsw i32 %i28.091, %inc44
%not.cmp38.not = xor i1 %cmp38.not, true
%inc49 = zext i1 %not.cmp38.not to i32
%j.1 = add nuw nsw i32 %j.092, %inc49
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%18 = load i32, ptr @count, align 4, !tbaa !5
%inc50 = add nsw i32 %18, 1
store i32 %inc50, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup32, label %for.body33, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress 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 @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; 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) #8
store i32 0, ptr @count, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
call void @mergeSort(ptr noundef %call1, i32 noundef 0, i32 noundef %.lcssa)
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp631 = icmp sgt i32 %1, 0
br i1 %cmp631, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond.cleanup8: ; preds = %for.body9, %for.cond.cleanup
%4 = load i32, ptr @count, align 4, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
ret i32 0
for.body9: ; preds = %for.cond.cleanup, %for.body9
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.body9 ], [ 0, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv35
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%6 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = zext i32 %sub to i64
%cmp13 = icmp eq i64 %indvars.iv35, %7
%. = select i1 %cmp13, i32 10, i32 32
%putchar28 = call i32 @putchar(i32 %.)
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%8 = load i32, ptr %N, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp6 = icmp slt i64 %indvars.iv.next36, %9
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !12
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define MAX 500000
void divi(int*,int,int);
void conq(int*,int,int,int);
int youko1,haire1[MAX],count=0;
int main()
{
int i,lefhasi,righasi;
scanf("%d",&youko1);
for(i=0;i<youko1;i++)
{
scanf("%d",&haire1[i]);
}
lefhasi=0;
righasi=youko1;
divi(haire1,lefhasi,righasi);
for(i=0;i<youko1-1;i++)
{
printf("%d ",haire1[i]);
}
printf("%d\n",haire1[youko1-1]);
printf("%d\n",count);
return 0;
}
void divi(int *haire1,int lefhasi,int righasi)
{
int man;
if(lefhasi+1<righasi)
{
man=(lefhasi+righasi)/2;
divi(haire1,lefhasi,man);
divi(haire1,man,righasi);
conq(haire1,lefhasi,man,righasi);
}
}
void conq(int *haire1,int lefhasi,int man,int righasi)
{
int lefnum,rignum,i=0,j=0,k=0;
lefnum=man-lefhasi;
rignum=righasi-man;
int lefhai[lefnum+1],righai[rignum+1];
for(i=0;i<lefnum;i++)
{
lefhai[i]=haire1[lefhasi+i];
// printf("%d\n",lefhai[lehasi+i]);
}
for(i=0;i<rignum;i++)
{
righai[i]=haire1[man+i];
//printf("%d\n",righai[man+i]);
}
lefhai[lefnum]=1000000000;
righai[rignum]=1000000000;
i=0;
for(k=lefhasi;k<righasi;k++)
{
if(lefhai[i]<=righai[j])
{
haire1[k]=lefhai[i];
i++;
count++;
}
else
{
haire1[k]=righai[j];
j++;
count++;
}
}
}
//4124232
/*
int divi(int haire1[],int lehasi,int rihasi)
{
int man;
if(lehasi+1<rihasi)
{
man=(lehasi+rihasi)/2;
divi(haire1[],lehasi,man);
divi(haire1[],man,rihasi);
conq(haire1[],lehasi,man,rihasi);
}
return 0;
}
int conq(int haire1[],int lehasi,int man,int rihasi)
{
int lefnum,rignum,lefhai,righai,i=0,j=0,k=0;
lefnum=man-lehasi;
rignum=right-man;
for(i=1;i<=lefnum-1;i++)
{
lefhai[i]=haire1[lehasi+i];
printf("lefhai[lehasi+i]\n");
}
for(i=1;i<=rignum-1;i++)
{
righai[i]=haire1[man+i];
printf("righai[man+i]\n");
}
lefhai[lefnum]=50000;
righai[rignum]=50000;
i=0;
for(k=lehasi;k<rihasi;k++)
{
if(lefhai[i]<=righai[j])
{
haire1[k]=lefhai[i];
i++;
count++;
}
else
{
haire1[k]=righai[j];
j++;
count++;
}
}
return 0;
}
int man,haileft[100],hairight[100],p,q;
//printf("%d\n",lehasi);
//printf("%d\n",rihasi);
if(lehasi+1<rihasi)
{
man=(lehasi+rihasi)/2;
//printf("%d\n",man);
for(p=lehasi;p<=man;p++)
{
printf("%d ",haire1[p]);
}
printf("\n");
for(q=man+1;q<rihasi;q++)
{
printf("%d ",haire1[q]);
}
printf("\n");
divi(lehasi,man);
divi(man,rihasi);
conq(lehasi,man,rihasi);
}
return 0;
}
*/
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148251/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148251/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@youko1 = dso_local global i32 0, align 4
@haire1 = dso_local global [500000 x i32] zeroinitializer, align 16
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @youko1)
%0 = load i32, ptr @youko1, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [500000 x i32], ptr @haire1, i64 0, i64 %indvars.iv
%call1 = tail 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 @youko1, 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 ]
tail call void @divi(ptr noundef nonnull @haire1, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @youko1, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub23 = add nsw i32 %3, -1
%.pre = sext i32 %sub23 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr @haire1, i64 0, i64 %indvars.iv30
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%5 = load i32, ptr @youko1, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr @haire1, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @divi(ptr noundef %haire1, i32 noundef %lefhasi, i32 noundef %righasi) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %lefhasi, 1
%cmp = icmp slt i32 %add, %righasi
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %righasi, %lefhasi
%div = sdiv i32 %add1, 2
tail call void @divi(ptr noundef %haire1, i32 noundef %lefhasi, i32 noundef %div)
tail call void @divi(ptr noundef %haire1, i32 noundef %div, i32 noundef %righasi)
tail call void @conq(ptr noundef %haire1, i32 noundef %lefhasi, i32 noundef %div, i32 noundef %righasi)
br label %common.ret12
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @conq(ptr nocapture noundef %haire1, i32 noundef %lefhasi, i32 noundef %man, i32 noundef %righasi) local_unnamed_addr #2 {
entry:
%sub = sub nsw i32 %man, %lefhasi
%sub1 = sub nsw i32 %righasi, %man
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp73 = icmp sgt i32 %sub, 0
br i1 %cmp73, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %lefhasi to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %haire1, i64 %3
%4 = xor i32 %lefhasi, -1
%5 = add i32 %4, %man
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body.preheader, %entry
%cmp875 = icmp sgt i32 %sub1, 0
br i1 %cmp875, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond7.preheader
%9 = sext i32 %man to i64
%10 = shl nsw i64 %9, 2
%scevgep83 = getelementptr i8, ptr %haire1, i64 %10
%11 = xor i32 %man, -1
%12 = add i32 %11, %righasi
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep83, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond7.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 1000000000, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 1000000000, ptr %arrayidx21, align 4, !tbaa !5
%cmp2377 = icmp slt i32 %lefhasi, %righasi
br i1 %cmp2377, label %for.body24.preheader, label %for.end44
for.body24.preheader: ; preds = %for.end17
%16 = sext i32 %lefhasi to i64
%wide.trip.count = sext i32 %righasi to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.body24
%indvars.iv = phi i64 [ %16, %for.body24.preheader ], [ %indvars.iv.next, %for.body24 ]
%i.280 = phi i32 [ 0, %for.body24.preheader ], [ %i.3, %for.body24 ]
%j.079 = phi i32 [ 0, %for.body24.preheader ], [ %j.1, %for.body24 ]
%idxprom25 = zext i32 %i.280 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom27 = zext i32 %j.079 to i64
%arrayidx28 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom27
%18 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29.not = icmp sgt i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc40 = zext i1 %cmp29.not to i32
%j.1 = add nuw nsw i32 %j.079, %inc40
%not.cmp29.not = xor i1 %cmp29.not, true
%inc34 = zext i1 %not.cmp29.not to i32
%i.3 = add nuw nsw i32 %i.280, %inc34
%19 = getelementptr inbounds i32, ptr %haire1, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end44, label %for.body24, !llvm.loop !12
for.end44: ; preds = %for.body24, %for.end17
ret void
}
; 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) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define N 500000
#define INFTY 1000000000
int L[N],R[N];
int count=0,n;
void merge(int * ,int ,int ,int );
void mergeSort(int *,int ,int );
int main()
{
int A[N],i;
scanf("%d",&n);
for(i=0;i<n; i++) scanf("%d",&A[i]);
mergeSort(A,0,n);
for(i=0;i<n;i++)
{
printf("%d",A[i]);
if(i!=n-1)printf(" ");
}
printf("\n%d\n",count);
return 0;
}
void merge(int A[],int left,int mid,int right)
{
int n1 = mid - left,n2=right - mid,i=0,j=0,k=0;
for( i = 0;i<n1;i++) L[i] = A[left + i];
for (i = 0;i<n2;i++) R[i] = A[mid + i];
L[n1] = INFTY;
R[n2] = INFTY;
i=0;
j=0;
for (k = left; k< right;k++)
{
count++;
if( L[i] <= R[j])
{
A[k] = L[i];
i = i + 1;
}
else
{
A[k] = R[j];
j = j + 1;
}
}
}
void mergeSort(int A[],int left,int right)
{
if (left+1 < right)
{
int mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148295/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv26, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !15
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !17
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count81.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter29 = and i64 %wide.trip.count81.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !18
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !19
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !20
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 1000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 1000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%j.073.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.073.i to i64
%arrayidx26.i = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add32.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %add32.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%add37.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %add37.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !21
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%A90 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !23
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %A, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !24
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !25
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !26
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !27
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count86 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [500000 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [500000 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %add32
%not.cmp27.not = xor i1 %cmp27.not, true
%add37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %add37
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !21
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10, !13, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !10, !13}
!20 = distinct !{!20, !10, !13}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !13, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !10, !13, !14}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !10, !13}
!27 = distinct !{!27, !10, !13}
|
#include<stdio.h>
#define N 500000
#define I 1000000000
void mergesort(int *,int,int);
void merge(int *,int,int,int);
int count=0;
void mergesort(int *S,int left,int right)
{
int mid;
if(left+1 < right) {
mid = (left + right) / 2;
mergesort(S,left,mid);
mergesort(S,mid,right);
merge(S,left,mid,right);
}
}
void merge(int *S,int left,int mid,int right)
{
int i,j,k,a,b;
int L[N],R[N];
a = mid - left;
b = right - mid;
for(i=0;i<a;i++) {
L[i] = S[left+i];
}
for(i=0;i<b;i++) {
R[i] = S[mid+i];
}
L[a] = I;
R[b] = I;
i=0;
j=0;
for(k=left;k<right;k++){
count++;
if(L[i] <= R[j]){
S[k] = L[i];
i++;
}else{
S[k] = R[j];
j++;
}
}
}
int main()
{
int n,i;
int S[N];
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%d",&S[i]);
}
mergesort(S,0,n);
for(i=0;i<n;i++) {
if(i)
printf(" ");
printf("%d",S[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148338/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148338/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %S, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %S, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %S, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %S, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %S, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%L = alloca [500000 x i32], align 16
%R = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %R) #7
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %S, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %S, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%i.274 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%15 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.274 to i64
%arrayidx24 = getelementptr inbounds [500000 x i32], ptr %L, i64 0, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%not.cmp27.not = xor i1 %cmp27.not, true
%inc32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.274, %inc32
%18 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !9
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %L) #7
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 uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergesort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp323 = icmp sgt i32 %3, 0
br i1 %cmp323, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %S, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %if.end ], [ 1, %if.end.peel ]
%putchar20 = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv27
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next28, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !12
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#define MAX 500000
#define S 1000000000
void merge(int *,int, int,int);
void mergeSort(int *,int,int);
int left[MAX/2+2],right[MAX/2+2];
int count,n;
int main(){
int a[MAX],i;
count=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]>=S){
return 1;
}
}
mergeSort(a,0,n);
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i<n-1){
printf(" ");
}
}
printf("\n");
printf("%d\n",count);
return 0;
}
void merge(int a[],int left2,int mid,int right2){
int i,j,k,n1,n2;
n1=mid-left2;
n2=right2-mid;
for(i=0;i<n1;i++){
left[i]=a[left2+i];
}
for(i=0;i<n2;i++){
right[i]=a[mid+i];
}
left[n1]=S;
right[n2]=S;
i=0;
j=0;
for(k=left2;k<right2;k++){
count++;
if(left[i]<=right[j]){
a[k]=left[i];
i=i+1;
}
else{
a[k]=right[j];
j=j+1;
}
}
}
void mergeSort(int a[],int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(a,left,mid);
mergeSort(a,mid,right);
merge(a,left,mid,right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148381/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148381/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@left = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@right = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %a) #6
store i32 0, ptr @count, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end
for.cond: ; preds = %for.body
%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.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %3, 999999999
br i1 %cmp4, label %cleanup, label %for.cond
for.end: ; preds = %for.cond, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.cond ]
call void @mergeSort(ptr noundef nonnull %a, i32 noundef 0, i32 noundef %.lcssa)
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp632 = icmp sgt i32 %4, 0
br i1 %cmp632, label %for.body7, label %for.end17
for.body7: ; preds = %for.end, %for.inc15
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.inc15 ], [ 0, %for.end ]
%arrayidx9 = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %indvars.iv36
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%6 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp11 = icmp slt i64 %indvars.iv36, %7
br i1 %cmp11, label %if.then12, label %for.inc15
if.then12: ; preds = %for.body7
%putchar28 = call i32 @putchar(i32 32)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc15
for.inc15: ; preds = %for.body7, %if.then12
%8 = phi i32 [ %6, %for.body7 ], [ %.pre, %if.then12 ]
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%9 = sext i32 %8 to i64
%cmp6 = icmp slt i64 %indvars.iv.next37, %9
br i1 %cmp6, label %for.body7, label %for.end17, !llvm.loop !11
for.end17: ; preds = %for.inc15, %for.end
%putchar = call i32 @putchar(i32 10)
%10 = load i32, ptr @count, align 4, !tbaa !5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
br label %cleanup
cleanup: ; preds = %for.body, %for.end17
%retval.0 = phi i32 [ 0, %for.end17 ], [ 1, %for.body ]
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %a) #6
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%a12 = ptrtoint ptr %a to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %a, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %a, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %a12
%3 = sub i64 ptrtoint (ptr @left to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !15
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %a, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %a12
%16 = sub i64 ptrtoint (ptr @right to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !17
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count81.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter29 = and i64 %wide.trip.count81.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !18
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !19
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !20
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %idxprom15.i
store i32 1000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %idxprom17.i
store i32 1000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%i.274.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.073.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.274.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.073.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add37.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %add37.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%add32.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.274.i, %add32.i
%38 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !21
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %a, i32 noundef %left2, i32 noundef %mid, i32 noundef %right2) local_unnamed_addr #3 {
entry:
%a90 = ptrtoint ptr %a to i64
%sub = sub nsw i32 %mid, %left2
%sub1 = sub i32 %right2, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left2 to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %a, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %a90
%3 = sub i64 ptrtoint (ptr @left to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !23
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %a, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %a90
%16 = sub i64 ptrtoint (ptr @right to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !24
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !25
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !26
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !27
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left2, %right2
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left2 to i64
%wide.trip.count86 = sext i32 %right2 to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%i.274 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.274 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @left, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @right, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %add37
%not.cmp27.not = xor i1 %cmp27.not, true
%add32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.274, %add32
%38 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !21
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10, !13, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !10, !13}
!20 = distinct !{!20, !10, !13}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !13, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !10, !13, !14}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !10, !13}
!27 = distinct !{!27, !10, !13}
|
#include<stdio.h>
int c = 0;
void merge(int a[], int left, int mid, int right)
{
int i;
int n1 = mid - left;
int n2 = right - mid;
int l[n1], r[n2];
for( i = 0; i < n1; i++ ){
l[i] = a[left+i];
}
for( i = 0; i < n2; i++ ){
r[i] = a[mid+i];
}
l[n1] = 100000000000;
r[n2] = 100000000000;
int j = 0, k;
i = 0;
for( k = left; k < right; k++ ){
c++;
if( l[i] <= r[j] ){
a[k] = l[i++];
}else{
a[k] = r[j++];
}
}
}
void mergeSort(int a[], int left, int right)
{
if( left+1 < right ){
int mid = (left+right) / 2;
mergeSort(a, left, mid);
mergeSort(a, mid, right);
merge(a, left, mid, right);
}
}
int main(void){
int n, i;
scanf( "%d", &n );
int a[n];
for( i = 0; i < n; i++ ){
scanf( "%d", &a[i] );
}
mergeSort(a, 0, n);
for( i = 0; i < n-1; i++ ){
printf( "%d ", a[i] );
}
printf( "%d\n", a[n-1] );
printf( "%d\n", c );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148424/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148424/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %a, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%0 = zext i32 %sub to i64
%vla = alloca i32, i64 %0, align 16
%1 = zext i32 %sub1 to i64
%vla2 = alloca i32, i64 %1, align 16
%cmp68 = icmp sgt i32 %sub, 0
br i1 %cmp68, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %a, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%cmp670 = icmp sgt i32 %sub1, 0
br i1 %cmp670, label %for.body7.preheader, label %for.end15
for.body7.preheader: ; preds = %for.cond5.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep78 = getelementptr i8, ptr %a, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla2, ptr noundef nonnull align 4 dereferenceable(1) %scevgep78, i64 %15, i1 false), !tbaa !5
br label %for.end15
for.end15: ; preds = %for.body7.preheader, %for.cond5.preheader
%idxprom16 = sext i32 %sub to i64
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %idxprom16
store i32 1215752192, ptr %arrayidx17, align 4, !tbaa !5
%idxprom18 = sext i32 %sub1 to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom18
store i32 1215752192, ptr %arrayidx19, align 4, !tbaa !5
%cmp2172 = icmp slt i32 %left, %right
br i1 %cmp2172, label %for.body22.preheader, label %for.end41
for.body22.preheader: ; preds = %for.end15
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.body22
%indvars.iv = phi i64 [ %16, %for.body22.preheader ], [ %indvars.iv.next, %for.body22 ]
%j.074 = phi i32 [ 0, %for.body22.preheader ], [ %j.1, %for.body22 ]
%i.273 = phi i32 [ 0, %for.body22.preheader ], [ %i.3, %for.body22 ]
%17 = load i32, ptr @c, align 4, !tbaa !5
%inc23 = add nsw i32 %17, 1
store i32 %inc23, ptr @c, align 4, !tbaa !5
%idxprom24 = zext i32 %i.273 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %vla, i64 %idxprom24
%18 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = zext i32 %j.074 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom26
%19 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28.not = icmp sle i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc29 = zext i1 %cmp28.not to i32
%i.3 = add nuw nsw i32 %i.273, %inc29
%not.cmp28.not = xor i1 %cmp28.not, true
%inc34 = zext i1 %not.cmp28.not to i32
%j.1 = add nuw nsw i32 %j.074, %inc34
%20 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.body22, !llvm.loop !9
for.end41: ; preds = %for.body22, %for.end15
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
declare ptr @llvm.stacksave.p0() #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) #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %a, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %a, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%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
%cmp21 = icmp sgt i32 %3, 0
br i1 %cmp21, 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, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %3, %entry ], [ %4, %for.body ]
call void @mergeSort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %.lcssa)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %6, 1
br i1 %cmp324, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub23 = add nsw i32 %6, -1
%.pre = sext i32 %sub23 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv30
%7 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %8, -1
%9 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %9
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !12
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %9, %for.body4 ]
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %idxprom12.pre-phi
%10 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
%11 = load i32, ptr @c, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
int L[MAX/2+2], R[MAX/2+2];
int cnt;
void merge(int A[],int n,int left, int mid, int right) {
int i, j, k;
int n1 = mid -left;
int n2 = right - mid;
for(i=0;i<n1;i++) L[i] = A[left + i];
for(i=0;i<n2;i++) R[i] = A[mid + i];
L[n1] = R[n2] = SENTINEL;
i=0, j=0;
for(k=left; k<right; k++) {
cnt++;
if(L[i]<=R[j]) {
A[k] = L[i++];
} else {
A[k] = R[j++];
}
}
}
void mergeSort(int A[],int n,int left,int right) {
int mid;
if(left+1 < right) {
mid = (left+right) / 2;
mergeSort(A,n,left,mid);
mergeSort(A,n,mid, right);
merge(A,n,left,mid,right);
}
}
int main(void) {
int A[MAX], n, i;
cnt = 0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);
mergeSort(A, n, 0, n);
for(i=0;i<n;i++) {
if(i) printf(" ");
printf("%d",A[i]);
}
printf("\n%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148468/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148468/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A88 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %A, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !15
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count84 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @cnt, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%not.cmp27.not = xor i1 %cmp27.not, true
%inc28 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc28
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A14 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body6.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body6.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !22
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count79.i
br i1 %cmp.n25, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck16, %for.body6.preheader.i, %middle.block18
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body6.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter31 = and i64 %wide.trip.count79.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block18, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count84.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @cnt, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc28.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %inc28.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr @cnt, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, 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 [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp321 = icmp sgt i32 %3, 0
br i1 %cmp321, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv25
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next26, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !27
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #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 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28}
!28 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#define MAX 500000
#define SENTINEL 1000000001
int S[MAX+1],n,cnt;
int L[(MAX/2)+1],R[(MAX/2)+1];
void merge( int left, int mid, int right ){
int i,j,k;
int n1=mid-left;
int n2=right-mid;
for( i = 0; i < n1; i++ ) {
L[i]=S[left+i];
}
for( i = 0; i < n2; i++ ) {
R[i]=S[mid+i];
}
L[n1]=R[n2]=SENTINEL;
i=j=0;
for( k = left; k < right; k++ ) {
cnt++;
if( L[i] <= R[j])
S[k]=L[i++];
else
S[k]=R[j++];
}
return;
}
void mergeSort(int left, int right){
int mid;
if( left+1 < right) {
mid=(left+right)/2;
mergeSort(left, mid);
mergeSort(mid, right);
merge(left, mid, right);
}
return;
}
int main() {
scanf("%d", &n );
int i;
for( i=0; i<n; i++ ) {
scanf("%d", &S[i] );
}
cnt=0;
mergeSort( 0, n );
for( i = 0; i < n; i++ ) {
printf("%d", S[i] );
if( i < n-1 )
printf( " " );
}
printf("\n%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148510/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148510/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@S = dso_local global [500001 x i32] zeroinitializer, align 16
@L = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp62 = icmp sgt i32 %sub, 0
br i1 %cmp62, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr @S, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp564 = icmp sgt i32 %sub1, 0
br i1 %cmp564, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep74 = getelementptr i8, ptr @S, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep74, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%cmp2067 = icmp slt i32 %left, %right
br i1 %cmp2067, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
%14 = sext i32 %left to i64
%15 = add i32 %cnt.promoted, %right
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%i.271 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.070 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%idxprom23 = zext i32 %i.271 to i64
%arrayidx24 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.070 to i64
%arrayidx26 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc33 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.070, %inc33
%not.cmp27.not = xor i1 %cmp27.not, true
%inc28 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.271, %inc28
%18 = getelementptr inbounds [500001 x i32], ptr @S, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond19.for.end40_crit_edge, label %for.body21, !llvm.loop !9
for.cond19.for.end40_crit_edge: ; preds = %for.body21
%19 = sub i32 %15, %left
store i32 %19, ptr @cnt, align 4, !tbaa !5
br label %for.end40
for.end40: ; preds = %for.cond19.for.end40_crit_edge, %for.end14
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub nsw i32 %right, %div
%cmp62.i = icmp sgt i32 %sub.i, 0
br i1 %cmp62.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep.i = getelementptr i8, ptr @S, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %div, %2
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep.i, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader.i
for.cond4.preheader.i: ; preds = %for.body.preheader.i, %if.then
%cmp564.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp564.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%7 = sext i32 %div to i64
%8 = shl nsw i64 %7, 2
%scevgep74.i = getelementptr i8, ptr @S, i64 %8
%9 = xor i32 %div, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep74.i, i64 %13, i1 false), !tbaa !5
br label %for.end14.i
for.end14.i: ; preds = %for.body6.preheader.i, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 1000000001, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 1000000001, ptr %arrayidx18.i, align 4, !tbaa !5
%cnt.promoted.i = load i32, ptr @cnt, align 4, !tbaa !5
%14 = sext i32 %left to i64
%wide.trip.count.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv.i = phi i64 [ %14, %for.end14.i ], [ %indvars.iv.next.i, %for.body21.i ]
%i.271.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.070.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%idxprom23.i = zext i32 %i.271.i to i64
%arrayidx24.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom23.i
%15 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.070.i to i64
%arrayidx26.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom25.i
%16 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %15, %16
%.sink.i = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc33.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.070.i, %inc33.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc28.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.271.i, %inc28.i
%17 = getelementptr inbounds [500001 x i32], ptr @S, i64 0, i64 %indvars.iv.i
store i32 %.sink.i, ptr %17, align 4
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond19.for.end40_crit_edge.i, label %for.body21.i, !llvm.loop !9
for.cond19.for.end40_crit_edge.i: ; preds = %for.body21.i
%18 = sub i32 %right, %left
%19 = add i32 %18, %cnt.promoted.i
store i32 %19, ptr @cnt, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %for.cond19.for.end40_crit_edge.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500001 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 0, ptr @cnt, align 4, !tbaa !5
tail call void @mergeSort(i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500001 x i32], ptr @S, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp8 = icmp slt i64 %indvars.iv26, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar = tail call i32 @putchar(i32 32)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @cnt, align 4, !tbaa !5
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define MAX 500000
#define SENTI 2000000000
int count = 0;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
void Marge(int*, int, int, int, int);
void margeSort(int*, int, int, int);
int main(){
int n, i, A[MAX];
scanf("%d",&n);
for(i = 0 ; i < n ; i++){
scanf("%d",&A[i]);
}
margeSort(A, n, 0, n);
for(i = 0 ; i < n ; i++){
if(i > 0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
void Marge(int A[], int n, int l, int m, int r){
int n1, n2,i,j,k;
n1 = m - l;
n2 = r - m;
for(i = 0 ; i < n1 ; i++){
L[i] = A[l + i];
}
for(i = 0 ; i < n2 ; i++){
R[i] = A[m + i];
}
L[n1] = R[n2] = SENTI;
i = 0;
j = 0;
for(k = l ; k < r ; k++){
count++;
if(L[i] <= R[j]){
A[k] = L[i++];
}
else{
A[k] = R[j++];
}
}
}
void margeSort(int A[], int n, int l, int r){
int m;
if(l + 1 < r ){
m = (l + r) / 2;
margeSort(A, n, l, m);
margeSort(A, n, m, r);
Marge(A, n, l, m, r);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148554/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148554/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @margeSort(ptr noundef nonnull %A, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 0
br i1 %cmp324, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %if.end ], [ 1, %if.end.peel ]
%putchar21 = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv28
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @margeSort(ptr noundef %A, i32 noundef %n, i32 noundef %l, i32 noundef %r) local_unnamed_addr #3 {
entry:
%A14 = ptrtoint ptr %A to i64
%add = add nsw i32 %l, 1
%cmp = icmp slt i32 %add, %r
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %r, %l
%div = sdiv i32 %add1, 2
tail call void @margeSort(ptr noundef %A, i32 noundef %n, i32 noundef %l, i32 noundef %div)
tail call void @margeSort(ptr noundef %A, i32 noundef %n, i32 noundef %div, i32 noundef %r)
%sub.i = sub nsw i32 %div, %l
%sub1.i = sub i32 %r, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %l to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !16
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body6.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body6.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !18
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count79.i
br i1 %cmp.n25, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck16, %for.body6.preheader.i, %middle.block18
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body6.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter31 = and i64 %wide.trip.count79.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !19
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !20
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !21
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block18, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %l to i64
%wide.trip.count84.i = sext i32 %r to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.270.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.270.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc28.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.270.i, %inc28.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc33.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !22
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Marge(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #3 {
entry:
%A88 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %m, %l
%sub1 = sub i32 %r, %m
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !23
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !24
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %m to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %A, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !25
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !26
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !27
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !28
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %l, %r
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %l to i64
%wide.trip.count84 = sext i32 %r to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.270 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.270 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc28 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.270, %inc28
%not.cmp27.not = xor i1 %cmp27.not, true
%inc33 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !22
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
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}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10, !14, !15}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !10, !14}
!21 = distinct !{!21, !10, !14}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !14, !15}
!24 = distinct !{!24, !17}
!25 = distinct !{!25, !10, !14, !15}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !10, !14}
!28 = distinct !{!28, !10, !14}
|
#include <stdio.h>
int sum = 0;
void merge(int a[], int left, int mid, int right){
int n1, n2;
int l[500000], r[500000];
int i, j, k, count;
n1 = mid - left;
n2 = right - mid;
for (i = 0; i < n1; i++) {
l[i] = a[left + i];
}
for (i = 0; i < n2; i++) {
r[i] = a[mid + i];
}
l[n1] = 1000000000;
r[n2] = 1000000000;
i = 0;
j = 0;
for (k = left; k <= right - 1; k++) {
sum++;
if (l[i] <= r[j]) {
a[k] = l[i];
i = i + 1;
}
else {
a[k] = r[j];
j = j + 1;
}
}
}
void mergeSort(int a[], int left, int right) {
int mid;
if (left + 1 < right) {
mid = (left + right) / 2;
mergeSort(a, left, mid);
mergeSort(a, mid, right);
merge(a, left, mid, right);
}
}
int main(void){
int n, s[500000];
int i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &s[i]);
}
mergeSort(s, 0, n);
for (i = 0; i < n; i++) {
if (i <= n - 2) {
printf("%d ", s[i]);
}
else if (i == n - 1) {
printf("%d\n", s[i]);
}
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148598/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148598/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@sum = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %a, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%l = alloca [500000 x i32], align 16
%r = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %l) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %r) #6
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp68 = icmp sgt i32 %sub, 0
br i1 %cmp68, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %a, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %l, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp570 = icmp sgt i32 %sub1, 0
br i1 %cmp570, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep78 = getelementptr i8, ptr %a, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %r, ptr noundef nonnull align 4 dereferenceable(1) %scevgep78, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr %l, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr %r, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp21.not.not72 = icmp slt i32 %left, %right
br i1 %cmp21.not.not72, label %for.body22.preheader, label %for.end41
for.body22.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.body22
%indvars.iv = phi i64 [ %14, %for.body22.preheader ], [ %indvars.iv.next, %for.body22 ]
%i.275 = phi i32 [ 0, %for.body22.preheader ], [ %i.3, %for.body22 ]
%j.073 = phi i32 [ 0, %for.body22.preheader ], [ %j.1, %for.body22 ]
%15 = load i32, ptr @sum, align 4, !tbaa !5
%inc23 = add nsw i32 %15, 1
store i32 %inc23, ptr @sum, align 4, !tbaa !5
%idxprom24 = zext i32 %i.275 to i64
%arrayidx25 = getelementptr inbounds [500000 x i32], ptr %l, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = zext i32 %j.073 to i64
%arrayidx27 = getelementptr inbounds [500000 x i32], ptr %r, i64 0, i64 %idxprom26
%17 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%add38 = zext i1 %cmp28.not to i32
%j.1 = add nuw nsw i32 %j.073, %add38
%not.cmp28.not = xor i1 %cmp28.not, true
%add33 = zext i1 %not.cmp28.not to i32
%i.3 = add nuw nsw i32 %i.275, %add33
%18 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end41, label %for.body22, !llvm.loop !9
for.end41: ; preds = %for.body22, %for.end14
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %l) #6
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %a, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %a, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %a, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%s = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
br i1 %cmp29, 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 [500000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %s, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp331 = icmp sgt i32 %3, 0
br i1 %cmp331, label %for.body4, label %for.end18
for.body4: ; preds = %for.end, %for.inc16
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.inc16 ], [ 0, %for.end ]
%4 = phi i32 [ %8, %for.inc16 ], [ %3, %for.end ]
%sub = add nsw i32 %4, -2
%5 = sext i32 %sub to i64
%cmp5.not = icmp sgt i64 %indvars.iv35, %5
br i1 %cmp5.not, label %if.else, label %for.inc16.sink.split
if.else: ; preds = %for.body4
%sub9 = add nsw i32 %4, -1
%6 = zext i32 %sub9 to i64
%cmp10 = icmp eq i64 %indvars.iv35, %6
br i1 %cmp10, label %for.inc16.sink.split, label %for.inc16
for.inc16.sink.split: ; preds = %if.else, %for.body4
%.str.1.sink = phi ptr [ @.str.1, %for.body4 ], [ @.str.2, %if.else ]
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %s, i64 0, i64 %indvars.iv35
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink, i32 noundef %7)
br label %for.inc16
for.inc16: ; preds = %for.inc16.sink.split, %if.else
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp3 = icmp slt i64 %indvars.iv.next36, %9
br i1 %cmp3, label %for.body4, label %for.end18, !llvm.loop !12
for.end18: ; preds = %for.inc16, %for.end
%10 = load i32, ptr @sum, align 4, !tbaa !5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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>
int N, M;
int Q;
int l, r;
int p, q;
int sum[505][505];
int main()
{
scanf("%d %d %d", &N, &M, &Q);
for (int i = 0; i < M; i++) {
scanf("%d %d", &l, &r);
sum[l][r]++;
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
}
}
for (int i = 0; i < Q; i++) {
scanf("%d %d", &p, &q);
printf("%d\n", sum[q][q] - sum[q][p - 1] - sum[p - 1][q] + sum[p - 1][p - 1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148648/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148648/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@N = dso_local global i32 0, align 4
@M = dso_local global i32 0, align 4
@Q = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@l = dso_local global i32 0, align 4
@r = dso_local global i32 0, align 4
@sum = dso_local local_unnamed_addr global [505 x [505 x i32]] zeroinitializer, align 16
@p = dso_local global i32 0, align 4
@q = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M, ptr noundef nonnull @Q)
%0 = load i32, ptr @M, align 4, !tbaa !5
%cmp89 = icmp sgt i32 %0, 0
br i1 %cmp89, label %for.body, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr @N, align 4, !tbaa !5
%cmp7.not93 = icmp slt i32 %1, 1
br i1 %cmp7.not93, label %for.cond42.preheader, label %for.cond10.preheader.preheader
for.cond10.preheader.preheader: ; preds = %for.cond6.preheader
%2 = add nuw i32 %1, 1
%wide.trip.count103 = zext i32 %2 to i64
%.pre105.pre = load i32, ptr @sum, align 16, !tbaa !5
%3 = add nsw i64 %wide.trip.count103, -1
%xtraiter = and i64 %3, 1
%4 = icmp eq i32 %2, 2
%unroll_iter = and i64 %3, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond10.preheader
for.body: ; preds = %entry, %for.body
%i.090 = phi i32 [ %inc4, %for.body ], [ 0, %entry ]
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @l, ptr noundef nonnull @r)
%5 = load i32, ptr @l, align 4, !tbaa !5
%idxprom = sext i32 %5 to i64
%6 = load i32, ptr @r, align 4, !tbaa !5
%idxprom2 = sext i32 %6 to i64
%arrayidx3 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %idxprom, i64 %idxprom2
%7 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%inc = add nsw i32 %7, 1
store i32 %inc, ptr %arrayidx3, align 4, !tbaa !5
%inc4 = add nuw nsw i32 %i.090, 1
%8 = load i32, ptr @M, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %8
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %for.cond10.for.cond.cleanup12_crit_edge
%.pre105 = phi i32 [ %.pre105.pre, %for.cond10.preheader.preheader ], [ %.pre, %for.cond10.for.cond.cleanup12_crit_edge ]
%indvars.iv99 = phi i64 [ 1, %for.cond10.preheader.preheader ], [ %indvars.iv.next100, %for.cond10.for.cond.cleanup12_crit_edge ]
%9 = add nsw i64 %indvars.iv99, -1
%arrayidx22.phi.trans.insert = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %indvars.iv99, i64 0
%.pre = load i32, ptr %arrayidx22.phi.trans.insert, align 4, !tbaa !5
br i1 %4, label %for.cond10.for.cond.cleanup12_crit_edge.unr-lcssa, label %for.body13
for.cond42.preheader: ; preds = %for.cond10.for.cond.cleanup12_crit_edge, %for.cond6.preheader
%10 = load i32, ptr @Q, align 4, !tbaa !5
%cmp4395 = icmp sgt i32 %10, 0
br i1 %cmp4395, label %for.body45, label %for.cond.cleanup44
for.cond10.for.cond.cleanup12_crit_edge.unr-lcssa: ; preds = %for.body13, %for.cond10.preheader
%.unr = phi i32 [ %.pre105, %for.cond10.preheader ], [ %17, %for.body13 ]
%.unr107 = phi i32 [ %.pre, %for.cond10.preheader ], [ %add34.1, %for.body13 ]
%indvars.iv.unr = phi i64 [ 1, %for.cond10.preheader ], [ %indvars.iv.next.1, %for.body13 ]
br i1 %lcmp.mod.not, label %for.cond10.for.cond.cleanup12_crit_edge, label %for.body13.epil
for.body13.epil: ; preds = %for.cond10.for.cond.cleanup12_crit_edge.unr-lcssa
%arrayidx17.epil = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %9, i64 %indvars.iv.unr
%11 = load i32, ptr %arrayidx17.epil, align 4, !tbaa !5
%add.epil = add nsw i32 %.unr107, %11
%sub29.epil = sub i32 %add.epil, %.unr
%arrayidx33.epil = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %indvars.iv99, i64 %indvars.iv.unr
%12 = load i32, ptr %arrayidx33.epil, align 4, !tbaa !5
%add34.epil = add nsw i32 %sub29.epil, %12
store i32 %add34.epil, ptr %arrayidx33.epil, align 4, !tbaa !5
br label %for.cond10.for.cond.cleanup12_crit_edge
for.cond10.for.cond.cleanup12_crit_edge: ; preds = %for.cond10.for.cond.cleanup12_crit_edge.unr-lcssa, %for.body13.epil
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%exitcond104.not = icmp eq i64 %indvars.iv.next100, %wide.trip.count103
br i1 %exitcond104.not, label %for.cond42.preheader, label %for.cond10.preheader, !llvm.loop !11
for.body13: ; preds = %for.cond10.preheader, %for.body13
%13 = phi i32 [ %17, %for.body13 ], [ %.pre105, %for.cond10.preheader ]
%14 = phi i32 [ %add34.1, %for.body13 ], [ %.pre, %for.cond10.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body13 ], [ 1, %for.cond10.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body13 ], [ 0, %for.cond10.preheader ]
%arrayidx17 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %9, i64 %indvars.iv
%15 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%add = add nsw i32 %14, %15
%sub29 = sub i32 %add, %13
%arrayidx33 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %indvars.iv99, i64 %indvars.iv
%16 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%add34 = add nsw i32 %sub29, %16
store i32 %add34, ptr %arrayidx33, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx17.1 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %9, i64 %indvars.iv.next
%17 = load i32, ptr %arrayidx17.1, align 4, !tbaa !5
%add.1 = add nsw i32 %add34, %17
%sub29.1 = sub i32 %add.1, %15
%arrayidx33.1 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %indvars.iv99, i64 %indvars.iv.next
%18 = load i32, ptr %arrayidx33.1, align 4, !tbaa !5
%add34.1 = add nsw i32 %sub29.1, %18
store i32 %add34.1, ptr %arrayidx33.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond10.for.cond.cleanup12_crit_edge.unr-lcssa, label %for.body13, !llvm.loop !12
for.cond.cleanup44: ; preds = %for.body45, %for.cond42.preheader
ret i32 0
for.body45: ; preds = %for.cond42.preheader, %for.body45
%i41.096 = phi i32 [ %inc72, %for.body45 ], [ 0, %for.cond42.preheader ]
%call46 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @p, ptr noundef nonnull @q)
%19 = load i32, ptr @q, align 4, !tbaa !5
%idxprom47 = sext i32 %19 to i64
%arrayidx50 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %idxprom47, i64 %idxprom47
%20 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%21 = load i32, ptr @p, align 4, !tbaa !5
%sub53 = add nsw i32 %21, -1
%idxprom54 = sext i32 %sub53 to i64
%arrayidx55 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %idxprom47, i64 %idxprom54
%22 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%arrayidx61 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %idxprom54, i64 %idxprom47
%23 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%arrayidx68 = getelementptr inbounds [505 x [505 x i32]], ptr @sum, i64 0, i64 %idxprom54, i64 %idxprom54
%24 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%25 = add i32 %22, %23
%sub62 = sub i32 %20, %25
%add69 = add nsw i32 %sub62, %24
%call70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add69)
%inc72 = add nuw nsw i32 %i41.096, 1
%26 = load i32, ptr @Q, align 4, !tbaa !5
%cmp43 = icmp slt i32 %inc72, %26
br i1 %cmp43, label %for.body45, label %for.cond.cleanup44, !llvm.loop !13
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int tbl[11] = { 0,0,10000,464,100,39,21,13,10,7,6 };
int sb(int a)
{
int s = 0;
while (a) {
s += a % 10;
a /= 10;
}
return s;
}
int main()
{
int a, n, m;
int x, y, lim, ans;
scanf("%d%d%d", &a, &n, &m);
lim = tbl[n] - a, ans = 0;
for (y = 1; y <= lim; y++) {
x = (int)pow(y + a, n);
if (x > m) break;
if (sb(x) == y) ans++;
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148691/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148691/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@tbl = dso_local local_unnamed_addr global [11 x i32] [i32 0, i32 0, i32 10000, i32 464, i32 100, i32 39, i32 21, i32 13, i32 10, i32 7, i32 6], align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @sb(i32 noundef %a) local_unnamed_addr #0 {
entry:
%tobool.not4 = icmp eq i32 %a, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%s.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%a.addr.05 = phi i32 [ %div, %while.body ], [ %a, %entry ]
%rem = srem i32 %a.addr.05, 10
%add = add nsw i32 %s.06, %rem
%div = sdiv i32 %a.addr.05, 10
%a.addr.05.off = add i32 %a.addr.05, 9
%tobool.not = icmp ult i32 %a.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%s.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %s.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !7
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [11 x i32], ptr @tbl, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%2 = load i32, ptr %a, align 4, !tbaa !7
%cmp.not18.not = icmp sgt i32 %1, %2
br i1 %cmp.not18.not, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%3 = add i32 %1, 1
%4 = sub i32 %3, %2
br label %for.body
for.body: ; preds = %for.body.preheader, %sb.exit
%ans.020 = phi i32 [ %spec.select, %sb.exit ], [ 0, %for.body.preheader ]
%y.019 = phi i32 [ %inc11, %sb.exit ], [ 1, %for.body.preheader ]
%5 = load i32, ptr %a, align 4, !tbaa !7
%add = add nsw i32 %5, %y.019
%conv = sitofp i32 %add to double
%6 = load i32, ptr %n, align 4, !tbaa !7
%conv1 = sitofp i32 %6 to double
%call2 = call double @pow(double noundef %conv, double noundef %conv1) #5
%conv3 = fptosi double %call2 to i32
%7 = load i32, ptr %m, align 4, !tbaa !7
%cmp4 = icmp slt i32 %7, %conv3
br i1 %cmp4, label %for.end, label %if.end
if.end: ; preds = %for.body
%tobool.not4.i = icmp eq i32 %conv3, 0
br i1 %tobool.not4.i, label %sb.exit, label %while.body.i
while.body.i: ; preds = %if.end, %while.body.i
%s.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %if.end ]
%a.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %conv3, %if.end ]
%rem.i = srem i32 %a.addr.05.i, 10
%add.i = add nsw i32 %rem.i, %s.06.i
%div.i = sdiv i32 %a.addr.05.i, 10
%a.addr.05.off.i = add i32 %a.addr.05.i, 9
%tobool.not.i = icmp ult i32 %a.addr.05.off.i, 19
br i1 %tobool.not.i, label %sb.exit, label %while.body.i, !llvm.loop !5
sb.exit: ; preds = %while.body.i, %if.end
%s.0.lcssa.i = phi i32 [ 0, %if.end ], [ %add.i, %while.body.i ]
%cmp7 = icmp eq i32 %s.0.lcssa.i, %y.019
%inc = zext i1 %cmp7 to i32
%spec.select = add nuw nsw i32 %ans.020, %inc
%inc11 = add nuw i32 %y.019, 1
%exitcond.not = icmp eq i32 %inc11, %4
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %sb.exit, %for.body, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.020, %for.body ], [ %spec.select, %sb.exit ]
%call12 = 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 %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"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}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#pragma warning(disable : 4996) //_CRT_SECURE_NO_WARNINGS
int main(void) {
double a, b;/*消費税(円)*/
double i = 0;
int res = 0;
scanf("%lf%lf", &a, &b);
for (;;i++) {
if ((int)(i * 0.08) == a && (int)(i * 0.1) == b) {
res = 1;
break;
}
if ((int)(i * 0.08) > a || (int)(i * 0.1) > b) {
break;
}
}
if (res == 1) printf("%d", (int)i);
if (res == 0) printf("%d", -1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148734/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148734/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load double, ptr %a, align 8, !tbaa !5
%1 = load double, ptr %b, align 8
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%i.0 = phi double [ 0.000000e+00, %entry ], [ %inc, %for.inc ]
%mul = fmul double %i.0, 8.000000e-02
%conv = fptosi double %mul to i32
%conv1 = sitofp i32 %conv to double
%cmp = fcmp oeq double %0, %conv1
br i1 %cmp, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %for.cond
%mul3 = fmul double %i.0, 1.000000e-01
%conv4 = fptosi double %mul3 to i32
%conv5 = sitofp i32 %conv4 to double
%cmp6 = fcmp oeq double %1, %conv5
br i1 %cmp6, label %if.end25, label %if.end
if.end: ; preds = %land.lhs.true, %for.cond
%cmp11 = fcmp olt double %0, %conv1
br i1 %cmp11, label %if.end30, label %lor.lhs.false
lor.lhs.false: ; preds = %if.end
%mul13 = fmul double %i.0, 1.000000e-01
%conv14 = fptosi double %mul13 to i32
%conv15 = sitofp i32 %conv14 to double
%cmp16 = fcmp olt double %1, %conv15
br i1 %cmp16, label %if.end30, label %for.inc
for.inc: ; preds = %lor.lhs.false
%inc = fadd double %i.0, 1.000000e+00
br label %for.cond
if.end25: ; preds = %land.lhs.true
%conv23 = fptosi double %i.0 to i32
br label %if.end30
if.end30: ; preds = %lor.lhs.false, %if.end, %if.end25
%conv23.sink = phi i32 [ %conv23, %if.end25 ], [ -1, %if.end ], [ -1, %lor.lhs.false ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv23.sink)
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int i_inputTax8Price;
int i_inputTax10Price;
scanf("%d%d", &i_inputTax8Price, &i_inputTax10Price);
int i_productPriceMinFromA = i_inputTax8Price * 12.5;
int i_productPriceMaxFromA = (i_inputTax8Price + 1) * 12.5;
if (i_inputTax8Price % 2 != 0)
{
i_productPriceMinFromA++;
}
if (i_inputTax8Price % 2 == 0)
{
i_productPriceMaxFromA++;
}
int i_productPriceMinFromB = i_inputTax10Price * 10;
int i_productPriceMaxFromB = (i_inputTax10Price + 1) * 10;
if (i_productPriceMinFromA >= i_productPriceMinFromB && i_productPriceMinFromA < i_productPriceMaxFromB)
{
printf("%d", i_productPriceMinFromA);
}
else if (i_productPriceMinFromB >= i_productPriceMinFromA && i_productPriceMinFromB < i_productPriceMaxFromA)
{
printf("%d", i_productPriceMinFromB);
}
else
{
printf("-1");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148778/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148778/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i_inputTax8Price = alloca i32, align 4
%i_inputTax10Price = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i_inputTax8Price) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i_inputTax10Price) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i_inputTax8Price, ptr noundef nonnull %i_inputTax10Price)
%0 = load i32, ptr %i_inputTax8Price, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%mul = fmul double %conv, 1.250000e+01
%conv1 = fptosi double %mul to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %conv1
%2 = load i32, ptr %i_inputTax10Price, align 4, !tbaa !5
%mul12 = mul nsw i32 %2, 10
%cmp15.not = icmp sge i32 %spec.select, %mul12
%mul14 = add i32 %mul12, 10
%cmp17 = icmp slt i32 %spec.select, %mul14
%or.cond40 = and i1 %cmp15.not, %cmp17
br i1 %or.cond40, label %if.then19, label %if.else
if.then19: ; preds = %entry
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
br label %if.end31
if.else: ; preds = %entry
%add = add nsw i32 %0, 1
%conv2 = sitofp i32 %add to double
%mul3 = fmul double %conv2, 1.250000e+01
%conv4 = fptosi double %mul3 to i32
%3 = xor i32 %1, 1
%i_productPriceMaxFromA.0 = add i32 %3, %conv4
%cmp21.not = icmp sge i32 %mul12, %spec.select
%cmp24 = icmp slt i32 %mul12, %i_productPriceMaxFromA.0
%or.cond = select i1 %cmp21.not, i1 %cmp24, i1 false
br i1 %or.cond, label %if.then26, label %if.else28
if.then26: ; preds = %if.else
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul12)
br label %if.end31
if.else28: ; preds = %if.else
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end31
if.end31: ; preds = %if.then26, %if.else28, %if.then19
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i_inputTax10Price) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i_inputTax8Price) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int i, j,c,a,b;
scanf("%d%d", &a, &b);
for (i=b*10; i <= b*10+9; i++)
{
c = i * 0.08;
if (c==a)
{
printf("%d", i);
return 0;
}
}
printf("-1");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148835/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148835/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %b, align 4, !tbaa !5
%mul = mul i32 %0, 10
%add = add i32 %mul, 9
%1 = load i32, ptr %a, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %mul, i32 %add)
br label %for.body
for.body: ; preds = %entry, %for.inc
%i.016 = phi i32 [ %mul, %entry ], [ %inc, %for.inc ]
%conv = sitofp i32 %i.016 to double
%mul2 = fmul double %conv, 8.000000e-02
%conv3 = fptosi double %mul2 to i32
%cmp4 = icmp eq i32 %1, %conv3
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %for.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.016)
br label %cleanup
for.inc: ; preds = %for.body
%inc = add i32 %i.016, 1
%exitcond.not = icmp eq i32 %i.016, %smax
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
cleanup: ; preds = %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include <math.h>
int main(void){
double a,b;
scanf("%lf %lf",&a,&b);
int i=0;
while(1){
if(floor((double)i*0.1)==b && floor((double)i*0.08)==a){
printf("%d\n",i);
break;
}
if(i>10000){
printf("-1");
break;
}
i++;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148879/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148879/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load double, ptr %b, align 8, !tbaa !5
%1 = load double, ptr %a, align 8
br label %while.cond
while.cond: ; preds = %if.end11.1, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc.1, %if.end11.1 ]
%conv = sitofp i32 %i.0 to double
%mul = fmul double %conv, 1.000000e-01
%2 = call double @llvm.floor.f64(double %mul)
%cmp = fcmp oeq double %2, %0
br i1 %cmp, label %land.lhs.true, label %if.end11
land.lhs.true: ; preds = %while.cond
%mul3 = fmul double %conv, 8.000000e-02
%3 = call double @llvm.floor.f64(double %mul3)
%cmp4 = fcmp oeq double %3, %1
br i1 %cmp4, label %if.then, label %if.end11
if.then: ; preds = %land.lhs.true.1, %land.lhs.true
%i.0.lcssa = phi i32 [ %i.0, %land.lhs.true ], [ %inc, %land.lhs.true.1 ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
br label %while.end
if.then9: ; preds = %if.end.1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %while.end
if.end11: ; preds = %while.cond, %land.lhs.true
%inc = or i32 %i.0, 1
%conv.1 = sitofp i32 %inc to double
%mul.1 = fmul double %conv.1, 1.000000e-01
%4 = call double @llvm.floor.f64(double %mul.1)
%cmp.1 = fcmp oeq double %4, %0
br i1 %cmp.1, label %land.lhs.true.1, label %if.end.1
land.lhs.true.1: ; preds = %if.end11
%mul3.1 = fmul double %conv.1, 8.000000e-02
%5 = call double @llvm.floor.f64(double %mul3.1)
%cmp4.1 = fcmp oeq double %5, %1
br i1 %cmp4.1, label %if.then, label %if.end.1
if.end.1: ; preds = %land.lhs.true.1, %if.end11
%exitcond.1 = icmp eq i32 %inc, 10001
br i1 %exitcond.1, label %if.then9, label %if.end11.1
if.end11.1: ; preds = %if.end.1
%inc.1 = add nuw nsw i32 %i.0, 2
br label %while.cond
while.end: ; preds = %if.then9, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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.floor.f64(double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int i,a,b;
scanf("%d %d",&a,&b);
for(i=0;i<=10000;i++){
if((i*8)/100==a&&(i*10)/100==b){
printf("%d\n",i);
return 0;
}
}
printf("-1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148921/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148921/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4
br label %for.body
for.body: ; preds = %entry, %for.inc
%i.015 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
%mul = shl nuw nsw i32 %i.015, 3
%div = udiv i32 %mul, 100
%cmp1 = icmp eq i32 %div, %0
br i1 %cmp1, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%div3.lhs.trunc = trunc i32 %i.015 to i16
%div313 = udiv i16 %div3.lhs.trunc, 10
%div3.zext = zext i16 %div313 to i32
%cmp4 = icmp eq i32 %1, %div3.zext
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.015)
br label %cleanup
for.inc: ; preds = %for.body, %land.lhs.true
%inc = add nuw nsw i32 %i.015, 1
%exitcond.not = icmp eq i32 %inc, 10001
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 N;
int A[100010];
scanf("%d",&N);
int i;
int B[100010];
for(i=1;i<=N;i++){
scanf("%d",&A[i]);
B[A[i]]=i;
}
for(A[i]=1;A[i]<=N;A[i]++){
printf("%d ",B[A[i]]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148965/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148965/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca [100010 x i32], align 16
%B = alloca [100010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %B) #3
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %for.end22, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100010 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom4 = sext i32 %1 to i64
%arrayidx5 = getelementptr inbounds [100010 x i32], ptr %B, i64 0, i64 %idxprom4
%2 = trunc i64 %indvars.iv to i32
store i32 %2, ptr %arrayidx5, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%5 = and i64 %indvars.iv.next, 4294967295
%6 = icmp slt i32 %3, 1
%arrayidx7 = getelementptr inbounds [100010 x i32], ptr %A, i64 0, i64 %5
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
br i1 %6, label %for.end22, label %for.body12
for.body12: ; preds = %for.end, %for.body12
%storemerge34 = phi i32 [ %inc21, %for.body12 ], [ 1, %for.end ]
%idxprom15 = sext i32 %storemerge34 to i64
%arrayidx16 = getelementptr inbounds [100010 x i32], ptr %B, i64 0, i64 %idxprom15
%7 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%inc21 = add nsw i32 %8, 1
store i32 %inc21, ptr %arrayidx7, align 4, !tbaa !5
%9 = load i32, ptr %N, align 4, !tbaa !5
%cmp11.not.not = icmp slt i32 %8, %9
br i1 %cmp11.not.not, label %for.body12, label %for.end22, !llvm.loop !11
for.end22: ; preds = %for.body12, %entry, %for.end
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 400040, 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}
|
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#define max 100000
//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}
int main()
{
int i, j, n, k, h[max], cnt=0, g[max];
scanf("%d", &n);
for (i=0; i<n; i++) {
scanf("%d", &h[i]);
}
for (i=0; i<n; i++) {
g[h[i]-1]=i+1;
}
for (i=0; i<n; i++) {
printf("%d ", g[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149007/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149007/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @up_comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @down_comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @count_digit(i32 noundef %a) local_unnamed_addr #1 {
entry:
%cmp.not3 = icmp eq i32 %a, 0
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%i.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%a.addr.04 = phi i32 [ %div, %while.body ], [ %a, %entry ]
%div = sdiv i32 %a.addr.04, 10
%inc = add nuw nsw i32 %i.05, 1
%a.addr.04.off = add i32 %a.addr.04, 9
%cmp.not = icmp ult i32 %a.addr.04.off, 19
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
ret i32 %i.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @euclid(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end3, %entry
%a.tr = phi i32 [ %a, %entry ], [ %spec.select17, %if.end3 ]
%b.tr = phi i32 [ %b, %entry ], [ %rem, %if.end3 ]
%spec.select17 = tail call i32 @llvm.smin.i32(i32 %a.tr, i32 %b.tr)
%cmp1 = icmp slt i32 %spec.select17, 1
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %tailrecurse
%spec.select = tail call i32 @llvm.smax.i32(i32 %a.tr, i32 %b.tr)
%rem = srem i32 %spec.select, %spec.select17
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %tailrecurse
cleanup: ; preds = %if.end3, %tailrecurse
%retval.0 = phi i32 [ -1, %tailrecurse ], [ %spec.select17, %if.end3 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%h = alloca [100000 x i32], align 16
%g = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %h) #7
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %g) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp332 = icmp sgt i32 %2, 0
br i1 %cmp332, label %for.body4.preheader, label %for.end20
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.cond12.preheader.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !11
for.cond12.preheader.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%indvars.iv38.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next39.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond12.preheader, label %for.body4.epil
for.body4.epil: ; preds = %for.cond12.preheader.unr-lcssa, %for.body4.epil
%indvars.iv38.epil = phi i64 [ %indvars.iv.next39.epil, %for.body4.epil ], [ %indvars.iv38.unr, %for.cond12.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.cond12.preheader.unr-lcssa ]
%indvars.iv.next39.epil = add nuw nsw i64 %indvars.iv38.epil, 1
%arrayidx6.epil = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv38.epil
%4 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%sub.epil = add nsw i32 %4, -1
%idxprom7.epil = sext i32 %sub.epil to i64
%arrayidx8.epil = getelementptr inbounds [100000 x i32], ptr %g, i64 0, i64 %idxprom7.epil
%5 = trunc i64 %indvars.iv.next39.epil to i32
store i32 %5, ptr %arrayidx8.epil, align 4, !tbaa !5
%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.cond12.preheader, label %for.body4.epil, !llvm.loop !12
for.cond12.preheader: ; preds = %for.body4.epil, %for.cond12.preheader.unr-lcssa
br i1 %cmp332, label %for.body14, label %for.end20
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv38 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next39.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%indvars.iv.next39 = or i64 %indvars.iv38, 1
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv38
%6 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%sub = add nsw i32 %6, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %g, i64 0, i64 %idxprom7
%7 = trunc i64 %indvars.iv.next39 to i32
store i32 %7, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next39.1 = or i64 %indvars.iv38, 2
%arrayidx6.1 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next39
%8 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%sub.1 = add nsw i32 %8, -1
%idxprom7.1 = sext i32 %sub.1 to i64
%arrayidx8.1 = getelementptr inbounds [100000 x i32], ptr %g, i64 0, i64 %idxprom7.1
%9 = trunc i64 %indvars.iv.next39.1 to i32
store i32 %9, ptr %arrayidx8.1, align 4, !tbaa !5
%indvars.iv.next39.2 = or i64 %indvars.iv38, 3
%arrayidx6.2 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next39.1
%10 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%sub.2 = add nsw i32 %10, -1
%idxprom7.2 = sext i32 %sub.2 to i64
%arrayidx8.2 = getelementptr inbounds [100000 x i32], ptr %g, i64 0, i64 %idxprom7.2
%11 = trunc i64 %indvars.iv.next39.2 to i32
store i32 %11, ptr %arrayidx8.2, align 4, !tbaa !5
%indvars.iv.next39.3 = add nuw nsw i64 %indvars.iv38, 4
%arrayidx6.3 = getelementptr inbounds [100000 x i32], ptr %h, i64 0, i64 %indvars.iv.next39.2
%12 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%sub.3 = add nsw i32 %12, -1
%idxprom7.3 = sext i32 %sub.3 to i64
%arrayidx8.3 = getelementptr inbounds [100000 x i32], ptr %g, i64 0, i64 %idxprom7.3
%13 = trunc i64 %indvars.iv.next39.3 to i32
store i32 %13, ptr %arrayidx8.3, align 4, !tbaa !5
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond12.preheader.unr-lcssa, label %for.body4, !llvm.loop !14
for.body14: ; preds = %for.cond12.preheader, %for.body14
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body14 ], [ 0, %for.cond12.preheader ]
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr %g, i64 0, i64 %indvars.iv41
%14 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp13 = icmp slt i64 %indvars.iv.next42, %16
br i1 %cmp13, label %for.body14, label %for.end20, !llvm.loop !15
for.end20: ; preds = %for.body14, %entry, %for.cond2.preheader, %for.cond12.preheader
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %g) #7
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %h) #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 #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(void){
int n,i;
scanf("%d",&n);
int a[n],b[n];
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n;i++) b[a[i]-1]=i+1;
for(i=0;i<n;i++) printf("%d ",b[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149050/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp31 = icmp sgt i32 %3, 0
br i1 %cmp31, label %for.body, label %for.end21
for.cond3.preheader: ; preds = %for.body
%cmp433 = icmp sgt i32 %6, 0
br i1 %cmp433, label %for.body5.preheader, label %for.end21
for.body5.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 3
%5 = icmp ult i32 %6, 4
br i1 %5, label %for.cond13.preheader.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond13.preheader.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%indvars.iv39.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next40.3, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond13.preheader, label %for.body5.epil
for.body5.epil: ; preds = %for.cond13.preheader.unr-lcssa, %for.body5.epil
%indvars.iv39.epil = phi i64 [ %indvars.iv.next40.epil, %for.body5.epil ], [ %indvars.iv39.unr, %for.cond13.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body5.epil ], [ 0, %for.cond13.preheader.unr-lcssa ]
%indvars.iv.next40.epil = add nuw nsw i64 %indvars.iv39.epil, 1
%arrayidx7.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39.epil
%8 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%sub.epil = add nsw i32 %8, -1
%idxprom8.epil = sext i32 %sub.epil to i64
%arrayidx9.epil = getelementptr inbounds i32, ptr %vla1, i64 %idxprom8.epil
%9 = trunc i64 %indvars.iv.next40.epil to i32
store i32 %9, ptr %arrayidx9.epil, align 4, !tbaa !5
%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.cond13.preheader, label %for.body5.epil, !llvm.loop !11
for.cond13.preheader: ; preds = %for.body5.epil, %for.cond13.preheader.unr-lcssa
br i1 %cmp433, label %for.body15, label %for.end21
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv39 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next40.3, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.3, %for.body5 ]
%indvars.iv.next40 = or i64 %indvars.iv39, 1
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx7, align 16, !tbaa !5
%sub = add nsw i32 %10, -1
%idxprom8 = sext i32 %sub to i64
%arrayidx9 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom8
%11 = trunc i64 %indvars.iv.next40 to i32
store i32 %11, ptr %arrayidx9, align 4, !tbaa !5
%indvars.iv.next40.1 = or i64 %indvars.iv39, 2
%arrayidx7.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next40
%12 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%sub.1 = add nsw i32 %12, -1
%idxprom8.1 = sext i32 %sub.1 to i64
%arrayidx9.1 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom8.1
%13 = trunc i64 %indvars.iv.next40.1 to i32
store i32 %13, ptr %arrayidx9.1, align 4, !tbaa !5
%indvars.iv.next40.2 = or i64 %indvars.iv39, 3
%arrayidx7.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next40.1
%14 = load i32, ptr %arrayidx7.2, align 8, !tbaa !5
%sub.2 = add nsw i32 %14, -1
%idxprom8.2 = sext i32 %sub.2 to i64
%arrayidx9.2 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom8.2
%15 = trunc i64 %indvars.iv.next40.2 to i32
store i32 %15, ptr %arrayidx9.2, align 4, !tbaa !5
%indvars.iv.next40.3 = add nuw nsw i64 %indvars.iv39, 4
%arrayidx7.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next40.2
%16 = load i32, ptr %arrayidx7.3, align 4, !tbaa !5
%sub.3 = add nsw i32 %16, -1
%idxprom8.3 = sext i32 %sub.3 to i64
%arrayidx9.3 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom8.3
%17 = trunc i64 %indvars.iv.next40.3 to i32
store i32 %17, ptr %arrayidx9.3, align 4, !tbaa !5
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond13.preheader.unr-lcssa, label %for.body5, !llvm.loop !13
for.body15: ; preds = %for.cond13.preheader, %for.body15
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body15 ], [ 0, %for.cond13.preheader ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv42
%18 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp14 = icmp slt i64 %indvars.iv.next43, %20
br i1 %cmp14, label %for.body15, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.body15, %entry, %for.cond3.preheader, %for.cond13.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
int a[n],b[n];
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
b[a[i]]=i;
}
for (int j=1;j<=n;j++){
printf("%d ",b[j]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149094/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149094/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp.not23 = icmp slt i32 %3, 1
br i1 %cmp.not23, label %for.cond.cleanup9, label %for.body
for.cond7.preheader: ; preds = %for.body
%5 = icmp slt i32 %8, 1
br i1 %5, label %for.cond.cleanup9, label %for.body10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom5 = sext i32 %6 to i64
%arrayidx6 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom5
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %9
br i1 %cmp.not.not, label %for.body, label %for.cond7.preheader, !llvm.loop !9
for.cond.cleanup9: ; preds = %for.body10, %entry, %for.cond7.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body10: ; preds = %for.cond7.preheader, %for.body10
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body10 ], [ 1, %for.cond7.preheader ]
%arrayidx12 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv28
%10 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp8.not.not = icmp slt i64 %indvars.iv28, %12
br i1 %cmp8.not.not, label %for.body10, label %for.cond.cleanup9, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct student{
int number;
int order;
}stu;
int cmp_order(const void *x, const void *y) {
return ((stu *)x)->order - ((stu *)y)->order;
}
int main() {
int n;
scanf("%d", &n);
stu a[n];
for (int i=0; i<n; i++) {
scanf("%d", &(a[i].order));
a[i].number = i+1;
}
qsort(a, n, sizeof(stu), cmp_order);
for (int i=0; i<n; i++) printf("%d ", a[i].number);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149137/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149137/source.c"
target datalayout = "e-m:e-p270: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.student = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_order(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) #0 {
entry:
%order = getelementptr inbounds %struct.student, ptr %x, i64 0, i32 1
%0 = load i32, ptr %order, align 4, !tbaa !5
%order1 = getelementptr inbounds %struct.student, ptr %y, i64 0, i32 1
%1 = load i32, ptr %order1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.student, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !10
%cmp24 = icmp sgt i32 %3, 0
br i1 %cmp24, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 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 ], [ %7, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @cmp_order) #7
%4 = load i32, ptr %n, align 4, !tbaa !10
%cmp626 = icmp sgt i32 %4, 0
br i1 %cmp626, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.student, ptr %vla, i64 %indvars.iv
%order = getelementptr inbounds %struct.student, ptr %vla, i64 %indvars.iv, i32 1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %order)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = trunc i64 %indvars.iv.next to i32
store i32 %5, ptr %arrayidx, align 8, !tbaa !11
%6 = load i32, ptr %n, align 4, !tbaa !10
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup8: ; preds = %for.body9, %for.cond.cleanup
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body9: ; preds = %for.cond.cleanup, %for.body9
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body9 ], [ 0, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds %struct.student, ptr %vla, i64 %indvars.iv30
%8 = load i32, ptr %arrayidx11, align 8, !tbaa !11
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%9 = load i32, ptr %n, align 4, !tbaa !10
%10 = sext i32 %9 to i64
%cmp6 = icmp slt i64 %indvars.iv.next31, %10
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
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 #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
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 nosync nounwind willreturn }
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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE 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 4}
!6 = !{!"student", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
#include <string.h>
int main(void){
int N = 0;
scanf("%d\n",&N);
int inputData[100000] = {};
int countData[100000] = {};
int resultData[100000] = {};
for(int i = 0;i < N;i++){
scanf("%d\n",&inputData[i]);
countData[i] = i+1;
}
for(int i = 0;i < N;i++){
resultData[inputData[i]] = countData[i];
}
for(int i = 0;i < N;i++){
printf("%d ",resultData[i+1]);
}
printf("\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149180/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149180/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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
%inputData = alloca [100000 x i32], align 16
%countData = alloca [100000 x i32], align 16
%resultData = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %inputData) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %inputData, i8 0, i64 400000, i1 false)
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %countData) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %countData, i8 0, i64 400000, i1 false)
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %resultData) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %resultData, i8 0, i64 400000, i1 false)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.cond.cleanup21
for.cond5.preheader: ; preds = %for.body
%cmp642 = icmp sgt i32 %3, 0
br i1 %cmp642, label %for.body8.preheader, label %for.cond.cleanup21
for.body8.preheader: ; preds = %for.cond5.preheader
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %3, 4
br i1 %1, label %for.cond19.preheader.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %inputData, 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
%arrayidx3 = getelementptr inbounds [100000 x i32], ptr %countData, i64 0, i64 %indvars.iv
%2 = trunc i64 %indvars.iv.next to i32
store i32 %2, ptr %arrayidx3, align 4, !tbaa !5
%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.cond5.preheader, !llvm.loop !9
for.cond19.preheader.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%indvars.iv48.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next49.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond19.preheader, label %for.body8.epil
for.body8.epil: ; preds = %for.cond19.preheader.unr-lcssa, %for.body8.epil
%indvars.iv48.epil = phi i64 [ %indvars.iv.next49.epil, %for.body8.epil ], [ %indvars.iv48.unr, %for.cond19.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.cond19.preheader.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [100000 x i32], ptr %countData, i64 0, i64 %indvars.iv48.epil
%5 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%arrayidx12.epil = getelementptr inbounds [100000 x i32], ptr %inputData, i64 0, i64 %indvars.iv48.epil
%6 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5
%idxprom13.epil = sext i32 %6 to i64
%arrayidx14.epil = getelementptr inbounds [100000 x i32], ptr %resultData, i64 0, i64 %idxprom13.epil
store i32 %5, ptr %arrayidx14.epil, align 4, !tbaa !5
%indvars.iv.next49.epil = add nuw nsw i64 %indvars.iv48.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond19.preheader, label %for.body8.epil, !llvm.loop !11
for.cond19.preheader: ; preds = %for.body8.epil, %for.cond19.preheader.unr-lcssa
br i1 %cmp642, label %for.body22, label %for.cond.cleanup21
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv48 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next49.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [100000 x i32], ptr %countData, i64 0, i64 %indvars.iv48
%7 = load i32, ptr %arrayidx10, align 16, !tbaa !5
%arrayidx12 = getelementptr inbounds [100000 x i32], ptr %inputData, i64 0, i64 %indvars.iv48
%8 = load i32, ptr %arrayidx12, align 16, !tbaa !5
%idxprom13 = sext i32 %8 to i64
%arrayidx14 = getelementptr inbounds [100000 x i32], ptr %resultData, i64 0, i64 %idxprom13
store i32 %7, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next49 = or i64 %indvars.iv48, 1
%arrayidx10.1 = getelementptr inbounds [100000 x i32], ptr %countData, i64 0, i64 %indvars.iv.next49
%9 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%arrayidx12.1 = getelementptr inbounds [100000 x i32], ptr %inputData, i64 0, i64 %indvars.iv.next49
%10 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5
%idxprom13.1 = sext i32 %10 to i64
%arrayidx14.1 = getelementptr inbounds [100000 x i32], ptr %resultData, i64 0, i64 %idxprom13.1
store i32 %9, ptr %arrayidx14.1, align 4, !tbaa !5
%indvars.iv.next49.1 = or i64 %indvars.iv48, 2
%arrayidx10.2 = getelementptr inbounds [100000 x i32], ptr %countData, i64 0, i64 %indvars.iv.next49.1
%11 = load i32, ptr %arrayidx10.2, align 8, !tbaa !5
%arrayidx12.2 = getelementptr inbounds [100000 x i32], ptr %inputData, i64 0, i64 %indvars.iv.next49.1
%12 = load i32, ptr %arrayidx12.2, align 8, !tbaa !5
%idxprom13.2 = sext i32 %12 to i64
%arrayidx14.2 = getelementptr inbounds [100000 x i32], ptr %resultData, i64 0, i64 %idxprom13.2
store i32 %11, ptr %arrayidx14.2, align 4, !tbaa !5
%indvars.iv.next49.2 = or i64 %indvars.iv48, 3
%arrayidx10.3 = getelementptr inbounds [100000 x i32], ptr %countData, i64 0, i64 %indvars.iv.next49.2
%13 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%arrayidx12.3 = getelementptr inbounds [100000 x i32], ptr %inputData, i64 0, i64 %indvars.iv.next49.2
%14 = load i32, ptr %arrayidx12.3, align 4, !tbaa !5
%idxprom13.3 = sext i32 %14 to i64
%arrayidx14.3 = getelementptr inbounds [100000 x i32], ptr %resultData, i64 0, i64 %idxprom13.3
store i32 %13, ptr %arrayidx14.3, align 4, !tbaa !5
%indvars.iv.next49.3 = add nuw nsw i64 %indvars.iv48, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond19.preheader.unr-lcssa, label %for.body8, !llvm.loop !13
for.cond.cleanup21: ; preds = %for.body22, %entry, %for.cond5.preheader, %for.cond19.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %resultData) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %countData) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %inputData) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.body22: ; preds = %for.cond19.preheader, %for.body22
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.body22 ], [ 0, %for.cond19.preheader ]
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%arrayidx25 = getelementptr inbounds [100000 x i32], ptr %resultData, i64 0, i64 %indvars.iv.next52
%15 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%16 = load i32, ptr %N, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp20 = icmp slt i64 %indvars.iv.next52, %17
br i1 %cmp20, label %for.body22, label %for.cond.cleanup21, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 nounwind willreturn memory(argmem: write) }
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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int a; //出席番号
int b; //登校順番
} order;
int compare_order_b(const void *p, const void *q) {
return ((order*)p)->b - ((order*)q)->b;
}
int main() {
int N;
scanf("%d",&N);
order A[N];
for (int i = 0; i < N; i++) {
scanf("%d",&A[i].b);
A[i].a = i+1;
}
qsort(A, N, sizeof(order), compare_order_b);
for (int i = 0; i < N; i++) {
printf("%d ",A[i].a);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149223/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149223/source.c"
target datalayout = "e-m:e-p270: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.order = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_order_b(ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) #0 {
entry:
%b = getelementptr inbounds %struct.order, ptr %p, i64 0, i32 1
%0 = load i32, ptr %b, align 4, !tbaa !5
%b1 = getelementptr inbounds %struct.order, ptr %q, i64 0, i32 1
%1 = load i32, ptr %b1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !10
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.order, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !10
%cmp24 = icmp sgt i32 %3, 0
br i1 %cmp24, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 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 ], [ %7, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @compare_order_b) #7
%4 = load i32, ptr %N, align 4, !tbaa !10
%cmp626 = icmp sgt i32 %4, 0
br i1 %cmp626, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.order, ptr %vla, i64 %indvars.iv
%b = getelementptr inbounds %struct.order, ptr %vla, i64 %indvars.iv, i32 1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = trunc i64 %indvars.iv.next to i32
store i32 %5, ptr %arrayidx, align 8, !tbaa !11
%6 = load i32, ptr %N, align 4, !tbaa !10
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup8: ; preds = %for.body9, %for.cond.cleanup
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
for.body9: ; preds = %for.cond.cleanup, %for.body9
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body9 ], [ 0, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds %struct.order, ptr %vla, i64 %indvars.iv30
%8 = load i32, ptr %arrayidx11, align 8, !tbaa !11
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%9 = load i32, ptr %N, align 4, !tbaa !10
%10 = sext i32 %9 to i64
%cmp6 = icmp slt i64 %indvars.iv.next31, %10
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
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 #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
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 nosync nounwind willreturn }
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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE 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 4}
!6 = !{!"", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
int xy[200000];
int tmp[200000];
void sort(int lb, int ub) {
int i, j, k;
if (ub - lb <= 1) return;
int m = (lb + ub) >> 1;
sort(lb, m);
sort(m, ub);
for (i = lb; i < ub; i++) {
tmp[i << 1] = xy[i << 1];
tmp[(i << 1) | 1] = xy[(i << 1) | 1];
}
for (i = lb, j = lb, k = m; i < ub; i++) {
if (j == m) {
xy[i << 1] = tmp[k << 1];
xy[(i << 1) | 1] = tmp[(k << 1) | 1];
++k;
}
else if (k == ub) {
xy[i << 1] = tmp[j << 1];
xy[(i << 1) | 1] = tmp[(j << 1) | 1];
++j;
}
else if (tmp[j << 1] < tmp[k << 1] || (tmp[j << 1] == tmp[k << 1] && tmp[(j << 1) | 1] < tmp[(k << 1) | 1])) {
xy[i << 1] = tmp[j << 1];
xy[(i << 1) | 1] = tmp[(j << 1) | 1];
++j;
}
else {
xy[i << 1] = tmp[k << 1];
xy[(i << 1) | 1] = tmp[(k << 1) | 1];
++k;
}
}
}
int main(void)
{
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d%d", &xy[i << 1], &xy[(i << 1) | 1]);
}
sort(0, n);
for (i = 0; i < n; i++) {
printf("%d %d\n", xy[i << 1], xy[(i << 1) | 1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149267/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149267/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@xy = dso_local global [200000 x i32] zeroinitializer, align 16
@tmp = dso_local local_unnamed_addr global [200000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @sort(i32 noundef %lb, i32 noundef %ub) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %ub, %lb
%cmp = icmp slt i32 %sub, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%add = add nsw i32 %ub, %lb
%shr = ashr i32 %add, 1
tail call void @sort(i32 noundef %lb, i32 noundef %shr)
tail call void @sort(i32 noundef %shr, i32 noundef %ub)
%cmp1160 = icmp slt i32 %lb, %ub
br i1 %cmp1160, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %if.end
%0 = sext i32 %lb to i64
%wide.trip.count = sext i32 %ub to i64
%1 = sub nsw i64 %wide.trip.count, %0
%min.iters.check = icmp ult i64 %1, 34
br i1 %min.iters.check, label %for.body.preheader186, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body.preheader
%2 = xor i64 %0, -1
%3 = add nsw i64 %2, %wide.trip.count
%4 = shl i32 %lb, 1
%5 = trunc i64 %3 to i32
%6 = add i32 %5, %lb
%7 = shl i32 %6, 1
%8 = icmp slt i32 %7, %4
%9 = or i32 %4, 1
%10 = trunc i64 %3 to i32
%mul.result176 = shl i32 %10, 1
%11 = add i32 %9, %mul.result176
%12 = icmp slt i32 %11, %9
%13 = icmp ugt i64 %3, 2147483647
%14 = or i1 %12, %13
%15 = sext i32 %4 to i64
%16 = shl nsw i64 %15, 2
%scevgep = getelementptr i8, ptr @tmp, i64 %16
%mul.result179 = shl nsw i64 %3, 3
%17 = getelementptr i8, ptr %scevgep, i64 %mul.result179
%18 = icmp ult ptr %17, %scevgep
%19 = or i64 %16, 4
%scevgep181 = getelementptr i8, ptr @tmp, i64 %19
%mul.result183 = shl nsw i64 %3, 3
%20 = getelementptr i8, ptr %scevgep181, i64 %mul.result183
%21 = icmp ult ptr %20, %scevgep181
%22 = or i1 %8, %14
%23 = or i1 %18, %22
%24 = or i1 %21, %23
br i1 %24, label %for.body.preheader186, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %1, -2
%ind.end = add nsw i64 %n.vec, %0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%25 = trunc i64 %index to i32
%26 = add i32 %25, %lb
%27 = shl i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %28
%wide.vec = load <4 x i32>, ptr %29, align 8, !tbaa !5
%30 = or i32 %27, 1
%31 = sext i32 %30 to i64
%gep = getelementptr [200000 x i32], ptr getelementptr (i32, ptr @tmp, i64 -1), i64 0, i64 %31
store <4 x i32> %wide.vec, ptr %gep, align 8, !tbaa !5
%index.next = add nuw i64 %index, 2
%32 = icmp eq i64 %index.next, %n.vec
br i1 %32, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.cond12.preheader, label %for.body.preheader186
for.body.preheader186: ; preds = %vector.scevcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %vector.scevcheck ], [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%33 = sub nsw i64 %wide.trip.count, %indvars.iv.ph
%xtraiter = and i64 %33, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader186
%34 = trunc i64 %indvars.iv.ph to i32
%shl.prol = shl i32 %34, 1
%idxprom.prol = sext i32 %shl.prol to i64
%arrayidx.prol = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom.prol
%arrayidx4.prol = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom.prol
%35 = load <2 x i32>, ptr %arrayidx.prol, align 8, !tbaa !5
store <2 x i32> %35, ptr %arrayidx4.prol, align 8, !tbaa !5
%indvars.iv.next.prol = add nsw i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader186
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader186 ], [ %indvars.iv.next.prol, %for.body.prol ]
%36 = sub nsw i64 0, %wide.trip.count
%37 = xor i64 %indvars.iv.ph, %36
%38 = icmp eq i64 %37, -1
br i1 %38, label %for.cond12.preheader, label %for.body
for.cond12.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block
br i1 %cmp1160, label %for.body14.preheader, label %cleanup
for.body14.preheader: ; preds = %for.cond12.preheader
%39 = sext i32 %lb to i64
%wide.trip.count170 = sext i32 %ub to i64
br label %for.body14
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%40 = trunc i64 %indvars.iv to i32
%shl = shl i32 %40, 1
%idxprom = sext i32 %shl to i64
%arrayidx = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom
%arrayidx4 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom
%41 = load <2 x i32>, ptr %arrayidx, align 8, !tbaa !5
store <2 x i32> %41, ptr %arrayidx4, align 8, !tbaa !5
%42 = trunc i64 %indvars.iv to i32
%43 = shl i32 %42, 1
%shl.1 = add i32 %43, 2
%idxprom.1 = sext i32 %shl.1 to i64
%arrayidx.1 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom.1
%arrayidx4.1 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom.1
%44 = load <2 x i32>, ptr %arrayidx.1, align 8, !tbaa !5
store <2 x i32> %44, ptr %arrayidx4.1, align 8, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.cond12.preheader, label %for.body, !llvm.loop !13
for.body14: ; preds = %for.body14.preheader, %for.inc108
%indvars.iv167 = phi i64 [ %39, %for.body14.preheader ], [ %indvars.iv.next168, %for.inc108 ]
%k.0164 = phi i32 [ %shr, %for.body14.preheader ], [ %k.1, %for.inc108 ]
%j.0163 = phi i32 [ %lb, %for.body14.preheader ], [ %j.1, %for.inc108 ]
%cmp15 = icmp eq i32 %j.0163, %shr
br i1 %cmp15, label %if.then16, label %if.else
if.then16: ; preds = %for.body14
%shl17 = shl i32 %k.0164, 1
%idxprom18 = sext i32 %shl17 to i64
%arrayidx19 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom18
%45 = load i32, ptr %arrayidx19, align 8, !tbaa !5
%46 = trunc i64 %indvars.iv167 to i32
%shl20 = shl i32 %46, 1
%idxprom21 = sext i32 %shl20 to i64
%arrayidx22 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom21
store i32 %45, ptr %arrayidx22, align 8, !tbaa !5
%or24 = or i32 %shl17, 1
%idxprom25 = sext i32 %or24 to i64
%arrayidx26 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom25
%47 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%or28 = or i32 %shl20, 1
%idxprom29 = sext i32 %or28 to i64
%arrayidx30 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom29
store i32 %47, ptr %arrayidx30, align 4, !tbaa !5
%inc31 = add nsw i32 %k.0164, 1
br label %for.inc108
if.else: ; preds = %for.body14
%cmp32 = icmp eq i32 %k.0164, %ub
%shl34 = shl i32 %j.0163, 1
%idxprom35 = sext i32 %shl34 to i64
%arrayidx36 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom35
%48 = load i32, ptr %arrayidx36, align 8, !tbaa !5
br i1 %cmp32, label %if.then33, label %if.else49
if.then33: ; preds = %if.else
%49 = trunc i64 %indvars.iv167 to i32
%shl37 = shl i32 %49, 1
%idxprom38 = sext i32 %shl37 to i64
%arrayidx39 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom38
store i32 %48, ptr %arrayidx39, align 8, !tbaa !5
%or41 = or i32 %shl34, 1
%idxprom42 = sext i32 %or41 to i64
%arrayidx43 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom42
%50 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%or45 = or i32 %shl37, 1
%idxprom46 = sext i32 %or45 to i64
%arrayidx47 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom46
store i32 %50, ptr %arrayidx47, align 4, !tbaa !5
%inc48 = add nsw i32 %j.0163, 1
br label %for.inc108
if.else49: ; preds = %if.else
%shl53 = shl i32 %k.0164, 1
%idxprom54 = sext i32 %shl53 to i64
%arrayidx55 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom54
%51 = load i32, ptr %arrayidx55, align 8, !tbaa !5
%cmp56 = icmp slt i32 %48, %51
br i1 %cmp56, label %if.else49.if.then73_crit_edge, label %lor.lhs.false
if.else49.if.then73_crit_edge: ; preds = %if.else49
%.pre = or i32 %shl34, 1
%.pre172 = sext i32 %.pre to i64
br label %if.then73
lor.lhs.false: ; preds = %if.else49
%cmp63 = icmp eq i32 %48, %51
br i1 %cmp63, label %land.lhs.true, label %lor.lhs.false.if.else89_crit_edge
lor.lhs.false.if.else89_crit_edge: ; preds = %lor.lhs.false
%.pre173 = or i32 %shl53, 1
%.pre174 = sext i32 %.pre173 to i64
br label %if.else89
land.lhs.true: ; preds = %lor.lhs.false
%or65 = or i32 %shl34, 1
%idxprom66 = sext i32 %or65 to i64
%arrayidx67 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom66
%52 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%or69 = or i32 %shl53, 1
%idxprom70 = sext i32 %or69 to i64
%arrayidx71 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom70
%53 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%cmp72 = icmp slt i32 %52, %53
br i1 %cmp72, label %if.then73, label %if.else89
if.then73: ; preds = %if.else49.if.then73_crit_edge, %land.lhs.true
%idxprom82.pre-phi = phi i64 [ %.pre172, %if.else49.if.then73_crit_edge ], [ %idxprom66, %land.lhs.true ]
%54 = trunc i64 %indvars.iv167 to i32
%shl77 = shl i32 %54, 1
%idxprom78 = sext i32 %shl77 to i64
%arrayidx79 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom78
store i32 %48, ptr %arrayidx79, align 8, !tbaa !5
%arrayidx83 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom82.pre-phi
%55 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%or85 = or i32 %shl77, 1
%idxprom86 = sext i32 %or85 to i64
%arrayidx87 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom86
store i32 %55, ptr %arrayidx87, align 4, !tbaa !5
%inc88 = add nsw i32 %j.0163, 1
br label %for.inc108
if.else89: ; preds = %lor.lhs.false.if.else89_crit_edge, %land.lhs.true
%idxprom98.pre-phi = phi i64 [ %.pre174, %lor.lhs.false.if.else89_crit_edge ], [ %idxprom70, %land.lhs.true ]
%56 = trunc i64 %indvars.iv167 to i32
%shl93 = shl i32 %56, 1
%idxprom94 = sext i32 %shl93 to i64
%arrayidx95 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom94
store i32 %51, ptr %arrayidx95, align 8, !tbaa !5
%arrayidx99 = getelementptr inbounds [200000 x i32], ptr @tmp, i64 0, i64 %idxprom98.pre-phi
%57 = load i32, ptr %arrayidx99, align 4, !tbaa !5
%or101 = or i32 %shl93, 1
%idxprom102 = sext i32 %or101 to i64
%arrayidx103 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom102
store i32 %57, ptr %arrayidx103, align 4, !tbaa !5
%inc104 = add nsw i32 %k.0164, 1
br label %for.inc108
for.inc108: ; preds = %if.then16, %if.then73, %if.else89, %if.then33
%j.1 = phi i32 [ %shr, %if.then16 ], [ %inc48, %if.then33 ], [ %inc88, %if.then73 ], [ %j.0163, %if.else89 ]
%k.1 = phi i32 [ %inc31, %if.then16 ], [ %ub, %if.then33 ], [ %k.0164, %if.then73 ], [ %inc104, %if.else89 ]
%indvars.iv.next168 = add nsw i64 %indvars.iv167, 1
%exitcond171.not = icmp eq i64 %indvars.iv.next168, %wide.trip.count170
br i1 %exitcond171.not, label %cleanup, label %for.body14, !llvm.loop !14
cleanup: ; preds = %for.inc108, %if.end, %for.cond12.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
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
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sext = shl i64 %indvars.iv, 33
%idxprom = ashr exact i64 %sext, 32
%arrayidx = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom
%indvars.iv.tr = trunc i64 %indvars.iv to i32
%1 = shl i32 %indvars.iv.tr, 1
%2 = or i32 %1, 1
%idxprom2 = sext i32 %2 to i64
%arrayidx3 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom2
%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
%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.end, !llvm.loop !15
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
call void @sort(i32 noundef 0, i32 noundef %.lcssa)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp628 = icmp sgt i32 %5, 0
br i1 %cmp628, label %for.body7, label %for.end18
for.body7: ; preds = %for.end, %for.body7
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.body7 ], [ 0, %for.end ]
%sext39 = shl i64 %indvars.iv34, 33
%idxprom9 = ashr exact i64 %sext39, 32
%arrayidx10 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom9
%6 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%indvars.iv34.tr = trunc i64 %indvars.iv34 to i32
%7 = shl i32 %indvars.iv34.tr, 1
%8 = or i32 %7, 1
%idxprom13 = sext i32 %8 to i64
%arrayidx14 = getelementptr inbounds [200000 x i32], ptr @xy, i64 0, i64 %idxprom13
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %6, i32 noundef %9)
%indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp6 = icmp slt i64 %indvars.iv.next35, %11
br i1 %cmp6, label %for.body7, label %for.end18, !llvm.loop !16
for.end18: ; preds = %for.body7, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main()
{
char a[3],b[3];
int i,c=1;
scanf("%s%s",a,b);
for(i=0;i<3;i++)
{
if(a[i]!=b[2-i])
c=0;
}
if(c)
printf("YES");
else
printf("NO");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149317/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149317/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [3 x i8], align 1
%b = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i8, ptr %a, align 1, !tbaa !5
%arrayidx3 = getelementptr inbounds [3 x i8], ptr %b, i64 0, i64 2
%1 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5.not = icmp ne i8 %0, %1
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %a, i64 0, i64 1
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [3 x i8], ptr %b, i64 0, i64 1
%3 = load i8, ptr %arrayidx3.1, align 1, !tbaa !5
%cmp5.not.1 = icmp ne i8 %2, %3
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %a, i64 0, i64 2
%4 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%5 = load i8, ptr %b, align 1, !tbaa !5
%cmp5.not.2 = icmp ne i8 %4, %5
%.not = select i1 %cmp5.not.2, i1 true, i1 %cmp5.not.1
%narrow18 = select i1 %.not, i1 true, i1 %cmp5.not
%.str.2..str.1 = select i1 %narrow18, ptr @.str.2, ptr @.str.1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 3, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void){
int A,B,C,D,E,x,y,cou=0,v[3];
char S[3],s[3],X,Y;
scanf("%s%s",&S,&s);
if((S[0]==s[2])&&(S[1]==s[1])&&(S[2]==s[0])){
printf("YES");
}else{
printf("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149368/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149368/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\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:
%S = alloca [3 x i8], align 1
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %s)
%0 = load i8, ptr %S, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 2
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%arrayidx4 = getelementptr inbounds [3 x i8], ptr %S, i64 0, i64 1
%2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%arrayidx6 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
%3 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8 = icmp eq i8 %2, %3
br i1 %cmp8, label %land.lhs.true10, label %if.else
land.lhs.true10: ; preds = %land.lhs.true
%arrayidx11 = getelementptr inbounds [3 x i8], ptr %S, i64 0, i64 2
%4 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%5 = load i8, ptr %s, align 1, !tbaa !5
%cmp15 = icmp eq i8 %4, %5
br i1 %cmp15, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true10, %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true10, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true10 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 a[4],b[4];
scanf("%s%s",a,b);
printf(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]?"YES":"NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i8], align 1
%b = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i8, ptr %a, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds [4 x i8], ptr %b, i64 0, i64 2
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %land.end
land.lhs.true: ; preds = %entry
%arrayidx5 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 1
%2 = load i8, ptr %arrayidx5, align 1, !tbaa !5
%arrayidx7 = getelementptr inbounds [4 x i8], ptr %b, i64 0, i64 1
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %2, %3
br i1 %cmp9, label %land.rhs, label %land.end
land.rhs: ; preds = %land.lhs.true
%arrayidx11 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 2
%4 = load i8, ptr %arrayidx11, align 1, !tbaa !5
%5 = load i8, ptr %b, align 1, !tbaa !5
%cmp15 = icmp eq i8 %4, %5
%6 = select i1 %cmp15, ptr @.str.1, ptr @.str.2
br label %land.end
land.end: ; preds = %land.rhs, %land.lhs.true, %entry
%cond = phi ptr [ @.str.2, %land.lhs.true ], [ @.str.2, %entry ], [ %6, %land.rhs ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
char A[2][3];
int i,j;
int flag=0;
scanf("%s",A[0]);
scanf("%s",A[1]);
for(i=0;i<3;i++){
if(A[0][i]==A[1][2-i]){
flag++;
}
}
if(flag==3)
printf("YES\n");
else
printf("NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [2 x [3 x i8]], align 1
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%arrayidx1 = getelementptr inbounds [2 x [3 x i8]], ptr %A, i64 0, i64 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1)
%0 = load i8, ptr %A, align 1, !tbaa !5
%arrayidx8 = getelementptr inbounds [2 x [3 x i8]], ptr %A, i64 0, i64 1, i64 2
%1 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%cmp10 = icmp eq i8 %0, %1
%inc = zext i1 %cmp10 to i32
%arrayidx5.1 = getelementptr inbounds [3 x i8], ptr %A, i64 0, i64 1
%2 = load i8, ptr %arrayidx5.1, align 1, !tbaa !5
%arrayidx8.1 = getelementptr inbounds [2 x [3 x i8]], ptr %A, i64 0, i64 1, i64 1
%3 = load i8, ptr %arrayidx8.1, align 1, !tbaa !5
%cmp10.1 = icmp eq i8 %2, %3
%inc.1 = zext i1 %cmp10.1 to i32
%spec.select.1 = add nuw nsw i32 %inc, %inc.1
%arrayidx5.2 = getelementptr inbounds [3 x i8], ptr %A, i64 0, i64 2
%4 = load i8, ptr %arrayidx5.2, align 1, !tbaa !5
%5 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp10.2 = icmp eq i8 %4, %5
%inc.2 = zext i1 %cmp10.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc.2
%cmp13 = icmp eq i32 %spec.select.2, 3
%str.3.str = select i1 %cmp13, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
char c1[5] = {}, c2[5] = {};
scanf("%s %s", c1, c2);
if (c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0])
puts("YES");
else
puts("NO");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149526/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149526/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s %s\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:
%c1 = alloca [5 x i8], align 1
%c2 = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %c1) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %c1, i8 0, i64 5, i1 false)
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %c2) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %c2, i8 0, i64 5, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c1, ptr noundef nonnull %c2)
%0 = load i8, ptr %c1, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds [5 x i8], ptr %c2, i64 0, i64 2
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%arrayidx5 = getelementptr inbounds [5 x i8], ptr %c1, i64 0, i64 1
%2 = load i8, ptr %arrayidx5, align 1, !tbaa !5
%arrayidx7 = getelementptr inbounds [5 x i8], ptr %c2, i64 0, i64 1
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %2, %3
br i1 %cmp9, label %land.lhs.true11, label %if.else
land.lhs.true11: ; preds = %land.lhs.true
%arrayidx12 = getelementptr inbounds [5 x i8], ptr %c1, i64 0, i64 2
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !5
%5 = load i8, ptr %c2, align 1, !tbaa !5
%cmp16 = icmp eq i8 %4, %5
br i1 %cmp16, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true11, %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true11, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true11 ]
%call19 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %c2) #4
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %c1) #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 @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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
int compare_long(const void *a, const void *b)
{
long *A = (long *)a;
long *B = (long *)b;
if (*A < *B) return 1;
if (*A > *B) return -1;
return 0;
}
int main(void)
{
//変数の宣言
int n;
int a[310][310];
//よく使う変数
int i,j,k,l;
int flag=0;
llong int ans=0;
int count=0;
int temp,temp1,temp2;
int max,min;
int len;
//データの読み込み
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%d",&a[i][j]);
}
}
// printf("nは%dです\n", n);
// printf("データの読み込み終了\n");
//実際の処理
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
flag=0;
for(k=0;k<n;k++){
if(a[i][j]>a[i][k]+a[k][j]){
printf("-1");
return 0;
}else if(i==k||j==k){
//nothing;
}else if(a[i][j]==a[i][k]+a[k][j]){
flag=1;
}
}
if(flag==0){
ans=ans+a[i][j];
}
}
}
// printf("計算部分終了\n");
//出力
printf("%lld",ans);
// printf("結果の出力終了\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149577/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"-1\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_long(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%a = alloca [310 x [310 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 384400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp123 = icmp sgt i32 %0, 0
br i1 %cmp123, label %for.cond1.preheader, label %for.end71
for.cond1.preheader: ; preds = %entry, %for.inc7
%1 = phi i32 [ %8, %for.inc7 ], [ %0, %entry ]
%indvars.iv143 = phi i64 [ %indvars.iv.next144, %for.inc7 ], [ 0, %entry ]
%cmp2121 = icmp sgt i32 %1, 0
br i1 %cmp2121, label %for.body3, label %for.cond1.preheader.for.inc7_crit_edge
for.cond1.preheader.for.inc7_crit_edge: ; preds = %for.cond1.preheader
%.pre = sext i32 %1 to i64
br label %for.inc7
for.cond10.preheader: ; preds = %for.inc7
%cmp11134 = icmp sgt i32 %8, 0
br i1 %cmp11134, label %for.body12.us.preheader, label %for.end71
for.body12.us.preheader: ; preds = %for.cond10.preheader
%2 = zext i32 %8 to i64
%wide.trip.count159 = zext i32 %8 to i64
br label %for.body12.us
for.body12.us: ; preds = %for.body12.us.preheader, %for.cond10.loopexit.us
%indvars.iv156 = phi i64 [ 0, %for.body12.us.preheader ], [ %indvars.iv.next157, %for.cond10.loopexit.us ]
%indvars.iv149 = phi i64 [ 1, %for.body12.us.preheader ], [ %indvars.iv.next150, %for.cond10.loopexit.us ]
%ans.0135.us = phi i64 [ 0, %for.body12.us.preheader ], [ %ans.1.lcssa.us, %for.cond10.loopexit.us ]
%indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
%cmp14129.us = icmp ult i64 %indvars.iv.next157, %2
br i1 %cmp14129.us, label %for.cond16.preheader.us.us, label %for.cond10.loopexit.us
for.cond10.loopexit.us: ; preds = %for.cond16.for.end57_crit_edge.us.us, %for.body12.us
%ans.1.lcssa.us = phi i64 [ %ans.0135.us, %for.body12.us ], [ %ans.2.us.us, %for.cond16.for.end57_crit_edge.us.us ]
%indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
%exitcond160.not = icmp eq i64 %indvars.iv.next157, %wide.trip.count159
br i1 %exitcond160.not, label %for.end71, label %for.body12.us, !llvm.loop !11
for.cond16.preheader.us.us: ; preds = %for.body12.us, %for.cond16.for.end57_crit_edge.us.us
%indvars.iv151 = phi i64 [ %indvars.iv.next152, %for.cond16.for.end57_crit_edge.us.us ], [ %indvars.iv149, %for.body12.us ]
%ans.1130.us.us = phi i64 [ %ans.2.us.us, %for.cond16.for.end57_crit_edge.us.us ], [ %ans.0135.us, %for.body12.us ]
%arrayidx22.us.us = getelementptr inbounds [310 x [310 x i32]], ptr %a, i64 0, i64 %indvars.iv156, i64 %indvars.iv151
%3 = load i32, ptr %arrayidx22.us.us, align 4, !tbaa !9
br label %for.body18.us.us
for.body18.us.us: ; preds = %if.else.us.us, %for.cond16.preheader.us.us
%indvars.iv146 = phi i64 [ %indvars.iv.next147, %if.else.us.us ], [ 0, %for.cond16.preheader.us.us ]
%flag.0126.us.us = phi i32 [ %flag.1.us.us, %if.else.us.us ], [ 0, %for.cond16.preheader.us.us ]
%arrayidx26.us.us = getelementptr inbounds [310 x [310 x i32]], ptr %a, i64 0, i64 %indvars.iv156, i64 %indvars.iv146
%4 = load i32, ptr %arrayidx26.us.us, align 4, !tbaa !9
%arrayidx30.us.us = getelementptr inbounds [310 x [310 x i32]], ptr %a, i64 0, i64 %indvars.iv146, i64 %indvars.iv151
%5 = load i32, ptr %arrayidx30.us.us, align 4, !tbaa !9
%add31.us.us = add nsw i32 %5, %4
%cmp32.us.us = icmp sgt i32 %3, %add31.us.us
br i1 %cmp32.us.us, label %if.then, label %if.else.us.us
if.else.us.us: ; preds = %for.body18.us.us
%cmp34.us.us = icmp ne i64 %indvars.iv156, %indvars.iv146
%cmp35.us.us = icmp ne i64 %indvars.iv151, %indvars.iv146
%or.cond.not117.us.us = and i1 %cmp34.us.us, %cmp35.us.us
%cmp51.us.us = icmp eq i32 %3, %add31.us.us
%or.cond116.us.us = and i1 %or.cond.not117.us.us, %cmp51.us.us
%flag.1.us.us = select i1 %or.cond116.us.us, i32 1, i32 %flag.0126.us.us
%indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
%exitcond.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count159
br i1 %exitcond.not, label %for.cond16.for.end57_crit_edge.us.us, label %for.body18.us.us, !llvm.loop !13
for.cond16.for.end57_crit_edge.us.us: ; preds = %if.else.us.us
%cmp58.us.us = icmp eq i32 %flag.1.us.us, 0
%narrow = select i1 %cmp58.us.us, i32 %3, i32 0
%add64.us.us = sext i32 %narrow to i64
%ans.2.us.us = add nsw i64 %ans.1130.us.us, %add64.us.us
%indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
%exitcond155.not = icmp eq i64 %indvars.iv.next152, %wide.trip.count159
br i1 %exitcond155.not, label %for.cond10.loopexit.us, label %for.cond16.preheader.us.us, !llvm.loop !14
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [310 x [310 x i32]], ptr %a, i64 0, i64 %indvars.iv143, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !9
%7 = sext i32 %6 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !15
for.inc7: ; preds = %for.body3, %for.cond1.preheader.for.inc7_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond1.preheader.for.inc7_crit_edge ], [ %7, %for.body3 ]
%8 = phi i32 [ %1, %for.cond1.preheader.for.inc7_crit_edge ], [ %6, %for.body3 ]
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%cmp = icmp slt i64 %indvars.iv.next144, %.pre-phi
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !16
if.then: ; preds = %for.body18.us.us
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
for.end71: ; preds = %for.cond10.loopexit.us, %entry, %for.cond10.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond10.preheader ], [ 0, %entry ], [ %ans.1.lcssa.us, %for.cond10.loopexit.us ]
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end71, %if.then
call void @llvm.lifetime.end.p0(i64 384400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include <stdio.h>
int main(void){
unsigned char w,h,k;
unsigned int kl=0;
scanf("%u %u %u",&w, &h, &k);
for (;k>0;k--){
kl+=2*(w+h-2);
w-=4;
h-=4;
}
printf("\n%u",kl);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14962/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%u %u %u\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"\0A%u\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i8, align 1
%h = alloca i8, align 1
%k = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %k)
%.pr = load i8, ptr %k, align 1, !tbaa !5
%h.promoted = load i8, ptr %h, align 1, !tbaa !5
%cmp.not15 = icmp eq i8 %.pr, 0
br i1 %cmp.not15, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%w.promoted = load i8, ptr %w, align 1, !tbaa !5
%0 = shl i8 %.pr, 2
%1 = sub i8 %w.promoted, %0
%2 = zext i8 %.pr to i32
%min.iters.check = icmp ult i8 %.pr, 8
br i1 %min.iters.check, label %for.body.preheader34, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %2, 248
%.cast = trunc i32 %n.vec to i8
%ind.end = sub i8 %.pr, %.cast
%.cast19 = trunc i32 %n.vec to i8
%3 = shl i8 %.cast19, 2
%ind.end20 = sub i8 %w.promoted, %3
%.cast22 = trunc i32 %n.vec to i8
%4 = shl i8 %.cast22, 2
%ind.end23 = sub i8 %h.promoted, %4
%.splatinsert = insertelement <4 x i8> poison, i8 %w.promoted, i64 0
%.splat = shufflevector <4 x i8> %.splatinsert, <4 x i8> poison, <4 x i32> zeroinitializer
%induction = add <4 x i8> %.splat, <i8 0, i8 -4, i8 -8, i8 -12>
%.splatinsert27 = insertelement <4 x i8> poison, i8 %h.promoted, i64 0
%.splat28 = shufflevector <4 x i8> %.splatinsert27, <4 x i8> poison, <4 x i32> zeroinitializer
%induction29 = add <4 x i8> %.splat28, <i8 0, i8 -4, i8 -8, i8 -12>
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%vec.phi25 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%vec.ind = phi <4 x i8> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.ind30 = phi <4 x i8> [ %induction29, %vector.ph ], [ %vec.ind.next33, %vector.body ]
%step.add = add <4 x i8> %vec.ind, <i8 -16, i8 -16, i8 -16, i8 -16>
%step.add31 = add <4 x i8> %vec.ind30, <i8 -16, i8 -16, i8 -16, i8 -16>
%5 = zext <4 x i8> %vec.ind to <4 x i32>
%6 = zext <4 x i8> %step.add to <4 x i32>
%7 = zext <4 x i8> %vec.ind30 to <4 x i32>
%8 = zext <4 x i8> %step.add31 to <4 x i32>
%9 = add nuw nsw <4 x i32> %7, %5
%10 = add nuw nsw <4 x i32> %8, %6
%11 = shl nuw nsw <4 x i32> %9, <i32 1, i32 1, i32 1, i32 1>
%12 = shl nuw nsw <4 x i32> %10, <i32 1, i32 1, i32 1, i32 1>
%13 = add <4 x i32> %vec.phi, <i32 -4, i32 -4, i32 -4, i32 -4>
%14 = add <4 x i32> %vec.phi25, <i32 -4, i32 -4, i32 -4, i32 -4>
%15 = add <4 x i32> %13, %11
%16 = add <4 x i32> %14, %12
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i8> %vec.ind, <i8 -32, i8 -32, i8 -32, i8 -32>
%vec.ind.next33 = add <4 x i8> %vec.ind30, <i8 -32, i8 -32, i8 -32, i8 -32>
%17 = icmp eq i32 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !8
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 i32 %n.vec, %2
br i1 %cmp.n, label %for.cond.for.end_crit_edge, label %for.body.preheader34
for.body.preheader34: ; preds = %for.body.preheader, %middle.block
%kl.018.ph = phi i32 [ 0, %for.body.preheader ], [ %18, %middle.block ]
%.ph = phi i8 [ %.pr, %for.body.preheader ], [ %ind.end, %middle.block ]
%sub61317.ph = phi i8 [ %w.promoted, %for.body.preheader ], [ %ind.end20, %middle.block ]
%sub91416.ph = phi i8 [ %h.promoted, %for.body.preheader ], [ %ind.end23, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader34, %for.body
%kl.018 = phi i32 [ %add4, %for.body ], [ %kl.018.ph, %for.body.preheader34 ]
%19 = phi i8 [ %dec, %for.body ], [ %.ph, %for.body.preheader34 ]
%sub61317 = phi i8 [ %sub6, %for.body ], [ %sub61317.ph, %for.body.preheader34 ]
%sub91416 = phi i8 [ %sub9, %for.body ], [ %sub91416.ph, %for.body.preheader34 ]
%conv2 = zext i8 %sub61317 to i32
%conv3 = zext i8 %sub91416 to i32
%add = add nuw nsw i32 %conv3, %conv2
%sub = shl nuw nsw i32 %add, 1
%mul = add i32 %kl.018, -4
%add4 = add i32 %mul, %sub
%sub6 = add i8 %sub61317, -4
%sub9 = add i8 %sub91416, -4
%dec = add i8 %19, -1
%cmp.not = icmp eq i8 %dec, 0
br i1 %cmp.not, label %for.cond.for.end_crit_edge, label %for.body, !llvm.loop !12
for.cond.for.end_crit_edge: ; preds = %for.body, %middle.block
%add4.lcssa = phi i32 [ %18, %middle.block ], [ %add4, %for.body ]
%20 = sub i8 %h.promoted, %0
store i8 %1, ptr %w, align 1, !tbaa !5
store i8 %20, ptr %h, align 1, !tbaa !5
store i8 0, ptr %k, align 1, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond.for.end_crit_edge, %entry
%kl.0.lcssa = phi i32 [ %add4.lcssa, %for.cond.for.end_crit_edge ], [ 0, %entry ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %kl.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 1, 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include <stdio.h>
int main()
{
/* 同じ人がとなり合う二切れのケーキを両方取ってはならない */
/* つまり食べられるケーキの最高数は8切れである */
int a; /* 入力一つ目 */
int b; /* 入力二つ目 */
scanf("%d %d", &a, &b);
if((a < 9) && (b < 9))
printf("Yay!\n");
else
printf(":(\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149663/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149663/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, 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 %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int A,B;
scanf("%d %d",&A,&B);
if(A>=9 || B>=9)
{
printf(":(");
return 0;
}
printf("Yay!");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149706/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149706/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 8
%1 = load i32, ptr %B, align 4
%cmp1 = icmp sgt i32 %1, 8
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int c1=0,c2=0,x,i;
for(i=0;i<n;i++)
{
scanf("%d",&x);
if(x==1) c1++;
else c2++;
}
if(c1%2==1) printf("NO\n");
else
{
if((c2%2==1) && (c1==0)) printf("NO\n");
else printf("YES\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14975/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"YES\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec30 = add nsw i32 %0, -1
store i32 %dec30, ptr %t, align 4, !tbaa !5
%tobool.not31 = icmp eq i32 %0, 0
br i1 %tobool.not31, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end18
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %1, 0
br i1 %cmp25, label %for.body, label %if.else15
for.body: ; preds = %while.body, %for.body
%i.028 = phi i32 [ %inc5, %for.body ], [ 0, %while.body ]
%c2.027 = phi i32 [ %c2.1, %for.body ], [ 0, %while.body ]
%c1.026 = phi i32 [ %c1.1, %for.body ], [ 0, %while.body ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%cmp3 = icmp eq i32 %2, 1
%inc = zext i1 %cmp3 to i32
%c1.1 = add nuw nsw i32 %c1.026, %inc
%not.cmp3 = xor i1 %cmp3, true
%inc4 = zext i1 %not.cmp3 to i32
%c2.1 = add nuw nsw i32 %c2.027, %inc4
%inc5 = add nuw nsw i32 %i.028, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc5, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%4 = and i32 %c1.1, 1
%cmp6.not = icmp eq i32 %4, 0
br i1 %cmp6.not, label %if.else9, label %if.end18
if.else9: ; preds = %for.end
%5 = and i32 %c2.1, 1
%cmp11 = icmp ne i32 %5, 0
%cmp12 = icmp eq i32 %c1.1, 0
%or.cond = and i1 %cmp11, %cmp12
br i1 %or.cond, label %if.end18, label %if.else15
if.else15: ; preds = %while.body, %if.else9
br label %if.end18
if.end18: ; preds = %if.else9, %for.end, %if.else15
%str.3.sink = phi ptr [ @str, %if.else15 ], [ @str.4, %for.end ], [ @str.4, %if.else9 ]
%puts23 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
%6 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end18, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d%d", &a, &b);
if(a < 9 && b < 9){
printf("Yay!\n");
}else{
printf(":(\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149793/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149793/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, 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 %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a, b;
scanf("%d %d", &a, &b);
printf("%s\n", (a <= 8 && b <= 8)? "Yay!" : ":(");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149836/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149836/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 9
%2 = select i1 %cmp, i1 %cmp1, i1 false
%cond = select i1 %2, ptr @.str.2, ptr @.str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
int i,j,k,m,n,test;
scanf("%d %d",&m,&n);
if((16/m)>1 && (16/n)>1)
printf("Yay!\n");
else printf(":(\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149894/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149894/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n)
%0 = load i32, ptr %m, align 4, !tbaa !5
%div = sdiv i32 16, %0
%cmp = icmp sgt i32 %div, 1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%div1 = sdiv i32 16, %1
%cmp2 = icmp sgt i32 %div1, 1
br i1 %cmp2, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int a,b;
scanf("%d %d",&a, &b);
if(a <= 8 && b <= 8){
printf("Yay!");
}else{printf(":(");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149937/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149937/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yay!\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c":(\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %b, align 4
%cmp1 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a>8 || b>8)
{
printf(":(");
}
else
{
printf("Yay!");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149988/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149988/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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":(\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 8
%1 = load i32, ptr %b, align 4
%cmp1 = icmp sgt i32 %1, 8
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
%.str.1..str.2 = select i1 %or.cond, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int A,B;
scanf("%d", &A);
scanf("%d", &B);
if(A<=8 && B<=8){
printf("Yay!\n");
}else{
printf(":(\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150029/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150029/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c":(\00", align 1
@str.3 = private unnamed_addr constant [5 x i8] c"Yay!\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 9
%1 = load i32, ptr %B, align 4
%cmp2 = icmp slt i32 %1, 9
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
%str.3.str = select i1 %or.cond, 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 %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
// AOJ 2784 Similarity of Subtrees
// 2018.4.15 bal4u
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// 数値のハッシュ関数
#define HASHSIZ 500009
typedef struct { unsigned long long id; int c; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash+HASHSIZ;
int many;
void insert(unsigned long long id)
{
HASH *p = hash + (int)(id % HASHSIZ);
while (p->id) {
if (p->id == id) { many = 1, p->c++; return; }
if (++p == hashend) p = hash;
}
p->id = id, p->c = 1;
}
// バッファを経ずstdinから数値を得る
//#define getchar_unlocked() getchar()
int in()
{
int n = 0, c = getchar_unlocked();
do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
return n;
}
#define M 1000000007
#define MAX 100002
int hi[MAX], *to[MAX];
long long dfs(int node)
{
int i;
unsigned long long ans;
ans = 1;
for (i = 0; i < hi[node]; i++) ans += (long long)dfs(to[node][i]) * M;
insert(ans);
return ans;
}
int main()
{
int N, a, b, i, j;
long long ans;
int *memo;
N = in();
memo = malloc(N<<3);
j = 0; for (i = 1; i < N; i++) {
memo[j++] = a = in(), memo[j++] = b = in();
hi[a]++;
}
for (i = 1; i <= N; i++) if (hi[i]) to[i] = malloc(hi[i]<<2);
memset(hi, 0, N<<2);
j = 0; for (i = 1; i < N; i++) {
a = memo[j++], b = memo[j++];
to[a][hi[a]++] = b;
}
dfs(1);
ans = 0;
if (many) for (i = 0; i < HASHSIZ; i++) {
if ((j = hash[i].c) > 1) ans += (long long)j*(j-1) >> 1;
}
printf("%lld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150072/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150072/source.c"
target datalayout = "e-m:e-p270: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.HASH = type { i64, i32 }
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@hash = dso_local global [500011 x %struct.HASH] zeroinitializer, align 16
@hashend = dso_local local_unnamed_addr global ptr getelementptr inbounds ([500011 x %struct.HASH], ptr @hash, i64 0, i64 500009, i32 0), align 8
@many = dso_local local_unnamed_addr global i32 0, align 4
@hi = dso_local local_unnamed_addr global [100002 x i32] zeroinitializer, align 16
@to = dso_local local_unnamed_addr global [100002 x ptr] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insert(i64 noundef %id) local_unnamed_addr #0 {
entry:
%rem = urem i64 %id, 500009
%add.ptr = getelementptr inbounds %struct.HASH, ptr @hash, i64 %rem
%0 = load i64, ptr %add.ptr, align 16, !tbaa !5
%tobool.not18 = icmp eq i64 %0, 0
br i1 %tobool.not18, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%1 = load ptr, ptr @hashend, align 8
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%2 = phi i64 [ %0, %while.body.lr.ph ], [ %4, %if.end ]
%p.019 = phi ptr [ %add.ptr, %while.body.lr.ph ], [ %spec.store.select, %if.end ]
%cmp = icmp eq i64 %2, %id
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %while.body
store i32 1, ptr @many, align 4, !tbaa !11
%c = getelementptr inbounds %struct.HASH, ptr %p.019, i64 0, i32 1
%3 = load i32, ptr %c, align 8, !tbaa !12
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %c, align 8, !tbaa !12
br label %cleanup
if.end: ; preds = %while.body
%incdec.ptr = getelementptr inbounds %struct.HASH, ptr %p.019, i64 1
%cmp4 = icmp eq ptr %incdec.ptr, %1
%spec.store.select = select i1 %cmp4, ptr @hash, ptr %incdec.ptr
%4 = load i64, ptr %spec.store.select, align 8, !tbaa !5
%tobool.not = icmp eq i64 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %if.end, %entry
%p.0.lcssa = phi ptr [ %add.ptr, %entry ], [ %spec.store.select, %if.end ]
store i64 %id, ptr %p.0.lcssa, align 8, !tbaa !5
%c9 = getelementptr inbounds %struct.HASH, ptr %p.0.lcssa, i64 0, i32 1
store i32 1, ptr %c9, align 8, !tbaa !12
br label %cleanup
cleanup: ; preds = %while.end, %if.then
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !15
%_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 !17
%_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 !21
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !22
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #7
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !15
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !17
%3 = load i8, ptr %1, align 1, !tbaa !23
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !17
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !21
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !22
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #7
%.pre = load ptr, ptr @stdin, align 8, !tbaa !15
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !17
%7 = load i8, ptr %5, align 1, !tbaa !23
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !24
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i64 @dfs(i32 noundef %node) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %node to i64
%arrayidx = getelementptr inbounds [100002 x i32], ptr @hi, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%arrayidx2 = getelementptr inbounds [100002 x ptr], ptr @to, i64 0, i64 %idxprom
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%ans.013 = phi i64 [ 1, %for.body.lr.ph ], [ %add, %for.body ]
%1 = load ptr, ptr %arrayidx2, align 8, !tbaa !15
%arrayidx4 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !11
%call = tail call i64 @dfs(i32 noundef %2)
%mul = mul nsw i64 %call, 1000000007
%add = add i64 %mul, %ans.013
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %arrayidx, align 4, !tbaa !11
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !25
for.end: ; preds = %for.body, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %add, %for.body ]
%rem.i = urem i64 %ans.0.lcssa, 500009
%add.ptr.i = getelementptr inbounds %struct.HASH, ptr @hash, i64 %rem.i
%5 = load i64, ptr %add.ptr.i, align 16, !tbaa !5
%tobool.not18.i = icmp eq i64 %5, 0
br i1 %tobool.not18.i, label %while.end.i, label %while.body.lr.ph.i
while.body.lr.ph.i: ; preds = %for.end
%6 = load ptr, ptr @hashend, align 8
br label %while.body.i
while.body.i: ; preds = %if.end.i, %while.body.lr.ph.i
%7 = phi i64 [ %5, %while.body.lr.ph.i ], [ %9, %if.end.i ]
%p.019.i = phi ptr [ %add.ptr.i, %while.body.lr.ph.i ], [ %spec.store.select.i, %if.end.i ]
%cmp.i = icmp eq i64 %7, %ans.0.lcssa
br i1 %cmp.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %while.body.i
store i32 1, ptr @many, align 4, !tbaa !11
%c.i = getelementptr inbounds %struct.HASH, ptr %p.019.i, i64 0, i32 1
%8 = load i32, ptr %c.i, align 8, !tbaa !12
%inc.i = add nsw i32 %8, 1
store i32 %inc.i, ptr %c.i, align 8, !tbaa !12
br label %insert.exit
if.end.i: ; preds = %while.body.i
%incdec.ptr.i = getelementptr inbounds %struct.HASH, ptr %p.019.i, i64 1
%cmp4.i = icmp eq ptr %incdec.ptr.i, %6
%spec.store.select.i = select i1 %cmp4.i, ptr @hash, ptr %incdec.ptr.i
%9 = load i64, ptr %spec.store.select.i, align 8, !tbaa !5
%tobool.not.i = icmp eq i64 %9, 0
br i1 %tobool.not.i, label %while.end.i, label %while.body.i, !llvm.loop !13
while.end.i: ; preds = %if.end.i, %for.end
%p.0.lcssa.i = phi ptr [ %add.ptr.i, %for.end ], [ %spec.store.select.i, %if.end.i ]
store i64 %ans.0.lcssa, ptr %p.0.lcssa.i, align 8, !tbaa !5
%c9.i = getelementptr inbounds %struct.HASH, ptr %p.0.lcssa.i, i64 0, i32 1
store i32 1, ptr %c9.i, align 8, !tbaa !12
br label %insert.exit
insert.exit: ; preds = %if.then.i, %while.end.i
ret i64 %ans.0.lcssa
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !15
%_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 !17
%_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 !21
%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 !22
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #7
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !15
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !17
%3 = load i8, ptr %1, align 1, !tbaa !23
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph197 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%4 = phi ptr [ %8, %getchar_unlocked.exit13.i ], [ %.ph197, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !17
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !21
%cmp.not.i6.i = icmp ult ptr %5, %6
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !22
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #7
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !15
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !17
%7 = load i8, ptr %5, align 1, !tbaa !23
%conv3.i12.i = zext i8 %7 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%8 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !24
in.exit: ; preds = %getchar_unlocked.exit13.i
%shl = shl i32 %add.i, 3
%conv = sext i32 %shl to i64
%call1 = tail call noalias ptr @malloc(i64 noundef %conv) #8
%cmp159 = icmp sgt i32 %add.i, 1
br i1 %cmp159, label %for.body, label %for.cond12.preheader
for.cond12.preheader: ; preds = %in.exit158, %in.exit
%cmp13.not162 = icmp slt i32 %add.i, 1
br i1 %cmp13.not162, label %for.end27.thread, label %for.body15.preheader
for.end27.thread: ; preds = %for.cond12.preheader
%shl28184 = shl i32 %add.i, 2
%conv29185 = sext i32 %shl28184 to i64
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @hi, i8 0, i64 %conv29185, i1 false)
br label %for.end49
for.body15.preheader: ; preds = %for.cond12.preheader
%9 = or i32 %mul.i, 1
%10 = and i32 %c.0.i, 15
%11 = add i32 %9, %10
%wide.trip.count = zext i32 %11 to i64
br label %for.body15
for.body: ; preds = %in.exit, %in.exit158
%12 = phi ptr [ %33, %in.exit158 ], [ %8, %in.exit ]
%13 = phi ptr [ %34, %in.exit158 ], [ %8, %in.exit ]
%indvars.iv = phi i64 [ %indvars.iv.next, %in.exit158 ], [ 0, %in.exit ]
%i.0160 = phi i32 [ %inc11, %in.exit158 ], [ 1, %in.exit ]
%_IO_read_ptr.i.i97 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i.i97, align 8, !tbaa !17
%_IO_read_end.i.i98 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i.i98, align 8, !tbaa !21
%cmp.not.i.i99 = icmp ult ptr %14, %15
br i1 %cmp.not.i.i99, label %cond.false.i.i124, label %cond.true.i.i100, !prof !22
cond.true.i.i100: ; preds = %for.body
%call.i.i101 = tail call i32 @__uflow(ptr noundef nonnull %13) #7
%.pre14.pre.i102 = load ptr, ptr @stdin, align 8, !tbaa !15
br label %do.body.i106.preheader
cond.false.i.i124: ; preds = %for.body
%incdec.ptr.i.i125 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i.i125, ptr %_IO_read_ptr.i.i97, align 8, !tbaa !17
%16 = load i8, ptr %14, align 1, !tbaa !23
%conv3.i.i126 = zext i8 %16 to i32
br label %do.body.i106.preheader
do.body.i106.preheader: ; preds = %cond.false.i.i124, %cond.true.i.i100
%.ph193 = phi ptr [ %12, %cond.false.i.i124 ], [ %.pre14.pre.i102, %cond.true.i.i100 ]
%.ph194 = phi ptr [ %13, %cond.false.i.i124 ], [ %.pre14.pre.i102, %cond.true.i.i100 ]
%c.0.i108.ph = phi i32 [ %conv3.i.i126, %cond.false.i.i124 ], [ %call.i.i101, %cond.true.i.i100 ]
br label %do.body.i106
do.body.i106: ; preds = %do.body.i106.preheader, %getchar_unlocked.exit13.i118
%17 = phi ptr [ %22, %getchar_unlocked.exit13.i118 ], [ %.ph193, %do.body.i106.preheader ]
%18 = phi ptr [ %23, %getchar_unlocked.exit13.i118 ], [ %.ph194, %do.body.i106.preheader ]
%n.0.i107 = phi i32 [ %add.i111, %getchar_unlocked.exit13.i118 ], [ 0, %do.body.i106.preheader ]
%c.0.i108 = phi i32 [ %cond.i9.i119, %getchar_unlocked.exit13.i118 ], [ %c.0.i108.ph, %do.body.i106.preheader ]
%mul.i109 = mul nsw i32 %n.0.i107, 10
%and.i110 = and i32 %c.0.i108, 15
%add.i111 = add nsw i32 %and.i110, %mul.i109
%_IO_read_ptr.i4.i112 = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 1
%19 = load ptr, ptr %_IO_read_ptr.i4.i112, align 8, !tbaa !17
%_IO_read_end.i5.i113 = getelementptr inbounds %struct._IO_FILE, ptr %18, i64 0, i32 2
%20 = load ptr, ptr %_IO_read_end.i5.i113, align 8, !tbaa !21
%cmp.not.i6.i114 = icmp ult ptr %19, %20
br i1 %cmp.not.i6.i114, label %cond.false.i10.i121, label %cond.true.i7.i115, !prof !22
cond.true.i7.i115: ; preds = %do.body.i106
%call.i8.i116 = tail call i32 @__uflow(ptr noundef nonnull %18) #7
%.pre.i117 = load ptr, ptr @stdin, align 8, !tbaa !15
br label %getchar_unlocked.exit13.i118
cond.false.i10.i121: ; preds = %do.body.i106
%incdec.ptr.i11.i122 = getelementptr inbounds i8, ptr %19, i64 1
store ptr %incdec.ptr.i11.i122, ptr %_IO_read_ptr.i4.i112, align 8, !tbaa !17
%21 = load i8, ptr %19, align 1, !tbaa !23
%conv3.i12.i123 = zext i8 %21 to i32
br label %getchar_unlocked.exit13.i118
getchar_unlocked.exit13.i118: ; preds = %cond.false.i10.i121, %cond.true.i7.i115
%22 = phi ptr [ %.pre.i117, %cond.true.i7.i115 ], [ %17, %cond.false.i10.i121 ]
%23 = phi ptr [ %.pre.i117, %cond.true.i7.i115 ], [ %18, %cond.false.i10.i121 ]
%cond.i9.i119 = phi i32 [ %call.i8.i116, %cond.true.i7.i115 ], [ %conv3.i12.i123, %cond.false.i10.i121 ]
%cmp.i120 = icmp sgt i32 %cond.i9.i119, 47
br i1 %cmp.i120, label %do.body.i106, label %in.exit127, !llvm.loop !24
in.exit127: ; preds = %getchar_unlocked.exit13.i118
%24 = or i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
store i32 %add.i111, ptr %arrayidx, align 4, !tbaa !11
%_IO_read_ptr.i.i128 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 1
%25 = load ptr, ptr %_IO_read_ptr.i.i128, align 8, !tbaa !17
%_IO_read_end.i.i129 = getelementptr inbounds %struct._IO_FILE, ptr %22, i64 0, i32 2
%26 = load ptr, ptr %_IO_read_end.i.i129, align 8, !tbaa !21
%cmp.not.i.i130 = icmp ult ptr %25, %26
br i1 %cmp.not.i.i130, label %cond.false.i.i155, label %cond.true.i.i131, !prof !22
cond.true.i.i131: ; preds = %in.exit127
%call.i.i132 = tail call i32 @__uflow(ptr noundef nonnull %22) #7
%.pre14.pre.i133 = load ptr, ptr @stdin, align 8, !tbaa !15
br label %do.body.i137.preheader
cond.false.i.i155: ; preds = %in.exit127
%incdec.ptr.i.i156 = getelementptr inbounds i8, ptr %25, i64 1
store ptr %incdec.ptr.i.i156, ptr %_IO_read_ptr.i.i128, align 8, !tbaa !17
%27 = load i8, ptr %25, align 1, !tbaa !23
%conv3.i.i157 = zext i8 %27 to i32
br label %do.body.i137.preheader
do.body.i137.preheader: ; preds = %cond.false.i.i155, %cond.true.i.i131
%.ph192 = phi ptr [ %22, %cond.false.i.i155 ], [ %.pre14.pre.i133, %cond.true.i.i131 ]
%c.0.i139.ph = phi i32 [ %conv3.i.i157, %cond.false.i.i155 ], [ %call.i.i132, %cond.true.i.i131 ]
br label %do.body.i137
do.body.i137: ; preds = %do.body.i137.preheader, %getchar_unlocked.exit13.i149
%28 = phi ptr [ %33, %getchar_unlocked.exit13.i149 ], [ %.ph192, %do.body.i137.preheader ]
%29 = phi ptr [ %34, %getchar_unlocked.exit13.i149 ], [ %.ph192, %do.body.i137.preheader ]
%n.0.i138 = phi i32 [ %add.i142, %getchar_unlocked.exit13.i149 ], [ 0, %do.body.i137.preheader ]
%c.0.i139 = phi i32 [ %cond.i9.i150, %getchar_unlocked.exit13.i149 ], [ %c.0.i139.ph, %do.body.i137.preheader ]
%mul.i140 = mul nsw i32 %n.0.i138, 10
%and.i141 = and i32 %c.0.i139, 15
%add.i142 = add nsw i32 %and.i141, %mul.i140
%_IO_read_ptr.i4.i143 = getelementptr inbounds %struct._IO_FILE, ptr %29, i64 0, i32 1
%30 = load ptr, ptr %_IO_read_ptr.i4.i143, align 8, !tbaa !17
%_IO_read_end.i5.i144 = getelementptr inbounds %struct._IO_FILE, ptr %29, i64 0, i32 2
%31 = load ptr, ptr %_IO_read_end.i5.i144, align 8, !tbaa !21
%cmp.not.i6.i145 = icmp ult ptr %30, %31
br i1 %cmp.not.i6.i145, label %cond.false.i10.i152, label %cond.true.i7.i146, !prof !22
cond.true.i7.i146: ; preds = %do.body.i137
%call.i8.i147 = tail call i32 @__uflow(ptr noundef nonnull %29) #7
%.pre.i148 = load ptr, ptr @stdin, align 8, !tbaa !15
br label %getchar_unlocked.exit13.i149
cond.false.i10.i152: ; preds = %do.body.i137
%incdec.ptr.i11.i153 = getelementptr inbounds i8, ptr %30, i64 1
store ptr %incdec.ptr.i11.i153, ptr %_IO_read_ptr.i4.i143, align 8, !tbaa !17
%32 = load i8, ptr %30, align 1, !tbaa !23
%conv3.i12.i154 = zext i8 %32 to i32
br label %getchar_unlocked.exit13.i149
getchar_unlocked.exit13.i149: ; preds = %cond.false.i10.i152, %cond.true.i7.i146
%33 = phi ptr [ %.pre.i148, %cond.true.i7.i146 ], [ %28, %cond.false.i10.i152 ]
%34 = phi ptr [ %.pre.i148, %cond.true.i7.i146 ], [ %29, %cond.false.i10.i152 ]
%cond.i9.i150 = phi i32 [ %call.i8.i147, %cond.true.i7.i146 ], [ %conv3.i12.i154, %cond.false.i10.i152 ]
%cmp.i151 = icmp sgt i32 %cond.i9.i150, 47
br i1 %cmp.i151, label %do.body.i137, label %in.exit158, !llvm.loop !24
in.exit158: ; preds = %getchar_unlocked.exit13.i149
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%arrayidx7 = getelementptr inbounds i32, ptr %call1, i64 %24
store i32 %add.i142, ptr %arrayidx7, align 4, !tbaa !11
%idxprom8 = sext i32 %add.i111 to i64
%arrayidx9 = getelementptr inbounds [100002 x i32], ptr @hi, i64 0, i64 %idxprom8
%35 = load i32, ptr %arrayidx9, align 4, !tbaa !11
%inc10 = add nsw i32 %35, 1
store i32 %inc10, ptr %arrayidx9, align 4, !tbaa !11
%inc11 = add nuw nsw i32 %i.0160, 1
%exitcond.not = icmp eq i32 %inc11, %add.i
br i1 %exitcond.not, label %for.cond12.preheader, label %for.body, !llvm.loop !26
for.body15: ; preds = %for.body15.preheader, %for.inc25
%indvars.iv171 = phi i64 [ 1, %for.body15.preheader ], [ %indvars.iv.next172, %for.inc25 ]
%arrayidx17 = getelementptr inbounds [100002 x i32], ptr @hi, i64 0, i64 %indvars.iv171
%36 = load i32, ptr %arrayidx17, align 4, !tbaa !11
%tobool.not = icmp eq i32 %36, 0
br i1 %tobool.not, label %for.inc25, label %if.then
if.then: ; preds = %for.body15
%shl20 = shl i32 %36, 2
%conv21 = sext i32 %shl20 to i64
%call22 = tail call noalias ptr @malloc(i64 noundef %conv21) #8
%arrayidx24 = getelementptr inbounds [100002 x ptr], ptr @to, i64 0, i64 %indvars.iv171
store ptr %call22, ptr %arrayidx24, align 8, !tbaa !15
br label %for.inc25
for.inc25: ; preds = %for.body15, %if.then
%indvars.iv.next172 = add nuw nsw i64 %indvars.iv171, 1
%exitcond174.not = icmp eq i64 %indvars.iv.next172, %wide.trip.count
br i1 %exitcond174.not, label %for.end27, label %for.body15, !llvm.loop !27
for.end27: ; preds = %for.inc25
%shl28 = shl i32 %add.i, 2
%conv29 = sext i32 %shl28 to i64
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @hi, i8 0, i64 %conv29, i1 false)
br i1 %cmp159, label %for.body33, label %for.end49
for.body33: ; preds = %for.end27, %for.body33
%indvars.iv175 = phi i64 [ %indvars.iv.next176, %for.body33 ], [ 0, %for.end27 ]
%i.2165 = phi i32 [ %inc48, %for.body33 ], [ 1, %for.end27 ]
%37 = or i64 %indvars.iv175, 1
%arrayidx36 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv175
%38 = load i32, ptr %arrayidx36, align 4, !tbaa !11
%indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 2
%arrayidx39 = getelementptr inbounds i32, ptr %call1, i64 %37
%39 = load i32, ptr %arrayidx39, align 4, !tbaa !11
%idxprom40 = sext i32 %38 to i64
%arrayidx41 = getelementptr inbounds [100002 x ptr], ptr @to, i64 0, i64 %idxprom40
%40 = load ptr, ptr %arrayidx41, align 8, !tbaa !15
%arrayidx43 = getelementptr inbounds [100002 x i32], ptr @hi, i64 0, i64 %idxprom40
%41 = load i32, ptr %arrayidx43, align 4, !tbaa !11
%inc44 = add nsw i32 %41, 1
store i32 %inc44, ptr %arrayidx43, align 4, !tbaa !11
%idxprom45 = sext i32 %41 to i64
%arrayidx46 = getelementptr inbounds i32, ptr %40, i64 %idxprom45
store i32 %39, ptr %arrayidx46, align 4, !tbaa !11
%inc48 = add nuw nsw i32 %i.2165, 1
%exitcond179.not = icmp eq i32 %inc48, %add.i
br i1 %exitcond179.not, label %for.end49, label %for.body33, !llvm.loop !28
for.end49: ; preds = %for.body33, %for.end27.thread, %for.end27
%call50 = tail call i64 @dfs(i32 noundef 1)
%42 = load i32, ptr @many, align 4, !tbaa !11
%tobool51.not = icmp eq i32 %42, 0
br i1 %tobool51.not, label %if.end68, label %for.body56
for.body56: ; preds = %for.end49, %for.inc65.1
%indvars.iv180 = phi i64 [ %indvars.iv.next181.1, %for.inc65.1 ], [ 0, %for.end49 ]
%ans.0168 = phi i64 [ %ans.1.1, %for.inc65.1 ], [ 0, %for.end49 ]
%c = getelementptr inbounds [500011 x %struct.HASH], ptr @hash, i64 0, i64 %indvars.iv180, i32 1
%43 = load i32, ptr %c, align 8, !tbaa !12
%cmp59 = icmp sgt i32 %43, 1
br i1 %cmp59, label %if.then61, label %for.inc65
if.then61: ; preds = %for.body56
%conv62 = zext i32 %43 to i64
%sub = add nsw i32 %43, -1
%conv63 = zext i32 %sub to i64
%mul = mul nuw nsw i64 %conv63, %conv62
%shr = lshr i64 %mul, 1
%add = add nsw i64 %shr, %ans.0168
br label %for.inc65
for.inc65: ; preds = %for.body56, %if.then61
%ans.1 = phi i64 [ %add, %if.then61 ], [ %ans.0168, %for.body56 ]
%indvars.iv.next181 = or i64 %indvars.iv180, 1
%exitcond183.not = icmp eq i64 %indvars.iv.next181, 500009
br i1 %exitcond183.not, label %if.end68, label %for.body56.1, !llvm.loop !29
for.body56.1: ; preds = %for.inc65
%c.1 = getelementptr inbounds [500011 x %struct.HASH], ptr @hash, i64 0, i64 %indvars.iv.next181, i32 1
%44 = load i32, ptr %c.1, align 8, !tbaa !12
%cmp59.1 = icmp sgt i32 %44, 1
br i1 %cmp59.1, label %if.then61.1, label %for.inc65.1
if.then61.1: ; preds = %for.body56.1
%conv62.1 = zext i32 %44 to i64
%sub.1 = add nsw i32 %44, -1
%conv63.1 = zext i32 %sub.1 to i64
%mul.1 = mul nuw nsw i64 %conv63.1, %conv62.1
%shr.1 = lshr i64 %mul.1, 1
%add.1 = add nsw i64 %shr.1, %ans.1
br label %for.inc65.1
for.inc65.1: ; preds = %if.then61.1, %for.body56.1
%ans.1.1 = phi i64 [ %add.1, %if.then61.1 ], [ %ans.1, %for.body56.1 ]
%indvars.iv.next181.1 = add nuw nsw i64 %indvars.iv180, 2
br label %for.body56
if.end68: ; preds = %for.inc65, %for.end49
%ans.2 = phi i64 [ 0, %for.end49 ], [ %ans.1, %for.inc65 ]
%call69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %ans.2)
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
declare i32 @__uflow(ptr noundef) local_unnamed_addr #6
attributes #0 = { 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 #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree 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 #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind "no-trapping-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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!6, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!18, !16, i64 8}
!18 = !{!"_IO_FILE", !10, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !10, i64 112, !10, i64 116, !19, i64 120, !20, i64 128, !8, i64 130, !8, i64 131, !16, i64 136, !19, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !16, i64 176, !19, i64 184, !10, i64 192, !8, i64 196}
!19 = !{!"long", !8, i64 0}
!20 = !{!"short", !8, i64 0}
!21 = !{!18, !16, i64 16}
!22 = !{!"branch_weights", i32 2000, i32 1}
!23 = !{!8, !8, i64 0}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}
!27 = distinct !{!27, !14}
!28 = distinct !{!28, !14}
!29 = distinct !{!29, !14}
|
#include<stdio.h>
int main(void){
int loop,a,b,c=0,d=0;
while(1){ scanf("%d",&loop);
if(loop==0)break;
a=0,b=0,c=0,d=0;
for(;loop--;){
scanf("%d %d",&a,&b);
if(a!=b){
if(a>b){
c+=a+b;
}else{
d+=a+b;
}
}else{
c+=a;
d+=b;
}
}
printf("%d %d\n",c,d);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150115/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150115/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%loop = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %loop) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %loop)
%0 = load i32, ptr %loop, align 4, !tbaa !5
%cmp25 = icmp eq i32 %0, 0
br i1 %cmp25, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%1 = phi i32 [ %4, %for.end ], [ %0, %entry ]
store i32 0, ptr %a, align 4, !tbaa !5
store i32 0, ptr %b, align 4, !tbaa !5
%dec21 = add nsw i32 %1, -1
store i32 %dec21, ptr %loop, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %if.end, %if.end13
%d.023 = phi i32 [ 0, %if.end ], [ %d.1, %if.end13 ]
%c.022 = phi i32 [ 0, %if.end ], [ %c.1, %if.end13 ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp2.not = icmp eq i32 %2, %3
br i1 %cmp2.not, label %if.else10, label %if.then3
if.then3: ; preds = %for.body
%cmp4 = icmp sgt i32 %2, %3
br i1 %cmp4, label %if.then5, label %if.else
if.then5: ; preds = %if.then3
%add = add i32 %2, %c.022
%add6 = add i32 %add, %3
br label %if.end13
if.else: ; preds = %if.then3
%add7 = add i32 %3, %d.023
%add8 = add i32 %add7, %2
br label %if.end13
if.else10: ; preds = %for.body
%add11 = add nsw i32 %2, %c.022
%add12 = add nsw i32 %2, %d.023
br label %if.end13
if.end13: ; preds = %if.then5, %if.else, %if.else10
%c.1 = phi i32 [ %add6, %if.then5 ], [ %c.022, %if.else ], [ %add11, %if.else10 ]
%d.1 = phi i32 [ %d.023, %if.then5 ], [ %add8, %if.else ], [ %add12, %if.else10 ]
%.pr = load i32, ptr %loop, align 4, !tbaa !5
%dec = add nsw i32 %.pr, -1
store i32 %dec, ptr %loop, align 4, !tbaa !5
%tobool.not = icmp eq i32 %.pr, 0
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %if.end13
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c.1, i32 noundef %d.1)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %loop)
%4 = load i32, ptr %loop, align 4, !tbaa !5
%cmp = icmp eq i32 %4, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %loop) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n;
int a,b,s,t;
int i;
while(scanf("%d",&n), n!=0){
a=0;
b=0;
for(i=0;i<n;i++){
scanf("%d %d",&s,&t);
if(s>t){
a += s+t;
}else if(s<t){
b += s+t;
}else{
a+= s;
b+= t;
}
}
printf("%d %d\n",a,b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150159/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150159/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca i32, align 4
%t = 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 %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not27 = icmp eq i32 %0, 0
br i1 %cmp.not27, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %5, %for.end ], [ %0, %entry ]
%cmp121 = icmp sgt i32 %1, 0
br i1 %cmp121, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.inc
%i.024 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond.preheader ]
%b.023 = phi i32 [ %b.1, %for.inc ], [ 0, %for.cond.preheader ]
%a.022 = phi i32 [ %a.1, %for.inc ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %t)
%2 = load i32, ptr %s, align 4, !tbaa !5
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %2, %3
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
%add = add i32 %2, %a.022
%add4 = add i32 %add, %3
br label %for.inc
if.else: ; preds = %for.body
%cmp5 = icmp slt i32 %2, %3
br i1 %cmp5, label %if.then6, label %if.else9
if.then6: ; preds = %if.else
%add7 = add i32 %3, %b.023
%add8 = add i32 %add7, %2
br label %for.inc
if.else9: ; preds = %if.else
%add10 = add nsw i32 %2, %a.022
%add11 = add nsw i32 %3, %b.023
br label %for.inc
for.inc: ; preds = %if.then, %if.else9, %if.then6
%a.1 = phi i32 [ %add4, %if.then ], [ %a.022, %if.then6 ], [ %add10, %if.else9 ]
%b.1 = phi i32 [ %b.023, %if.then ], [ %add8, %if.then6 ], [ %add11, %if.else9 ]
%inc = add nuw nsw i32 %i.024, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %4
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%a.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %a.1, %for.inc ]
%b.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %b.1, %for.inc ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %a.0.lcssa, i32 noundef %b.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %5, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int n,i,a[10000],b[10000],sum_a,sum_b;
while(1){
sum_a = 0;
sum_b = 0;
scanf("%d",&n);
if(n==0)return(0);
for(i=0;i<n;i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i]>b[i]){
sum_a += a[i] + b[i];
}
else if(b[i]>a[i]){
sum_b += a[i] + b[i];
}
else{
sum_a += a[i];
sum_b += b[i];
}
}
printf("%d %d\n",sum_a,sum_b);
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150209/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [10000 x i32], align 16
%b = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %b) #3
%call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp63 = icmp eq i32 %0, 0
br i1 %cmp63, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %6, %for.end ], [ %0, %entry ]
%cmp157 = icmp sgt i32 %1, 0
br i1 %cmp157, label %for.body, label %for.end
if.then: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %for.cond.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.cond.preheader ]
%sum_b.060 = phi i32 [ %sum_b.1, %for.inc ], [ 0, %for.cond.preheader ]
%sum_a.059 = phi i32 [ %sum_a.1, %for.inc ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %2, %3
br i1 %cmp9, label %if.then10, label %if.else
if.then10: ; preds = %for.body
%add = add i32 %2, %sum_a.059
%add15 = add i32 %add, %3
br label %for.inc
if.else: ; preds = %for.body
%cmp20 = icmp sgt i32 %3, %2
br i1 %cmp20, label %if.then21, label %if.else28
if.then21: ; preds = %if.else
%add26 = add i32 %3, %sum_b.060
%add27 = add i32 %add26, %2
br label %for.inc
if.else28: ; preds = %if.else
%add31 = add nsw i32 %2, %sum_a.059
%add34 = add nsw i32 %3, %sum_b.060
br label %for.inc
for.inc: ; preds = %if.then10, %if.else28, %if.then21
%sum_a.1 = phi i32 [ %add15, %if.then10 ], [ %sum_a.059, %if.then21 ], [ %add31, %if.else28 ]
%sum_b.1 = phi i32 [ %sum_b.060, %if.then10 ], [ %add27, %if.then21 ], [ %add34, %if.else28 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader
%sum_a.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %sum_a.1, %for.inc ]
%sum_b.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %sum_b.1, %for.inc ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum_a.0.lcssa, i32 noundef %sum_b.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
br i1 %cmp, label %if.then, label %for.cond.preheader
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main() {
//code
int r;
scanf("%d\n",&r);
while(r--){
int t;
scanf("%d",&t);
int d=0;
int y=0;
while(t--){
int x;
scanf("%d",&x);
if(x==1){
d+=1;
}
else{
y+=1;
}
// d+=x;
}
if(d%2==1 ){
printf("NO\n");
}
else if(y%2==1 && d==0){
printf("NO\n");
}
else{
printf("YES\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_15026/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_15026/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.5 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%r = alloca i32, align 4
%t = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r)
%0 = load i32, ptr %r, align 4, !tbaa !5
%dec32 = add nsw i32 %0, -1
store i32 %dec32, ptr %r, align 4, !tbaa !5
%tobool.not33 = icmp eq i32 %0, 0
br i1 %tobool.not33, label %while.end21, label %while.body
while.body: ; preds = %entry, %if.end20
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%1 = load i32, ptr %t, align 4, !tbaa !5
%dec327 = add nsw i32 %1, -1
store i32 %dec327, ptr %t, align 4, !tbaa !5
%tobool4.not28 = icmp eq i32 %1, 0
br i1 %tobool4.not28, label %if.else17, label %while.body5
while.body5: ; preds = %while.body, %while.body5
%y.030 = phi i32 [ %y.1, %while.body5 ], [ 0, %while.body ]
%d.029 = phi i32 [ %d.1, %while.body5 ], [ 0, %while.body ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%2 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp eq i32 %2, 1
%add = zext i1 %cmp to i32
%d.1 = add nuw nsw i32 %d.029, %add
%not.cmp = xor i1 %cmp, true
%add7 = zext i1 %not.cmp to i32
%y.1 = add nuw nsw i32 %y.030, %add7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec3 = add nsw i32 %3, -1
store i32 %dec3, ptr %t, align 4, !tbaa !5
%tobool4.not = icmp eq i32 %3, 0
br i1 %tobool4.not, label %while.end, label %while.body5, !llvm.loop !9
while.end: ; preds = %while.body5
%4 = and i32 %d.1, 1
%cmp8.not = icmp eq i32 %4, 0
br i1 %cmp8.not, label %if.else11, label %if.end20
if.else11: ; preds = %while.end
%5 = and i32 %y.1, 1
%cmp13 = icmp ne i32 %5, 0
%cmp14 = icmp eq i32 %d.1, 0
%or.cond = and i1 %cmp13, %cmp14
br i1 %or.cond, label %if.end20, label %if.else17
if.else17: ; preds = %while.body, %if.else11
br label %if.end20
if.end20: ; preds = %if.else11, %while.end, %if.else17
%str.4.sink = phi ptr [ @str, %if.else17 ], [ @str.5, %while.end ], [ @str.5, %if.else11 ]
%puts25 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
%6 = load i32, ptr %r, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %r, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end21, label %while.body, !llvm.loop !11
while.end21: ; preds = %if.end20, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
unsigned short score1, score2, i, n, buf1, buf2;;
while(1){
score1 = 0; score2 = 0;
scanf("%u", &n);
if(n == 0){ break; }
for(i=0; i<n; i++){
scanf("%u %u", &buf1, &buf2);
getchar();
if(buf1 > buf2){ score1 += buf1 + buf2; }
else if(buf1 < buf2){ score2 += buf1 + buf2; }
else{ score1 += buf1; score2 += buf2; }
}
printf("%u %u\n", score1, score2);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150302/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150302/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%u\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%u %u\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%u %u\0A\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:
%n = alloca i16, align 2
%buf1 = alloca i16, align 2
%buf2 = alloca i16, align 2
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %buf1) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %buf2) #3
%call53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i16, ptr %n, align 2, !tbaa !5
%cmp54 = icmp eq i16 %0, 0
br i1 %cmp54, label %while.end, label %for.body
for.body: ; preds = %entry, %for.body.backedge
%i.051 = phi i16 [ %i.051.be, %for.body.backedge ], [ 0, %entry ]
%score2.050 = phi i16 [ %score2.050.be, %for.body.backedge ], [ 0, %entry ]
%score1.049 = phi i16 [ %score1.049.be, %for.body.backedge ], [ 0, %entry ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %buf1, ptr noundef nonnull %buf2)
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %1)
%2 = load i16, ptr %buf1, align 2, !tbaa !5
%3 = load i16, ptr %buf2, align 2, !tbaa !5
%cmp10 = icmp ugt i16 %2, %3
br i1 %cmp10, label %if.then12, label %if.else
if.then12: ; preds = %for.body
%add = add i16 %2, %score1.049
%add16 = add i16 %add, %3
br label %for.inc
if.else: ; preds = %for.body
%cmp20 = icmp ult i16 %2, %3
br i1 %cmp20, label %if.then22, label %if.else29
if.then22: ; preds = %if.else
%add25 = add i16 %3, %score2.050
%add27 = add i16 %add25, %2
br label %for.inc
if.else29: ; preds = %if.else
%add32 = add i16 %2, %score1.049
%add36 = add i16 %3, %score2.050
br label %for.inc
for.inc: ; preds = %if.then12, %if.else29, %if.then22
%score1.1 = phi i16 [ %add16, %if.then12 ], [ %score1.049, %if.then22 ], [ %add32, %if.else29 ]
%score2.1 = phi i16 [ %score2.050, %if.then12 ], [ %add27, %if.then22 ], [ %add36, %if.else29 ]
%inc = add nuw i16 %i.051, 1
%4 = load i16, ptr %n, align 2, !tbaa !5
%cmp4 = icmp ult i16 %inc, %4
br i1 %cmp4, label %for.body.backedge, label %for.end
for.body.backedge: ; preds = %for.inc, %for.end
%i.051.be = phi i16 [ %inc, %for.inc ], [ 0, %for.end ]
%score2.050.be = phi i16 [ %score2.1, %for.inc ], [ 0, %for.end ]
%score1.049.be = phi i16 [ %score1.1, %for.inc ], [ 0, %for.end ]
br label %for.body, !llvm.loop !11
for.end: ; preds = %for.inc
%conv40 = zext i16 %score1.1 to i32
%conv41 = zext i16 %score2.1 to i32
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv40, i32 noundef %conv41)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i16, ptr %n, align 2, !tbaa !5
%cmp = icmp eq i16 %5, 0
br i1 %cmp, label %while.end, label %for.body.backedge
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %buf2) #3
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %buf1) #3
call void @llvm.lifetime.end.p0(i64 2, 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
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n=0,i=0,j;
int A[10000],B[10000],a[10000],b[10000];
for(j=0;;j++){
scanf("%d",&n);
if(n==0){
break;
}
for(i=0;i<n;i++){
scanf("%d%d",&a[i],&b[i]);
if(a[i]>b[i]){
A[j]=A[j]+a[i]+b[i];
}
else if(a[i]<b[i]){
B[j]=B[j]+a[i]+b[i];
}
else if(a[i]==b[i]){
A[j]=A[j]+a[i];
B[j]=B[j]+b[i];
}
}
printf("%d %d\n",A[j],B[j]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150346/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150346/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [10000 x i32], align 16
%B = alloca [10000 x i32], align 16
%a = alloca [10000 x i32], align 16
%b = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %b) #3
%call98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp99 = icmp eq i32 %0, 0
br i1 %cmp99, label %for.end68, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %12, %for.end ], [ %0, %entry ]
%indvars.iv102 = phi i64 [ %indvars.iv.next103, %for.end ], [ 0, %entry ]
%cmp296 = icmp sgt i32 %1, 0
br i1 %cmp296, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond1.preheader
%arrayidx45 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv102
%arrayidx52 = getelementptr inbounds [10000 x i32], ptr %B, i64 0, i64 %indvars.iv102
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %2, %3
br i1 %cmp10, label %if.then11, label %if.else
if.then11: ; preds = %for.body
%4 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%add = add i32 %3, %2
%add18 = add i32 %add, %4
store i32 %add18, ptr %arrayidx45, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%cmp25 = icmp slt i32 %2, %3
br i1 %cmp25, label %if.then26, label %if.else37
if.then26: ; preds = %if.else
%5 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%add31 = add i32 %3, %2
%add34 = add i32 %add31, %5
store i32 %add34, ptr %arrayidx52, align 4, !tbaa !5
br label %for.inc
if.else37: ; preds = %if.else
%cmp42 = icmp eq i32 %2, %3
br i1 %cmp42, label %if.then43, label %for.inc
if.then43: ; preds = %if.else37
%6 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%add48 = add nsw i32 %6, %2
store i32 %add48, ptr %arrayidx45, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%add55 = add nsw i32 %7, %2
store i32 %add55, ptr %arrayidx52, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then11, %if.else37, %if.then43, %if.then26
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond1.preheader
%arrayidx62 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv102
%10 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%arrayidx64 = getelementptr inbounds [10000 x i32], ptr %B, i64 0, i64 %indvars.iv102
%11 = load i32, ptr %arrayidx64, align 4, !tbaa !5
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %10, i32 noundef %11)
%indvars.iv.next103 = add nuw i64 %indvars.iv102, 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %12, 0
br i1 %cmp, label %for.end68, label %for.cond1.preheader
for.end68: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 40000, 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"}
|
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void) {
int test;
scanf("%d\n",&test);
for(int times=0;times<test;times++)
{
int w,h,n;
scanf("%d %d %d\n",&w,&h,&n);
int t_w=0,t_h=0;
for(;;t_w++)
{
if(((w>>t_w)*((int)pow(2,t_w)))!=w)
{
break;
}
}
for(;;t_h++)
{
if(((h>>t_h)*((int)pow(2,t_h)))!=h)
{
break;
}
}
t_w--;
t_h--;
t_w=(int)pow(2,t_w);
t_h=(int)pow(2,t_h);
//printf("%d %d\n",t_w,t_h);//
int check_v=t_w*t_h;
//printf("$%d$\n",check_v);//
if(check_v>=n)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_15039/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_15039/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%test = alloca i32, align 4
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %test) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %test)
%0 = load i32, ptr %test, align 4, !tbaa !5
%cmp52 = icmp sgt i32 %0, 0
br i1 %cmp52, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.end19, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %test) #5
ret i32 0
for.body: ; preds = %entry, %for.end19
%times.053 = phi i32 [ %inc35, %for.end19 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%.pre = load i32, ptr %w, align 4, !tbaa !5
br label %for.cond2
for.cond2: ; preds = %for.cond2, %for.body
%1 = phi i32 [ %.pre, %for.body ], [ %mul, %for.cond2 ]
%t_w.0 = phi i32 [ 0, %for.body ], [ %inc, %for.cond2 ]
%shr = ashr i32 %1, %t_w.0
%ldexp = call double @ldexp(double 1.000000e+00, i32 %t_w.0) #5
%conv4 = fptosi double %ldexp to i32
%mul = mul nsw i32 %shr, %conv4
%2 = load i32, ptr %w, align 4, !tbaa !5
%cmp5.not = icmp eq i32 %mul, %2
%inc = add nuw nsw i32 %t_w.0, 1
br i1 %cmp5.not, label %for.cond2, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond2
%.pre54 = load i32, ptr %h, align 4, !tbaa !5
br label %for.cond7
for.cond7: ; preds = %for.cond7, %for.cond7.preheader
%3 = phi i32 [ %mul12, %for.cond7 ], [ %.pre54, %for.cond7.preheader ]
%t_h.0 = phi i32 [ %inc18, %for.cond7 ], [ 0, %for.cond7.preheader ]
%shr8 = ashr i32 %3, %t_h.0
%ldexp48 = call double @ldexp(double 1.000000e+00, i32 %t_h.0) #5
%conv11 = fptosi double %ldexp48 to i32
%mul12 = mul nsw i32 %shr8, %conv11
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp13.not = icmp eq i32 %mul12, %4
%inc18 = add nuw nsw i32 %t_h.0, 1
br i1 %cmp13.not, label %for.cond7, label %for.end19
for.end19: ; preds = %for.cond7
%dec = add nsw i32 %t_w.0, -1
%dec20 = add nsw i32 %t_h.0, -1
%ldexp49 = call double @ldexp(double 1.000000e+00, i32 %dec) #5
%conv23 = fptosi double %ldexp49 to i32
%ldexp50 = call double @ldexp(double 1.000000e+00, i32 %dec20) #5
%conv26 = fptosi double %ldexp50 to i32
%mul27 = mul nsw i32 %conv26, %conv23
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp28.not = icmp slt i32 %mul27, %5
%str.str.4 = select i1 %cmp28.not, ptr @str, ptr @str.4
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
%inc35 = add nuw nsw i32 %times.053, 1
%6 = load i32, ptr %test, align 4, !tbaa !5
%cmp = icmp slt i32 %inc35, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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
; 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 willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
int g(char*s,char*t){
int i=0;
while(s[i]!='\0'&&t[i]!='\0')
if(s[i]!=t[i++])return 0;
if(s[i]=='\0'&&t[i]!='\0')return 0;
return 1;
}
int f(char*s){
if(s[0]=='\0'){printf("YES\n");exit(0);}
if(g(s,"dream"))f(&s[5]);
if(g(s,"dreamer"))f(&s[7]);
if(g(s,"erase"))f(&s[5]);
if(g(s,"eraser"))f(&s[6]);
}
int main(void){
char s[100000];
scanf("%s",s);
int i=0;
f(s);
printf("NO\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150483/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150483/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [6 x i8] c"dream\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"dreamer\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"erase\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"eraser\00", align 1
@.str.5 = 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.7 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @g(ptr nocapture noundef readonly %s, ptr nocapture noundef readonly %t) local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %while.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 0
%arrayidx21 = getelementptr inbounds i8, ptr %t, i64 %indvars.iv
%1 = load i8, ptr %arrayidx21, align 1, !tbaa !5
%cmp23.not = icmp eq i8 %1, 0
br i1 %cmp.not, label %land.lhs.true, label %land.rhs
land.rhs: ; preds = %while.cond
br i1 %cmp23.not, label %if.end26, label %while.body
while.body: ; preds = %land.rhs
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp13.not = icmp eq i8 %0, %1
br i1 %cmp13.not, label %while.cond, label %cleanup, !llvm.loop !8
land.lhs.true: ; preds = %while.cond
br i1 %cmp23.not, label %if.end26, label %cleanup
if.end26: ; preds = %land.rhs, %land.lhs.true
br label %cleanup
cleanup: ; preds = %while.body, %land.lhs.true, %if.end26
%retval.0 = phi i32 [ 1, %if.end26 ], [ 0, %land.lhs.true ], [ 0, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local i32 @f(ptr noundef %s) local_unnamed_addr #2 {
entry:
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp105 = icmp eq i8 %0, 0
br i1 %cmp105, label %if.then, label %land.rhs.i
if.then: ; preds = %if.then21, %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
tail call void @exit(i32 noundef 0) #6
unreachable
land.rhs.i: ; preds = %entry, %if.then21
%1 = phi i8 [ %36, %if.then21 ], [ %0, %entry ]
%s.tr106 = phi ptr [ %arrayidx22, %if.then21 ], [ %s, %entry ]
%cmp13.not.i = icmp eq i8 %1, 100
br i1 %cmp13.not.i, label %while.cond.i.1, label %land.rhs.i37, !llvm.loop !8
while.cond.i.1: ; preds = %land.rhs.i
%arrayidx.i.1 = getelementptr inbounds i8, ptr %s.tr106, i64 1
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %while.cond.i33.1 [
i8 0, label %land.lhs.true.i
i8 114, label %while.cond.i.2
]
while.cond.i.2: ; preds = %while.cond.i.1
%arrayidx.i.2 = getelementptr inbounds i8, ptr %s.tr106, i64 2
%3 = load i8, ptr %arrayidx.i.2, align 1, !tbaa !5
switch i8 %3, label %while.cond.i33.1 [
i8 0, label %land.lhs.true.i
i8 101, label %while.cond.i.3
]
while.cond.i.3: ; preds = %while.cond.i.2
%arrayidx.i.3 = getelementptr inbounds i8, ptr %s.tr106, i64 3
%4 = load i8, ptr %arrayidx.i.3, align 1, !tbaa !5
switch i8 %4, label %while.cond.i33.1 [
i8 0, label %land.lhs.true.i
i8 97, label %while.cond.i.4
]
while.cond.i.4: ; preds = %while.cond.i.3
%arrayidx.i.4 = getelementptr inbounds i8, ptr %s.tr106, i64 4
%5 = load i8, ptr %arrayidx.i.4, align 1, !tbaa !5
switch i8 %5, label %while.cond.i33.1 [
i8 0, label %land.lhs.true.i
i8 109, label %while.cond.i.5
]
while.cond.i.5: ; preds = %while.cond.i.4
%arrayidx.i.5 = getelementptr inbounds i8, ptr %s.tr106, i64 5
%6 = load i8, ptr %arrayidx.i.5, align 1, !tbaa !5
%cmp.not.i.5 = icmp eq i8 %6, 0
br i1 %cmp.not.i.5, label %land.lhs.true.i, label %if.end6
land.lhs.true.i: ; preds = %while.cond.i.4, %while.cond.i.3, %while.cond.i.2, %while.cond.i.1, %while.cond.i.5
%indvars.iv.i.lcssa = phi i64 [ 1, %while.cond.i.1 ], [ 2, %while.cond.i.2 ], [ 3, %while.cond.i.3 ], [ 4, %while.cond.i.4 ], [ 5, %while.cond.i.5 ]
%arrayidx21.i = getelementptr inbounds i8, ptr @.str.1, i64 %indvars.iv.i.lcssa
%7 = load i8, ptr %arrayidx21.i, align 1, !tbaa !5
%cmp23.not.i = icmp eq i8 %7, 0
br i1 %cmp23.not.i, label %if.end6, label %while.cond.i33.1
if.end6: ; preds = %land.lhs.true.i, %while.cond.i.5
%arrayidx4 = getelementptr inbounds i8, ptr %s.tr106, i64 5
%call5 = tail call i32 @f(ptr noundef nonnull %arrayidx4)
%.pre = load i8, ptr %s.tr106, align 1, !tbaa !5
%cmp.not.i36 = icmp eq i8 %.pre, 0
br i1 %cmp.not.i36, label %land.lhs.true.i45, label %land.rhs.i37
land.rhs.i37: ; preds = %land.rhs.i, %if.end6
%8 = phi i8 [ %.pre, %if.end6 ], [ %1, %land.rhs.i ]
%cmp13.not.i42 = icmp eq i8 %8, 100
br i1 %cmp13.not.i42, label %while.cond.i33.1, label %land.rhs.i53, !llvm.loop !8
while.cond.i33.1: ; preds = %while.cond.i.4, %while.cond.i.3, %while.cond.i.2, %while.cond.i.1, %land.lhs.true.i, %land.rhs.i37
%arrayidx.i35.1 = getelementptr inbounds i8, ptr %s.tr106, i64 1
%9 = load i8, ptr %arrayidx.i35.1, align 1, !tbaa !5
switch i8 %9, label %if.end24 [
i8 0, label %land.lhs.true.i45
i8 114, label %while.cond.i33.2
]
while.cond.i33.2: ; preds = %while.cond.i33.1
%arrayidx.i35.2 = getelementptr inbounds i8, ptr %s.tr106, i64 2
%10 = load i8, ptr %arrayidx.i35.2, align 1, !tbaa !5
switch i8 %10, label %if.end24 [
i8 0, label %land.lhs.true.i45
i8 101, label %while.cond.i33.3
]
while.cond.i33.3: ; preds = %while.cond.i33.2
%arrayidx.i35.3 = getelementptr inbounds i8, ptr %s.tr106, i64 3
%11 = load i8, ptr %arrayidx.i35.3, align 1, !tbaa !5
switch i8 %11, label %if.end24 [
i8 0, label %land.lhs.true.i45
i8 97, label %while.cond.i33.4
]
while.cond.i33.4: ; preds = %while.cond.i33.3
%arrayidx.i35.4 = getelementptr inbounds i8, ptr %s.tr106, i64 4
%12 = load i8, ptr %arrayidx.i35.4, align 1, !tbaa !5
switch i8 %12, label %if.end24 [
i8 0, label %land.lhs.true.i45
i8 109, label %while.cond.i33.5
]
while.cond.i33.5: ; preds = %while.cond.i33.4
%arrayidx.i35.5 = getelementptr inbounds i8, ptr %s.tr106, i64 5
%13 = load i8, ptr %arrayidx.i35.5, align 1, !tbaa !5
switch i8 %13, label %if.end24 [
i8 0, label %land.lhs.true.i45
i8 101, label %while.cond.i33.6
]
while.cond.i33.6: ; preds = %while.cond.i33.5
%arrayidx.i35.6 = getelementptr inbounds i8, ptr %s.tr106, i64 6
%14 = load i8, ptr %arrayidx.i35.6, align 1, !tbaa !5
switch i8 %14, label %if.end24 [
i8 0, label %land.lhs.true.i45
i8 114, label %while.cond.i33.7
]
while.cond.i33.7: ; preds = %while.cond.i33.6
%arrayidx.i35.7 = getelementptr inbounds i8, ptr %s.tr106, i64 7
%15 = load i8, ptr %arrayidx.i35.7, align 1, !tbaa !5
%cmp.not.i36.7 = icmp eq i8 %15, 0
br i1 %cmp.not.i36.7, label %land.lhs.true.i45, label %if.then9
land.lhs.true.i45: ; preds = %while.cond.i33.6, %while.cond.i33.5, %while.cond.i33.4, %while.cond.i33.3, %while.cond.i33.2, %while.cond.i33.1, %while.cond.i33.7, %if.end6
%16 = phi i8 [ 0, %if.end6 ], [ 100, %while.cond.i33.1 ], [ 100, %while.cond.i33.2 ], [ 100, %while.cond.i33.3 ], [ 100, %while.cond.i33.4 ], [ 100, %while.cond.i33.5 ], [ 100, %while.cond.i33.6 ], [ 100, %while.cond.i33.7 ]
%indvars.iv.i34.lcssa = phi i64 [ 0, %if.end6 ], [ 1, %while.cond.i33.1 ], [ 2, %while.cond.i33.2 ], [ 3, %while.cond.i33.3 ], [ 4, %while.cond.i33.4 ], [ 5, %while.cond.i33.5 ], [ 6, %while.cond.i33.6 ], [ 7, %while.cond.i33.7 ]
%arrayidx21.i46 = getelementptr inbounds i8, ptr @.str.2, i64 %indvars.iv.i34.lcssa
%17 = load i8, ptr %arrayidx21.i46, align 1, !tbaa !5
%cmp23.not.i47 = icmp eq i8 %17, 0
br i1 %cmp23.not.i47, label %if.then9, label %if.end12
if.then9: ; preds = %while.cond.i33.7, %land.lhs.true.i45
%arrayidx10 = getelementptr inbounds i8, ptr %s.tr106, i64 7
%call11 = tail call i32 @f(ptr noundef nonnull %arrayidx10)
%.pre118 = load i8, ptr %s.tr106, align 1, !tbaa !5
br label %if.end12
if.end12: ; preds = %land.lhs.true.i45, %if.then9
%18 = phi i8 [ %16, %land.lhs.true.i45 ], [ %.pre118, %if.then9 ]
%cmp.not.i52 = icmp eq i8 %18, 0
br i1 %cmp.not.i52, label %land.lhs.true.i61, label %land.rhs.i53
land.rhs.i53: ; preds = %land.rhs.i37, %if.end12
%19 = phi i8 [ %18, %if.end12 ], [ %8, %land.rhs.i37 ]
%cmp13.not.i58 = icmp eq i8 %19, 101
br i1 %cmp13.not.i58, label %while.cond.i49.1, label %land.rhs.i69, !llvm.loop !8
while.cond.i49.1: ; preds = %land.rhs.i53
%arrayidx.i51.1 = getelementptr inbounds i8, ptr %s.tr106, i64 1
%20 = load i8, ptr %arrayidx.i51.1, align 1, !tbaa !5
switch i8 %20, label %while.cond.i65.1 [
i8 0, label %land.lhs.true.i61
i8 114, label %while.cond.i49.2
]
while.cond.i49.2: ; preds = %while.cond.i49.1
%arrayidx.i51.2 = getelementptr inbounds i8, ptr %s.tr106, i64 2
%21 = load i8, ptr %arrayidx.i51.2, align 1, !tbaa !5
switch i8 %21, label %while.cond.i65.1 [
i8 0, label %land.lhs.true.i61
i8 97, label %while.cond.i49.3
]
while.cond.i49.3: ; preds = %while.cond.i49.2
%arrayidx.i51.3 = getelementptr inbounds i8, ptr %s.tr106, i64 3
%22 = load i8, ptr %arrayidx.i51.3, align 1, !tbaa !5
switch i8 %22, label %while.cond.i65.1 [
i8 0, label %land.lhs.true.i61
i8 115, label %while.cond.i49.4
]
while.cond.i49.4: ; preds = %while.cond.i49.3
%arrayidx.i51.4 = getelementptr inbounds i8, ptr %s.tr106, i64 4
%23 = load i8, ptr %arrayidx.i51.4, align 1, !tbaa !5
switch i8 %23, label %while.cond.i65.1 [
i8 0, label %land.lhs.true.i61
i8 101, label %while.cond.i49.5
]
while.cond.i49.5: ; preds = %while.cond.i49.4
%arrayidx.i51.5 = getelementptr inbounds i8, ptr %s.tr106, i64 5
%24 = load i8, ptr %arrayidx.i51.5, align 1, !tbaa !5
%cmp.not.i52.5 = icmp eq i8 %24, 0
br i1 %cmp.not.i52.5, label %land.lhs.true.i61, label %if.then15
land.lhs.true.i61: ; preds = %while.cond.i49.4, %while.cond.i49.3, %while.cond.i49.2, %while.cond.i49.1, %while.cond.i49.5, %if.end12
%25 = phi i8 [ 0, %if.end12 ], [ 101, %while.cond.i49.1 ], [ 101, %while.cond.i49.2 ], [ 101, %while.cond.i49.3 ], [ 101, %while.cond.i49.4 ], [ 101, %while.cond.i49.5 ]
%indvars.iv.i50.lcssa = phi i64 [ 0, %if.end12 ], [ 1, %while.cond.i49.1 ], [ 2, %while.cond.i49.2 ], [ 3, %while.cond.i49.3 ], [ 4, %while.cond.i49.4 ], [ 5, %while.cond.i49.5 ]
%arrayidx21.i62 = getelementptr inbounds i8, ptr @.str.3, i64 %indvars.iv.i50.lcssa
%26 = load i8, ptr %arrayidx21.i62, align 1, !tbaa !5
%cmp23.not.i63 = icmp eq i8 %26, 0
br i1 %cmp23.not.i63, label %if.then15, label %if.end18
if.then15: ; preds = %while.cond.i49.5, %land.lhs.true.i61
%arrayidx16 = getelementptr inbounds i8, ptr %s.tr106, i64 5
%call17 = tail call i32 @f(ptr noundef nonnull %arrayidx16)
%.pre119 = load i8, ptr %s.tr106, align 1, !tbaa !5
br label %if.end18
if.end18: ; preds = %land.lhs.true.i61, %if.then15
%27 = phi i8 [ %25, %land.lhs.true.i61 ], [ %.pre119, %if.then15 ]
%cmp.not.i68 = icmp eq i8 %27, 0
br i1 %cmp.not.i68, label %land.lhs.true.i77, label %land.rhs.i69
land.rhs.i69: ; preds = %land.rhs.i53, %if.end18
%28 = phi i8 [ %27, %if.end18 ], [ %19, %land.rhs.i53 ]
%cmp13.not.i74 = icmp eq i8 %28, 101
br i1 %cmp13.not.i74, label %while.cond.i65.1, label %if.end24, !llvm.loop !8
while.cond.i65.1: ; preds = %while.cond.i49.4, %while.cond.i49.3, %while.cond.i49.2, %while.cond.i49.1, %land.rhs.i69
%arrayidx.i67.1 = getelementptr inbounds i8, ptr %s.tr106, i64 1
%29 = load i8, ptr %arrayidx.i67.1, align 1, !tbaa !5
switch i8 %29, label %if.end24 [
i8 0, label %land.lhs.true.i77
i8 114, label %while.cond.i65.2
]
while.cond.i65.2: ; preds = %while.cond.i65.1
%arrayidx.i67.2 = getelementptr inbounds i8, ptr %s.tr106, i64 2
%30 = load i8, ptr %arrayidx.i67.2, align 1, !tbaa !5
switch i8 %30, label %if.end24 [
i8 0, label %land.lhs.true.i77
i8 97, label %while.cond.i65.3
]
while.cond.i65.3: ; preds = %while.cond.i65.2
%arrayidx.i67.3 = getelementptr inbounds i8, ptr %s.tr106, i64 3
%31 = load i8, ptr %arrayidx.i67.3, align 1, !tbaa !5
switch i8 %31, label %if.end24 [
i8 0, label %land.lhs.true.i77
i8 115, label %while.cond.i65.4
]
while.cond.i65.4: ; preds = %while.cond.i65.3
%arrayidx.i67.4 = getelementptr inbounds i8, ptr %s.tr106, i64 4
%32 = load i8, ptr %arrayidx.i67.4, align 1, !tbaa !5
switch i8 %32, label %if.end24 [
i8 0, label %land.lhs.true.i77
i8 101, label %while.cond.i65.5
]
while.cond.i65.5: ; preds = %while.cond.i65.4
%arrayidx.i67.5 = getelementptr inbounds i8, ptr %s.tr106, i64 5
%33 = load i8, ptr %arrayidx.i67.5, align 1, !tbaa !5
switch i8 %33, label %if.end24 [
i8 0, label %land.lhs.true.i77
i8 114, label %while.cond.i65.6
]
while.cond.i65.6: ; preds = %while.cond.i65.5
%arrayidx.i67.6 = getelementptr inbounds i8, ptr %s.tr106, i64 6
%34 = load i8, ptr %arrayidx.i67.6, align 1, !tbaa !5
%cmp.not.i68.6 = icmp eq i8 %34, 0
br i1 %cmp.not.i68.6, label %land.lhs.true.i77, label %if.then21
land.lhs.true.i77: ; preds = %while.cond.i65.5, %while.cond.i65.4, %while.cond.i65.3, %while.cond.i65.2, %while.cond.i65.1, %while.cond.i65.6, %if.end18
%indvars.iv.i66.lcssa = phi i64 [ 0, %if.end18 ], [ 1, %while.cond.i65.1 ], [ 2, %while.cond.i65.2 ], [ 3, %while.cond.i65.3 ], [ 4, %while.cond.i65.4 ], [ 5, %while.cond.i65.5 ], [ 6, %while.cond.i65.6 ]
%arrayidx21.i78 = getelementptr inbounds i8, ptr @.str.4, i64 %indvars.iv.i66.lcssa
%35 = load i8, ptr %arrayidx21.i78, align 1, !tbaa !5
%cmp23.not.i79 = icmp eq i8 %35, 0
br i1 %cmp23.not.i79, label %land.lhs.true.i77.if.then21_crit_edge, label %if.end24
land.lhs.true.i77.if.then21_crit_edge: ; preds = %land.lhs.true.i77
%arrayidx22.phi.trans.insert = getelementptr inbounds i8, ptr %s.tr106, i64 6
%.pre120 = load i8, ptr %arrayidx22.phi.trans.insert, align 1, !tbaa !5
br label %if.then21
if.then21: ; preds = %while.cond.i65.6, %land.lhs.true.i77.if.then21_crit_edge
%36 = phi i8 [ %.pre120, %land.lhs.true.i77.if.then21_crit_edge ], [ %34, %while.cond.i65.6 ]
%arrayidx22 = getelementptr inbounds i8, ptr %s.tr106, i64 6
%cmp = icmp eq i8 %36, 0
br i1 %cmp, label %if.then, label %land.rhs.i
if.end24: ; preds = %while.cond.i65.5, %while.cond.i65.4, %while.cond.i65.3, %while.cond.i65.2, %while.cond.i65.1, %while.cond.i33.6, %while.cond.i33.5, %while.cond.i33.4, %while.cond.i33.3, %while.cond.i33.2, %while.cond.i33.1, %land.lhs.true.i77, %land.rhs.i69
ret i32 undef
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%s = alloca [100000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %s) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %s)
%call2 = call i32 @f(ptr noundef nonnull %s)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %s) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { noreturn nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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(void)
{
int ok = 0;
char S[1000001];
char temp[1024];
char *p;
scanf("%s", S);
p = S;
while(*p != '\0'){
if(strlen(p) >= 5){
strncpy(temp, p, 5);
temp[5] = '\0';
}else{
break;
}
if(strcmp(temp, "dream") != 0 && strcmp(temp, "erase") != 0){
break;
}
p += 5;
if(p[0] == 'e' && p[1] == 'r' && p[2] != 'a'){
p += 2;
}else if(p[0] == 'r'){
p += 1;
}
}
if(*p == '\0'){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150526/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150526/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"dream\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"erase\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [1000001 x i8], align 16
%temp = alloca [1024 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000001, ptr nonnull %S) #7
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %temp) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 16, !tbaa !5
%cmp.not68 = icmp eq i8 %0, 0
br i1 %cmp.not68, label %if.end50, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx = getelementptr inbounds [1024 x i8], ptr %temp, i64 0, i64 5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end42
%p.069 = phi ptr [ %S, %while.body.lr.ph ], [ %p.1, %if.end42 ]
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %p.069) #8
%cmp4 = icmp ugt i64 %call3, 4
br i1 %cmp4, label %if.then, label %if.else48
if.then: ; preds = %while.body
%call7 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %temp, ptr noundef nonnull dereferenceable(1) %p.069, i64 noundef 5) #7
store i8 0, ptr %arrayidx, align 1, !tbaa !5
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %temp, ptr noundef nonnull dereferenceable(6) @.str.1, i64 6)
%cmp10.not = icmp eq i32 %bcmp, 0
br i1 %cmp10.not, label %if.end17, label %land.lhs.true
land.lhs.true: ; preds = %if.then
%bcmp61 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %temp, ptr noundef nonnull dereferenceable(6) @.str.2, i64 6)
%cmp14.not = icmp eq i32 %bcmp61, 0
br i1 %cmp14.not, label %if.end17, label %while.end
if.end17: ; preds = %land.lhs.true, %if.then
%add.ptr = getelementptr inbounds i8, ptr %p.069, i64 5
%1 = load i8, ptr %add.ptr, align 1, !tbaa !5
%cmp20 = icmp eq i8 %1, 101
br i1 %cmp20, label %land.lhs.true22, label %if.else34
land.lhs.true22: ; preds = %if.end17
%arrayidx23 = getelementptr inbounds i8, ptr %p.069, i64 6
%2 = load i8, ptr %arrayidx23, align 1, !tbaa !5
%cmp25 = icmp eq i8 %2, 114
br i1 %cmp25, label %land.lhs.true27, label %if.else34
land.lhs.true27: ; preds = %land.lhs.true22
%arrayidx28 = getelementptr inbounds i8, ptr %p.069, i64 7
%3 = load i8, ptr %arrayidx28, align 1, !tbaa !5
%cmp30.not = icmp eq i8 %3, 97
br i1 %cmp30.not, label %if.else34, label %if.end42
if.else34: ; preds = %land.lhs.true27, %land.lhs.true22, %if.end17
%cmp37 = icmp eq i8 %1, 114
%add.ptr40 = getelementptr inbounds i8, ptr %p.069, i64 6
%spec.select = select i1 %cmp37, ptr %add.ptr40, ptr %add.ptr
%.pre = load i8, ptr %spec.select, align 1, !tbaa !5
br label %if.end42
if.end42: ; preds = %if.else34, %land.lhs.true27
%4 = phi i8 [ %3, %land.lhs.true27 ], [ %.pre, %if.else34 ]
%p.1 = phi ptr [ %arrayidx28, %land.lhs.true27 ], [ %spec.select, %if.else34 ]
%cmp.not = icmp eq i8 %4, 0
br i1 %cmp.not, label %if.end50, label %while.body, !llvm.loop !8
while.end: ; preds = %land.lhs.true
%.pr = load i8, ptr %p.069, align 1, !tbaa !5
%cmp44 = icmp eq i8 %.pr, 0
br i1 %cmp44, label %if.end50, label %if.else48
if.else48: ; preds = %while.body, %while.end
br label %if.end50
if.end50: ; preds = %if.end42, %while.end, %entry, %if.else48
%str.sink = phi ptr [ @str, %if.else48 ], [ @str.5, %entry ], [ @str.5, %while.end ], [ @str.5, %if.end42 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %temp) #7
call void @llvm.lifetime.end.p0(i64 1000001, ptr nonnull %S) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
void main() {
int t;
scanf("%d",&t);
while(t--) {
int w,h,n;
scanf("%d%d%d",&w,&h,&n);
int total_sheets=0,i=1;
if(n==1)
{
printf("yes\n");
continue;
}
while(1)
{
while(w%2==0) {
w=w/2;
total_sheets=2*i;
i*=2;
}
while(h%2==0) {
h=h/2;
total_sheets=2*i;
i*=2;
}
if(h%2!=0 && w%2!=0)
break;
}
if(total_sheets>=n)
printf("yes\n");
else
printf("no\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_15057/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_15057/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec49 = add nsw i32 %0, -1
store i32 %dec49, ptr %t, align 4, !tbaa !5
%tobool.not50 = icmp eq i32 %0, 0
br i1 %tobool.not50, label %while.end33, label %while.body
while.body: ; preds = %entry, %cleanup
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %1, 1
br i1 %cmp, label %cleanup, label %while.cond5.preheader, !llvm.loop !9
while.cond5.preheader: ; preds = %while.body
%w.promoted = load i32, ptr %w, align 4, !tbaa !5
%2 = and i32 %w.promoted, 1
%cmp640 = icmp eq i32 %2, 0
br i1 %cmp640, label %while.body7, label %while.cond9.preheader
while.cond5.while.cond9.preheader_crit_edge: ; preds = %while.body7
store i32 %div, ptr %w, align 4, !tbaa !5
br label %while.cond9.preheader
while.cond9.preheader: ; preds = %while.cond5.while.cond9.preheader_crit_edge, %while.cond5.preheader
%total_sheets.1.lcssa = phi i32 [ %mul, %while.cond5.while.cond9.preheader_crit_edge ], [ 0, %while.cond5.preheader ]
%i.1.lcssa = phi i32 [ %mul, %while.cond5.while.cond9.preheader_crit_edge ], [ 1, %while.cond5.preheader ]
%h.promoted = load i32, ptr %h, align 4, !tbaa !5
%3 = and i32 %h.promoted, 1
%cmp1145 = icmp eq i32 %3, 0
br i1 %cmp1145, label %while.body12, label %while.end23
while.body7: ; preds = %while.cond5.preheader, %while.body7
%i.142 = phi i32 [ %mul, %while.body7 ], [ 1, %while.cond5.preheader ]
%div3941 = phi i32 [ %div, %while.body7 ], [ %w.promoted, %while.cond5.preheader ]
%div = sdiv i32 %div3941, 2
%mul = shl nsw i32 %i.142, 1
%4 = and i32 %div, 1
%cmp6 = icmp eq i32 %4, 0
br i1 %cmp6, label %while.body7, label %while.cond5.while.cond9.preheader_crit_edge, !llvm.loop !11
while.body12: ; preds = %while.cond9.preheader, %while.body12
%i.247 = phi i32 [ %mul14, %while.body12 ], [ %i.1.lcssa, %while.cond9.preheader ]
%div134446 = phi i32 [ %div13, %while.body12 ], [ %h.promoted, %while.cond9.preheader ]
%div13 = sdiv i32 %div134446, 2
%mul14 = shl nsw i32 %i.247, 1
%5 = and i32 %div13, 1
%cmp11 = icmp eq i32 %5, 0
br i1 %cmp11, label %while.body12, label %while.cond9.while.end23_crit_edge, !llvm.loop !12
while.cond9.while.end23_crit_edge: ; preds = %while.body12
store i32 %div13, ptr %h, align 4, !tbaa !5
br label %while.end23
while.end23: ; preds = %while.cond9.while.end23_crit_edge, %while.cond9.preheader
%total_sheets.2.lcssa = phi i32 [ %mul14, %while.cond9.while.end23_crit_edge ], [ %total_sheets.1.lcssa, %while.cond9.preheader ]
%cmp24.not = icmp slt i32 %total_sheets.2.lcssa, %1
%str.str.4 = select i1 %cmp24.not, ptr @str, ptr @str.5
br label %cleanup
cleanup: ; preds = %while.end23, %while.body
%str.4.sink = phi ptr [ @str.5, %while.body ], [ %str.str.4, %while.end23 ]
%puts37 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
%6 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end33, label %while.body
while.end33: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main (){
// DECLARAÇÃO
int A,B,X;
// INSTRUÇÕES
scanf ("%d %d %d",&A,&B,&X);
if (A > X)
printf ("NO\n");
else if (A+B < X)
printf ("NO\n");
else
printf ("YES\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150612/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150612/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %X)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %X, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%2 = load i32, ptr %B, align 4
%add = add nsw i32 %2, %0
%cmp2 = icmp slt i32 %add, %1
%str.3.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.3.sink = select i1 %cmp, ptr @str.4, ptr %str.3.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b,x;
scanf("%d%d%d",&a,&b,&x);
if((x>=a)&&((a+b)>=x)){
printf("YES\n");
}
else{
printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150656/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150656/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@str = 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
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp1.not = icmp slt i32 %add, %0
br i1 %cmp1.not, label %if.else, label %if.end
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int q,i;
scanf("%d",&q);
long long int a,b,c;
for(i=0;i<q;i++)
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
printf("%I64d\n",(a+b+c)/2);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1507/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1507/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [18 x i8] c"%I64d %I64d %I64d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%I64d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
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
%0 = load i32, ptr %q, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%1 = load i64, ptr %a, align 8, !tbaa !9
%2 = load i64, ptr %b, align 8, !tbaa !9
%add = add nsw i64 %2, %1
%3 = load i64, ptr %c, align 8, !tbaa !9
%add2 = add nsw i64 %add, %3
%div = sdiv i64 %add2, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
%inc = add nuw nsw i32 %i.06, 1
%4 = load i32, ptr %q, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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>
int main() {
int a, b, x = 0;
scanf("%d %d %d", &a, &b, &x);
if (a > x) {
printf("NO\n");
} else if (a + b < x) {
printf("NO\n");
} else {
printf("YES\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150742/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150742/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
store i32 0, ptr %x, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%2 = load i32, ptr %b, align 4
%add = add nsw i32 %2, %0
%cmp2 = icmp slt i32 %add, %1
%str.3.str = select i1 %cmp2, ptr @str.4, ptr @str
%str.3.sink = select i1 %cmp, ptr @str.4, ptr %str.3.str
%puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <inttypes.h>
#include <stdint.h>
#define __STDC_FORMAT_MACROS
int main(void)
{
int32_t knownCats, unknown, sumCats;
scanf("%"PRId32" %"PRId32" %"PRId32, &knownCats, &unknown, &sumCats);
printf("%s", ((knownCats <= sumCats) && (sumCats <= knownCats + unknown)) ? "YES" : "NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150843/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%knownCats = alloca i32, align 4
%unknown = alloca i32, align 4
%sumCats = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %knownCats) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %unknown) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sumCats) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %knownCats, ptr noundef nonnull %unknown, ptr noundef nonnull %sumCats)
%0 = load i32, ptr %knownCats, align 4, !tbaa !5
%1 = load i32, ptr %sumCats, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%2 = load i32, ptr %unknown, align 4
%add = add nsw i32 %2, %0
%cmp1.not = icmp sgt i32 %1, %add
%3 = select i1 %cmp.not, i1 true, i1 %cmp1.not
%cond = select i1 %3, ptr @.str.3, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sumCats) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %unknown) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %knownCats) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int a, b, x;
scanf("%d %d %d", &a, &b, &x);
puts(a <= x && x <= a + b ? "YES" : "NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150887/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150887/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%2 = load i32, ptr %b, align 4
%add = add nsw i32 %2, %0
%cmp1.not = icmp sgt i32 %1, %add
%3 = select i1 %cmp.not, i1 true, i1 %cmp1.not
%cond = select i1 %3, ptr @.str.2, ptr @.str.1
%call2 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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 n,a,b,i,j,m;
int main(void){
scanf("%d%d%d",&n,&a,&b);
if(a <= b){
i = a;
m = b;
}else{
i = b;
m = a;
}
// printf("%d,%d",i,m);
if(a+b < n){
j = 0;
}else{
j = a+b-n;
}
printf("%d %d\n",i,j);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150944/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150944/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@n = dso_local global i32 0, align 4
@a = dso_local global i32 0, align 4
@b = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@m = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @a, ptr noundef nonnull @b)
%0 = load i32, ptr @a, align 4
%1 = load i32, ptr @b, align 4
%. = tail call i32 @llvm.smin.i32(i32 %0, i32 %1)
store i32 %., ptr @i, align 4, !tbaa !5
%storemerge = tail call i32 @llvm.smax.i32(i32 %0, i32 %1)
store i32 %storemerge, ptr @m, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr @n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %add, %2
%sub = sub nsw i32 %add, %2
%storemerge10 = select i1 %cmp1, i32 0, i32 %sub
store i32 %storemerge10, ptr @j, align 4, !tbaa !5
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %., i32 noundef %storemerge10)
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.smin.i32(i32, i32) #2
; 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"}
|
#include<stdio.h>
int main(){
int N,A,B;
int max=0,min=0;
scanf("%d %d %d",&N,&A,&B);
if( A >= B){
max = B;
}else{
max = A;
}
if(A+B <= N){
min = 0;
}else{
min = A+B-N;
}
printf("%d %d\n",max,min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_150988/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_150988/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%add = add nsw i32 %1, %0
%2 = load i32, ptr %N, align 4, !tbaa !5
%cmp1.not = icmp sgt i32 %add, %2
%sub = sub nsw i32 %add, %2
%min.0 = select i1 %cmp1.not, i32 %sub, i32 0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %., i32 noundef %min.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int comp(const void*a,const void*b)
{
return *(int*)a-*(int*)b;
}
#define min(x,y) x<y?x:y
#define max(x,y) x>y?x:y
int main()
{
int t;
scanf("%d",&t);
int i;
for(i=0; i<t; i++)
{
int n,m;
scanf("%d %d",&n,&m);
if(n%m==0){
printf("YES\n");
}
else{
printf("NO\n");
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_15103/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_15103/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %m)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %m, align 4, !tbaa !5
%rem = srem i32 %1, %2
%cmp2 = icmp eq i32 %rem, 0
%str.4.str = select i1 %cmp2, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%inc = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#define N 1000
int main(){
int i, j, c;
int flag = 0;
char T[N], P[N];
scanf("%s", T);
scanf("%s", P);
for(i=0; i<strlen(T); i++){
flag = 0;
for(j=0, c=i; j<strlen(P); j++, c++){
if(T[c] != P[j]){
flag = 1;
}
}
if(flag == 0) printf("%d\n", i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151080/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151080/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%T = alloca [1000 x i8], align 16
%P = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %P) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %P)
%char0 = load i8, ptr %T, align 16
%cmp40.not = icmp eq i8 %char0, 0
br i1 %cmp40.not, label %for.end27, label %for.cond6.preheader
for.cond6.preheader: ; preds = %entry, %for.inc25
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc25 ], [ 0, %entry ]
%call9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %P) #5
%cmp1034.not = icmp eq i64 %call9, 0
br i1 %cmp1034.not, label %if.then22, label %for.body12.preheader
for.body12.preheader: ; preds = %for.cond6.preheader
%min.iters.check = icmp ult i64 %call9, 8
br i1 %min.iters.check, label %for.body12.preheader60, label %vector.ph
vector.ph: ; preds = %for.body12.preheader
%n.vec = and i64 %call9, -8
%ind.end = add i64 %indvars.iv, %n.vec
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%offset.idx = add i64 %indvars.iv, %index
%0 = getelementptr inbounds [1000 x i8], ptr %T, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %0, align 1, !tbaa !5
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load54 = load <4 x i8>, ptr %1, align 1, !tbaa !5
%2 = getelementptr inbounds [1000 x i8], ptr %P, i64 0, i64 %index
%wide.load55 = load <4 x i8>, ptr %2, align 8, !tbaa !5
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load56 = load <4 x i8>, ptr %3, align 4, !tbaa !5
%4 = icmp eq <4 x i8> %wide.load, %wide.load55
%5 = icmp eq <4 x i8> %wide.load54, %wide.load56
%6 = select <4 x i1> %4, <4 x i32> %vec.phi, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%7 = select <4 x i1> %5, <4 x i32> %vec.phi53, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %6, zeroinitializer
%rdx.select.cmp5759 = icmp ne <4 x i32> %7, zeroinitializer
%rdx.select.cmp57 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp5759
%9 = bitcast <4 x i1> %rdx.select.cmp57 to i4
%.not = icmp ne i4 %9, 0
%rdx.select58 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %call9, %n.vec
br i1 %cmp.n, label %for.end, label %for.body12.preheader60
for.body12.preheader60: ; preds = %for.body12.preheader, %middle.block
%indvars.iv44.ph = phi i64 [ 0, %for.body12.preheader ], [ %n.vec, %middle.block ]
%indvars.iv42.ph = phi i64 [ %indvars.iv, %for.body12.preheader ], [ %ind.end, %middle.block ]
%flag.037.ph = phi i32 [ 0, %for.body12.preheader ], [ %rdx.select58, %middle.block ]
br label %for.body12
for.body12: ; preds = %for.body12.preheader60, %for.body12
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body12 ], [ %indvars.iv44.ph, %for.body12.preheader60 ]
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body12 ], [ %indvars.iv42.ph, %for.body12.preheader60 ]
%flag.037 = phi i32 [ %spec.select, %for.body12 ], [ %flag.037.ph, %for.body12.preheader60 ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %T, i64 0, i64 %indvars.iv42
%10 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx15 = getelementptr inbounds [1000 x i8], ptr %P, i64 0, i64 %indvars.iv44
%11 = load i8, ptr %arrayidx15, align 1, !tbaa !5
%cmp17.not = icmp eq i8 %10, %11
%spec.select = select i1 %cmp17.not, i32 %flag.037, i32 1
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%indvars.iv.next43 = add nuw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next45, %call9
br i1 %exitcond.not, label %for.end, label %for.body12, !llvm.loop !12
for.end: ; preds = %for.body12, %middle.block
%spec.select.lcssa = phi i32 [ %rdx.select58, %middle.block ], [ %spec.select, %for.body12 ]
%cmp20 = icmp eq i32 %spec.select.lcssa, 0
br i1 %cmp20, label %if.then22, label %for.inc25
if.then22: ; preds = %for.cond6.preheader, %for.end
%12 = trunc i64 %indvars.iv to i32
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
br label %for.inc25
for.inc25: ; preds = %for.end, %if.then22
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %T) #5
%cmp = icmp ugt i64 %call4, %indvars.iv.next
br i1 %cmp, label %for.cond6.preheader, label %for.end27, !llvm.loop !13
for.end27: ; preds = %for.inc25, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %P) #4
call void @llvm.lifetime.end.p0(i64 1000, 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9}
|
#include<stdio.h>
#define INF 1000000
int edge[101][101],mincost[101],used[101],V;
int prim(void);
int min(int,int);
int main(void){
int e,i,j,a,b,cost;
while(scanf("%d %d",&V,&e),V,e){
for(i=0;i<V;i++){
for(j=0;j<V;j++){
edge[i][j]=edge[j][i]=INF;
}
}
for(i=0;i<e;i++){
scanf("%d %d %d",&a,&b,&cost);
edge[a][b]=edge[b][a]=cost;
}
printf("%d\n",prim());
}
return 0;
}
int prim(void){
int i,u,v;
for(i=0;i<V;i++){
mincost[i]=INF;
used[i]=0;
}
mincost[0]=0;
int res=0;
while(1){
v=-1;
for(u=0;u<V;u++)
if(!used[u] && (v==-1 || mincost[v]>mincost[u]))v=u;
if(v==-1)break;
used[v]=1;
res+=mincost[v];
for(u=0;u<V;u++)
mincost[u]=min(mincost[u],edge[v][u]);
}
return res;
}
int min(int x,int y){
return x<y?x:y;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151123/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151123/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@V = dso_local global i32 0, align 4
@edge = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@mincost = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@used = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%e = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%cost = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %cost) #7
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @V, ptr noundef nonnull %e)
%0 = load i32, ptr %e, align 4, !tbaa !5
%tobool.not45 = icmp eq i32 %0, 0
br i1 %tobool.not45, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %prim.exit
%1 = phi i32 [ %28, %prim.exit ], [ %0, %entry ]
%2 = load i32, ptr @V, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %2, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond13.preheader
for.cond1.preheader.us.preheader: ; preds = %for.cond.preheader
%wide.trip.count50 = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count50, 1
%3 = icmp eq i32 %2, 1
%unroll_iter = and i64 %wide.trip.count50, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc10_crit_edge.us
%indvars.iv47 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next48, %for.cond1.for.inc10_crit_edge.us ]
br i1 %3, label %for.cond1.for.inc10_crit_edge.us.unr-lcssa, label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body3.us ], [ 0, %for.cond1.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.body3.us ], [ 0, %for.cond1.preheader.us ]
%arrayidx5.us = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %indvars.iv, i64 %indvars.iv47
store i32 1000000, ptr %arrayidx5.us, align 4, !tbaa !5
%arrayidx9.us = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %indvars.iv47, i64 %indvars.iv
store i32 1000000, ptr %arrayidx9.us, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx5.us.1 = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %indvars.iv.next, i64 %indvars.iv47
store i32 1000000, ptr %arrayidx5.us.1, align 4, !tbaa !5
%arrayidx9.us.1 = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %indvars.iv47, i64 %indvars.iv.next
store i32 1000000, ptr %arrayidx9.us.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond1.for.inc10_crit_edge.us.unr-lcssa, label %for.body3.us, !llvm.loop !9
for.cond1.for.inc10_crit_edge.us.unr-lcssa: ; preds = %for.body3.us, %for.cond1.preheader.us
%indvars.iv.unr = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next.1, %for.body3.us ]
br i1 %lcmp.mod.not, label %for.cond1.for.inc10_crit_edge.us, label %for.body3.us.epil
for.body3.us.epil: ; preds = %for.cond1.for.inc10_crit_edge.us.unr-lcssa
%arrayidx5.us.epil = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %indvars.iv.unr, i64 %indvars.iv47
store i32 1000000, ptr %arrayidx5.us.epil, align 4, !tbaa !5
%arrayidx9.us.epil = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %indvars.iv47, i64 %indvars.iv.unr
store i32 1000000, ptr %arrayidx9.us.epil, align 4, !tbaa !5
br label %for.cond1.for.inc10_crit_edge.us
for.cond1.for.inc10_crit_edge.us: ; preds = %for.cond1.for.inc10_crit_edge.us.unr-lcssa, %for.body3.us.epil
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
br i1 %exitcond51.not, label %for.cond13.preheader, label %for.cond1.preheader.us, !llvm.loop !11
for.cond13.preheader: ; preds = %for.cond1.for.inc10_crit_edge.us, %for.cond.preheader
%cmp1442 = icmp sgt i32 %1, 0
br i1 %cmp1442, label %for.body15, label %for.end27
for.body15: ; preds = %for.cond13.preheader, %for.body15
%i.143 = phi i32 [ %inc26, %for.body15 ], [ 0, %for.cond13.preheader ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %cost)
%4 = load i32, ptr %cost, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%idxprom17 = sext i32 %5 to i64
%6 = load i32, ptr %a, align 4, !tbaa !5
%idxprom19 = sext i32 %6 to i64
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 %4, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx24 = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %idxprom19, i64 %idxprom17
store i32 %4, ptr %arrayidx24, align 4, !tbaa !5
%inc26 = add nuw nsw i32 %i.143, 1
%7 = load i32, ptr %e, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc26, %7
br i1 %cmp14, label %for.body15, label %for.end27.loopexit, !llvm.loop !12
for.end27.loopexit: ; preds = %for.body15
%.pre = load i32, ptr @V, align 4, !tbaa !5
br label %for.end27
for.end27: ; preds = %for.end27.loopexit, %for.cond13.preheader
%8 = phi i32 [ %.pre, %for.end27.loopexit ], [ %2, %for.cond13.preheader ]
%cmp56.i = icmp sgt i32 %8, 0
br i1 %cmp56.i, label %for.body.preheader.i, label %for.end.thread.i
for.end.thread.i: ; preds = %for.end27
store i32 0, ptr @mincost, align 16, !tbaa !5
br label %prim.exit
for.body.preheader.i: ; preds = %for.end27
%9 = zext i32 %8 to i64
%10 = shl nuw nsw i64 %9, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @used, i8 0, i64 %10, i1 false), !tbaa !5
%min.iters.check57 = icmp ult i32 %8, 8
br i1 %min.iters.check57, label %for.body.i.preheader, label %vector.ph58
vector.ph58: ; preds = %for.body.preheader.i
%n.vec60 = and i64 %9, 4294967288
br label %vector.body63
vector.body63: ; preds = %vector.body63, %vector.ph58
%index64 = phi i64 [ 0, %vector.ph58 ], [ %index.next65, %vector.body63 ]
%11 = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %index64
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %12, align 16, !tbaa !5
%index.next65 = add nuw i64 %index64, 8
%13 = icmp eq i64 %index.next65, %n.vec60
br i1 %13, label %middle.block55, label %vector.body63, !llvm.loop !13
middle.block55: ; preds = %vector.body63
%cmp.n62 = icmp eq i64 %n.vec60, %9
br i1 %cmp.n62, label %while.cond.us.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block55
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec60, %middle.block55 ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %indvars.iv.i
store i32 1000000, ptr %arrayidx.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %9
br i1 %exitcond.not.i, label %while.cond.us.preheader.i, label %for.body.i, !llvm.loop !16
while.cond.us.preheader.i: ; preds = %for.body.i, %middle.block55
store i32 0, ptr @mincost, align 16, !tbaa !5
%min.iters.check = icmp ult i32 %8, 8
%n.vec = and i64 %9, 4294967288
%cmp.n = icmp eq i64 %n.vec, %9
br label %while.cond.us.i
while.cond.us.i.loopexit: ; preds = %for.body26.us.i, %middle.block
%add.us.i = add nsw i32 %14, %res.0.us.i
br label %while.cond.us.i, !llvm.loop !17
while.cond.us.i: ; preds = %while.cond.us.i.loopexit, %while.cond.us.preheader.i
%res.0.us.i = phi i32 [ 0, %while.cond.us.preheader.i ], [ %add.us.i, %while.cond.us.i.loopexit ]
br label %for.body5.us.i
for.body26.us.preheader.i: ; preds = %for.cond3.for.end16_crit_edge.us.i
%idxprom20.us.i = sext i32 %v.1.us.i to i64
%arrayidx21.us.i = getelementptr inbounds [101 x i32], ptr @used, i64 0, i64 %idxprom20.us.i
store i32 1, ptr %arrayidx21.us.i, align 4, !tbaa !5
%arrayidx23.us.i = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %idxprom20.us.i
%14 = load i32, ptr %arrayidx23.us.i, align 4, !tbaa !5
br i1 %min.iters.check, label %for.body26.us.i.preheader, label %vector.body
vector.body: ; preds = %for.body26.us.preheader.i, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body26.us.preheader.i ]
%15 = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load52 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %idxprom20.us.i, i64 %index
%wide.load53 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load54 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load53)
%20 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load52, <4 x i32> %wide.load54)
store <4 x i32> %19, ptr %15, align 16, !tbaa !5
store <4 x i32> %20, ptr %16, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %while.cond.us.i.loopexit, label %for.body26.us.i.preheader
for.body26.us.i.preheader: ; preds = %for.body26.us.preheader.i, %middle.block
%indvars.iv86.i.ph = phi i64 [ 0, %for.body26.us.preheader.i ], [ %n.vec, %middle.block ]
br label %for.body26.us.i
for.body26.us.i: ; preds = %for.body26.us.i.preheader, %for.body26.us.i
%indvars.iv86.i = phi i64 [ %indvars.iv.next87.i, %for.body26.us.i ], [ %indvars.iv86.i.ph, %for.body26.us.i.preheader ]
%arrayidx28.us.i = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %indvars.iv86.i
%22 = load i32, ptr %arrayidx28.us.i, align 4, !tbaa !5
%arrayidx32.us.i = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %idxprom20.us.i, i64 %indvars.iv86.i
%23 = load i32, ptr %arrayidx32.us.i, align 4, !tbaa !5
%cond.i.us.i = call i32 @llvm.smin.i32(i32 %22, i32 %23)
store i32 %cond.i.us.i, ptr %arrayidx28.us.i, align 4, !tbaa !5
%indvars.iv.next87.i = add nuw nsw i64 %indvars.iv86.i, 1
%exitcond90.not.i = icmp eq i64 %indvars.iv.next87.i, %9
br i1 %exitcond90.not.i, label %while.cond.us.i.loopexit, label %for.body26.us.i, !llvm.loop !19
for.body5.us.i: ; preds = %for.inc14.us.i, %while.cond.us.i
%indvars.iv81.i = phi i64 [ 0, %while.cond.us.i ], [ %indvars.iv.next82.i, %for.inc14.us.i ]
%v.060.us.i = phi i32 [ -1, %while.cond.us.i ], [ %v.1.us.i, %for.inc14.us.i ]
%arrayidx7.us.i = getelementptr inbounds [101 x i32], ptr @used, i64 0, i64 %indvars.iv81.i
%24 = load i32, ptr %arrayidx7.us.i, align 4, !tbaa !5
%tobool.not.us.i = icmp eq i32 %24, 0
br i1 %tobool.not.us.i, label %land.lhs.true.us.i, label %for.inc14.us.i
land.lhs.true.us.i: ; preds = %for.body5.us.i
%cmp8.us.i = icmp eq i32 %v.060.us.i, -1
br i1 %cmp8.us.i, label %if.then.us.i, label %lor.lhs.false.us.i
lor.lhs.false.us.i: ; preds = %land.lhs.true.us.i
%idxprom9.us.i = sext i32 %v.060.us.i to i64
%arrayidx10.us.i = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %idxprom9.us.i
%25 = load i32, ptr %arrayidx10.us.i, align 4, !tbaa !5
%arrayidx12.us.i = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %indvars.iv81.i
%26 = load i32, ptr %arrayidx12.us.i, align 4, !tbaa !5
%cmp13.us.i = icmp sgt i32 %25, %26
br i1 %cmp13.us.i, label %if.then.us.i, label %for.inc14.us.i
if.then.us.i: ; preds = %lor.lhs.false.us.i, %land.lhs.true.us.i
%27 = trunc i64 %indvars.iv81.i to i32
br label %for.inc14.us.i
for.inc14.us.i: ; preds = %if.then.us.i, %lor.lhs.false.us.i, %for.body5.us.i
%v.1.us.i = phi i32 [ %v.060.us.i, %for.body5.us.i ], [ %27, %if.then.us.i ], [ %v.060.us.i, %lor.lhs.false.us.i ]
%indvars.iv.next82.i = add nuw nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %9
br i1 %exitcond85.not.i, label %for.cond3.for.end16_crit_edge.us.i, label %for.body5.us.i, !llvm.loop !20
for.cond3.for.end16_crit_edge.us.i: ; preds = %for.inc14.us.i
%cmp17.us.i = icmp eq i32 %v.1.us.i, -1
br i1 %cmp17.us.i, label %prim.exit, label %for.body26.us.preheader.i
prim.exit: ; preds = %for.cond3.for.end16_crit_edge.us.i, %for.end.thread.i
%.us-phi.i = phi i32 [ 0, %for.end.thread.i ], [ %res.0.us.i, %for.cond3.for.end16_crit_edge.us.i ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @V, ptr noundef nonnull %e)
%28 = load i32, ptr %e, align 4, !tbaa !5
%tobool.not = icmp eq i32 %28, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !21
while.end: ; preds = %prim.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %cost) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @prim() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @V, align 4, !tbaa !5
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body.preheader, label %for.end.thread
for.end.thread: ; preds = %entry
store i32 0, ptr @mincost, align 16, !tbaa !5
br label %while.end
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @used, i8 0, i64 %2, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%3 = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %index
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %4, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %for.end, label %for.body.preheader106
for.body.preheader106: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader106, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader106 ]
%arrayidx = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %indvars.iv
store i32 1000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %1
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !23
for.end: ; preds = %for.body, %middle.block
store i32 0, ptr @mincost, align 16, !tbaa !5
br i1 %cmp56, label %while.cond.us.preheader, label %while.end
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count84 = zext i32 %0 to i64
%min.iters.check93 = icmp ult i32 %0, 8
%n.vec96 = and i64 %1, 4294967288
%cmp.n98 = icmp eq i64 %n.vec96, %1
br label %while.cond.us
while.cond.us.loopexit: ; preds = %for.body26.us, %middle.block91
br label %while.cond.us, !llvm.loop !17
while.cond.us: ; preds = %while.cond.us.loopexit, %while.cond.us.preheader
%res.0.us = phi i32 [ 0, %while.cond.us.preheader ], [ %add.us, %while.cond.us.loopexit ]
br label %for.body5.us
for.body26.us.preheader: ; preds = %for.cond3.for.end16_crit_edge.us
%idxprom20.us = sext i32 %v.1.us to i64
%arrayidx21.us = getelementptr inbounds [101 x i32], ptr @used, i64 0, i64 %idxprom20.us
store i32 1, ptr %arrayidx21.us, align 4, !tbaa !5
%arrayidx23.us = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %idxprom20.us
%6 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5
%add.us = add nsw i32 %6, %res.0.us
br i1 %min.iters.check93, label %for.body26.us.preheader105, label %vector.body99
vector.body99: ; preds = %for.body26.us.preheader, %vector.body99
%index100 = phi i64 [ %index.next104, %vector.body99 ], [ 0, %for.body26.us.preheader ]
%7 = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %index100
%wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load101 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %idxprom20.us, i64 %index100
%wide.load102 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load103 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load102)
%12 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load101, <4 x i32> %wide.load103)
store <4 x i32> %11, ptr %7, align 16, !tbaa !5
store <4 x i32> %12, ptr %8, align 16, !tbaa !5
%index.next104 = add nuw i64 %index100, 8
%13 = icmp eq i64 %index.next104, %n.vec96
br i1 %13, label %middle.block91, label %vector.body99, !llvm.loop !24
middle.block91: ; preds = %vector.body99
br i1 %cmp.n98, label %while.cond.us.loopexit, label %for.body26.us.preheader105
for.body26.us.preheader105: ; preds = %for.body26.us.preheader, %middle.block91
%indvars.iv86.ph = phi i64 [ 0, %for.body26.us.preheader ], [ %n.vec96, %middle.block91 ]
br label %for.body26.us
for.body26.us: ; preds = %for.body26.us.preheader105, %for.body26.us
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.body26.us ], [ %indvars.iv86.ph, %for.body26.us.preheader105 ]
%arrayidx28.us = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %indvars.iv86
%14 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%arrayidx32.us = getelementptr inbounds [101 x [101 x i32]], ptr @edge, i64 0, i64 %idxprom20.us, i64 %indvars.iv86
%15 = load i32, ptr %arrayidx32.us, align 4, !tbaa !5
%cond.i.us = tail call i32 @llvm.smin.i32(i32 %14, i32 %15)
store i32 %cond.i.us, ptr %arrayidx28.us, align 4, !tbaa !5
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count84
br i1 %exitcond90.not, label %while.cond.us.loopexit, label %for.body26.us, !llvm.loop !25
for.body5.us: ; preds = %while.cond.us, %for.inc14.us
%indvars.iv81 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next82, %for.inc14.us ]
%v.060.us = phi i32 [ -1, %while.cond.us ], [ %v.1.us, %for.inc14.us ]
%arrayidx7.us = getelementptr inbounds [101 x i32], ptr @used, i64 0, i64 %indvars.iv81
%16 = load i32, ptr %arrayidx7.us, align 4, !tbaa !5
%tobool.not.us = icmp eq i32 %16, 0
br i1 %tobool.not.us, label %land.lhs.true.us, label %for.inc14.us
land.lhs.true.us: ; preds = %for.body5.us
%cmp8.us = icmp eq i32 %v.060.us, -1
br i1 %cmp8.us, label %if.then.us, label %lor.lhs.false.us
lor.lhs.false.us: ; preds = %land.lhs.true.us
%idxprom9.us = sext i32 %v.060.us to i64
%arrayidx10.us = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %idxprom9.us
%17 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%arrayidx12.us = getelementptr inbounds [101 x i32], ptr @mincost, i64 0, i64 %indvars.iv81
%18 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%cmp13.us = icmp sgt i32 %17, %18
br i1 %cmp13.us, label %if.then.us, label %for.inc14.us
if.then.us: ; preds = %lor.lhs.false.us, %land.lhs.true.us
%19 = trunc i64 %indvars.iv81 to i32
br label %for.inc14.us
for.inc14.us: ; preds = %if.then.us, %lor.lhs.false.us, %for.body5.us
%v.1.us = phi i32 [ %v.060.us, %for.body5.us ], [ %19, %if.then.us ], [ %v.060.us, %lor.lhs.false.us ]
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.cond3.for.end16_crit_edge.us, label %for.body5.us, !llvm.loop !20
for.cond3.for.end16_crit_edge.us: ; preds = %for.inc14.us
%cmp17.us = icmp eq i32 %v.1.us, -1
br i1 %cmp17.us, label %while.end, label %for.body26.us.preheader
while.end: ; preds = %for.cond3.for.end16_crit_edge.us, %for.end.thread, %for.end
%.us-phi = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %res.0.us, %for.cond3.for.end16_crit_edge.us ]
ret i32 %.us-phi
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #4 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !14, !15}
!19 = distinct !{!19, !10, !15, !14}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !14, !15}
!23 = distinct !{!23, !10, !15, !14}
!24 = distinct !{!24, !10, !14, !15}
!25 = distinct !{!25, !10, !15, !14}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double star_coor[500][4];
int star_num;
double telescope_direction[50][4];
int telescope_num;
#define fors(i, n) for (int i = 0; i < n; i++)
int parse()
{
scanf("%d", &star_num);
if (star_num == 0)
return 0;
fors(i, star_num)
{
scanf("%lf %lf %lf", &star_coor[i][0], &star_coor[i][1], &star_coor[i][2]);
star_coor[i][3] = 0;
}
scanf("%d", &telescope_num);
fors(i, telescope_num)
scanf("%lf %lf %lf %lf", &telescope_direction[i][0], &telescope_direction[i][1], &telescope_direction[i][2], &telescope_direction[i][3]);
return 1;
}
int run()
{
fors(i, star_num)
{
fors(j, telescope_num)
{
double edge1 = pow(telescope_direction[j][0] - star_coor[i][0], 2);
edge1 += pow(telescope_direction[j][1] - star_coor[i][1], 2);
edge1 += pow(telescope_direction[j][2] - star_coor[i][2], 2);
double edge2 = pow(telescope_direction[j][0], 2);
edge2 += pow(telescope_direction[j][1], 2);
edge2 += pow(telescope_direction[j][2], 2);
double edge3 = pow(star_coor[i][0], 2);
edge3 += pow(star_coor[i][1], 2);
edge3 += pow(star_coor[i][2], 2);
double cosA = (edge2 + edge3 - edge1) / (2 * sqrt(edge2 * edge3));
if (cosA > cos(telescope_direction[j][3]))
{
star_coor[i][3] = 1;
break;
}
}
}
int res = 0;
fors(i, star_num)
{
res += star_coor[i][3];
}
return res;
}
int main()
{
while (parse())
{
printf("%d\n", run());
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151181/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151181/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@star_num = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [12 x i8] c"%lf %lf %lf\00", align 1
@star_coor = dso_local global [500 x [4 x double]] zeroinitializer, align 16
@telescope_num = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@telescope_direction = dso_local global [50 x [4 x double]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @parse() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @star_num)
%0 = load i32, ptr @star_num, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %return, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp145 = icmp sgt i32 %0, 0
br i1 %cmp145, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %for.cond.preheader
%call13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @telescope_num)
%1 = load i32, ptr @telescope_num, align 4, !tbaa !5
%cmp1647 = icmp sgt i32 %1, 0
br i1 %cmp1647, label %for.body18, label %return
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv, i64 1
%arrayidx8 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv, i64 2
%call9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx8)
%arrayidx12 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv, i64 3
store double 0.000000e+00, ptr %arrayidx12, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @star_num, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp1, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.body18: ; preds = %for.cond.cleanup, %for.body18
%indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.body18 ], [ 0, %for.cond.cleanup ]
%arrayidx20 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv50
%arrayidx24 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv50, i64 1
%arrayidx27 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv50, i64 2
%arrayidx30 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv50, i64 3
%call31 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx20, ptr noundef nonnull %arrayidx24, ptr noundef nonnull %arrayidx27, ptr noundef nonnull %arrayidx30)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%4 = load i32, ptr @telescope_num, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp16 = icmp slt i64 %indvars.iv.next51, %5
br i1 %cmp16, label %for.body18, label %return, !llvm.loop !13
return: ; preds = %for.body18, %for.cond.cleanup, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %for.cond.cleanup ], [ 1, %for.body18 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local i32 @run() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @star_num, align 4, !tbaa !5
%cmp126 = icmp sgt i32 %0, 0
br i1 %cmp126, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup77
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr @telescope_num, align 4, !tbaa !5
%2 = icmp sgt i32 %1, 0
br i1 %2, label %for.cond1.preheader, label %for.body78.preheader
for.cond1.preheaderthread-pre-split: ; preds = %cleanup69
%.pr = load i32, ptr @telescope_num, align 4, !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheaderthread-pre-split
%3 = phi i32 [ %.pr, %for.cond1.preheaderthread-pre-split ], [ %1, %for.cond1.preheader.lr.ph ]
%indvars.iv136 = phi i64 [ %indvars.iv.next137, %for.cond1.preheaderthread-pre-split ], [ 0, %for.cond1.preheader.lr.ph ]
%cmp2124 = icmp sgt i32 %3, 0
br i1 %cmp2124, label %for.body4.lr.ph, label %cleanup69
for.body4.lr.ph: ; preds = %for.cond1.preheader
%arrayidx7 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv136
%arrayidx14 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv136, i64 1
br label %for.body4
for.cond75.preheader: ; preds = %cleanup69
%cmp76129 = icmp sgt i32 %31, 0
br i1 %cmp76129, label %for.body78.preheader, label %for.cond.cleanup77
for.body78.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond75.preheader
%.lcssa144 = phi i32 [ %31, %for.cond75.preheader ], [ %0, %for.cond1.preheader.lr.ph ]
%wide.trip.count = zext i32 %.lcssa144 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %.lcssa144, 4
br i1 %4, label %for.cond.cleanup77.loopexit.unr-lcssa, label %for.body78.preheader.new
for.body78.preheader.new: ; preds = %for.body78.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body78
for.cond1: ; preds = %for.body4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr @telescope_num, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp2, label %for.body4, label %cleanup69, !llvm.loop !14
for.body4: ; preds = %for.body4.lr.ph, %for.cond1
%indvars.iv = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next, %for.cond1 ]
%arrayidx = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv
%7 = load double, ptr %arrayidx, align 16, !tbaa !9
%8 = load double, ptr %arrayidx7, align 16, !tbaa !9
%sub = fsub double %7, %8
%arrayidx11 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv, i64 1
%9 = load double, ptr %arrayidx11, align 8, !tbaa !9
%arrayidx19 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv, i64 2
%10 = load double, ptr %arrayidx19, align 16, !tbaa !9
%11 = insertelement <2 x double> poison, double %7, i64 0
%12 = insertelement <2 x double> %11, double %sub, i64 1
%13 = fmul <2 x double> %12, %12
%14 = insertelement <2 x double> poison, double %9, i64 0
%15 = insertelement <2 x double> poison, double %10, i64 0
%square121 = fmul double %8, %8
%16 = load <2 x double>, ptr %arrayidx14, align 8, !tbaa !9
%17 = extractelement <2 x double> %16, i64 0
%sub15 = fsub double %9, %17
%18 = extractelement <2 x double> %16, i64 1
%sub23 = fsub double %10, %18
%19 = insertelement <2 x double> %14, double %sub15, i64 1
%20 = fmul <2 x double> %19, %19
%21 = fadd <2 x double> %13, %20
%22 = insertelement <2 x double> %15, double %sub23, i64 1
%23 = fmul <2 x double> %22, %22
%24 = fadd <2 x double> %21, %23
%25 = fmul <2 x double> %16, %16
%26 = extractelement <2 x double> %25, i64 0
%add48 = fadd double %square121, %26
%27 = extractelement <2 x double> %25, i64 1
%add53 = fadd double %add48, %27
%28 = extractelement <2 x double> %24, i64 0
%add54 = fadd double %28, %add53
%29 = extractelement <2 x double> %24, i64 1
%sub55 = fsub double %add54, %29
%mul = fmul double %28, %add53
%call56 = tail call double @sqrt(double noundef %mul) #4
%mul57 = fmul double %call56, 2.000000e+00
%div = fdiv double %sub55, %mul57
%arrayidx60 = getelementptr inbounds [50 x [4 x double]], ptr @telescope_direction, i64 0, i64 %indvars.iv, i64 3
%30 = load double, ptr %arrayidx60, align 8, !tbaa !9
%call61 = tail call double @cos(double noundef %30) #4
%cmp62 = fcmp ule double %div, %call61
br i1 %cmp62, label %for.cond1, label %if.then
if.then: ; preds = %for.body4
%arrayidx65 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv136, i64 3
store double 1.000000e+00, ptr %arrayidx65, align 8, !tbaa !9
br label %cleanup69
cleanup69: ; preds = %for.cond1, %for.cond1.preheader, %if.then
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%31 = load i32, ptr @star_num, align 4, !tbaa !5
%32 = sext i32 %31 to i64
%cmp = icmp slt i64 %indvars.iv.next137, %32
br i1 %cmp, label %for.cond1.preheaderthread-pre-split, label %for.cond75.preheader, !llvm.loop !15
for.cond.cleanup77.loopexit.unr-lcssa: ; preds = %for.body78, %for.body78.preheader
%conv83.lcssa.ph = phi i32 [ undef, %for.body78.preheader ], [ %conv83.3, %for.body78 ]
%indvars.iv139.unr = phi i64 [ 0, %for.body78.preheader ], [ %indvars.iv.next140.3, %for.body78 ]
%res.0130.unr = phi i32 [ 0, %for.body78.preheader ], [ %conv83.3, %for.body78 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup77, label %for.body78.epil
for.body78.epil: ; preds = %for.cond.cleanup77.loopexit.unr-lcssa, %for.body78.epil
%indvars.iv139.epil = phi i64 [ %indvars.iv.next140.epil, %for.body78.epil ], [ %indvars.iv139.unr, %for.cond.cleanup77.loopexit.unr-lcssa ]
%res.0130.epil = phi i32 [ %conv83.epil, %for.body78.epil ], [ %res.0130.unr, %for.cond.cleanup77.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body78.epil ], [ 0, %for.cond.cleanup77.loopexit.unr-lcssa ]
%arrayidx81.epil = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv139.epil, i64 3
%33 = load double, ptr %arrayidx81.epil, align 8, !tbaa !9
%conv.epil = sitofp i32 %res.0130.epil to double
%add82.epil = fadd double %33, %conv.epil
%conv83.epil = fptosi double %add82.epil to i32
%indvars.iv.next140.epil = add nuw nsw i64 %indvars.iv139.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup77, label %for.body78.epil, !llvm.loop !17
for.cond.cleanup77: ; preds = %for.cond.cleanup77.loopexit.unr-lcssa, %for.body78.epil, %entry, %for.cond75.preheader
%res.0.lcssa = phi i32 [ 0, %for.cond75.preheader ], [ 0, %entry ], [ %conv83.lcssa.ph, %for.cond.cleanup77.loopexit.unr-lcssa ], [ %conv83.epil, %for.body78.epil ]
ret i32 %res.0.lcssa
for.body78: ; preds = %for.body78, %for.body78.preheader.new
%indvars.iv139 = phi i64 [ 0, %for.body78.preheader.new ], [ %indvars.iv.next140.3, %for.body78 ]
%res.0130 = phi i32 [ 0, %for.body78.preheader.new ], [ %conv83.3, %for.body78 ]
%niter = phi i64 [ 0, %for.body78.preheader.new ], [ %niter.next.3, %for.body78 ]
%arrayidx81 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv139, i64 3
%34 = load double, ptr %arrayidx81, align 8, !tbaa !9
%conv = sitofp i32 %res.0130 to double
%add82 = fadd double %34, %conv
%conv83 = fptosi double %add82 to i32
%indvars.iv.next140 = or i64 %indvars.iv139, 1
%arrayidx81.1 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv.next140, i64 3
%35 = load double, ptr %arrayidx81.1, align 8, !tbaa !9
%conv.1 = sitofp i32 %conv83 to double
%add82.1 = fadd double %35, %conv.1
%conv83.1 = fptosi double %add82.1 to i32
%indvars.iv.next140.1 = or i64 %indvars.iv139, 2
%arrayidx81.2 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv.next140.1, i64 3
%36 = load double, ptr %arrayidx81.2, align 8, !tbaa !9
%conv.2 = sitofp i32 %conv83.1 to double
%add82.2 = fadd double %36, %conv.2
%conv83.2 = fptosi double %add82.2 to i32
%indvars.iv.next140.2 = or i64 %indvars.iv139, 3
%arrayidx81.3 = getelementptr inbounds [500 x [4 x double]], ptr @star_coor, i64 0, i64 %indvars.iv.next140.2, i64 3
%37 = load double, ptr %arrayidx81.3, align 8, !tbaa !9
%conv.3 = sitofp i32 %conv83.2 to double
%add82.3 = fadd double %37, %conv.3
%conv83.3 = fptosi double %add82.3 to i32
%indvars.iv.next140.3 = add nuw nsw i64 %indvars.iv139, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup77.loopexit.unr-lcssa, label %for.body78, !llvm.loop !19
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call3 = tail call i32 @parse(), !range !20
%tobool.not4 = icmp eq i32 %call3, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = tail call i32 @run()
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %call1)
%call = tail call i32 @parse(), !range !20
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !21
while.end: ; preds = %while.body, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !12}
!20 = !{i32 0, i32 2}
!21 = distinct !{!21, !12}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
typedef struct {
size_t idx;
uint64_t x;
uint64_t length;
} _xInfo;
int compare_f(const void *a, const void *b) {
return ((_xInfo *)a)->x < ((_xInfo *)b)->x ? -1 : 1;
}
int compare_f2(const void *a, const void *b) {
return ((_xInfo *)a)->idx < ((_xInfo *)b)->idx ? -1 : 1;
}
static size_t comb(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t gcd(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m%n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t s[100000], t[100000];
static _xInfo xInfo[100000];
int main(void) {
size_t A, B, Q;
scanf("%zu %zu %zu\n", &A, &B, &Q);
for (size_t i = 0; i < A; i++) {
scanf("%"PRIu64"\n", &s[i]);
}
for (size_t i = 0; i < B; i++) {
scanf("%"PRIu64"\n", &t[i]);
}
for (size_t i = 0; i < Q; i++) {
scanf("%"PRIu64, &xInfo[i].x);
xInfo[i].idx = i;
xInfo[i].length = 0;
if (i < Q - 1) {
scanf("\n");
}
}
qsort(xInfo, Q, sizeof(_xInfo), compare_f);
size_t aSeqIdx = 0;
size_t bSeqIdx = 0;
for (size_t i = 0; i < Q; i++) {
while (true) {
if (aSeqIdx == A - 1) {
break;
}
else if (s[aSeqIdx] <= xInfo[i].x && xInfo[i].x < s[aSeqIdx + 1]) {
break;
}
else if (aSeqIdx == 0 && xInfo[i].x < s[aSeqIdx]) {
break;
}
aSeqIdx++;
}
while (true) {
if (bSeqIdx == B - 1) {
break;
}
else if (t[bSeqIdx] <= xInfo[i].x && xInfo[i].x < t[bSeqIdx + 1]) {
break;
}
else if (bSeqIdx == 0 && xInfo[i].x < t[bSeqIdx]) {
break;
}
bSeqIdx++;
}
uint64_t min;
{
uint64_t length;
length = ABSS(xInfo[i].x, s[aSeqIdx]);
length += ABSS(s[aSeqIdx], t[bSeqIdx]);
min = length;
}
if (bSeqIdx < B - 1){
uint64_t length;
length = ABSS(xInfo[i].x, s[aSeqIdx]);
length += ABSS(s[aSeqIdx], t[bSeqIdx + 1]);
if (length < min) {
min = length;
}
}
if (aSeqIdx < A - 1) {
uint64_t length;
length = ABSS(xInfo[i].x, s[aSeqIdx + 1]);
length += ABSS(s[aSeqIdx + 1], t[bSeqIdx]);
if (length < min) {
min = length;
}
}
if (aSeqIdx < A - 1 && bSeqIdx < B - 1){
uint64_t length;
length = ABSS(xInfo[i].x, s[aSeqIdx + 1]);
length += ABSS(s[aSeqIdx + 1], t[bSeqIdx + 1]);
if (length < min) {
min = length;
}
}
{
uint64_t length;
length = ABSS(xInfo[i].x, t[bSeqIdx]);
length += ABSS(t[bSeqIdx], s[aSeqIdx]);
if (length < min) {
min = length;
}
}
if (aSeqIdx < A - 1) {
uint64_t length;
length = ABSS(xInfo[i].x, t[bSeqIdx]);
length += ABSS(t[bSeqIdx], s[aSeqIdx + 1]);
if (length < min) {
min = length;
}
}
if (bSeqIdx < B - 1) {
uint64_t length;
length = ABSS(xInfo[i].x, t[bSeqIdx + 1]);
length += ABSS(t[bSeqIdx + 1], s[aSeqIdx]);
if (length < min) {
min = length;
}
}
if (aSeqIdx < A - 1 && bSeqIdx < B - 1) {
uint64_t length;
length = ABSS(xInfo[i].x, t[bSeqIdx + 1]);
length += ABSS(t[bSeqIdx + 1], s[aSeqIdx + 1]);
if (length < min) {
min = length;
}
}
xInfo[i].length = min;
}
qsort(xInfo, Q, sizeof(_xInfo), compare_f2);
for (size_t idx = 0; idx < Q; idx++) {
printf("%"PRIu64"\n", xInfo[idx].length);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151231/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151231/source.c"
target datalayout = "e-m:e-p270: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._xInfo = type { i64, i64, i64 }
@.str = private unnamed_addr constant [13 x i8] c"%zu %zu %zu\0A\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lu\0A\00", align 1
@s = internal global [100000 x i64] zeroinitializer, align 16
@t = internal global [100000 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%lu\00", align 1
@xInfo = internal global [100000 x %struct._xInfo] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_f(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%x = getelementptr inbounds %struct._xInfo, ptr %a, i64 0, i32 1
%0 = load i64, ptr %x, align 8, !tbaa !5
%x1 = getelementptr inbounds %struct._xInfo, ptr %b, i64 0, i32 1
%1 = load i64, ptr %x1, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_f2(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !10
%1 = load i64, ptr %b, align 8, !tbaa !10
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%Q = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %Q) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %Q)
%0 = load i64, ptr %A, align 8, !tbaa !11
%cmp666.not = icmp eq i64 %0, 0
br i1 %cmp666.not, label %for.cond3.preheader, label %for.body
for.cond3.preheader: ; preds = %for.body, %entry
%1 = load i64, ptr %B, align 8, !tbaa !11
%cmp4668.not = icmp eq i64 %1, 0
br i1 %cmp4668.not, label %for.cond13.preheader, label %for.body6
for.body: ; preds = %entry, %for.body
%i.0667 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %i.0667
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw i64 %i.0667, 1
%2 = load i64, ptr %A, align 8, !tbaa !11
%cmp = icmp ult i64 %inc, %2
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !12
for.cond13.preheader: ; preds = %for.body6, %for.cond3.preheader
%3 = load i64, ptr %Q, align 8, !tbaa !11
%cmp14670.not = icmp eq i64 %3, 0
br i1 %cmp14670.not, label %for.cond.cleanup15, label %for.body16
for.body6: ; preds = %for.cond3.preheader, %for.body6
%i2.0669 = phi i64 [ %inc10, %for.body6 ], [ 0, %for.cond3.preheader ]
%arrayidx7 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %i2.0669
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx7)
%inc10 = add nuw i64 %i2.0669, 1
%4 = load i64, ptr %B, align 8, !tbaa !11
%cmp4 = icmp ult i64 %inc10, %4
br i1 %cmp4, label %for.body6, label %for.cond13.preheader, !llvm.loop !14
for.cond.cleanup15: ; preds = %for.inc23, %for.cond13.preheader
%.lcssa665 = phi i64 [ 0, %for.cond13.preheader ], [ %9, %for.inc23 ]
call void @qsort(ptr noundef nonnull @xInfo, i64 noundef %.lcssa665, i64 noundef 24, ptr noundef nonnull @compare_f) #6
%5 = load i64, ptr %Q, align 8, !tbaa !11
%cmp28688.not = icmp eq i64 %5, 0
br i1 %cmp28688.not, label %for.cond.cleanup29, label %while.cond.preheader.lr.ph
while.cond.preheader.lr.ph: ; preds = %for.cond.cleanup15
%6 = load i64, ptr %A, align 8, !tbaa !11
%sub31 = add i64 %6, -1
%7 = load i64, ptr %B, align 8, !tbaa !11
%sub57 = add i64 %7, -1
br label %while.cond.preheader
for.body16: ; preds = %for.cond13.preheader, %for.inc23
%i12.0671 = phi i64 [ %inc24, %for.inc23 ], [ 0, %for.cond13.preheader ]
%arrayidx17 = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %i12.0671
%x = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %i12.0671, i32 1
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x)
store i64 %i12.0671, ptr %arrayidx17, align 8, !tbaa !10
%length = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %i12.0671, i32 2
store i64 0, ptr %length, align 8, !tbaa !15
%8 = load i64, ptr %Q, align 8, !tbaa !11
%sub = add i64 %8, -1
%cmp21 = icmp ult i64 %i12.0671, %sub
br i1 %cmp21, label %if.then, label %for.inc23
if.then: ; preds = %for.body16
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3)
%.pre = load i64, ptr %Q, align 8, !tbaa !11
br label %for.inc23
for.inc23: ; preds = %for.body16, %if.then
%9 = phi i64 [ %8, %for.body16 ], [ %.pre, %if.then ]
%inc24 = add nuw i64 %i12.0671, 1
%cmp14 = icmp ult i64 %inc24, %9
br i1 %cmp14, label %for.body16, label %for.cond.cleanup15, !llvm.loop !16
while.cond.preheader: ; preds = %while.cond.preheader.lr.ph, %if.end415
%i26.0691 = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %inc419, %if.end415 ]
%bSeqIdx.0690 = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %bSeqIdx.1.lcssa, %if.end415 ]
%aSeqIdx.0689 = phi i64 [ 0, %while.cond.preheader.lr.ph ], [ %aSeqIdx.1.lcssa, %if.end415 ]
%cmp32672 = icmp eq i64 %aSeqIdx.0689, %sub31
br i1 %cmp32672, label %while.end, label %if.else.lr.ph
if.else.lr.ph: ; preds = %while.cond.preheader
%x36 = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %i26.0691, i32 1
%10 = load i64, ptr %x36, align 8, !tbaa !5
br label %if.else
for.cond.cleanup29: ; preds = %if.end415, %for.cond.cleanup15
call void @qsort(ptr noundef nonnull @xInfo, i64 noundef %5, i64 noundef 24, ptr noundef nonnull @compare_f2) #6
%11 = load i64, ptr %Q, align 8, !tbaa !11
%cmp423693.not = icmp eq i64 %11, 0
br i1 %cmp423693.not, label %for.cond.cleanup424, label %for.body425
if.else: ; preds = %if.else.lr.ph, %if.end53
%aSeqIdx.1673 = phi i64 [ %aSeqIdx.0689, %if.else.lr.ph ], [ %inc54.pre-phi, %if.end53 ]
%arrayidx34 = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %aSeqIdx.1673
%12 = load i64, ptr %arrayidx34, align 8, !tbaa !11
%cmp37.not = icmp ugt i64 %12, %10
br i1 %cmp37.not, label %if.else43, label %land.lhs.true
land.lhs.true: ; preds = %if.else
%add = add i64 %aSeqIdx.1673, 1
%arrayidx40 = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %add
%13 = load i64, ptr %arrayidx40, align 8, !tbaa !11
%cmp41 = icmp ult i64 %10, %13
br i1 %cmp41, label %while.end, label %if.end53
if.else43: ; preds = %if.else
%cmp44 = icmp eq i64 %aSeqIdx.1673, 0
br i1 %cmp44, label %while.end, label %if.else43.if.end53_crit_edge
if.else43.if.end53_crit_edge: ; preds = %if.else43
%.pre697 = add i64 %aSeqIdx.1673, 1
br label %if.end53
if.end53: ; preds = %if.else43.if.end53_crit_edge, %land.lhs.true
%inc54.pre-phi = phi i64 [ %.pre697, %if.else43.if.end53_crit_edge ], [ %add, %land.lhs.true ]
%cmp32 = icmp eq i64 %inc54.pre-phi, %sub31
br i1 %cmp32, label %while.end, label %if.else
while.end: ; preds = %if.end53, %land.lhs.true, %if.else43, %while.cond.preheader
%aSeqIdx.1.lcssa = phi i64 [ %sub31, %while.cond.preheader ], [ 0, %if.else43 ], [ %aSeqIdx.1673, %land.lhs.true ], [ %sub31, %if.end53 ]
%cmp58680 = icmp eq i64 %bSeqIdx.0690, %sub57
%x87.phi.trans.insert = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %i26.0691, i32 1
%.pre695 = load i64, ptr %x87.phi.trans.insert, align 8, !tbaa !5
br i1 %cmp58680, label %while.end84, label %if.else60
if.else60: ; preds = %while.end, %if.end82
%bSeqIdx.1681 = phi i64 [ %inc83.pre-phi, %if.end82 ], [ %bSeqIdx.0690, %while.end ]
%arrayidx61 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %bSeqIdx.1681
%14 = load i64, ptr %arrayidx61, align 8, !tbaa !11
%cmp64.not = icmp ugt i64 %14, %.pre695
br i1 %cmp64.not, label %if.else72, label %land.lhs.true65
land.lhs.true65: ; preds = %if.else60
%add68 = add i64 %bSeqIdx.1681, 1
%arrayidx69 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %add68
%15 = load i64, ptr %arrayidx69, align 8, !tbaa !11
%cmp70 = icmp ult i64 %.pre695, %15
br i1 %cmp70, label %while.end84, label %if.end82
if.else72: ; preds = %if.else60
%cmp73 = icmp eq i64 %bSeqIdx.1681, 0
br i1 %cmp73, label %while.end84, label %if.else72.if.end82_crit_edge
if.else72.if.end82_crit_edge: ; preds = %if.else72
%.pre696 = add i64 %bSeqIdx.1681, 1
br label %if.end82
if.end82: ; preds = %if.else72.if.end82_crit_edge, %land.lhs.true65
%inc83.pre-phi = phi i64 [ %.pre696, %if.else72.if.end82_crit_edge ], [ %add68, %land.lhs.true65 ]
%cmp58 = icmp eq i64 %inc83.pre-phi, %sub57
br i1 %cmp58, label %while.end84, label %if.else60
while.end84: ; preds = %if.end82, %land.lhs.true65, %if.else72, %while.end
%bSeqIdx.1.lcssa = phi i64 [ %sub57, %while.end ], [ 0, %if.else72 ], [ %bSeqIdx.1681, %land.lhs.true65 ], [ %sub57, %if.end82 ]
%arrayidx88 = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %aSeqIdx.1.lcssa
%16 = load i64, ptr %arrayidx88, align 8, !tbaa !11
%cmp89 = icmp ugt i64 %.pre695, %16
%sub93 = sub i64 %.pre695, %16
%sub97 = sub i64 %16, %.pre695
%cond = select i1 %cmp89, i64 %sub93, i64 %sub97
%arrayidx99 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %bSeqIdx.1.lcssa
%17 = load i64, ptr %arrayidx99, align 8, !tbaa !11
%cmp100 = icmp ugt i64 %16, %17
%sub104 = sub i64 %16, %17
%sub108 = sub i64 %17, %16
%cond110 = select i1 %cmp100, i64 %sub104, i64 %sub108
%add111 = add i64 %cond110, %cond
%cmp113 = icmp uge i64 %bSeqIdx.1.lcssa, %sub57
br i1 %cmp113, label %if.end152, label %if.then114
if.then114: ; preds = %while.end84
%add133 = add nuw i64 %bSeqIdx.1.lcssa, 1
%arrayidx134 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %add133
%18 = load i64, ptr %arrayidx134, align 8, !tbaa !11
%cmp135 = icmp ugt i64 %16, %18
%sub140 = sub i64 %16, %18
%sub145 = sub i64 %18, %16
%cond147 = select i1 %cmp135, i64 %sub140, i64 %sub145
%add148 = add i64 %cond147, %cond
%min.0 = call i64 @llvm.umin.i64(i64 %add148, i64 %add111)
br label %if.end152
if.end152: ; preds = %if.then114, %while.end84
%min.1 = phi i64 [ %min.0, %if.then114 ], [ %add111, %while.end84 ]
%cmp154 = icmp uge i64 %aSeqIdx.1.lcssa, %sub31
br i1 %cmp154, label %if.end246, label %land.lhs.true199
land.lhs.true199: ; preds = %if.end152
%add159 = add nuw i64 %aSeqIdx.1.lcssa, 1
%arrayidx160 = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %add159
%19 = load i64, ptr %arrayidx160, align 8, !tbaa !11
%cmp161 = icmp ugt i64 %.pre695, %19
%sub167 = sub i64 %.pre695, %19
%sub173 = sub i64 %19, %.pre695
%cond175 = select i1 %cmp161, i64 %sub167, i64 %sub173
%cmp179 = icmp ugt i64 %19, %17
%sub184 = sub i64 %19, %17
%sub189 = sub i64 %17, %19
%cond191 = select i1 %cmp179, i64 %sub184, i64 %sub189
%add192 = add i64 %cond175, %cond191
%min.2 = call i64 @llvm.umin.i64(i64 %add192, i64 %min.1)
br i1 %cmp113, label %if.end246, label %if.then202
if.then202: ; preds = %land.lhs.true199
%add225 = add nuw i64 %bSeqIdx.1.lcssa, 1
%arrayidx226 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %add225
%20 = load i64, ptr %arrayidx226, align 8, !tbaa !11
%cmp227 = icmp ugt i64 %19, %20
%sub233 = sub i64 %19, %20
%sub239 = sub i64 %20, %19
%cond241 = select i1 %cmp227, i64 %sub233, i64 %sub239
%add242 = add i64 %cond241, %cond175
%min.4 = call i64 @llvm.umin.i64(i64 %add242, i64 %min.2)
br label %if.end246
if.end246: ; preds = %if.end152, %if.then202, %land.lhs.true199
%min.5 = phi i64 [ %min.4, %if.then202 ], [ %min.2, %land.lhs.true199 ], [ %min.1, %if.end152 ]
%cmp251 = icmp ugt i64 %.pre695, %17
%sub256 = sub i64 %.pre695, %17
%sub261 = sub i64 %17, %.pre695
%cond263 = select i1 %cmp251, i64 %sub256, i64 %sub261
%cmp266 = icmp ugt i64 %17, %16
%cond276 = select i1 %cmp266, i64 %sub108, i64 %sub104
%add277 = add i64 %cond263, %cond276
%min.6 = call i64 @llvm.umin.i64(i64 %add277, i64 %min.5)
br i1 %cmp154, label %if.end321.thread, label %if.end321
if.end321: ; preds = %if.end246
%add302 = add nuw i64 %aSeqIdx.1.lcssa, 1
%arrayidx303 = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %add302
%21 = load i64, ptr %arrayidx303, align 8, !tbaa !11
%cmp304 = icmp ugt i64 %17, %21
%sub309 = sub i64 %17, %21
%sub314 = sub i64 %21, %17
%cond316 = select i1 %cmp304, i64 %sub309, i64 %sub314
%add317 = add i64 %cond316, %cond263
%min.7 = call i64 @llvm.umin.i64(i64 %add317, i64 %min.6)
br i1 %cmp113, label %if.end415, label %if.end365
if.end321.thread: ; preds = %if.end246
br i1 %cmp113, label %if.end415, label %if.end365
if.end365: ; preds = %if.end321.thread, %if.end321
%min.8662 = phi i64 [ %min.6, %if.end321.thread ], [ %min.7, %if.end321 ]
%add328 = add nuw i64 %bSeqIdx.1.lcssa, 1
%arrayidx329 = getelementptr inbounds [100000 x i64], ptr @t, i64 0, i64 %add328
%22 = load i64, ptr %arrayidx329, align 8, !tbaa !11
%cmp330 = icmp ugt i64 %.pre695, %22
%sub336 = sub i64 %.pre695, %22
%sub342 = sub i64 %22, %.pre695
%cond344 = select i1 %cmp330, i64 %sub336, i64 %sub342
%cmp348 = icmp ugt i64 %22, %16
%sub353 = sub i64 %22, %16
%sub358 = sub i64 %16, %22
%cond360 = select i1 %cmp348, i64 %sub353, i64 %sub358
%add361 = add i64 %cond344, %cond360
%min.9 = call i64 @llvm.umin.i64(i64 %add361, i64 %min.8662)
%brmerge = or i1 %cmp154, %cmp113
br i1 %brmerge, label %if.end415, label %if.then371
if.then371: ; preds = %if.end365
%add394 = add nuw i64 %aSeqIdx.1.lcssa, 1
%arrayidx395 = getelementptr inbounds [100000 x i64], ptr @s, i64 0, i64 %add394
%23 = load i64, ptr %arrayidx395, align 8, !tbaa !11
%cmp396 = icmp ugt i64 %22, %23
%sub402 = sub i64 %22, %23
%sub408 = sub i64 %23, %22
%cond410 = select i1 %cmp396, i64 %sub402, i64 %sub408
%add411 = add i64 %cond410, %cond344
%min.11 = call i64 @llvm.umin.i64(i64 %add411, i64 %min.9)
br label %if.end415
if.end415: ; preds = %if.end365, %if.end321, %if.end321.thread, %if.then371
%min.12 = phi i64 [ %min.11, %if.then371 ], [ %min.9, %if.end365 ], [ %min.6, %if.end321.thread ], [ %min.7, %if.end321 ]
%length417 = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %i26.0691, i32 2
store i64 %min.12, ptr %length417, align 8, !tbaa !15
%inc419 = add nuw i64 %i26.0691, 1
%exitcond.not = icmp eq i64 %inc419, %5
br i1 %exitcond.not, label %for.cond.cleanup29, label %while.cond.preheader, !llvm.loop !17
for.cond.cleanup424: ; preds = %for.body425, %for.cond.cleanup29
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %Q) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #6
ret i32 0
for.body425: ; preds = %for.cond.cleanup29, %for.body425
%idx421.0694 = phi i64 [ %inc430, %for.body425 ], [ 0, %for.cond.cleanup29 ]
%length427 = getelementptr inbounds [100000 x %struct._xInfo], ptr @xInfo, i64 0, i64 %idx421.0694, i32 2
%24 = load i64, ptr %length427, align 8, !tbaa !15
%call428 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %24)
%inc430 = add nuw i64 %idx421.0694, 1
%25 = load i64, ptr %Q, align 8, !tbaa !11
%cmp423 = icmp ult i64 %inc430, %25
br i1 %cmp423, label %for.body425, label %for.cond.cleanup424, !llvm.loop !18
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!6, !7, i64 16}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
|
// AOJ 2399: Save Your Privacy!
// 2017.10.4 bal4u@uu
#include <stdio.h>
#include <string.h>
int rel[101][101], sz[101];
int mk[101];
int main()
{
int n, i, j, x, m, p, ans;
while (scanf("%d", &n) && n > 0) {
memset(sz, 0, sizeof(sz));
memset(mk, 0, sizeof(mk));
for (i = 1; i <= n; i++) {
scanf("%d", &m);
for (j = 0; j < m; j++) {
scanf("%d", &p);
rel[p][sz[p]++] = i;
}
}
scanf("%d", &m);
for (i = 0; i < m; i++) {
scanf("%d", &p);
for (j = 0; j < sz[p]; j++) {
x = rel[p][j];
mk[x]++;
}
}
for (ans = -1, x = 1; x <= n; x++) {
if (mk[x] == m) {
if (ans < 0) ans = x;
else { ans = -1; goto Done; }
}
}
Done:
printf("%d\n", ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151275/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151275/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@sz = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@mk = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@rel = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
%call77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool78 = icmp ne i32 %call77, 0
%0 = load i32, ptr %n, align 4
%cmp79 = icmp sgt i32 %0, 0
%1 = select i1 %tobool78, i1 %cmp79, i1 false
br i1 %1, label %for.body.preheader, label %while.end
for.body.preheader: ; preds = %entry, %Done
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @sz, i8 0, i64 404, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @mk, i8 0, i64 404, i1 false)
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc12
%i.067 = phi i32 [ %inc13, %for.inc12 ], [ 1, %for.body.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp464 = icmp sgt i32 %2, 0
br i1 %cmp464, label %for.body5, label %for.inc12
for.body5: ; preds = %for.body, %for.body5
%j.065 = phi i32 [ %inc11, %for.body5 ], [ 0, %for.body ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%3 = load i32, ptr %p, align 4, !tbaa !5
%idxprom = sext i32 %3 to i64
%arrayidx8 = getelementptr inbounds [101 x i32], ptr @sz, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %arrayidx8, align 4, !tbaa !5
%idxprom9 = sext i32 %4 to i64
%arrayidx10 = getelementptr inbounds [101 x [101 x i32]], ptr @rel, i64 0, i64 %idxprom, i64 %idxprom9
store i32 %i.067, ptr %arrayidx10, align 4, !tbaa !5
%inc11 = add nuw nsw i32 %j.065, 1
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc11, %5
br i1 %cmp4, label %for.body5, label %for.inc12, !llvm.loop !9
for.inc12: ; preds = %for.body5, %for.body
%inc13 = add nuw nsw i32 %i.067, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp1.not.not = icmp slt i32 %i.067, %6
br i1 %cmp1.not.not, label %for.body, label %for.end14, !llvm.loop !11
for.end14: ; preds = %for.inc12
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%7 = load i32, ptr %m, align 4, !tbaa !5
%cmp1770 = icmp sgt i32 %7, 0
br i1 %cmp1770, label %for.body18, label %for.cond38.preheader
for.cond38.preheader: ; preds = %for.inc35, %for.end14
%.lcssa = phi i32 [ %7, %for.end14 ], [ %19, %for.inc35 ]
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp39.not72 = icmp slt i32 %8, 1
br i1 %cmp39.not72, label %Done, label %for.body40.preheader
for.body40.preheader: ; preds = %for.cond38.preheader
%9 = add nuw i32 %8, 1
%wide.trip.count85 = zext i32 %9 to i64
br label %for.body40
for.body18: ; preds = %for.end14, %for.inc35
%i.171 = phi i32 [ %inc36, %for.inc35 ], [ 0, %for.end14 ]
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%10 = load i32, ptr %p, align 4, !tbaa !5
%idxprom21 = sext i32 %10 to i64
%arrayidx22 = getelementptr inbounds [101 x i32], ptr @sz, i64 0, i64 %idxprom21
%11 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp2368 = icmp sgt i32 %11, 0
br i1 %cmp2368, label %for.body24.preheader, label %for.inc35
for.body24.preheader: ; preds = %for.body18
%wide.trip.count = zext i32 %11 to i64
%xtraiter = and i64 %wide.trip.count, 1
%12 = icmp eq i32 %11, 1
br i1 %12, label %for.inc35.loopexit.unr-lcssa, label %for.body24.preheader.new
for.body24.preheader.new: ; preds = %for.body24.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body24
for.body24: ; preds = %for.body24, %for.body24.preheader.new
%indvars.iv = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next.1, %for.body24 ]
%niter = phi i64 [ 0, %for.body24.preheader.new ], [ %niter.next.1, %for.body24 ]
%arrayidx28 = getelementptr inbounds [101 x [101 x i32]], ptr @rel, i64 0, i64 %idxprom21, i64 %indvars.iv
%13 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%idxprom29 = sext i32 %13 to i64
%arrayidx30 = getelementptr inbounds [101 x i32], ptr @mk, i64 0, i64 %idxprom29
%14 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%inc31 = add nsw i32 %14, 1
store i32 %inc31, ptr %arrayidx30, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx28.1 = getelementptr inbounds [101 x [101 x i32]], ptr @rel, i64 0, i64 %idxprom21, i64 %indvars.iv.next
%15 = load i32, ptr %arrayidx28.1, align 4, !tbaa !5
%idxprom29.1 = sext i32 %15 to i64
%arrayidx30.1 = getelementptr inbounds [101 x i32], ptr @mk, i64 0, i64 %idxprom29.1
%16 = load i32, ptr %arrayidx30.1, align 4, !tbaa !5
%inc31.1 = add nsw i32 %16, 1
store i32 %inc31.1, ptr %arrayidx30.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.inc35.loopexit.unr-lcssa, label %for.body24, !llvm.loop !12
for.inc35.loopexit.unr-lcssa: ; preds = %for.body24, %for.body24.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next.1, %for.body24 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc35, label %for.body24.epil
for.body24.epil: ; preds = %for.inc35.loopexit.unr-lcssa
%arrayidx28.epil = getelementptr inbounds [101 x [101 x i32]], ptr @rel, i64 0, i64 %idxprom21, i64 %indvars.iv.unr
%17 = load i32, ptr %arrayidx28.epil, align 4, !tbaa !5
%idxprom29.epil = sext i32 %17 to i64
%arrayidx30.epil = getelementptr inbounds [101 x i32], ptr @mk, i64 0, i64 %idxprom29.epil
%18 = load i32, ptr %arrayidx30.epil, align 4, !tbaa !5
%inc31.epil = add nsw i32 %18, 1
store i32 %inc31.epil, ptr %arrayidx30.epil, align 4, !tbaa !5
br label %for.inc35
for.inc35: ; preds = %for.body24.epil, %for.inc35.loopexit.unr-lcssa, %for.body18
%inc36 = add nuw nsw i32 %i.171, 1
%19 = load i32, ptr %m, align 4, !tbaa !5
%cmp17 = icmp slt i32 %inc36, %19
br i1 %cmp17, label %for.body18, label %for.cond38.preheader, !llvm.loop !13
for.body40: ; preds = %for.body40.preheader, %for.inc47
%indvars.iv82 = phi i64 [ 1, %for.body40.preheader ], [ %indvars.iv.next83, %for.inc47 ]
%ans.074 = phi i32 [ -1, %for.body40.preheader ], [ %ans.1, %for.inc47 ]
%arrayidx42 = getelementptr inbounds [101 x i32], ptr @mk, i64 0, i64 %indvars.iv82
%20 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%cmp43 = icmp eq i32 %20, %.lcssa
br i1 %cmp43, label %if.then, label %for.inc47
if.then: ; preds = %for.body40
%cmp44 = icmp slt i32 %ans.074, 0
%21 = trunc i64 %indvars.iv82 to i32
br i1 %cmp44, label %for.inc47, label %Done
for.inc47: ; preds = %if.then, %for.body40
%ans.1 = phi i32 [ %ans.074, %for.body40 ], [ %21, %if.then ]
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
br i1 %exitcond86.not, label %Done, label %for.body40, !llvm.loop !14
Done: ; preds = %for.inc47, %if.then, %for.cond38.preheader
%ans.2 = phi i32 [ -1, %for.cond38.preheader ], [ -1, %if.then ], [ %ans.1, %for.inc47 ]
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool = icmp ne i32 %call, 0
%22 = load i32, ptr %n, align 4
%cmp = icmp sgt i32 %22, 0
%23 = select i1 %tobool, i1 %cmp, i1 false
br i1 %23, label %for.body.preheader, label %while.end, !llvm.loop !15
while.end: ; preds = %Done, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
/* ABC174 B */
#include<stdio.h>
int main(void){
int n, i, count=0;
long long d, x, y;
scanf("%d %lld", &n, &d);
for(i=0; i<n; i++){
scanf("%lld %lld", &x, &y);
if(x*x+y*y <= d*d){
count++;
}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151318/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151318/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%d %lld\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%count.011 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%i.010 = phi i32 [ %inc5, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i64, ptr %x, align 8, !tbaa !9
%mul = mul nsw i64 %1, %1
%2 = load i64, ptr %y, align 8, !tbaa !9
%mul2 = mul nsw i64 %2, %2
%add = add nuw nsw i64 %mul2, %mul
%3 = load i64, ptr %d, align 8, !tbaa !9
%mul3 = mul nsw i64 %3, %3
%cmp4.not = icmp ule i64 %add, %mul3
%inc = zext i1 %cmp4.not to i32
%spec.select = add nuw nsw i32 %count.011, %inc
%inc5 = add nuw nsw i32 %i.010, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc5, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main() {
long n, d, x, y, a, count = 0;
scanf("%ld", &n);
scanf("%ld", &d);
for (a = 0; a < n; a++) {
scanf("%ld", &x);
scanf("%ld", &y);
if ( sqrt(x*x+y*y)<=d) {
count++;
}
}
printf("%ld\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151361/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%d = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4
%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 %d)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp13 = icmp sgt i64 %0, 0
br i1 %cmp13, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%count.015 = phi i64 [ %count.1, %for.body ], [ 0, %entry ]
%a.014 = phi i64 [ %inc9, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%1 = load i64, ptr %x, align 8, !tbaa !5
%mul = mul nsw i64 %1, %1
%2 = load i64, ptr %y, align 8, !tbaa !5
%mul4 = mul nsw i64 %2, %2
%add = add nuw nsw i64 %mul4, %mul
%conv = sitofp i64 %add to double
%call5 = call double @sqrt(double noundef %conv) #4
%3 = load i64, ptr %d, align 8, !tbaa !5
%conv6 = sitofp i64 %3 to double
%cmp7 = fcmp ole double %call5, %conv6
%inc = zext i1 %cmp7 to i64
%count.1 = add nuw nsw i64 %count.015, %inc
%inc9 = add nuw nsw i64 %a.014, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc9, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%count.0.lcssa = phi i64 [ 0, %entry ], [ %count.1, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double 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(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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main()
{
long long int i,n,d,c=0;
scanf("%lld%lld",&n,&d);
for(i=0;i<n;i++)
{
double j;
long long int p,q;
scanf("%lld%lld",&p,&q);
j=sqrt((p*p)+(q*q));
if(j<=d)
{
c++;
}
}
printf("%lld\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151404/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%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:
%n = alloca i64, align 8
%d = alloca i64, align 8
%p = alloca i64, align 8
%q = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp11 = icmp sgt i64 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.013 = phi i64 [ %inc7, %for.body ], [ 0, %entry ]
%c.012 = phi i64 [ %c.1, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p, ptr noundef nonnull %q)
%1 = load i64, ptr %p, align 8, !tbaa !5
%mul = mul nsw i64 %1, %1
%2 = load i64, ptr %q, align 8, !tbaa !5
%mul2 = mul nsw i64 %2, %2
%add = add nuw nsw i64 %mul2, %mul
%conv = sitofp i64 %add to double
%call3 = call double @sqrt(double noundef %conv) #4
%3 = load i64, ptr %d, align 8, !tbaa !5
%conv4 = sitofp i64 %3 to double
%cmp5 = fcmp ole double %call3, %conv4
%inc = zext i1 %cmp5 to i64
%c.1 = add nuw nsw i64 %c.012, %inc
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p) #4
%inc7 = add nuw nsw i64 %i.013, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc7, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%c.0.lcssa = phi i64 [ 0, %entry ], [ %c.1, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double 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(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 #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>
#include <stdlib.h>
#include <math.h>
#define rep(i,r,l) for(int i = r; i < l; i++)
#define elif else if
#define ll long long
int nextint(void){ll int n;scanf("%lld",&n);return n;}
void printint(ll int d){printf("%lld\n",d);}
int main(void){
ll d,n;
int count=0;
scanf("%lld %lld",&n,&d);
ll x ,y;
rep(i,0,n){
scanf("%lld %lld",&x,&y);
if(x*x+y*y<=d*d)count++;
}
printint(count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151455/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151455/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@.str.2 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @nextint() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%conv = trunc i64 %0 to i32
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 %conv
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @printint(i64 noundef %d) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %d)
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 i32 @main() local_unnamed_addr #0 {
entry:
%d = alloca i64, align 8
%n = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n, ptr noundef nonnull %d)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp11 = icmp sgt i64 %0, 0
br i1 %cmp11, label %for.body, label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %for.body
%1 = zext i32 %spec.select to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%count.0.lcssa = phi i64 [ 0, %entry ], [ %1, %for.cond.cleanup.loopexit ]
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%count.012 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y)
%2 = load i64, ptr %x, align 8, !tbaa !5
%mul = mul nsw i64 %2, %2
%3 = load i64, ptr %y, align 8, !tbaa !5
%mul3 = mul nsw i64 %3, %3
%add = add nuw nsw i64 %mul3, %mul
%4 = load i64, ptr %d, align 8, !tbaa !5
%mul4 = mul nsw i64 %4, %4
%cmp5.not = icmp ule i64 %add, %mul4
%inc = zext i1 %cmp5.not to i32
%spec.select = add nuw nsw i32 %count.012, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %5, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !9
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main()
{
long int x, y, n, res=0;
double dis;
scanf("%ld %lf",&n,&dis);
for(int i=0; i<n; i++){
scanf("%ld %ld",&x,&y);
if(sqrt(x*x + y*y)<=dis){
res++;
}
}
printf("%ld\n",res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_151499/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_151499/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %lf\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
%y = alloca i64, align 8
%n = alloca i64, align 8
%dis = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %dis) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %dis)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp12 = icmp sgt i64 %0, 0
br i1 %cmp12, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%res.0.lcssa = phi i64 [ 0, %entry ], [ %res.1, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %res.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %dis) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%res.013 = phi i64 [ %res.1, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i64, ptr %x, align 8, !tbaa !5
%mul = mul nsw i64 %1, %1
%2 = load i64, ptr %y, align 8, !tbaa !5
%mul3 = mul nsw i64 %2, %2
%add = add nuw nsw i64 %mul3, %mul
%conv4 = sitofp i64 %add to double
%call5 = call double @sqrt(double noundef %conv4) #4
%3 = load double, ptr %dis, align 8, !tbaa !9
%cmp6 = fcmp ole double %call5, %3
%inc = zext i1 %cmp6 to i64
%res.1 = add nuw nsw i64 %res.013, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %4, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double 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(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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.