Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
void swap(long *x, long *y){
long tmp = *x;
*x = *y;
*y = tmp;
}
int main(void){
while(1){
long a, b;
long count=0;
scanf(" %ld %ld", &a, &b);
if(a==0 && b==0) break;
if(a<b) swap(&a, &b);
while(b!=0){
a = a%b;
swap(&a, &b);
count++;
}
printf("%ld %ld\n", a, count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143687/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143687/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%ld %ld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
store i64 %1, ptr %x, align 8, !tbaa !5
store i64 %0, ptr %y, 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 i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i64, align 8
%b = alloca i64, 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
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp18 = icmp eq i64 %0, 0
%1 = load i64, ptr %b, align 8
%cmp119 = icmp eq i64 %1, 0
%or.cond20 = select i1 %cmp18, i1 %cmp119, i1 false
br i1 %or.cond20, label %while.end11, label %if.end
if.end: ; preds = %entry, %cleanup
%2 = phi i64 [ %8, %cleanup ], [ %1, %entry ]
%3 = phi i64 [ %7, %cleanup ], [ %0, %entry ]
%cmp2 = icmp slt i64 %3, %2
br i1 %cmp2, label %if.then3, label %if.end4
if.then3: ; preds = %if.end
store i64 %2, ptr %a, align 8, !tbaa !5
store i64 %3, ptr %b, align 8, !tbaa !5
br label %if.end4
if.end4: ; preds = %if.then3, %if.end
%a.promoted = phi i64 [ %2, %if.then3 ], [ %3, %if.end ]
%.pr = phi i64 [ %3, %if.then3 ], [ %2, %if.end ]
%cmp6.not15 = icmp eq i64 %.pr, 0
br i1 %cmp6.not15, label %cleanup, label %while.body7
while.body7: ; preds = %if.end4, %while.body7
%count.016 = phi i64 [ %inc, %while.body7 ], [ 0, %if.end4 ]
%4 = phi i64 [ %rem, %while.body7 ], [ %.pr, %if.end4 ]
%5 = phi i64 [ %4, %while.body7 ], [ %a.promoted, %if.end4 ]
%rem = srem i64 %5, %4
%inc = add nuw nsw i64 %count.016, 1
%cmp6.not = icmp eq i64 %rem, 0
br i1 %cmp6.not, label %while.cond5.cleanup_crit_edge, label %while.body7, !llvm.loop !9
while.cond5.cleanup_crit_edge: ; preds = %while.body7
store i64 %4, ptr %a, align 8, !tbaa !5
store i64 0, ptr %b, align 8, !tbaa !5
br label %cleanup
cleanup: ; preds = %while.cond5.cleanup_crit_edge, %if.end4
%6 = phi i64 [ %4, %while.cond5.cleanup_crit_edge ], [ %a.promoted, %if.end4 ]
%count.0.lcssa = phi i64 [ %inc, %while.cond5.cleanup_crit_edge ], [ 0, %if.end4 ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %6, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
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)
%7 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %7, 0
%8 = load i64, ptr %b, align 8
%cmp1 = icmp eq i64 %8, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end11, label %if.end
while.end11: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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>
// Check Examples
//Compiler version gcc 6.3.0
int main()
{
int q; scanf("%d", &q);
int a;
for(int i = 0; i < q; i++){
int sum = 0;
int n; scanf("%d", &n);
for(int j = 0; j < n; j++){
scanf("%d", &a);
sum+=a;
}
if(sum%n)printf("%d\n", sum/n + 1);
else printf("%d\n", sum/n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14373/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14373/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%q = alloca i32, align 4
%a = alloca i32, align 4
%n = alloca i32, align 4
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 4, ptr nonnull %a) #3
%0 = load i32, ptr %q, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup4, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
ret i32 0
for.body: ; preds = %entry, %for.cond.cleanup4
%i.024 = phi i32 [ %inc12, %for.cond.cleanup4 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp319 = icmp sgt i32 %1, 0
br i1 %cmp319, label %for.body5, label %for.cond.cleanup4
for.cond.cleanup4: ; preds = %for.body5, %for.body
%sum.0.lcssa = phi i32 [ 0, %for.body ], [ %add, %for.body5 ]
%.lcssa = phi i32 [ %1, %for.body ], [ %4, %for.body5 ]
%rem = srem i32 %sum.0.lcssa, %.lcssa
%tobool.not = icmp ne i32 %rem, 0
%div9 = sdiv i32 %sum.0.lcssa, %.lcssa
%add7 = zext i1 %tobool.not to i32
%div9.sink = add nsw i32 %div9, %add7
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div9.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%inc12 = add nuw nsw i32 %i.024, 1
%2 = load i32, ptr %q, align 4, !tbaa !5
%cmp = icmp slt i32 %inc12, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body5: ; preds = %for.body, %for.body5
%j.021 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body ]
%sum.020 = phi i32 [ %add, %for.body5 ], [ 0, %for.body ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %3, %sum.020
%inc = add nuw nsw i32 %j.021, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %4
br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 <stdlib.h>
#include <stdbool.h>
#include <math.h>
int main(void){
int a, b;
scanf("%d%d", &a, &b);
if((a + b) % 2 == 0){
printf("%d\n", (a+b) / 2);
}else{
printf("%d\n", (a+b) / 2 + 1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143801/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143801/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, 1
%div = sdiv i32 %add, 2
%add5.sink = add nsw i32 %div, %2
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add5.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include "stdio.h"
int main(void){
int a,b,x;
scanf("%d %d", &a, &b );
x = (a + b + 1) / 2;
printf("%d\n", x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143845/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143845/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %0, 1
%add1 = add i32 %add, %1
%div = sdiv i32 %add1, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
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, c;
scanf("%d %d", &a, &b);
c = a + b;
if(c % 2){
printf("%d\n", c / 2 + 1);
}else printf("%d\n", c / 2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143889/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143889/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, 1
%div3 = sdiv i32 %add, 2
%div3.sink = add nsw i32 %div3, %2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div3.sink)
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()
{
double a, b, d, e;
int c;
scanf("%lf%lf", &a, &b);
e = (a + b) / 2;
c = (a + b) / 2;
d = e - c;
if (d >= 0.5)
{
c = c + 1;
printf("%d", c);
}
else
{
printf("%d", c);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143931/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143931/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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, !tbaa !5
%add = fadd double %0, %1
%div = fmul double %add, 5.000000e-01
%conv = fptosi double %div to i32
%conv3 = sitofp i32 %conv to double
%sub = fsub double %div, %conv3
%cmp = fcmp oge double %sub, 5.000000e-01
%add5 = zext i1 %cmp to i32
%conv.sink = add nsw i32 %conv, %add5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.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()
{
float k;
int a,b,c;
scanf("%d%d",&a,&b);
k=(float)(a+b)/2;
c=k;
if(c+0.5==k)
{c++;
printf("%d",c);
}else{
if(c+0.5<k)
{c++;
printf("%d",c+1);
}else{
printf("%d",c);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_143975/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_143975/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%conv = sitofp i32 %add to float
%div = fmul float %conv, 5.000000e-01
%conv1 = fptosi float %div to i32
%conv2 = sitofp i32 %conv1 to double
%add3 = fadd double %conv2, 5.000000e-01
%conv4 = fpext float %div to double
%cmp = fcmp oeq double %add3, %conv4
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%inc = add nsw i32 %conv1, 1
br label %if.end18
if.else: ; preds = %entry
%cmp10 = fcmp olt double %add3, %conv4
br i1 %cmp10, label %if.then12, label %if.end18
if.then12: ; preds = %if.else
%add14 = add nsw i32 %conv1, 2
br label %if.end18
if.end18: ; preds = %if.else, %if.then12, %if.then
%add14.sink = phi i32 [ %add14, %if.then12 ], [ %inc, %if.then ], [ %conv1, %if.else ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add14.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a,b,ans;
scanf("%d%d",&a,&b);
ans=(a+b)/2;
if((a+b)%2==0){
printf("%d",ans);
return 0;
}
else{
printf("%d",ans+1);
return 0;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144017/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144017/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%2 = and i32 %add, 1
%add3.sink = add nsw i32 %div, %2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add3.sink)
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>
#include <math.h>
int main(void) {
int a, b, c;
scanf("%d%d",&a, &b);
c = ceil((a + b) / 2.0);
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144068/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144068/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%conv = sitofp i32 %add to double
%div = fmul double %conv, 5.000000e-01
%2 = call double @llvm.ceil.f64(double %div)
%conv1 = fptosi double %2 to i32
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv1)
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 speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b,x;
scanf("%d",&a);
scanf("%d",&b);
if((a+b)%2==0) x = (a+b)/2;
if((a+b)%2!=0) x = (a+b)/2+1;
printf("%d",x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144118/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144118/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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 %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, 1
%div = sdiv i32 %add, 2
%spec.select = add nsw i32 %div, %2
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,m=1,s,i,j,p[50000]={1,1},d[5200]={2};
for(i=2;i*2<50000;i++)
p[2*i]=1;
for(i=3;i<50000;i+=2)
if(p[i]==0)
{
d[m++]=i;
for(j=i*2;j<50000;j+=i)
p[j]=1;
}
while(1)
{
s=0;
scanf("%d",&n);
if(!n)
break;
for(i=0;d[i]<=n/2;i++)
if(n-d[i]>1&&!p[n-d[i]])
s++;
printf("%d\n",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144161/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144161/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [50000 x i32], align 16
%d = alloca [5200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %p) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200000) %p, i8 0, i64 200000, i1 false)
%0 = getelementptr inbounds <{ i32, i32, [49998 x i32] }>, ptr %p, i64 0, i32 1
store i32 1, ptr %0, align 4
call void @llvm.lifetime.start.p0(i64 20800, ptr nonnull %d) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20800) %d, i8 0, i64 20800, i1 false)
store i32 2, ptr %d, align 16
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next.1, %for.body ]
%1 = shl nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [50000 x i32], ptr %p, i64 0, i64 %1
store i32 1, ptr %arrayidx, align 16, !tbaa !5
%indvars.iv.next = shl nuw i64 %indvars.iv, 1
%2 = or i64 %indvars.iv.next, 2
%arrayidx.1 = getelementptr inbounds [50000 x i32], ptr %p, i64 0, i64 %2
store i32 1, ptr %arrayidx.1, align 8, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 25000
br i1 %exitcond.not.1, label %for.body4, label %for.body, !llvm.loop !9
while.cond.preheader: ; preds = %for.inc19
%call69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%3 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not70 = icmp eq i32 %3, 0
br i1 %tobool.not70, label %while.end, label %for.cond24.preheader.lr.ph
for.cond24.preheader.lr.ph: ; preds = %while.cond.preheader
%4 = load i32, ptr %d, align 16, !tbaa !5
br label %for.cond24.preheader
for.body4: ; preds = %for.body, %for.inc19
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.inc19 ], [ 3, %for.body ]
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.inc19 ], [ 6, %for.body ]
%m.063 = phi i32 [ %m.1, %for.inc19 ], [ 1, %for.body ]
%arrayidx6 = getelementptr inbounds [50000 x i32], ptr %p, i64 0, i64 %indvars.iv75
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %5, 0
br i1 %cmp7, label %if.then, label %for.inc19
if.then: ; preds = %for.body4
%inc8 = add nsw i32 %m.063, 1
%idxprom9 = sext i32 %m.063 to i64
%arrayidx10 = getelementptr inbounds [5200 x i32], ptr %d, i64 0, i64 %idxprom9
%6 = trunc i64 %indvars.iv75 to i32
store i32 %6, ptr %arrayidx10, align 4, !tbaa !5
%cmp1361 = icmp ult i64 %indvars.iv75, 25000
br i1 %cmp1361, label %for.body14, label %for.inc19
for.body14: ; preds = %if.then, %for.body14
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body14 ], [ %indvars.iv73, %if.then ]
%arrayidx16 = getelementptr inbounds [50000 x i32], ptr %p, i64 0, i64 %indvars.iv77
store i32 1, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, %indvars.iv75
%cmp13 = icmp ult i64 %indvars.iv.next78, 50000
br i1 %cmp13, label %for.body14, label %for.inc19, !llvm.loop !11
for.inc19: ; preds = %for.body14, %if.then, %for.body4
%m.1 = phi i32 [ %m.063, %for.body4 ], [ %inc8, %if.then ], [ %inc8, %for.body14 ]
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 2
%cmp3 = icmp ult i64 %indvars.iv75, 49998
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 4
br i1 %cmp3, label %for.body4, label %while.cond.preheader, !llvm.loop !12
for.cond24.preheader: ; preds = %for.cond24.preheader.lr.ph, %for.end43
%7 = phi i32 [ %3, %for.cond24.preheader.lr.ph ], [ %11, %for.end43 ]
%div = sdiv i32 %7, 2
%cmp27.not66 = icmp sgt i32 %4, %div
br i1 %cmp27.not66, label %for.end43, label %for.body28
for.body28: ; preds = %for.cond24.preheader, %for.inc41
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.inc41 ], [ 0, %for.cond24.preheader ]
%8 = phi i32 [ %10, %for.inc41 ], [ %4, %for.cond24.preheader ]
%s.067 = phi i32 [ %s.1, %for.inc41 ], [ 0, %for.cond24.preheader ]
%sub = sub nsw i32 %7, %8
%cmp31 = icmp sgt i32 %sub, 1
br i1 %cmp31, label %land.lhs.true, label %for.inc41
land.lhs.true: ; preds = %for.body28
%idxprom35 = zext i32 %sub to i64
%arrayidx36 = getelementptr inbounds [50000 x i32], ptr %p, i64 0, i64 %idxprom35
%9 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%tobool37.not = icmp eq i32 %9, 0
%inc39 = zext i1 %tobool37.not to i32
%spec.select = add nsw i32 %s.067, %inc39
br label %for.inc41
for.inc41: ; preds = %land.lhs.true, %for.body28
%s.1 = phi i32 [ %s.067, %for.body28 ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%arrayidx26 = getelementptr inbounds [5200 x i32], ptr %d, i64 0, i64 %indvars.iv.next82
%10 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %10, %div
br i1 %cmp27.not, label %for.end43, label %for.body28, !llvm.loop !13
for.end43: ; preds = %for.inc41, %for.cond24.preheader
%s.0.lcssa = phi i32 [ 0, %for.cond24.preheader ], [ %s.1, %for.inc41 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%11 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %11, 0
br i1 %tobool.not, label %while.end, label %for.cond24.preheader
while.end: ; preds = %for.end43, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 20800, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int b_search(int bottom, int top, int x, int array[]) {
int mid = (bottom + top) / 2;
do {
if(array[mid] == x)
return mid;
else if(array[mid] > x)
top = mid;
else
bottom = mid;
mid = (bottom + top) / 2;
} while(mid != bottom);
if(array[mid] == x)
return mid;
return -1;
}
int main() {
int prime[60000] = {1, 1};
int prime_num[10000] = {0};
int num;
int i, j;
int n;
int ans;
int temp;
for(i = 2; i < 60000; i++)
if(!prime[i])
for(j = 2; i * j < 60000; j++)
prime[i * j] = 1;
for(i = 0, num = 0; i < 60000; i++) {
if(!prime[i]) {
prime_num[num] = i;
num++;
}
}
while(1) {
ans = 0;
scanf("%d", &n);
if(n == 0)
break;
if(n % 2 == 1) {
if(b_search(0, num, n - 2, prime_num) >= 0)
ans++;
}
else {
for(i = 0; prime_num[i] * 2 <= n; i++) {
if(b_search(0, num, n - prime_num[i], prime_num) >= 0) {
ans++;
}
}
}
printf("%d\n", ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144248/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144248/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @b_search(i32 noundef %bottom, i32 noundef %top, i32 noundef %x, ptr nocapture noundef readonly %array) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %top, %bottom
%div = sdiv i32 %add, 2
br label %do.body
do.body: ; preds = %if.else, %entry
%top.addr.0 = phi i32 [ %top, %entry ], [ %mid.0.top.addr.0, %if.else ]
%bottom.addr.0 = phi i32 [ %bottom, %entry ], [ %bottom.addr.0.mid.0, %if.else ]
%mid.0 = phi i32 [ %div, %entry ], [ %div8, %if.else ]
%idxprom = sext i32 %mid.0 to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %x
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %do.body
%cmp3 = icmp sgt i32 %0, %x
%mid.0.top.addr.0 = select i1 %cmp3, i32 %mid.0, i32 %top.addr.0
%bottom.addr.0.mid.0 = select i1 %cmp3, i32 %bottom.addr.0, i32 %mid.0
%add7 = add nsw i32 %bottom.addr.0.mid.0, %mid.0.top.addr.0
%div8 = sdiv i32 %add7, 2
%cmp9.not = icmp eq i32 %div8, %bottom.addr.0.mid.0
br i1 %cmp9.not, label %do.end, label %do.body, !llvm.loop !9
do.end: ; preds = %if.else
%idxprom10 = sext i32 %bottom.addr.0.mid.0 to i64
%arrayidx11 = getelementptr inbounds i32, ptr %array, i64 %idxprom10
%1 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp eq i32 %1, %x
%div8. = select i1 %cmp12, i32 %bottom.addr.0.mid.0, i32 -1
br label %cleanup
cleanup: ; preds = %do.body, %do.end
%retval.0 = phi i32 [ %div8., %do.end ], [ %mid.0, %do.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%prime = alloca [60000 x i32], align 16
%prime_num = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 240000, ptr nonnull %prime) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240000) %prime, i8 0, i64 240000, i1 false)
store i32 1, ptr %prime, align 16
%0 = getelementptr inbounds <{ i32, i32, [59998 x i32] }>, ptr %prime, i64 0, i32 1
store i32 1, ptr %0, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %prime_num) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) %prime_num, i8 0, i64 40000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
br label %for.body
for.body: ; preds = %entry, %for.inc7
%indvars.iv114 = phi i64 [ 2, %entry ], [ %indvars.iv.next115, %for.inc7 ]
%indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx = getelementptr inbounds [60000 x i32], ptr %prime, i64 0, i64 %indvars.iv114
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%tobool.not = icmp eq i32 %1, 0
%cmp2100 = icmp ult i64 %indvars.iv114, 30000
%or.cond = and i1 %tobool.not, %cmp2100
br i1 %or.cond, label %for.body3, label %for.inc7
for.body3: ; preds = %for.body, %for.body3
%indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.body3 ], [ 2, %for.body ]
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.body3 ], [ %indvars.iv, %for.body ]
%arrayidx6 = getelementptr inbounds [60000 x i32], ptr %prime, i64 0, i64 %indvars.iv116
store i32 1, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%2 = mul nuw nsw i64 %indvars.iv.next119, %indvars.iv114
%indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, %indvars.iv114
%cmp2 = icmp ult i64 %2, 60000
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !11
for.inc7: ; preds = %for.body3, %for.body
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%exitcond.not = icmp eq i64 %indvars.iv.next115, 60000
br i1 %exitcond.not, label %for.body12, label %for.body, !llvm.loop !12
while.cond.preheader: ; preds = %for.inc21.1
%call110 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp24111 = icmp eq i32 %3, 0
br i1 %cmp24111, label %while.end, label %if.end26.lr.ph
if.end26.lr.ph: ; preds = %while.cond.preheader
%4 = load i32, ptr %prime_num, align 16
%mul37106 = shl nsw i32 %4, 1
%div.i74 = sdiv i32 %num.1.1, 2
br label %if.end26
for.body12: ; preds = %for.inc7, %for.inc21.1
%indvars.iv125 = phi i64 [ %indvars.iv.next126.1, %for.inc21.1 ], [ 0, %for.inc7 ]
%num.0105 = phi i32 [ %num.1.1, %for.inc21.1 ], [ 0, %for.inc7 ]
%arrayidx14 = getelementptr inbounds [60000 x i32], ptr %prime, i64 0, i64 %indvars.iv125
%5 = load i32, ptr %arrayidx14, align 8, !tbaa !5
%tobool15.not = icmp eq i32 %5, 0
br i1 %tobool15.not, label %if.then16, label %for.inc21
if.then16: ; preds = %for.body12
%idxprom17 = sext i32 %num.0105 to i64
%arrayidx18 = getelementptr inbounds [10000 x i32], ptr %prime_num, i64 0, i64 %idxprom17
%6 = trunc i64 %indvars.iv125 to i32
store i32 %6, ptr %arrayidx18, align 4, !tbaa !5
%inc19 = add nsw i32 %num.0105, 1
br label %for.inc21
for.inc21: ; preds = %for.body12, %if.then16
%num.1 = phi i32 [ %num.0105, %for.body12 ], [ %inc19, %if.then16 ]
%indvars.iv.next126 = or i64 %indvars.iv125, 1
%arrayidx14.1 = getelementptr inbounds [60000 x i32], ptr %prime, i64 0, i64 %indvars.iv.next126
%7 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5
%tobool15.not.1 = icmp eq i32 %7, 0
br i1 %tobool15.not.1, label %if.then16.1, label %for.inc21.1
if.then16.1: ; preds = %for.inc21
%idxprom17.1 = sext i32 %num.1 to i64
%arrayidx18.1 = getelementptr inbounds [10000 x i32], ptr %prime_num, i64 0, i64 %idxprom17.1
%8 = trunc i64 %indvars.iv.next126 to i32
store i32 %8, ptr %arrayidx18.1, align 4, !tbaa !5
%inc19.1 = add nsw i32 %num.1, 1
br label %for.inc21.1
for.inc21.1: ; preds = %if.then16.1, %for.inc21
%num.1.1 = phi i32 [ %num.1, %for.inc21 ], [ %inc19.1, %if.then16.1 ]
%indvars.iv.next126.1 = add nuw nsw i64 %indvars.iv125, 2
%exitcond128.not.1 = icmp eq i64 %indvars.iv.next126.1, 60000
br i1 %exitcond128.not.1, label %while.cond.preheader, label %for.body12, !llvm.loop !13
if.end26: ; preds = %if.end26.lr.ph, %if.end52
%9 = phi i32 [ %3, %if.end26.lr.ph ], [ %17, %if.end52 ]
%10 = and i32 %9, -2147483647
%cmp27 = icmp eq i32 %10, 1
br i1 %cmp27, label %if.then28, label %for.cond34.preheader
for.cond34.preheader: ; preds = %if.end26
%cmp38.not107 = icmp sgt i32 %mul37106, %9
br i1 %cmp38.not107, label %if.end52, label %for.body39
if.then28: ; preds = %if.end26
%sub = add nsw i32 %9, -2
br label %do.body.i
do.body.i: ; preds = %if.else.i, %if.then28
%top.addr.0.i = phi i32 [ %num.1.1, %if.then28 ], [ %mid.0.top.addr.0.i, %if.else.i ]
%bottom.addr.0.i = phi i32 [ 0, %if.then28 ], [ %bottom.addr.0.mid.0.i, %if.else.i ]
%mid.0.i = phi i32 [ %div.i74, %if.then28 ], [ %div8.i, %if.else.i ]
%idxprom.i = sext i32 %mid.0.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr %prime_num, i64 %idxprom.i
%11 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp.i = icmp eq i32 %11, %sub
br i1 %cmp.i, label %b_search.exit, label %if.else.i
if.else.i: ; preds = %do.body.i
%cmp3.i = icmp sgt i32 %11, %sub
%mid.0.top.addr.0.i = select i1 %cmp3.i, i32 %mid.0.i, i32 %top.addr.0.i
%bottom.addr.0.mid.0.i = select i1 %cmp3.i, i32 %bottom.addr.0.i, i32 %mid.0.i
%add7.i = add nsw i32 %bottom.addr.0.mid.0.i, %mid.0.top.addr.0.i
%div8.i = sdiv i32 %add7.i, 2
%cmp9.not.i = icmp eq i32 %div8.i, %bottom.addr.0.mid.0.i
br i1 %cmp9.not.i, label %do.end.i, label %do.body.i, !llvm.loop !9
do.end.i: ; preds = %if.else.i
%idxprom10.i = sext i32 %bottom.addr.0.mid.0.i to i64
%arrayidx11.i = getelementptr inbounds i32, ptr %prime_num, i64 %idxprom10.i
%12 = load i32, ptr %arrayidx11.i, align 4, !tbaa !5
%cmp12.i = icmp eq i32 %12, %sub
%div8..i = select i1 %cmp12.i, i32 %bottom.addr.0.mid.0.i, i32 -1
br label %b_search.exit
b_search.exit: ; preds = %do.body.i, %do.end.i
%retval.0.i = phi i32 [ %div8..i, %do.end.i ], [ %mid.0.i, %do.body.i ]
%cmp30 = icmp sgt i32 %retval.0.i, -1
%spec.select = zext i1 %cmp30 to i32
br label %if.end52
for.body39: ; preds = %for.cond34.preheader, %b_search.exit95
%indvars.iv129 = phi i64 [ %indvars.iv.next130, %b_search.exit95 ], [ 0, %for.cond34.preheader ]
%13 = phi i32 [ %16, %b_search.exit95 ], [ %4, %for.cond34.preheader ]
%ans.0109 = phi i32 [ %spec.select73, %b_search.exit95 ], [ 0, %for.cond34.preheader ]
%sub42 = sub nsw i32 %9, %13
br label %do.body.i75
do.body.i75: ; preds = %if.else.i82, %for.body39
%top.addr.0.i76 = phi i32 [ %num.1.1, %for.body39 ], [ %mid.0.top.addr.0.i84, %if.else.i82 ]
%bottom.addr.0.i77 = phi i32 [ 0, %for.body39 ], [ %bottom.addr.0.mid.0.i85, %if.else.i82 ]
%mid.0.i78 = phi i32 [ %div.i74, %for.body39 ], [ %div8.i87, %if.else.i82 ]
%idxprom.i79 = sext i32 %mid.0.i78 to i64
%arrayidx.i80 = getelementptr inbounds i32, ptr %prime_num, i64 %idxprom.i79
%14 = load i32, ptr %arrayidx.i80, align 4, !tbaa !5
%cmp.i81 = icmp eq i32 %14, %sub42
br i1 %cmp.i81, label %b_search.exit95, label %if.else.i82
if.else.i82: ; preds = %do.body.i75
%cmp3.i83 = icmp sgt i32 %14, %sub42
%mid.0.top.addr.0.i84 = select i1 %cmp3.i83, i32 %mid.0.i78, i32 %top.addr.0.i76
%bottom.addr.0.mid.0.i85 = select i1 %cmp3.i83, i32 %bottom.addr.0.i77, i32 %mid.0.i78
%add7.i86 = add nsw i32 %bottom.addr.0.mid.0.i85, %mid.0.top.addr.0.i84
%div8.i87 = sdiv i32 %add7.i86, 2
%cmp9.not.i88 = icmp eq i32 %div8.i87, %bottom.addr.0.mid.0.i85
br i1 %cmp9.not.i88, label %do.end.i89, label %do.body.i75, !llvm.loop !9
do.end.i89: ; preds = %if.else.i82
%idxprom10.i90 = sext i32 %bottom.addr.0.mid.0.i85 to i64
%arrayidx11.i91 = getelementptr inbounds i32, ptr %prime_num, i64 %idxprom10.i90
%15 = load i32, ptr %arrayidx11.i91, align 4, !tbaa !5
%cmp12.i92 = icmp eq i32 %15, %sub42
%div8..i93 = select i1 %cmp12.i92, i32 %bottom.addr.0.mid.0.i85, i32 -1
br label %b_search.exit95
b_search.exit95: ; preds = %do.body.i75, %do.end.i89
%retval.0.i94 = phi i32 [ %div8..i93, %do.end.i89 ], [ %mid.0.i78, %do.body.i75 ]
%cmp4596 = icmp sgt i32 %retval.0.i94, -1
%inc47 = zext i1 %cmp4596 to i32
%spec.select73 = add nuw nsw i32 %ans.0109, %inc47
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%arrayidx36 = getelementptr inbounds [10000 x i32], ptr %prime_num, i64 0, i64 %indvars.iv.next130
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%mul37 = shl nsw i32 %16, 1
%cmp38.not = icmp sgt i32 %mul37, %9
br i1 %cmp38.not, label %if.end52, label %for.body39, !llvm.loop !14
if.end52: ; preds = %b_search.exit95, %for.cond34.preheader, %b_search.exit
%ans.2 = phi i32 [ %spec.select, %b_search.exit ], [ 0, %for.cond34.preheader ], [ %spec.select73, %b_search.exit95 ]
%call53 = 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)
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp24 = icmp eq i32 %17, 0
br i1 %cmp24, label %while.end, label %if.end26
while.end: ; preds = %if.end52, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %prime_num) #5
call void @llvm.lifetime.end.p0(i64 240000, ptr nonnull %prime) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
long long n,m,i,a,b,s=0,c;
scanf("%lld %lld",&n,&m);
scanf("%lld",&a);
if(a>m){
s+=a-m;
a=m;
}
while(--n){//printf("%d\n",s);
scanf("%lld",&b);
c=0;
if(a+b>m)c=a+b-m;
s+=c;
a=b-c;
}
printf("%lld\n",s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144291/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144291/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3
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 %n, ptr noundef nonnull %m)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %m, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%sub = sub nsw i64 %0, %1
store i64 %1, ptr %a, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%s.0 = phi i64 [ %sub, %if.then ], [ 0, %entry ]
%2 = load i64, ptr %n, align 8, !tbaa !5
%dec17 = add nsw i64 %2, -1
store i64 %dec17, ptr %n, align 8, !tbaa !5
%tobool.not18 = icmp eq i64 %dec17, 0
br i1 %tobool.not18, label %while.end, label %while.body
while.body: ; preds = %if.end, %while.body
%s.119 = phi i64 [ %add9, %while.body ], [ %s.0, %if.end ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%3 = load i64, ptr %a, align 8, !tbaa !5
%4 = load i64, ptr %b, align 8, !tbaa !5
%add3 = add nsw i64 %4, %3
%5 = load i64, ptr %m, align 8, !tbaa !5
%cmp4 = icmp sgt i64 %add3, %5
%sub7 = sub nsw i64 %add3, %5
%spec.select = select i1 %cmp4, i64 %sub7, i64 0
%add9 = add nsw i64 %spec.select, %s.119
%sub10 = sub nsw i64 %4, %spec.select
store i64 %sub10, ptr %a, align 8, !tbaa !5
%6 = load i64, ptr %n, align 8, !tbaa !5
%dec = add nsw i64 %6, -1
store i64 %dec, ptr %n, align 8, !tbaa !5
%tobool.not = icmp eq i64 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %if.end
%s.1.lcssa = phi i64 [ %s.0, %if.end ], [ %add9, %while.body ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %s.1.lcssa)
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 8, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h> // putchar(), fgets()
#define MAX_L 100
const char NUL = '\0';
int
main(int argc, char **argv)
{
char line[MAX_L + 1];
int i;
while (fgets(line, sizeof(line), stdin) != NULL)
{
const char *s = line;
for (; *s != NUL; ++s)
{
if (*s == '@')
{
s++;
int n = *s++ - '0';
for (i = 0; i < n; ++i)
putchar(*s);
}
else
putchar(*s);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144334/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144334/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@NUL = dso_local local_unnamed_addr constant i8 0, align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%line = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %line) #3
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call30 = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 101, ptr noundef %0)
%cmp.not31 = icmp eq ptr %call30, null
br i1 %cmp.not31, label %while.end, label %for.cond
while.cond.loopexit: ; preds = %for.cond
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 101, ptr noundef %1)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end, label %for.cond.backedge
for.cond: ; preds = %entry, %for.cond.backedge
%s.0 = phi ptr [ %s.0.be, %for.cond.backedge ], [ %line, %entry ]
%2 = load i8, ptr %s.0, align 1, !tbaa !9
switch i8 %2, label %if.else [
i8 0, label %while.cond.loopexit
i8 64, label %if.then
]
if.then: ; preds = %for.cond
%incdec.ptr = getelementptr inbounds i8, ptr %s.0, i64 1
%incdec.ptr7 = getelementptr inbounds i8, ptr %s.0, i64 2
%3 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%cmp1028 = icmp sgt i8 %3, 48
br i1 %cmp1028, label %for.body12.preheader, label %for.inc17
for.body12.preheader: ; preds = %if.then
%conv8 = sext i8 %3 to i32
%4 = add nsw i32 %conv8, -49
br label %for.body12
for.body12: ; preds = %for.body12.preheader, %for.body12
%i.029 = phi i32 [ %inc, %for.body12 ], [ 0, %for.body12.preheader ]
%5 = load i8, ptr %incdec.ptr7, align 1, !tbaa !9
%conv13 = sext i8 %5 to i32
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = call i32 @putc(i32 noundef %conv13, ptr noundef %6)
%inc = add nuw nsw i32 %i.029, 1
%exitcond.not = icmp eq i32 %i.029, %4
br i1 %exitcond.not, label %for.inc17, label %for.body12, !llvm.loop !10
if.else: ; preds = %for.cond
%conv = sext i8 %2 to i32
%7 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i27 = call i32 @putc(i32 noundef %conv, ptr noundef %7)
br label %for.inc17
for.inc17: ; preds = %for.body12, %if.then, %if.else
%s.1 = phi ptr [ %s.0, %if.else ], [ %incdec.ptr7, %if.then ], [ %incdec.ptr7, %for.body12 ]
%incdec.ptr18 = getelementptr inbounds i8, ptr %s.1, i64 1
br label %for.cond.backedge
for.cond.backedge: ; preds = %for.inc17, %while.cond.loopexit
%s.0.be = phi ptr [ %incdec.ptr18, %for.inc17 ], [ %line, %while.cond.loopexit ]
br label %for.cond, !llvm.loop !12
while.end: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %line) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main ()
{
char a[1001][5];
int x,i,j,key=0;
scanf("%d",&x);
for(i=1;i<=x;i++)
{
scanf("%s",a[i]+1);
if(key != 1)
{
if(a[i][1] == 'O' && a[i][2] == 'O')
{
a[i][1]='+';
a[i][2]='+';
key=1;
}
else if(a[i][4] == 'O' && a[i][5] == 'O')
{
a[i][4]='+';
a[i][5]='+';
key=1;
}
}
}
if(key==1)
{
printf("YES\n");
for(i=1;i<=x;i++)
{
for(j=1;j<=5;j++)
{
printf("%c",a[i][j]);
}
printf("\n");
}
}
else
{
printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1444/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1444/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.6 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [1001 x [5 x i8]], align 16
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 5005, ptr nonnull %a) #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 %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not89 = icmp slt i32 %0, 1
br i1 %cmp.not89, label %if.else68, label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%key.091 = phi i32 [ %key.1, %for.inc ], [ 0, %entry ]
%add.ptr = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv, i64 1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%cmp2.not = icmp eq i32 %key.091, 1
br i1 %cmp2.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%1 = load i8, ptr %add.ptr, align 1, !tbaa !9
%cmp6 = icmp eq i8 %1, 79
br i1 %cmp6, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %if.then
%arrayidx10 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv, i64 2
%2 = load i8, ptr %arrayidx10, align 1, !tbaa !9
%cmp12 = icmp eq i8 %2, 79
br i1 %cmp12, label %for.inc.sink.split, label %if.else
if.else: ; preds = %land.lhs.true, %if.then
%arrayidx23 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv, i64 4
%3 = load i8, ptr %arrayidx23, align 1, !tbaa !9
%cmp25 = icmp eq i8 %3, 79
br i1 %cmp25, label %land.lhs.true27, label %for.inc
land.lhs.true27: ; preds = %if.else
%arrayidx30 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv, i64 5
%4 = load i8, ptr %arrayidx30, align 1, !tbaa !9
%cmp32 = icmp eq i8 %4, 79
br i1 %cmp32, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %land.lhs.true27, %land.lhs.true
%arrayidx23.sink = phi ptr [ %add.ptr, %land.lhs.true ], [ %arrayidx23, %land.lhs.true27 ]
%arrayidx30.sink = phi ptr [ %arrayidx10, %land.lhs.true ], [ %arrayidx30, %land.lhs.true27 ]
store i8 43, ptr %arrayidx23.sink, align 1, !tbaa !9
store i8 43, ptr %arrayidx30.sink, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %for.body, %if.else, %land.lhs.true27
%5 = phi i1 [ false, %land.lhs.true27 ], [ false, %if.else ], [ true, %for.body ], [ true, %for.inc.sink.split ]
%key.1 = phi i32 [ 0, %land.lhs.true27 ], [ 0, %if.else ], [ 1, %for.body ], [ 1, %for.inc.sink.split ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %x, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.inc
br i1 %5, label %if.then45, label %if.else68
if.then45: ; preds = %for.end
%puts87 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%8 = load i32, ptr %x, align 4, !tbaa !5
%cmp48.not93 = icmp slt i32 %8, 1
br i1 %cmp48.not93, label %if.end70, label %for.cond51.preheader
for.cond51.preheader: ; preds = %if.then45, %for.cond51.preheader
%indvars.iv99 = phi i64 [ %indvars.iv.next100, %for.cond51.preheader ], [ 1, %if.then45 ]
%arrayidx58 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv99, i64 1
%9 = load i8, ptr %arrayidx58, align 1, !tbaa !9
%conv59 = sext i8 %9 to i32
%putchar88 = call i32 @putchar(i32 %conv59)
%arrayidx58.1 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv99, i64 2
%10 = load i8, ptr %arrayidx58.1, align 1, !tbaa !9
%conv59.1 = sext i8 %10 to i32
%putchar88.1 = call i32 @putchar(i32 %conv59.1)
%arrayidx58.2 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv99, i64 3
%11 = load i8, ptr %arrayidx58.2, align 1, !tbaa !9
%conv59.2 = sext i8 %11 to i32
%putchar88.2 = call i32 @putchar(i32 %conv59.2)
%arrayidx58.3 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv99, i64 4
%12 = load i8, ptr %arrayidx58.3, align 1, !tbaa !9
%conv59.3 = sext i8 %12 to i32
%putchar88.3 = call i32 @putchar(i32 %conv59.3)
%arrayidx58.4 = getelementptr inbounds [1001 x [5 x i8]], ptr %a, i64 0, i64 %indvars.iv99, i64 5
%13 = load i8, ptr %arrayidx58.4, align 1, !tbaa !9
%conv59.4 = sext i8 %13 to i32
%putchar88.4 = call i32 @putchar(i32 %conv59.4)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%14 = load i32, ptr %x, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp48.not.not = icmp slt i64 %indvars.iv99, %15
br i1 %cmp48.not.not, label %for.cond51.preheader, label %if.end70, !llvm.loop !12
if.else68: ; preds = %entry, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end70
if.end70: ; preds = %for.cond51.preheader, %if.then45, %if.else68
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 5005, 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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int N, M;
int X[114514], Y[114514], Z[114514];
int uf[114514], ufSize[114514];;
void ufInit(void) {
int i;
for (i = 1; i <= N; i++) {
uf[i] = i;
ufSize[i] = 1;
}
}
int ufGet(int kugyu) {
return uf[kugyu] == kugyu ? kugyu : (uf[kugyu] = ufGet(uf[kugyu]));
}
int ufGetSize(int kugyu) {
return ufSize[ufGet(kugyu)];
}
int ufIsSame(int asumisu, int mizuhasu) {
return ufGet(asumisu) == ufGet(mizuhasu);
}
void ufMerge(int tomatuharuka, int igutiyuka) {
int maaya = ufGet(tomatuharuka), sumipe = ufGet(igutiyuka);
if (maaya != sumipe) {
int satorina = ufGetSize(maaya), zaasan = ufGetSize(sumipe);
if (satorina < zaasan) {
uf[maaya] = sumipe;
ufSize[sumipe] += ufSize[maaya];
} else {
uf[sumipe] = maaya;
ufSize[maaya] += ufSize[sumipe];
}
}
}
int main(void) {
int i;
int emirin = 1;
if (scanf("%d%d", &N, &M) != 2) return 1;
for (i = 0; i < M; i++) {
if (scanf("%d%d%d", &X[i], &Y[i], &Z[i]) != 3) return 1;
}
ufInit();
for (i = 0; i < M; i++) {
ufMerge(X[i], Y[i]);
}
for (i = 2; i <= N; i++) {
if (!ufIsSame(1, i)) {
emirin++;
ufMerge(1, i);
}
}
printf("%d\n", emirin);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144442/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144442/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@N = dso_local global i32 0, align 4
@uf = dso_local local_unnamed_addr global [114514 x i32] zeroinitializer, align 16
@ufSize = dso_local local_unnamed_addr global [114514 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@M = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@X = dso_local global [114514 x i32] zeroinitializer, align 16
@Y = dso_local global [114514 x i32] zeroinitializer, align 16
@Z = dso_local global [114514 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @ufInit() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp.not7 = icmp slt i32 %0, 1
br i1 %cmp.not7, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader11, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%offset.idx = or i64 %index, 1
%3 = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %offset.idx
store <4 x i32> %vec.ind, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> %step.add, ptr %4, align 4, !tbaa !5
%5 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader11
for.body.preheader11: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader11, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader11 ]
%arrayidx = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %indvars.iv
%8 = trunc i64 %indvars.iv to i32
store i32 %8, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @ufGet(i32 noundef %kugyu) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %kugyu to i64
%arrayidx = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %kugyu
br i1 %cmp, label %common.ret9, label %cond.false
common.ret9: ; preds = %entry, %cond.false
%common.ret9.op = phi i32 [ %call, %cond.false ], [ %kugyu, %entry ]
ret i32 %common.ret9.op
cond.false: ; preds = %entry
%call = tail call i32 @ufGet(i32 noundef %0)
store i32 %call, ptr %arrayidx, align 4, !tbaa !5
br label %common.ret9
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @ufGetSize(i32 noundef %kugyu) local_unnamed_addr #2 {
entry:
%call = tail call i32 @ufGet(i32 noundef %kugyu)
%idxprom = sext i32 %call to i64
%arrayidx = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @ufIsSame(i32 noundef %asumisu, i32 noundef %mizuhasu) local_unnamed_addr #2 {
entry:
%call = tail call i32 @ufGet(i32 noundef %asumisu)
%call1 = tail call i32 @ufGet(i32 noundef %mizuhasu)
%cmp = icmp eq i32 %call, %call1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @ufMerge(i32 noundef %tomatuharuka, i32 noundef %igutiyuka) local_unnamed_addr #2 {
entry:
%call = tail call i32 @ufGet(i32 noundef %tomatuharuka)
%call1 = tail call i32 @ufGet(i32 noundef %igutiyuka)
%cmp.not = icmp eq i32 %call, %call1
br i1 %cmp.not, label %if.end17, label %if.then
if.then: ; preds = %entry
%call.i = tail call i32 @ufGet(i32 noundef %call)
%idxprom.i = sext i32 %call.i to i64
%arrayidx.i = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom.i
%0 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call.i28 = tail call i32 @ufGet(i32 noundef %call1)
%idxprom.i29 = sext i32 %call.i28 to i64
%arrayidx.i30 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom.i29
%1 = load i32, ptr %arrayidx.i30, align 4, !tbaa !5
%cmp4 = icmp slt i32 %0, %1
%call.call1 = select i1 %cmp4, i32 %call, i32 %call1
%call1.call = select i1 %cmp4, i32 %call1, i32 %call
%idxprom10 = sext i32 %call.call1 to i64
%arrayidx11 = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %idxprom10
store i32 %call1.call, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom10
%2 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%idxprom14 = sext i32 %call1.call to i64
%arrayidx15 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom14
%3 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%add = add nsw i32 %3, %2
store i32 %add, ptr %arrayidx15, align 4, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @M)
%cmp.not = icmp eq i32 %call, 2
br i1 %cmp.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %entry
%0 = load i32, ptr @M, align 4, !tbaa !5
%cmp167 = icmp sgt i32 %0, 0
br i1 %cmp167, 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 @M, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.end.loopexit, !llvm.loop !14
for.body: ; preds = %for.cond.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [114514 x i32], ptr @X, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [114514 x i32], ptr @Y, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [114514 x i32], ptr @Z, i64 0, i64 %indvars.iv
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx5)
%cmp7.not = icmp eq i32 %call6, 3
br i1 %cmp7.not, label %for.cond, label %cleanup
for.end.loopexit: ; preds = %for.cond
%3 = icmp sgt i32 %1, 0
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond.preheader
%cmp1169 = phi i1 [ %3, %for.end.loopexit ], [ false, %for.cond.preheader ]
%4 = load i32, ptr @N, align 4, !tbaa !5
%cmp.not7.i = icmp slt i32 %4, 1
br i1 %cmp.not7.i, label %ufInit.exit, label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.end
%5 = add nuw i32 %4, 1
%wide.trip.count.i = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count.i, -1
%min.iters.check = icmp ult i32 %4, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.vec = and i64 %6, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%offset.idx = or i64 %index, 1
%7 = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %offset.idx
store <4 x i32> %vec.ind, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> %step.add, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %ufInit.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 1, %for.body.preheader.i ], [ %ind.end, %middle.block ]
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 [114514 x i32], ptr @uf, i64 0, i64 %indvars.iv.i
%12 = trunc i64 %indvars.iv.i to i32
store i32 %12, ptr %arrayidx.i, align 4, !tbaa !5
%arrayidx2.i = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %indvars.iv.i
store i32 1, ptr %arrayidx2.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, %wide.trip.count.i
br i1 %exitcond.not.i, label %ufInit.exit, label %for.body.i, !llvm.loop !16
ufInit.exit: ; preds = %for.body.i, %middle.block, %for.end
br i1 %cmp1169, label %for.body12, label %for.cond20.preheader
for.cond20.preheader.loopexit: ; preds = %ufMerge.exit
%.pre = load i32, ptr @N, align 4, !tbaa !5
br label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond20.preheader.loopexit, %ufInit.exit
%13 = phi i32 [ %.pre, %for.cond20.preheader.loopexit ], [ %4, %ufInit.exit ]
%cmp21.not71 = icmp slt i32 %13, 2
br i1 %cmp21.not71, label %for.end29, label %for.body22
for.body12: ; preds = %ufInit.exit, %ufMerge.exit
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %ufMerge.exit ], [ 0, %ufInit.exit ]
%arrayidx14 = getelementptr inbounds [114514 x i32], ptr @X, i64 0, i64 %indvars.iv75
%14 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [114514 x i32], ptr @Y, i64 0, i64 %indvars.iv75
%15 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call.i = tail call i32 @ufGet(i32 noundef %14)
%call1.i = tail call i32 @ufGet(i32 noundef %15)
%cmp.not.i = icmp eq i32 %call.i, %call1.i
br i1 %cmp.not.i, label %ufMerge.exit, label %if.then.i
if.then.i: ; preds = %for.body12
%call.i.i = tail call i32 @ufGet(i32 noundef %call.i)
%idxprom.i.i = sext i32 %call.i.i to i64
%arrayidx.i.i = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom.i.i
%16 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%call.i28.i = tail call i32 @ufGet(i32 noundef %call1.i)
%idxprom.i29.i = sext i32 %call.i28.i to i64
%arrayidx.i30.i = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom.i29.i
%17 = load i32, ptr %arrayidx.i30.i, align 4, !tbaa !5
%cmp4.i = icmp slt i32 %16, %17
%call.call1.i = select i1 %cmp4.i, i32 %call.i, i32 %call1.i
%call1.call.i = select i1 %cmp4.i, i32 %call1.i, i32 %call.i
%idxprom10.i = sext i32 %call.call1.i to i64
%arrayidx11.i = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %idxprom10.i
store i32 %call1.call.i, ptr %arrayidx11.i, align 4, !tbaa !5
%arrayidx13.i = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom10.i
%18 = load i32, ptr %arrayidx13.i, align 4, !tbaa !5
%idxprom14.i = sext i32 %call1.call.i to i64
%arrayidx15.i = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom14.i
%19 = load i32, ptr %arrayidx15.i, align 4, !tbaa !5
%add.i = add nsw i32 %19, %18
store i32 %add.i, ptr %arrayidx15.i, align 4, !tbaa !5
br label %ufMerge.exit
ufMerge.exit: ; preds = %for.body12, %if.then.i
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%20 = load i32, ptr @M, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp11 = icmp slt i64 %indvars.iv.next76, %21
br i1 %cmp11, label %for.body12, label %for.cond20.preheader.loopexit, !llvm.loop !17
for.body22: ; preds = %for.cond20.preheader, %for.inc27
%emirin.073 = phi i32 [ %emirin.1, %for.inc27 ], [ 1, %for.cond20.preheader ]
%i.272 = phi i32 [ %inc28, %for.inc27 ], [ 2, %for.cond20.preheader ]
%call.i45 = tail call i32 @ufGet(i32 noundef 1)
%call1.i46 = tail call i32 @ufGet(i32 noundef %i.272)
%cmp.i.not = icmp eq i32 %call.i45, %call1.i46
br i1 %cmp.i.not, label %for.inc27, label %if.then24
if.then24: ; preds = %for.body22
%inc25 = add nsw i32 %emirin.073, 1
%call.i47 = tail call i32 @ufGet(i32 noundef 1)
%call1.i48 = tail call i32 @ufGet(i32 noundef %i.272)
%cmp.not.i49 = icmp eq i32 %call.i47, %call1.i48
br i1 %cmp.not.i49, label %for.inc27, label %if.then.i50
if.then.i50: ; preds = %if.then24
%call.i.i51 = tail call i32 @ufGet(i32 noundef %call.i47)
%idxprom.i.i52 = sext i32 %call.i.i51 to i64
%arrayidx.i.i53 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom.i.i52
%22 = load i32, ptr %arrayidx.i.i53, align 4, !tbaa !5
%call.i28.i54 = tail call i32 @ufGet(i32 noundef %call1.i48)
%idxprom.i29.i55 = sext i32 %call.i28.i54 to i64
%arrayidx.i30.i56 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom.i29.i55
%23 = load i32, ptr %arrayidx.i30.i56, align 4, !tbaa !5
%cmp4.i57 = icmp slt i32 %22, %23
%call.call1.i58 = select i1 %cmp4.i57, i32 %call.i47, i32 %call1.i48
%call1.call.i59 = select i1 %cmp4.i57, i32 %call1.i48, i32 %call.i47
%idxprom10.i60 = sext i32 %call.call1.i58 to i64
%arrayidx11.i61 = getelementptr inbounds [114514 x i32], ptr @uf, i64 0, i64 %idxprom10.i60
store i32 %call1.call.i59, ptr %arrayidx11.i61, align 4, !tbaa !5
%arrayidx13.i62 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom10.i60
%24 = load i32, ptr %arrayidx13.i62, align 4, !tbaa !5
%idxprom14.i63 = sext i32 %call1.call.i59 to i64
%arrayidx15.i64 = getelementptr inbounds [114514 x i32], ptr @ufSize, i64 0, i64 %idxprom14.i63
%25 = load i32, ptr %arrayidx15.i64, align 4, !tbaa !5
%add.i65 = add nsw i32 %25, %24
store i32 %add.i65, ptr %arrayidx15.i64, align 4, !tbaa !5
br label %for.inc27
for.inc27: ; preds = %if.then.i50, %if.then24, %for.body22
%emirin.1 = phi i32 [ %emirin.073, %for.body22 ], [ %inc25, %if.then24 ], [ %inc25, %if.then.i50 ]
%inc28 = add nuw nsw i32 %i.272, 1
%26 = load i32, ptr @N, align 4, !tbaa !5
%cmp21.not.not = icmp slt i32 %i.272, %26
br i1 %cmp21.not.not, label %for.body22, label %for.end29, !llvm.loop !18
for.end29: ; preds = %for.inc27, %for.cond20.preheader
%emirin.0.lcssa = phi i32 [ 1, %for.cond20.preheader ], [ %emirin.1, %for.inc27 ]
%call30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %emirin.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.body, %entry, %for.end29
%retval.0 = phi i32 [ 0, %for.end29 ], [ 1, %entry ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree 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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include <stdio.h>
#define maxl 105
char s[maxl];
int main(int argc, char** argv)
{
long long k;
scanf("%s%lld", s, &k);
for(int i=0; s[i] && i<k; i++)
if(s[i] != '1')
{
putchar(s[i]);
putchar('\n');
return 0;
}
puts("1");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144659/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144659/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%lld\00", align 1
@s = dso_local global [105 x i8] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [2 x i8] c"1\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8
%1 = load i8, ptr @s, align 16, !tbaa !5
%tobool21 = icmp eq i8 %1, 0
%cmp22 = icmp slt i64 %0, 1
%.not23 = select i1 %tobool21, i1 true, i1 %cmp22
br i1 %.not23, label %for.end, label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [105 x i8], ptr @s, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%tobool = icmp eq i8 %2, 0
%cmp = icmp sle i64 %0, %indvars.iv.next
%.not = select i1 %tobool, i1 true, i1 %cmp
br i1 %.not, label %for.end, label %for.body, !llvm.loop !8
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%3 = phi i8 [ %2, %for.cond ], [ %1, %entry ]
%cmp6.not = icmp eq i8 %3, 49
br i1 %cmp6.not, label %for.cond, label %if.then
if.then: ; preds = %for.body
%conv.le = sext i8 %3 to i32
%4 = load ptr, ptr @stdout, align 8, !tbaa !10
%call.i = call i32 @putc(i32 noundef %conv.le, ptr noundef %4)
%5 = load ptr, ptr @stdout, align 8, !tbaa !10
%call.i19 = call i32 @putc(i32 noundef 10, ptr noundef %5)
br label %cleanup14
for.end: ; preds = %for.cond, %entry
%call13 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup14
cleanup14: ; preds = %if.then, %for.end
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
|
#include <stdio.h>
#include <string.h>
char str[128];
long long k;
int main()
{
char ans;
long long length;
scanf("%s %lld", str, &k);
length = strlen(str);
for (long long i = 0; i < length; i++) {
if (i == k - 1) {
ans = str[i];
break;
} else if (str[i] != '1') {
ans = str[i];
break;
}
}
printf("%c\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144701/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144701/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s %lld\00", align 1
@str = dso_local global [128 x i8] zeroinitializer, align 16
@k = dso_local global i64 0, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c"%c\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 @str, ptr noundef nonnull @k)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @str) #3
%cmp19 = icmp sgt i64 %call1, 0
br i1 %cmp19, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %entry
%0 = load i64, ptr @k, align 8, !tbaa !5
%sub = add nsw i64 %0, -1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.020 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
%cmp2 = icmp eq i64 %i.020, %sub
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%arrayidx = getelementptr inbounds [128 x i8], ptr @str, i64 0, i64 %sub
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
br label %cleanup
if.else: ; preds = %for.body
%arrayidx3 = getelementptr inbounds [128 x i8], ptr @str, i64 0, i64 %i.020
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !9
%cmp4.not = icmp eq i8 %2, 49
br i1 %cmp4.not, label %for.inc, label %cleanup
for.inc: ; preds = %if.else
%inc = add nuw nsw i64 %i.020, 1
%exitcond.not = icmp eq i64 %inc, %call1
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
cleanup: ; preds = %for.inc, %if.else, %entry, %if.then
%ans.0 = phi i8 [ %1, %if.then ], [ undef, %entry ], [ 49, %for.inc ], [ %2, %if.else ]
%conv9 = sext i8 %ans.0 to i32
%call10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv9)
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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
char s[101];
int i;
long k;
scanf("%s%ld",s,&k);
if(k==1)printf("%c",s[0]);
else{
for(i=0;i<k;i++){
if(s[i]!='1'){
printf("%c",s[i]);
break;
}
}
if(i==k)puts("1");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144752/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144752/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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%ld\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
%k = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %k)
%0 = load i64, ptr %k, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 1
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp328 = icmp sgt i64 %0, 0
br i1 %cmp328, label %for.body, label %for.end
if.then: ; preds = %entry
%1 = load i8, ptr %s, align 16, !tbaa !9
%conv = sext i8 %1 to i32
%putchar25 = call i32 @putchar(i32 %conv)
br label %if.end20
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %if.then17, label %for.body, !llvm.loop !10
for.body: ; preds = %for.cond.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %for.cond.preheader ]
%arrayidx5 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx5, align 1, !tbaa !9
%cmp7.not = icmp eq i8 %2, 49
br i1 %cmp7.not, label %for.cond, label %if.then9
if.then9: ; preds = %for.body
%conv6 = sext i8 %2 to i32
%putchar = call i32 @putchar(i32 %conv6)
%.pre = load i64, ptr %k, align 8, !tbaa !5
br label %for.end
for.end: ; preds = %for.cond.preheader, %if.then9
%3 = phi i64 [ %.pre, %if.then9 ], [ %0, %for.cond.preheader ]
%conv227 = phi i64 [ %indvars.iv, %if.then9 ], [ 0, %for.cond.preheader ]
%cmp15 = icmp eq i64 %3, %conv227
br i1 %cmp15, label %if.then17, label %if.end20
if.then17: ; preds = %for.cond, %for.end
%call18 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end20
if.end20: ; preds = %for.end, %if.then17, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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
; 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(){
long long int n,s=0,i,j,a[100],k;
scanf("%lld",&n);
k=n;
i=0;
while(n!=0){
a[i]=n%10;
n=n/10;
i++;
}
for(j=0;j<i;j++)
s=s+a[j];
if(k%s==0)
printf("Yes\n");
else
printf("No\n");}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144802/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144802/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [100 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not14 = icmp eq i64 %0, 0
br i1 %cmp.not14, label %for.end, label %while.body
for.body.preheader: ; preds = %while.body
store i64 %div, ptr %n, align 8, !tbaa !5
%1 = add nuw i64 %i.015, 1
%min.iters.check = icmp ult i64 %i.015, 3
br i1 %min.iters.check, label %for.body.preheader24, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -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> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ]
%vec.phi22 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%2 = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i64, ptr %2, i64 2
%wide.load23 = load <2 x i64>, ptr %3, align 16, !tbaa !5
%4 = add <2 x i64> %wide.load, %vec.phi
%5 = add <2 x i64> %wide.load23, %vec.phi22
%index.next = add nuw i64 %index, 4
%6 = icmp eq i64 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %5, %4
%7 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader24
for.body.preheader24: ; preds = %for.body.preheader, %middle.block
%s.018.ph = phi i64 [ 0, %for.body.preheader ], [ %7, %middle.block ]
%j.017.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
while.body: ; preds = %entry, %while.body
%i.015 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%8 = phi i64 [ %div, %while.body ], [ %0, %entry ]
%rem = srem i64 %8, 10
%arrayidx = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %i.015
store i64 %rem, ptr %arrayidx, align 8, !tbaa !5
%div = sdiv i64 %8, 10
%inc = add nuw nsw i64 %i.015, 1
%.off = add i64 %8, 9
%cmp.not = icmp ult i64 %.off, 19
br i1 %cmp.not, label %for.body.preheader, label %while.body, !llvm.loop !13
for.body: ; preds = %for.body.preheader24, %for.body
%s.018 = phi i64 [ %add, %for.body ], [ %s.018.ph, %for.body.preheader24 ]
%j.017 = phi i64 [ %inc3, %for.body ], [ %j.017.ph, %for.body.preheader24 ]
%arrayidx2 = getelementptr inbounds [100 x i64], ptr %a, i64 0, i64 %j.017
%9 = load i64, ptr %arrayidx2, align 8, !tbaa !5
%add = add nsw i64 %9, %s.018
%inc3 = add nuw nsw i64 %j.017, 1
%exitcond.not = icmp eq i64 %j.017, %i.015
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %for.body, %middle.block, %entry
%s.0.lcssa = phi i64 [ 0, %entry ], [ %7, %middle.block ], [ %add, %for.body ]
%rem4 = srem i64 %0, %s.0.lcssa
%cmp5 = icmp eq i64 %rem4, 0
%str.3.str = select i1 %cmp5, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include <stdio.h>
int main(void)
{
char arr[15];
int n;
int x,y;
fgets(arr, sizeof(arr), stdin);
sscanf(arr, "%d", &n);
y = n;
x = 0;
for (;;) {
x += y % 10;
y /= 10;
if (y == 0) {break;}
}
if (n%x == 0) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144860/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144860/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = 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:
%arr = alloca [15 x i8], align 1
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %arr) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %arr, i32 noundef 15, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %arr, ptr noundef nonnull @.str, ptr noundef nonnull %n) #4
%1 = load i32, ptr %n, align 4, !tbaa !9
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%x.0 = phi i32 [ 0, %entry ], [ %add, %for.cond ]
%y.0 = phi i32 [ %1, %entry ], [ %div, %for.cond ]
%rem = srem i32 %y.0, 10
%add = add nsw i32 %rem, %x.0
%div = sdiv i32 %y.0, 10
%y.0.off = add i32 %y.0, 9
%cmp = icmp ult i32 %y.0.off, 19
br i1 %cmp, label %for.end, label %for.cond
for.end: ; preds = %for.cond
%rem3 = srem i32 %1, %add
%cmp4 = icmp eq i32 %rem3, 0
%str.3.str = select i1 %cmp4, 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 %n) #4
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %arr) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.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))
int compare_sz_asc(const void* a, const void* b) {
return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}
int compare_sz_desc(const void* a, const void* b) {
return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}
int compare_i64_asc(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_i64_desc(const void* a, const void* b) {
return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}
int compare_u64_asc(const void* a, const void* b) {
return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1;
}
int compare_u64_desc(const void* a, const void* b) {
return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}
int compare_c_asc(const void* a, const void* b) {
return *((char*)a) < *((char*)b) ? -1 : 1;
}
int compare_c_desc(const void* a, const void* b) {
return *((char*)a) > * ((char*)b) ? -1 : 1;
}
static size_t powSz(const size_t base, const size_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powSz(base * base, exp / 2);
}
else {
return base * powSz(base, exp - 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 combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static size_t gcdZu(size_t m, size_t n) {
size_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t gcdU64(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
typedef struct {
uint64_t A;
uint64_t B;
uint64_t val;
} _status;
static _status status[200000];
typedef struct {
uint64_t idx;
}BHeap_Val;
#define BHEAP_VAL_TYPE BHeap_Val
static int _bHeap_Compare(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
const uint64_t parentVal = status[parent->idx].val;
const uint64_t nodeVal = status[node->idx].val;
return parentVal >= nodeVal ? -1 : 1;
}
#define BHEAP_INVALID_NODE ((size_t)100000000)
typedef struct {
BHEAP_VAL_TYPE val;
} BHeap_Node;
static struct {
size_t size;
int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node);
} bHeap_Info;
static BHeap_Node bHeap_Node[1 << 20];
static void bHeap_Init(int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node)) {
bHeap_Info.size = 0;
bHeap_Info.compare = compare;
}
static void bHeap_UpHeap(const size_t nodeIdx) {
if (nodeIdx == 0) {
return;
}
const size_t parentIdx = (nodeIdx + 1) / 2 - 1;
const int compareResult = bHeap_Info.compare(&(bHeap_Node[parentIdx].val), &(bHeap_Node[nodeIdx].val));
if (0 < compareResult) {
const BHEAP_VAL_TYPE tmp = bHeap_Node[parentIdx].val;
bHeap_Node[parentIdx].val = bHeap_Node[nodeIdx].val;
bHeap_Node[nodeIdx].val = tmp;
if (parentIdx != 0) {
bHeap_UpHeap(parentIdx);
}
}
}
static void bHeap_DownHeap(const size_t nodeIdx) {
if (bHeap_Info.size - 1 <= nodeIdx) {
return;
}
const size_t leftIdx = 2 * (nodeIdx + 1) - 1;
if (leftIdx < bHeap_Info.size) {
const int leftResult = bHeap_Info.compare(&(bHeap_Node[nodeIdx].val), &(bHeap_Node[leftIdx].val));
size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx;
const size_t rightIdx = leftIdx + 1;
if (rightIdx < bHeap_Info.size) {
const int rightResult = bHeap_Info.compare(&(bHeap_Node[nodeIdx].val), &(bHeap_Node[rightIdx].val));
if (swapTarget == BHEAP_INVALID_NODE) {
if (0 < rightResult) {
swapTarget = rightIdx;
}
}
else {
if (0 < rightResult) {
const int rightLeftResult = bHeap_Info.compare(&(bHeap_Node[leftIdx].val), &(bHeap_Node[rightIdx].val));
if (0 < rightLeftResult) {
swapTarget = rightIdx;
}
}
}
}
if (swapTarget != BHEAP_INVALID_NODE) {
const BHEAP_VAL_TYPE tmp = bHeap_Node[nodeIdx].val;
bHeap_Node[nodeIdx].val = bHeap_Node[swapTarget].val;
bHeap_Node[swapTarget].val = tmp;
bHeap_DownHeap(swapTarget);
}
}
}
static void bHeap_Add(const BHEAP_VAL_TYPE val) {
bHeap_Node[bHeap_Info.size].val = val;
bHeap_Info.size++;
bHeap_UpHeap(bHeap_Info.size - 1);
}
static void bHeap_RemoveTop(void) {
if (bHeap_Info.size == 0) {
return;
}
if (bHeap_Info.size == 1) {
bHeap_Info.size--;
return;
}
bHeap_Node[0].val = bHeap_Node[bHeap_Info.size - 1].val;
bHeap_Info.size--;
bHeap_DownHeap(0);
}
static BHEAP_VAL_TYPE* bHeap_GetTopVal(void) {
return bHeap_Info.size == 0 ? NULL : &(bHeap_Node[0].val);
}
typedef struct {
uint64_t cnt;
size_t* child;
size_t numChild;
size_t maxNumChild;
} Tree_Node;
#define TREE_INIT_ALLOC (128)
static Tree_Node tree_Node[200000];
static void tree_Init(const uint64_t N) {
for (uint64_t i = 0; i < N; i++) {
tree_Node[i].cnt = 0;
tree_Node[i].numChild = 0;
tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC);
tree_Node[i].maxNumChild = TREE_INIT_ALLOC;
}
}
static void tree_AddChild(const size_t parent, const size_t child) {
if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) {
tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2);
tree_Node[parent].maxNumChild *= 2;
}
tree_Node[parent].child[tree_Node[parent].numChild] = child;
tree_Node[parent].numChild++;
}
int main(void) {
uint64_t N;
scanf("%"PRIu64, &N);
uint64_t nCp = N;
uint64_t fN = 0;
while (nCp != 0) {
fN += nCp % 10;
nCp /= 10;
}
puts(N % fN == 0 ? "Yes" : "No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144903/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144903/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu\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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_asc(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 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_sz_desc(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 ugt 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_i64_asc(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
%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_i64_desc(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 sgt 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_u64_asc(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 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_u64_desc(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 ugt 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_c_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp slt i8 %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_c_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp sgt i8 %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:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not7 = icmp eq i64 %0, 0
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%fN.09 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%nCp.08 = phi i64 [ %div, %while.body ], [ %0, %entry ]
%rem = urem i64 %nCp.08, 10
%add = add i64 %fN.09, %rem
%div = udiv i64 %nCp.08, 10
%cmp.not = icmp ult i64 %nCp.08, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %while.body, %entry
%fN.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
%rem1 = urem i64 %0, %fN.0.lcssa
%cmp2 = icmp eq i64 %rem1, 0
%cond = select i1 %cmp2, ptr @.str.1, ptr @.str.2
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
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) #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) #2
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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int i, sum=0, num;
char N[16];
scanf("%s", N);
for (i=0; N[i]!='\0'; i++) sum+=N[i]-48;
if (atoi(N)%sum==0) printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144954/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144954/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%N = alloca [16 x i8], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i8, ptr %N, align 16, !tbaa !5
%cmp.not15 = icmp eq i8 %0, 0
br i1 %cmp.not15, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = phi i8 [ %2, %for.body ], [ %0, %entry ]
%sum.016 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%conv = sext i8 %1 to i32
%sub = add i32 %sum.016, -48
%add = add i32 %sub, %conv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [16 x i8], ptr %N, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %2, 0
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %N, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
%rem = srem i32 %conv.i, %sum.0.lcssa
%cmp7 = icmp eq i32 %rem, 0
%str.3.str = select i1 %cmp7, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 "no-trapping-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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s) qsort(s,strlen(s),sizeof(char),cmp)
#define chsort_r(s) qsort(s,strlen(s),sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;
int in(void){
int i;scanf("%d",&i);
return i;
}
long long llin(void){
long long i;scanf("%lld",&i);
return i;
}
double din(void){
double i;scanf("%lf",&i);
return i;
}
void chin(char s[]){
scanf("%s",s);
}
void print(int a){
printf("%d\n",a);
}
void llprint(long long a){
printf("%lld\n",a);
}
void dprint(double a){
printf("%.10f\n",a);
}
void print2(int a,int b){
printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
return a>b?a:b;
}
long long min(long long a,long long b){
return a<b?a:b;
}
long long llabs(long long a){
return a>0?a:-a;
}
double dmax(double a,double b){
return a>b?a:b;
}
int cmp(const void *a,const void *b){
return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
int t=*a;
*a=*b;
*b=t;
}
int main(void){
int x=in(),t,f=0;
t=x;
while(t)f+=t%10,t/=10;
puts(x%f?"No":"Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144998/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144998/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@mod = dso_local local_unnamed_addr constant i32 1000000007, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%.10f\0A\00", align 1
@.str.7 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.8 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.9 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #10
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #10
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @din() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #10
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @chin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @llprint(i64 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dprint(double noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %a, i32 noundef %b)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llabs(i64 noundef %a) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dmax(double noundef %a, double noundef %b) local_unnamed_addr #4 {
entry:
%cmp = fcmp ogt double %a, %b
%cond = select i1 %cmp, double %a, double %b
ret double %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #11
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #11
ret i32 %call
}
; 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 #8 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #10
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i)
%0 = load i32, ptr %i.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #10
%tobool.not8 = icmp eq i32 %0, 0
br i1 %tobool.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%f.010 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%t.09 = phi i32 [ %div, %while.body ], [ %0, %entry ]
%rem = srem i32 %t.09, 10
%add = add nsw i32 %f.010, %rem
%div = sdiv i32 %t.09, 10
%t.09.off = add i32 %t.09, 9
%tobool.not = icmp ult i32 %t.09.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%f.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%rem1 = srem i32 %0, %f.0.lcssa
%tobool2.not = icmp eq i32 %rem1, 0
%cond = select i1 %tobool2.not, ptr @.str.9, ptr @.str.8
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #9
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int q;
int main()
{
int n; scanf("%d %d", &n, &q);
char d[n], e[26]; for (int i=0; i<26; i++) e[i]=0;
scanf("%s", d);
for (int i=0; i<n; i++)
{
e[d[i]-97]++;
}
int c=97;
while (q)
{
if (!(e[c-97])) c+=1;
for (int i=0; i<n; i++)
{
if (d[i]==c)
{
d[i]='\0'; q--; e[c-97]--;
if (!q) break;
}
}
if (!q) break;
}
for (int i=0; i<n; i++)
{
if (d[i]!='\0') {printf("%c", d[i]);}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14504/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14504/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@q = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%e = alloca [26 x i8], 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, ptr noundef nonnull @q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
call void @llvm.lifetime.start.p0(i64 26, ptr nonnull %e) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(26) %e, i8 0, i64 26, i1 false), !tbaa !9
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp486 = icmp sgt i32 %3, 0
br i1 %cmp486, label %for.body6.preheader, label %for.cond.cleanup5.thread
for.body6.preheader: ; preds = %entry
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %3, 1
br i1 %4, label %for.cond.cleanup5.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.cond.cleanup5.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.unr-lcssa
%arrayidx8.epil = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.unr
%5 = load i8, ptr %arrayidx8.epil, align 1, !tbaa !9
%conv.epil = sext i8 %5 to i64
%sub.epil = add nsw i64 %conv.epil, -97
%arrayidx10.epil = getelementptr inbounds [26 x i8], ptr %e, i64 0, i64 %sub.epil
%6 = load i8, ptr %arrayidx10.epil, align 1, !tbaa !9
%inc11.epil = add i8 %6, 1
store i8 %inc11.epil, ptr %arrayidx10.epil, align 1, !tbaa !9
br label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %for.cond.cleanup5.unr-lcssa, %for.body6.epil
%.old = load i32, ptr @q, align 4
%tobool.old.not = icmp eq i32 %.old, 0
br i1 %tobool.old.not, label %while.end, label %while.body.preheader
for.cond.cleanup5.thread: ; preds = %entry
%.old111 = load i32, ptr @q, align 4
%tobool.old.not112 = icmp eq i32 %.old111, 0
br i1 %tobool.old.not112, label %for.cond.cleanup51, label %while.body.preheader120
while.body.preheader: ; preds = %for.cond.cleanup5
br i1 %cmp486, label %while.body.us.preheader, label %while.body.preheader120
while.body.preheader120: ; preds = %for.cond.cleanup5.thread, %while.body.preheader
br label %while.body
while.body.us.preheader: ; preds = %while.body.preheader
%wide.trip.count106 = zext i32 %3 to i64
br label %while.body.us
while.body.us: ; preds = %while.body.us.preheader, %cleanup.us
%q.promoted97.us = phi i32 [ %q.promoted95.us, %cleanup.us ], [ %.old, %while.body.us.preheader ]
%c.0.us = phi i32 [ %spec.select.us, %cleanup.us ], [ 97, %while.body.us.preheader ]
%sub15.us = add nsw i32 %c.0.us, -97
%idxprom16.us = sext i32 %sub15.us to i64
%arrayidx17.us = getelementptr inbounds [26 x i8], ptr %e, i64 0, i64 %idxprom16.us
%7 = load i8, ptr %arrayidx17.us, align 1, !tbaa !9
%tobool18.not.us = icmp eq i8 %7, 0
%add.us = zext i1 %tobool18.not.us to i32
%spec.select.us = add nuw nsw i32 %c.0.us, %add.us
%sub33.us = add nsw i32 %spec.select.us, -97
%idxprom34.us = sext i32 %sub33.us to i64
%arrayidx35.us = getelementptr inbounds [26 x i8], ptr %e, i64 0, i64 %idxprom34.us
br label %for.body24.us
for.body24.us: ; preds = %while.body.us, %for.inc41.us
%indvars.iv103 = phi i64 [ 0, %while.body.us ], [ %indvars.iv.next104, %for.inc41.us ]
%q.promoted96.us = phi i32 [ %q.promoted97.us, %while.body.us ], [ %q.promoted95.us, %for.inc41.us ]
%dec8991.us = phi i32 [ %q.promoted97.us, %while.body.us ], [ %dec88.us, %for.inc41.us ]
%arrayidx26.us = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv103
%8 = load i8, ptr %arrayidx26.us, align 1, !tbaa !9
%conv27.us = sext i8 %8 to i32
%cmp28.us = icmp eq i32 %spec.select.us, %conv27.us
br i1 %cmp28.us, label %if.then30.us, label %for.inc41.us
if.then30.us: ; preds = %for.body24.us
store i8 0, ptr %arrayidx26.us, align 1, !tbaa !9
%dec.us = add nsw i32 %dec8991.us, -1
store i32 %dec.us, ptr @q, align 4, !tbaa !5
%9 = load i8, ptr %arrayidx35.us, align 1, !tbaa !9
%dec36.us = add i8 %9, -1
store i8 %dec36.us, ptr %arrayidx35.us, align 1, !tbaa !9
%tobool37.not.us = icmp eq i32 %dec.us, 0
br i1 %tobool37.not.us, label %while.end, label %for.inc41.us
for.inc41.us: ; preds = %if.then30.us, %for.body24.us
%q.promoted95.us = phi i32 [ %q.promoted96.us, %for.body24.us ], [ %dec.us, %if.then30.us ]
%dec88.us = phi i32 [ %dec8991.us, %for.body24.us ], [ %dec.us, %if.then30.us ]
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%exitcond107.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count106
br i1 %exitcond107.not, label %cleanup.us, label %for.body24.us, !llvm.loop !10
cleanup.us: ; preds = %for.inc41.us
%tobool44.not.us = icmp eq i32 %q.promoted95.us, 0
br i1 %tobool44.not.us, label %while.end, label %while.body.us, !llvm.loop !12
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%10 = load i8, ptr %arrayidx8, align 2, !tbaa !9
%conv = sext i8 %10 to i64
%sub = add nsw i64 %conv, -97
%arrayidx10 = getelementptr inbounds [26 x i8], ptr %e, i64 0, i64 %sub
%11 = load i8, ptr %arrayidx10, align 1, !tbaa !9
%inc11 = add i8 %11, 1
store i8 %inc11, ptr %arrayidx10, align 1, !tbaa !9
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx8.1 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.next
%12 = load i8, ptr %arrayidx8.1, align 1, !tbaa !9
%conv.1 = sext i8 %12 to i64
%sub.1 = add nsw i64 %conv.1, -97
%arrayidx10.1 = getelementptr inbounds [26 x i8], ptr %e, i64 0, i64 %sub.1
%13 = load i8, ptr %arrayidx10.1, align 1, !tbaa !9
%inc11.1 = add i8 %13, 1
store i8 %inc11.1, ptr %arrayidx10.1, align 1, !tbaa !9
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup5.unr-lcssa, label %for.body6, !llvm.loop !13
while.body: ; preds = %while.body.preheader120, %while.body
br label %while.body
while.end: ; preds = %cleanup.us, %if.then30.us, %for.cond.cleanup5
br i1 %cmp486, label %for.body52, label %for.cond.cleanup51
for.cond.cleanup51: ; preds = %for.inc64, %for.cond.cleanup5.thread, %while.end
call void @llvm.lifetime.end.p0(i64 26, ptr nonnull %e) #6
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body52: ; preds = %while.end, %for.inc64
%14 = phi i32 [ %16, %for.inc64 ], [ %3, %while.end ]
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.inc64 ], [ 0, %while.end ]
%arrayidx54 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv108
%15 = load i8, ptr %arrayidx54, align 1, !tbaa !9
%cmp56.not = icmp eq i8 %15, 0
br i1 %cmp56.not, label %for.inc64, label %if.then58
if.then58: ; preds = %for.body52
%conv55 = sext i8 %15 to i32
%putchar = call i32 @putchar(i32 %conv55)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc64
for.inc64: ; preds = %for.body52, %if.then58
%16 = phi i32 [ %14, %for.body52 ], [ %.pre, %if.then58 ]
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%17 = sext i32 %16 to i64
%cmp49 = icmp slt i64 %indvars.iv.next109, %17
br i1 %cmp49, label %for.body52, label %for.cond.cleanup51, !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 nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
|
#include <stdio.h>
int main(void)
{
int num[5], sum, n, small, large;
int i, j, k;
while (scanf("%d", &n), n != 0){
large = 0;
small = 1000;
for (k = 0; k < n; k++){
sum = 0;
for (j = 0; j < 5; j++){
scanf("%d", &num[j]);
sum += num[j];
}
if (large < sum){
large = sum;
}
if (small > sum){
small = sum;
}
}
printf("%d %d\n", large, small);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145083/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145083/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [5 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not34 = icmp eq i32 %0, 0
br i1 %cmp.not34, label %while.end, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%arrayidx.1 = getelementptr inbounds [5 x i32], ptr %num, i64 0, i64 1
%arrayidx.2 = getelementptr inbounds [5 x i32], ptr %num, i64 0, i64 2
%arrayidx.3 = getelementptr inbounds [5 x i32], ptr %num, i64 0, i64 3
%arrayidx.4 = getelementptr inbounds [5 x i32], ptr %num, i64 0, i64 4
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %for.end14
%1 = phi i32 [ %0, %for.cond.preheader.preheader ], [ %8, %for.end14 ]
%cmp128 = icmp sgt i32 %1, 0
br i1 %cmp128, label %for.cond2.preheader, label %for.end14
for.cond2.preheader: ; preds = %for.cond.preheader, %for.cond2.preheader
%k.031 = phi i32 [ %inc13, %for.cond2.preheader ], [ 0, %for.cond.preheader ]
%large.030 = phi i32 [ %spec.select, %for.cond2.preheader ], [ 0, %for.cond.preheader ]
%small.029 = phi i32 [ %small.1, %for.cond2.preheader ], [ 1000, %for.cond.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%2 = load i32, ptr %num, align 16, !tbaa !5
%call5.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%3 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%add.1 = add nsw i32 %3, %2
%call5.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%4 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%add.2 = add nsw i32 %4, %add.1
%call5.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%5 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%add.3 = add nsw i32 %5, %add.2
%call5.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%6 = load i32, ptr %arrayidx.4, align 16, !tbaa !5
%add.4 = add nsw i32 %6, %add.3
%spec.select = call i32 @llvm.smax.i32(i32 %large.030, i32 %add.4)
%small.1 = call i32 @llvm.smin.i32(i32 %small.029, i32 %add.4)
%inc13 = add nuw nsw i32 %k.031, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc13, %7
br i1 %cmp1, label %for.cond2.preheader, label %for.end14, !llvm.loop !9
for.end14: ; preds = %for.cond2.preheader, %for.cond.preheader
%small.0.lcssa = phi i32 [ 1000, %for.cond.preheader ], [ %small.1, %for.cond2.preheader ]
%large.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %spec.select, %for.cond2.preheader ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %large.0.lcssa, i32 noundef %small.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %8, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !11
while.end: ; preds = %for.end14, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int i, j;
int n;
int a, sum;
int min, max;
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
for (i = 0; i < n; i++){
sum = 0;
for (j = 0; j < 5; j++){
scanf("%d", &a);
sum += a;
}
if (i == 0){
min = max = sum;
}
if (min > sum){
min = sum;
}
if (sum > max){
max = sum;
}
}
printf("%d %d\n", max, min);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145133/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145133/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = 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
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp38 = icmp eq i32 %0, 0
br i1 %cmp38, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end17
%1 = phi i32 [ %14, %for.end17 ], [ %0, %entry ]
%max.040 = phi i32 [ %max.1.lcssa, %for.end17 ], [ undef, %entry ]
%min.039 = phi i32 [ %min.1.lcssa, %for.end17 ], [ undef, %entry ]
%cmp132 = icmp sgt i32 %1, 0
br i1 %cmp132, label %for.cond2.preheader.preheader, label %for.end17
for.cond2.preheader.preheader: ; preds = %for.cond.preheader
%call5.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%call5.1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
%add.1.peel = add nsw i32 %3, %2
%call5.2.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !5
%add.2.peel = add nsw i32 %4, %add.1.peel
%call5.3.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%5 = load i32, ptr %a, align 4, !tbaa !5
%add.3.peel = add nsw i32 %5, %add.2.peel
%call5.4.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%6 = load i32, ptr %a, align 4, !tbaa !5
%add.4.peel = add nsw i32 %6, %add.3.peel
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp1.peel = icmp sgt i32 %7, 1
br i1 %cmp1.peel, label %for.cond2.preheader, label %for.end17
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.cond2.preheader
%max.135 = phi i32 [ %max.3, %for.cond2.preheader ], [ %add.4.peel, %for.cond2.preheader.preheader ]
%min.134 = phi i32 [ %min.3, %for.cond2.preheader ], [ %add.4.peel, %for.cond2.preheader.preheader ]
%i.033 = phi i32 [ %inc16, %for.cond2.preheader ], [ 1, %for.cond2.preheader.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%8 = load i32, ptr %a, align 4, !tbaa !5
%call5.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%9 = load i32, ptr %a, align 4, !tbaa !5
%add.1 = add nsw i32 %9, %8
%call5.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%10 = load i32, ptr %a, align 4, !tbaa !5
%add.2 = add nsw i32 %10, %add.1
%call5.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%11 = load i32, ptr %a, align 4, !tbaa !5
%add.3 = add nsw i32 %11, %add.2
%call5.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%12 = load i32, ptr %a, align 4, !tbaa !5
%add.4 = add nsw i32 %12, %add.3
%min.3 = call i32 @llvm.smin.i32(i32 %min.134, i32 %add.4)
%max.3 = call i32 @llvm.smax.i32(i32 %add.4, i32 %max.135)
%inc16 = add nuw nsw i32 %i.033, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc16, %13
br i1 %cmp1, label %for.cond2.preheader, label %for.end17, !llvm.loop !9
for.end17: ; preds = %for.cond2.preheader, %for.cond2.preheader.preheader, %for.cond.preheader
%min.1.lcssa = phi i32 [ %min.039, %for.cond.preheader ], [ %add.4.peel, %for.cond2.preheader.preheader ], [ %min.3, %for.cond2.preheader ]
%max.1.lcssa = phi i32 [ %max.040, %for.cond.preheader ], [ %add.4.peel, %for.cond2.preheader.preheader ], [ %max.3, %for.cond2.preheader ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.1.lcssa, i32 noundef %min.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%14 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %14, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end17, %entry
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
; 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
/* ex 7_1
Kohei_Suzuki */
#include <stdio.h>
//(x,y)のpointをtypedef宣言
typedef struct point{
int x_elem;
int y_elem;
}point;
//正方形の二点の座標から反時計回りに次の一点のお座標を求める関数
point shift_point(point pt1, point pt2){
point moved_point;
moved_point.x_elem = pt2.x_elem - (pt2.y_elem - pt1.y_elem);
moved_point.y_elem = pt2.y_elem + (pt2.x_elem - pt1.x_elem);
return moved_point;
}
int main (void){
point pt1, pt2, pt3, pt4;
//入力受取
scanf("%d %d %d %d", &pt1.x_elem, &pt1.y_elem, &pt2.x_elem, &pt2.y_elem);
//pt1,pt2からpt3を求める
pt3 = shift_point(pt1, pt2);
//pt2,pt3からpt4を求める
pt4 = shift_point(pt2, pt3);
//出力
printf("%d %d %d %d", pt3.x_elem, pt3.y_elem, pt4.x_elem, pt4.y_elem);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145177/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145177/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32 }
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @shift_point(i64 %pt1.coerce, i64 %pt2.coerce) local_unnamed_addr #0 {
entry:
%pt1.sroa.2.0.extract.shift = lshr i64 %pt1.coerce, 32
%pt2.sroa.3.0.extract.shift = lshr i64 %pt2.coerce, 32
%sub.neg = add i64 %pt1.sroa.2.0.extract.shift, %pt2.coerce
%sub2 = sub i64 %sub.neg, %pt2.sroa.3.0.extract.shift
%sub7 = sub i64 %pt2.coerce, %pt1.coerce
%add = add i64 %sub7, %pt2.sroa.3.0.extract.shift
%retval.sroa.2.0.insert.ext = shl i64 %add, 32
%retval.sroa.0.0.insert.ext = and i64 %sub2, 4294967295
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.0.0.insert.ext, %retval.sroa.2.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%pt1 = alloca %struct.point, align 8
%pt2 = alloca %struct.point, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %pt1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %pt2) #4
%y_elem = getelementptr inbounds %struct.point, ptr %pt1, i64 0, i32 1
%y_elem2 = getelementptr inbounds %struct.point, ptr %pt2, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %pt1, ptr noundef nonnull %y_elem, ptr noundef nonnull %pt2, ptr noundef nonnull %y_elem2)
%0 = load i64, ptr %pt1, align 8
%1 = load i64, ptr %pt2, align 8
%pt1.sroa.2.0.extract.shift.i = lshr i64 %0, 32
%pt2.sroa.3.0.extract.shift.i = lshr i64 %1, 32
%sub.neg.i = add i64 %pt1.sroa.2.0.extract.shift.i, %1
%sub2.i = sub i64 %sub.neg.i, %pt2.sroa.3.0.extract.shift.i
%sub7.i = sub i64 %1, %0
%add.i = add i64 %sub7.i, %pt2.sroa.3.0.extract.shift.i
%pt3.sroa.0.0.extract.trunc = trunc i64 %sub2.i to i32
%pt3.sroa.5.0.extract.trunc = trunc i64 %add.i to i32
%sub2.i15 = sub i64 %sub.neg.i, %add.i
%sub7.i16 = sub i64 %sub2.i, %1
%add.i17 = add i64 %sub7.i16, %add.i
%pt4.sroa.0.0.extract.trunc = trunc i64 %sub2.i15 to i32
%pt4.sroa.4.0.extract.trunc = trunc i64 %add.i17 to i32
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %pt3.sroa.0.0.extract.trunc, i32 noundef %pt3.sroa.5.0.extract.trunc, i32 noundef %pt4.sroa.0.0.extract.trunc, i32 noundef %pt4.sroa.4.0.extract.trunc)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %pt2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %pt1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
/* ex 7_1
kanon */
#include <stdio.h>
#include <stdlib.h>
typedef struct point
{
int x_elem;
int y_elem;
} point;
point shift_point(int x, int y, point point_)
{
point new_point = point_;
//元の頂点point_からx軸方向にx、y軸方向にyだけ移動した頂点を返す
new_point.x_elem += x;
new_point.y_elem += y;
return new_point;
}
int main(void)
{
//頂点の座標を入れる変数を宣言
point point1, point2, point3, point4;
int dif_x, dif_y;
scanf("%d %d %d %d", &point1.x_elem, &point1.y_elem, &point2.x_elem, &point2.y_elem);
//既知の頂点1と2のx座標y座標の差をとる
dif_x = point2.x_elem - point1.x_elem;
dif_y = point2.y_elem - point1.y_elem;
//頂点3は頂点2の位置ベクトル+ベクトル(-dif_y,dif_X)で求まる
//頂点4は頂点1の位置ベクトル+ベクトル(-dif_y,dif_X)で求まる
point3 = shift_point(-dif_y, dif_x, point2);
point4 = shift_point(-dif_y, dif_x, point1);
printf("%d %d %d %d", point3.x_elem, point3.y_elem, point4.x_elem, point4.y_elem);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145227/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145227/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32 }
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @shift_point(i32 noundef %x, i32 noundef %y, i64 %point_.coerce) local_unnamed_addr #0 {
entry:
%retval.sroa.0.0.extract.trunc = trunc i64 %point_.coerce to i32
%retval.sroa.4.0.extract.shift = lshr i64 %point_.coerce, 32
%retval.sroa.4.0.extract.trunc = trunc i64 %retval.sroa.4.0.extract.shift to i32
%add = add nsw i32 %retval.sroa.0.0.extract.trunc, %x
%add1 = add nsw i32 %retval.sroa.4.0.extract.trunc, %y
%retval.sroa.4.0.insert.ext = zext i32 %add1 to i64
%retval.sroa.4.0.insert.shift = shl nuw i64 %retval.sroa.4.0.insert.ext, 32
%retval.sroa.0.0.insert.ext = zext i32 %add to i64
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.4.0.insert.shift, %retval.sroa.0.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%point1 = alloca %struct.point, align 8
%point2 = alloca %struct.point, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %point1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %point2) #4
%y_elem = getelementptr inbounds %struct.point, ptr %point1, i64 0, i32 1
%y_elem2 = getelementptr inbounds %struct.point, ptr %point2, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %point1, ptr noundef nonnull %y_elem, ptr noundef nonnull %point2, ptr noundef nonnull %y_elem2)
%0 = load i32, ptr %point2, align 8, !tbaa !5
%1 = load i32, ptr %point1, align 8, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %y_elem2, align 4, !tbaa !10
%3 = load i32, ptr %y_elem, align 4, !tbaa !10
%sub7.neg = sub nsw i32 %3, %2
%4 = load i64, ptr %point2, align 8
%retval.sroa.0.0.extract.trunc.i = trunc i64 %4 to i32
%retval.sroa.4.0.extract.shift.i = lshr i64 %4, 32
%retval.sroa.4.0.extract.trunc.i = trunc i64 %retval.sroa.4.0.extract.shift.i to i32
%add.i = add nsw i32 %sub7.neg, %retval.sroa.0.0.extract.trunc.i
%add1.i = add nsw i32 %sub, %retval.sroa.4.0.extract.trunc.i
%5 = load i64, ptr %point1, align 8
%retval.sroa.0.0.extract.trunc.i20 = trunc i64 %5 to i32
%retval.sroa.4.0.extract.shift.i21 = lshr i64 %5, 32
%retval.sroa.4.0.extract.trunc.i22 = trunc i64 %retval.sroa.4.0.extract.shift.i21 to i32
%add.i23 = add nsw i32 %sub7.neg, %retval.sroa.0.0.extract.trunc.i20
%add1.i24 = add nsw i32 %sub, %retval.sroa.4.0.extract.trunc.i22
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add.i, i32 noundef %add1.i, i32 noundef %add.i23, i32 noundef %add1.i24)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %point2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %point1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE 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 = !{!"point", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
|
/* ex7_1
L40S38 */
#include <stdio.h>
typedef struct point{
int x_elem;
int y_elem;
}point;
point rot1(point* top, point* base){//baseを中心にtopを-90度回転
//printf("rot\n");
point p, dif;
dif.x_elem=(top->x_elem-base->x_elem);
dif.y_elem=(top->y_elem-base->y_elem);
p.x_elem=dif.y_elem+base->x_elem;
p.y_elem=-dif.x_elem+base->y_elem;
return p;
};
point rot2(point* top, point* base){//baseを中心にtopを90度回転
//printf("rot\n");
point p, dif;
dif.x_elem=(top->x_elem-base->x_elem);
dif.y_elem=(top->y_elem-base->y_elem);
p.x_elem=-dif.y_elem+base->x_elem;
p.y_elem=dif.x_elem+base->y_elem;
return p;
};
int main(void){
int i;
point square[4];
//square[i]:問題文における(x_i+1,y_i+1)のpointのこと
for(i=0;i<2;i++){
scanf(" %d %d",&square[i].x_elem,&square[i].y_elem);
}
//square[2]の計算・出力
square[2]=rot1(&square[0],&square[1]);
printf("%d %d ",square[2].x_elem,square[2].y_elem);
//square[3]の計算・出力
square[3]=rot2(&square[1],&square[0]);
printf("%d %d",square[3].x_elem,square[3].y_elem);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145270/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145270/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32 }
@.str = private unnamed_addr constant [7 x i8] c" %d %d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d \00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i64 @rot1(ptr nocapture noundef readonly %top, ptr nocapture noundef readonly %base) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %top, align 4, !tbaa !5
%1 = load i32, ptr %base, align 4, !tbaa !5
%sub.neg = sub i32 %1, %0
%y_elem = getelementptr inbounds %struct.point, ptr %top, i64 0, i32 1
%2 = load i32, ptr %y_elem, align 4, !tbaa !10
%y_elem3 = getelementptr inbounds %struct.point, ptr %base, i64 0, i32 1
%3 = load i32, ptr %y_elem3, align 4, !tbaa !10
%sub4 = add i32 %2, %1
%add = sub i32 %sub4, %3
%add12 = add nsw i32 %sub.neg, %3
%retval.sroa.2.0.insert.ext = zext i32 %add12 to i64
%retval.sroa.2.0.insert.shift = shl nuw i64 %retval.sroa.2.0.insert.ext, 32
%retval.sroa.0.0.insert.ext = zext i32 %add to i64
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.2.0.insert.shift, %retval.sroa.0.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i64 @rot2(ptr nocapture noundef readonly %top, ptr nocapture noundef readonly %base) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %top, align 4, !tbaa !5
%1 = load i32, ptr %base, align 4, !tbaa !5
%sub = sub i32 %0, %1
%y_elem = getelementptr inbounds %struct.point, ptr %top, i64 0, i32 1
%2 = load i32, ptr %y_elem, align 4, !tbaa !10
%y_elem3 = getelementptr inbounds %struct.point, ptr %base, i64 0, i32 1
%3 = load i32, ptr %y_elem3, align 4, !tbaa !10
%sub4.neg = sub i32 %1, %2
%add = add i32 %sub4.neg, %3
%add12 = add nsw i32 %sub, %3
%retval.sroa.2.0.insert.ext = zext i32 %add12 to i64
%retval.sroa.2.0.insert.shift = shl nuw i64 %retval.sroa.2.0.insert.ext, 32
%retval.sroa.0.0.insert.ext = zext i32 %add to i64
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.2.0.insert.shift, %retval.sroa.0.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%square = alloca [4 x %struct.point], align 16
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %square) #4
%y_elem = getelementptr inbounds [4 x %struct.point], ptr %square, i64 0, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %square, ptr noundef nonnull %y_elem)
%arrayidx.1 = getelementptr inbounds [4 x %struct.point], ptr %square, i64 0, i64 1
%y_elem.1 = getelementptr inbounds [4 x %struct.point], ptr %square, i64 0, i64 1, i32 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1, ptr noundef nonnull %y_elem.1)
%arrayidx3 = getelementptr inbounds [4 x %struct.point], ptr %square, i64 0, i64 2
%0 = load i32, ptr %square, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx.1, align 8, !tbaa !5
%sub.neg.i = sub i32 %1, %0
%2 = load i32, ptr %y_elem, align 4, !tbaa !10
%3 = load i32, ptr %y_elem.1, align 4, !tbaa !10
%sub4.i = add i32 %2, %1
%add.i = sub i32 %sub4.i, %3
%add12.i = add nsw i32 %sub.neg.i, %3
%retval.sroa.2.0.insert.ext.i = zext i32 %add12.i to i64
%retval.sroa.2.0.insert.shift.i = shl nuw i64 %retval.sroa.2.0.insert.ext.i, 32
%retval.sroa.0.0.insert.ext.i = zext i32 %add.i to i64
%retval.sroa.0.0.insert.insert.i = or i64 %retval.sroa.2.0.insert.shift.i, %retval.sroa.0.0.insert.ext.i
store i64 %retval.sroa.0.0.insert.insert.i, ptr %arrayidx3, align 16, !tbaa.struct !11
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.i, i32 noundef %add12.i)
%arrayidx12 = getelementptr inbounds [4 x %struct.point], ptr %square, i64 0, i64 3
%4 = load i32, ptr %arrayidx.1, align 8, !tbaa !5
%5 = load i32, ptr %square, align 16, !tbaa !5
%sub.i = sub i32 %4, %5
%6 = load i32, ptr %y_elem.1, align 4, !tbaa !10
%7 = load i32, ptr %y_elem, align 4, !tbaa !10
%sub4.neg.i = sub i32 %5, %6
%add.i27 = add i32 %sub4.neg.i, %7
%add12.i28 = add nsw i32 %sub.i, %7
%retval.sroa.2.0.insert.ext.i29 = zext i32 %add12.i28 to i64
%retval.sroa.2.0.insert.shift.i30 = shl nuw i64 %retval.sroa.2.0.insert.ext.i29, 32
%retval.sroa.0.0.insert.ext.i31 = zext i32 %add.i27 to i64
%retval.sroa.0.0.insert.insert.i32 = or i64 %retval.sroa.2.0.insert.shift.i30, %retval.sroa.0.0.insert.ext.i31
store i64 %retval.sroa.0.0.insert.insert.i32, ptr %arrayidx12, align 8, !tbaa.struct !11
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add.i27, i32 noundef %add12.i28)
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %square) #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, !7, i64 0}
!6 = !{!"point", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12}
!12 = !{!7, !7, i64 0}
|
#include <stdio.h>
int main(void){
int x[4], y[4];
scanf("%d", x);
scanf("%d", y);
scanf("%d", x+1);
scanf("%d", y+1);
int dx = x[1] - x[0];
int dy = y[1] - y[0];
int Dx = -dy;
int Dy = dx;
x[2] = x[1] + Dx;
y[2] = y[1] + Dy;
x[3] = x[2] - dx;
y[3] = y[2] - dy;
printf("%d %d %d %d\n", x[2], y[2], x[3], y[3]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145313/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145313/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [4 x i32], align 16
%y = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%add.ptr = getelementptr inbounds i32, ptr %x, i64 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%add.ptr6 = getelementptr inbounds i32, ptr %y, i64 1
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr6)
%0 = load i32, ptr %add.ptr, align 4, !tbaa !5
%1 = load i32, ptr %x, align 16, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %add.ptr6, align 4, !tbaa !5
%3 = load i32, ptr %y, align 16, !tbaa !5
%sub11 = sub nsw i32 %2, %3
%add = sub i32 %0, %sub11
%arrayidx14 = getelementptr inbounds [4 x i32], ptr %x, i64 0, i64 2
store i32 %add, ptr %arrayidx14, align 8, !tbaa !5
%add16 = add nsw i32 %2, %sub
%arrayidx17 = getelementptr inbounds [4 x i32], ptr %y, i64 0, i64 2
store i32 %add16, ptr %arrayidx17, align 8, !tbaa !5
%sub19 = sub nsw i32 %add, %sub
%arrayidx20 = getelementptr inbounds [4 x i32], ptr %x, i64 0, i64 3
store i32 %sub19, ptr %arrayidx20, align 4, !tbaa !5
%sub22 = sub nsw i32 %add16, %sub11
%arrayidx23 = getelementptr inbounds [4 x i32], ptr %y, i64 0, i64 3
store i32 %sub22, ptr %arrayidx23, align 4, !tbaa !5
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add, i32 noundef %add16, i32 noundef %sub19, i32 noundef %sub22)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int x1,y1,x2,y2,x3,y3,x4,y4;
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
x3=x2-(y2-y1);
y3=y2+(x2-x1);
x4=x3-(x2-x1);
y4=y3-(y2-y1);
printf("%d %d %d %d\n",x3,y3,x4,y4);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145357/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145357/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca i32, align 4
%y1 = alloca i32, align 4
%x2 = alloca i32, align 4
%y2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load i32, ptr %x2, align 4, !tbaa !5
%1 = load i32, ptr %y2, align 4, !tbaa !5
%2 = load i32, ptr %y1, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%sub1 = sub nsw i32 %0, %sub
%3 = load i32, ptr %x1, align 4, !tbaa !5
%sub2 = sub nsw i32 %0, %3
%add = add nsw i32 %sub2, %1
%sub4 = sub nsw i32 %sub1, %sub2
%sub6 = sub nsw i32 %add, %sub
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub1, i32 noundef %add, i32 noundef %sub4, i32 noundef %sub6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int x[5],y[5],dx,dy,area;
scanf("%d %d %d %d",&x[0],&y[0],&x[1],&y[1]);
dx = x[1] - x[0];
dy = y[1] - y[0];
x[2] = x[1] + dy;
y[2] = y[1] - dx;
area = x[0]*y[1]+x[1]*y[2]+x[2]*y[0]-x[1]*y[0]-x[2]*y[1]-x[0]*y[2];
if(area < 0){
x[2] = x[2] - 2*dy;
y[2] = y[2] + 2*dx;
}
printf("%d %d %d %d\n",x[2],y[2],x[2]-dx,y[2]-dy);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145407/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145407/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [5 x i32], align 16
%y = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %y) #3
%arrayidx2 = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 1
%arrayidx3 = getelementptr inbounds [5 x i32], ptr %y, i64 0, i64 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr %x, align 16, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%3 = load i32, ptr %y, align 16, !tbaa !5
%sub8 = sub nsw i32 %2, %3
%add = add nsw i32 %sub8, %0
%arrayidx10 = getelementptr inbounds [5 x i32], ptr %x, i64 0, i64 2
store i32 %add, ptr %arrayidx10, align 8, !tbaa !5
%sub12 = sub nsw i32 %2, %sub
%arrayidx13 = getelementptr inbounds [5 x i32], ptr %y, i64 0, i64 2
store i32 %sub12, ptr %arrayidx13, align 8, !tbaa !5
%mul = mul nsw i32 %2, %1
%mul18 = mul nsw i32 %sub12, %0
%mul22 = mul nsw i32 %add, %3
%mul34.neg = mul i32 %sub12, %1
%mul26.neg = mul i32 %3, %0
%mul30.neg = mul i32 %add, %2
%reass.add = add i32 %mul26.neg, %mul34.neg
%reass.add56 = add i32 %reass.add, %mul30.neg
%add19 = add i32 %mul18, %mul
%add23 = add i32 %add19, %mul22
%sub35 = sub i32 %add23, %reass.add56
%cmp = icmp slt i32 %sub35, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%mul37 = shl nsw i32 %sub8, 1
%sub38 = sub nsw i32 %add, %mul37
store i32 %sub38, ptr %arrayidx10, align 8, !tbaa !5
%mul41 = shl nsw i32 %sub, 1
%add42 = add nsw i32 %sub12, %mul41
store i32 %add42, ptr %arrayidx13, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%4 = phi i32 [ %add42, %if.then ], [ %sub12, %entry ]
%5 = phi i32 [ %sub38, %if.then ], [ %add, %entry ]
%sub47 = sub nsw i32 %5, %sub
%sub49 = sub nsw i32 %4, %sub8
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %4, i32 noundef %sub47, i32 noundef %sub49)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a,b,c,d=0;
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("%d %d %d %d",c+b-d,d+c-a,a+b-d,b+c-a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145450/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145450/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
store i32 0, ptr %d, 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 %c, ptr noundef nonnull %d)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %d, align 4, !tbaa !5
%sub = sub nsw i32 %add, %2
%add1 = add nsw i32 %2, %0
%3 = load i32, ptr %a, align 4, !tbaa !5
%sub2 = sub i32 %add1, %3
%add3 = sub i32 %1, %2
%sub4 = add i32 %add3, %3
%sub6 = sub nsw i32 %add, %3
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub, i32 noundef %sub2, i32 noundef %sub4, i32 noundef %sub6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int x1, y1, x2, y2, x3, y3, x4, y4;
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
x3 = x2-(y2-y1);
y3 = y2+(x2-x1);
x4 = x3-(y3-y2);
y4 = y3+(x3-x2);
printf("%d %d %d %d\n", x3, y3, x4, y4);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145494/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145494/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca i32, align 4
%y1 = alloca i32, align 4
%x2 = alloca i32, align 4
%y2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load i32, ptr %x2, align 4, !tbaa !5
%1 = load i32, ptr %y2, align 4, !tbaa !5
%2 = load i32, ptr %y1, align 4, !tbaa !5
%sub.neg = sub i32 %2, %1
%sub1 = add i32 %sub.neg, %0
%3 = load i32, ptr %x1, align 4, !tbaa !5
%sub2 = sub nsw i32 %0, %3
%add = add nsw i32 %sub2, %1
%sub4 = sub nsw i32 %sub1, %sub2
%add6 = add i32 %sub2, %2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub1, i32 noundef %add, i32 noundef %sub4, i32 noundef %add6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
int main(void)
{
long n,a,b;
scanf("%ld %ld %ld",&n,&a,&b);
if(n%(a+b)<=a)
printf("%ld",n/(a+b)*a+n%(a+b));
if(n%(a+b)>a)
printf("%ld",n/(a+b)*a+a);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145537/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145537/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%ld %ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %2, %1
%rem = srem i64 %0, %add
%div = sdiv i64 %0, %add
%cmp.not = icmp sgt i64 %rem, %1
br i1 %cmp.not, label %if.end, label %if.then
if.then: ; preds = %entry
%mul = mul nsw i64 %div, %1
%add4 = add nsw i64 %mul, %rem
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add4)
%.pre = load i64, ptr %n, align 8, !tbaa !5
%.pre18 = load i64, ptr %a, align 8, !tbaa !5
%.pre19 = load i64, ptr %b, align 8, !tbaa !5
%.pre20 = add nsw i64 %.pre19, %.pre18
%.pre21 = srem i64 %.pre, %.pre20
br label %if.end
if.end: ; preds = %if.then, %entry
%rem7.pre-phi = phi i64 [ %.pre21, %if.then ], [ %rem, %entry ]
%add6.pre-phi = phi i64 [ %.pre20, %if.then ], [ %add, %entry ]
%3 = phi i64 [ %.pre18, %if.then ], [ %1, %entry ]
%4 = phi i64 [ %.pre, %if.then ], [ %0, %entry ]
%cmp8 = icmp sgt i64 %rem7.pre-phi, %3
br i1 %cmp8, label %if.then9, label %if.end15
if.then9: ; preds = %if.end
%div11 = sdiv i64 %4, %add6.pre-phi
%mul1217 = add i64 %div11, 1
%add13 = mul i64 %mul1217, %3
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add13)
br label %if.end15
if.end15: ; preds = %if.then9, %if.end
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
long n,a,b,l,m;
scanf("%ld%ld%ld",&n,&a,&b);
l=a+b;
if(n%l==0)
m=a*(n/l);
else if(n%l>=a)
m=a*(n/l)+a;
else
m=a*(n/l)+n%l;
printf("%ld",m);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145580/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145580/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%ld%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
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 %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %1, %0
%2 = load i64, ptr %n, align 8, !tbaa !5
%rem = srem i64 %2, %add
%div8 = sdiv i64 %2, %add
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%div = sdiv i64 %2, %add
%mul = mul nsw i64 %div, %0
br label %if.end12
if.else: ; preds = %entry
%cmp2.not = icmp slt i64 %rem, %0
br i1 %cmp2.not, label %if.else7, label %if.then3
if.then3: ; preds = %if.else
%3 = add i64 %div8, 1
%add6 = mul i64 %3, %0
br label %if.end12
if.else7: ; preds = %if.else
%mul9 = mul nsw i64 %div8, %0
%add11 = add nsw i64 %mul9, %rem
br label %if.end12
if.end12: ; preds = %if.then3, %if.else7, %if.then
%m.0 = phi i64 [ %mul, %if.then ], [ %add6, %if.then3 ], [ %add11, %if.else7 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %m.0)
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 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
long long n, azul, ver, ciclo=0, resposta=0, sobra=0;
scanf("%lld %lld %lld", &n, &azul, &ver);
ciclo= n/(azul+ver);
resposta= ciclo*azul;
sobra= n%(azul+ver);
if(sobra <= azul)
resposta+= sobra;
else
resposta +=azul;
printf("%lld\n",resposta);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145623/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145623/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%azul = alloca i64, align 8
%ver = 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 %azul) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ver) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %azul, ptr noundef nonnull %ver)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i64, ptr %azul, align 8, !tbaa !5
%2 = load i64, ptr %ver, align 8, !tbaa !5
%add = add nsw i64 %2, %1
%rem = srem i64 %0, %add
%.rem = call i64 @llvm.smin.i64(i64 %rem, i64 %1)
%div = sdiv i64 %0, %add
%mul = mul nsw i64 %div, %1
%resposta.0 = add nsw i64 %mul, %.rem
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %resposta.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ver) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %azul) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main (void){
unsigned long long int a,b,n;
scanf("%llu",&n);
scanf("%llu",&a);
scanf("%llu",&b);
if(a == 0)
printf("0\n");
else if(n%(a+b) < a)
printf("%llu\n",n/(a+b)*a+n%(a+b));
else
printf("%llu\n",n/(a+b)*a+a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145667/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145667/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%llu\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%llu\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 i64, align 8
%b = alloca i64, align 8
%n = alloca i64, 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end17
if.else: ; preds = %entry
%1 = load i64, ptr %n, align 8, !tbaa !5
%2 = load i64, ptr %b, align 8, !tbaa !5
%add = add i64 %2, %0
%rem = urem i64 %1, %add
%cmp4 = icmp ult i64 %rem, %0
%div = udiv i64 %1, %add
br i1 %cmp4, label %if.then5, label %if.else11
if.then5: ; preds = %if.else
%mul = mul i64 %div, %0
%add9 = add i64 %mul, %rem
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add9)
br label %if.end17
if.else11: ; preds = %if.else
%mul1418 = add i64 %div, 1
%add15 = mul i64 %mul1418, %0
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add15)
br label %if.end17
if.end17: ; preds = %if.then5, %if.else11, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
void merging(int arr[],int low,int mid,int high)
{
int l1,l2,i,b[200005];
for(l1=low,i=low,l2=mid+1;l1<=mid && l2<=high;i++)
{
if(arr[l1]<=arr[l2])
b[i]=arr[l1++];
else
{
b[i]=arr[l2++];
// count+=mid-l1+1;
}
}
while(l1<=mid)
{
b[i++]=arr[l1++];
}
while(l2<=high)
{
b[i++]=arr[l2++];
}
for(i=low;i<=high;i++)
{
arr[i]=b[i];
}
}
void sort(int arr[],int low,int high)
{
int mid;
if(low<high)
{
mid=(low+high)/2;
sort(arr,low,mid);
sort(arr,mid+1,high);
merging(arr,low,mid,high);
}
}
int main()
{
int n,t,arr[200005],c[200005],count,i,l,r;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
c[i]=arr[i];
}
sort(arr,0,n-1);
count=0;
for(i=0;i<n;i++)
{
if(arr[i]==c[i])
{
count++;
}
}
if(count==n)
{
printf("0\n");
}
else
{
for(i=0;i<n;i++)
{
if(arr[i]!=c[i])
{
l=i;
break;
}
}
for(i=n-1;i>l;i--)
{
if(arr[i]!=c[i])
{
r=i;
break;
}
}
count=0;
for(i=l;i<=r;i++)
{
if(arr[i]==c[i])
{
count++;
}
}
if(count==0)
{
printf("1\n");
}
else
{
printf("2\n");
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14571/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14571/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.4 = private unnamed_addr constant [2 x i8] c"1\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @merging(ptr nocapture noundef %arr, i32 noundef %low, i32 noundef %mid, i32 noundef %high) local_unnamed_addr #0 {
entry:
%b = alloca [200005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 800020, ptr nonnull %b) #7
%add = add i32 %mid, 1
%cmp71 = icmp sle i32 %low, %mid
%cmp172 = icmp slt i32 %mid, %high
%0 = and i1 %cmp71, %cmp172
br i1 %0, label %for.body.preheader, label %while.cond.preheader
for.body.preheader: ; preds = %entry
%1 = sext i32 %low to i64
br label %for.body
while.cond.preheader.loopexit: ; preds = %for.body
%2 = trunc i64 %indvars.iv.next to i32
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.loopexit, %entry
%l1.0.lcssa = phi i32 [ %low, %entry ], [ %l1.1, %while.cond.preheader.loopexit ]
%l2.0.lcssa = phi i32 [ %add, %entry ], [ %l2.1, %while.cond.preheader.loopexit ]
%i.0.lcssa = phi i32 [ %low, %entry ], [ %2, %while.cond.preheader.loopexit ]
%cmp15.not78 = icmp sgt i32 %l1.0.lcssa, %mid
br i1 %cmp15.not78, label %while.cond22.preheader, label %while.body.preheader
while.body.preheader: ; preds = %while.cond.preheader
%3 = sext i32 %i.0.lcssa to i64
%4 = shl nsw i64 %3, 2
%scevgep = getelementptr i8, ptr %b, i64 %4
%5 = sext i32 %l1.0.lcssa to i64
%6 = shl nsw i64 %5, 2
%scevgep88 = getelementptr i8, ptr %arr, i64 %6
%7 = sub i32 %mid, %l1.0.lcssa
%8 = zext i32 %7 to i64
%9 = shl nuw nsw i64 %8, 2
%10 = add nuw nsw i64 %9, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep88, i64 %10, i1 false), !tbaa !5
%11 = add i32 %i.0.lcssa, %7
%12 = add i32 %11, 1
br label %while.cond22.preheader
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%l2.074 = phi i32 [ %add, %for.body.preheader ], [ %l2.1, %for.body ]
%l1.073 = phi i32 [ %low, %for.body.preheader ], [ %l1.1, %for.body ]
%idxprom = sext i32 %l1.073 to i64
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %idxprom
%13 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom2 = sext i32 %l2.074 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %arr, i64 %idxprom2
%14 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4.not = icmp sle i32 %13, %14
%.sink = tail call i32 @llvm.smin.i32(i32 %13, i32 %14)
%inc = zext i1 %cmp4.not to i32
%l1.1 = add nsw i32 %l1.073, %inc
%not.cmp4.not = xor i1 %cmp4.not, true
%inc9 = zext i1 %not.cmp4.not to i32
%l2.1 = add nsw i32 %l2.074, %inc9
%15 = getelementptr inbounds [200005 x i32], ptr %b, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %15, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%cmp = icmp sle i32 %l1.1, %mid
%cmp1 = icmp sle i32 %l2.1, %high
%16 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %16, label %for.body, label %while.cond.preheader.loopexit, !llvm.loop !9
while.cond22.preheader: ; preds = %while.body.preheader, %while.cond.preheader
%i.1.lcssa = phi i32 [ %i.0.lcssa, %while.cond.preheader ], [ %12, %while.body.preheader ]
%cmp23.not82 = icmp sgt i32 %l2.0.lcssa, %high
br i1 %cmp23.not82, label %for.cond32.preheader, label %while.body24.preheader
while.body24.preheader: ; preds = %while.cond22.preheader
%17 = sext i32 %i.1.lcssa to i64
%18 = shl nsw i64 %17, 2
%scevgep96 = getelementptr i8, ptr %b, i64 %18
%19 = sext i32 %l2.0.lcssa to i64
%20 = shl nsw i64 %19, 2
%scevgep97 = getelementptr i8, ptr %arr, i64 %20
%21 = sub i32 %high, %l2.0.lcssa
%22 = zext i32 %21 to i64
%23 = shl nuw nsw i64 %22, 2
%24 = add nuw nsw i64 %23, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep96, ptr noundef nonnull align 4 dereferenceable(1) %scevgep97, i64 %24, i1 false), !tbaa !5
br label %for.cond32.preheader
for.cond32.preheader: ; preds = %while.body24.preheader, %while.cond22.preheader
%cmp33.not85 = icmp sgt i32 %low, %high
br i1 %cmp33.not85, label %for.end41, label %for.body34.preheader
for.body34.preheader: ; preds = %for.cond32.preheader
%25 = sext i32 %low to i64
%26 = shl nsw i64 %25, 2
%scevgep105 = getelementptr i8, ptr %arr, i64 %26
%scevgep106 = getelementptr i8, ptr %b, i64 %26
%27 = sub i32 %high, %low
%28 = zext i32 %27 to i64
%29 = shl nuw nsw i64 %28, 2
%30 = add nuw nsw i64 %29, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep105, ptr noundef nonnull align 4 dereferenceable(1) %scevgep106, i64 %30, i1 false), !tbaa !5
br label %for.end41
for.end41: ; preds = %for.body34.preheader, %for.cond32.preheader
call void @llvm.lifetime.end.p0(i64 800020, ptr nonnull %b) #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(argmem: readwrite) uwtable
define dso_local void @sort(ptr noundef %arr, i32 noundef %low, i32 noundef %high) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %low, %high
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add = add nsw i32 %high, %low
%div = sdiv i32 %add, 2
tail call void @sort(ptr noundef %arr, i32 noundef %low, i32 noundef %div)
%add1 = add nsw i32 %div, 1
tail call void @sort(ptr noundef %arr, i32 noundef %add1, i32 noundef %high)
tail call void @merging(ptr noundef %arr, i32 noundef %low, i32 noundef %div, i32 noundef %high)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
%arr = alloca [200005 x i32], align 16
%c = alloca [200005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #7
call void @llvm.lifetime.start.p0(i64 800020, ptr nonnull %arr) #7
call void @llvm.lifetime.start.p0(i64 800020, ptr nonnull %c) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec114 = add nsw i32 %0, -1
store i32 %dec114, ptr %t, align 4, !tbaa !5
%tobool.not115 = icmp eq i32 %0, 0
br i1 %tobool.not115, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end69
%r.0117 = phi i32 [ %r.2, %if.end69 ], [ undef, %entry ]
%l.0116 = phi i32 [ %l.2, %if.end69 ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp100 = icmp sgt i32 %1, 0
br i1 %cmp100, label %for.body, label %for.end18.thread
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %indvars.iv
store i32 %2, ptr %arrayidx6, 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 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
%sub = add nsw i32 %3, -1
call void @sort(ptr noundef nonnull %arr, i32 noundef 0, i32 noundef %sub)
%cmp8102 = icmp sgt i32 %3, 0
br i1 %cmp8102, label %for.body9.preheader, label %for.end18
for.body9.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %3 to i64
%min.iters.check164 = icmp ult i32 %3, 8
br i1 %min.iters.check164, label %for.body9.preheader182, label %vector.ph165
vector.ph165: ; preds = %for.body9.preheader
%n.vec167 = and i64 %wide.trip.count, 4294967288
br label %vector.body170
vector.body170: ; preds = %vector.body170, %vector.ph165
%index171 = phi i64 [ 0, %vector.ph165 ], [ %index.next178, %vector.body170 ]
%vec.phi172 = phi <4 x i32> [ zeroinitializer, %vector.ph165 ], [ %13, %vector.body170 ]
%vec.phi173 = phi <4 x i32> [ zeroinitializer, %vector.ph165 ], [ %14, %vector.body170 ]
%5 = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %index171
%wide.load174 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load175 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %index171
%wide.load176 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load177 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = icmp eq <4 x i32> %wide.load174, %wide.load176
%10 = icmp eq <4 x i32> %wide.load175, %wide.load177
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi172, %11
%14 = add <4 x i32> %vec.phi173, %12
%index.next178 = add nuw i64 %index171, 8
%15 = icmp eq i64 %index.next178, %n.vec167
br i1 %15, label %middle.block162, label %vector.body170, !llvm.loop !12
middle.block162: ; preds = %vector.body170
%bin.rdx179 = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx179)
%cmp.n169 = icmp eq i64 %n.vec167, %wide.trip.count
br i1 %cmp.n169, label %for.end18, label %for.body9.preheader182
for.body9.preheader182: ; preds = %for.body9.preheader, %middle.block162
%indvars.iv120.ph = phi i64 [ 0, %for.body9.preheader ], [ %n.vec167, %middle.block162 ]
%count.0103.ph = phi i32 [ 0, %for.body9.preheader ], [ %16, %middle.block162 ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader182, %for.body9
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body9 ], [ %indvars.iv120.ph, %for.body9.preheader182 ]
%count.0103 = phi i32 [ %spec.select, %for.body9 ], [ %count.0103.ph, %for.body9.preheader182 ]
%arrayidx11 = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %indvars.iv120
%17 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %indvars.iv120
%18 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp eq i32 %17, %18
%inc15 = zext i1 %cmp14 to i32
%spec.select = add nuw nsw i32 %count.0103, %inc15
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%exitcond.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count
br i1 %exitcond.not, label %for.end18, label %for.body9, !llvm.loop !15
for.end18: ; preds = %for.body9, %middle.block162, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %16, %middle.block162 ], [ %spec.select, %for.body9 ]
%cmp19 = icmp eq i32 %count.0.lcssa, %3
br i1 %cmp19, label %if.end69, label %for.cond22.preheader
for.end18.thread: ; preds = %while.body
%sub136 = add nsw i32 %1, -1
call void @sort(ptr noundef nonnull %arr, i32 noundef 0, i32 noundef %sub136)
%cmp19143 = icmp eq i32 %1, 0
br i1 %cmp19143, label %if.end69, label %for.end34
for.cond22.preheader: ; preds = %for.end18
br i1 %cmp8102, label %for.body24.preheader, label %for.end34
for.body24.preheader: ; preds = %for.cond22.preheader
%wide.trip.count126 = zext i32 %3 to i64
br label %for.body24
for.body24: ; preds = %for.body24.preheader, %for.inc32
%indvars.iv123 = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next124, %for.inc32 ]
%arrayidx26 = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %indvars.iv123
%19 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%arrayidx28 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %indvars.iv123
%20 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29.not = icmp eq i32 %19, %20
br i1 %cmp29.not, label %for.inc32, label %for.end34.loopexit.split.loop.exit
for.inc32: ; preds = %for.body24
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%exitcond127.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count126
br i1 %exitcond127.not, label %for.end34, label %for.body24, !llvm.loop !16
for.end34.loopexit.split.loop.exit: ; preds = %for.body24
%21 = trunc i64 %indvars.iv123 to i32
br label %for.end34
for.end34: ; preds = %for.inc32, %for.end34.loopexit.split.loop.exit, %for.end18.thread, %for.cond22.preheader
%.lcssa138145148 = phi i32 [ %3, %for.cond22.preheader ], [ %1, %for.end18.thread ], [ %3, %for.end34.loopexit.split.loop.exit ], [ %3, %for.inc32 ]
%l.1 = phi i32 [ %l.0116, %for.cond22.preheader ], [ %l.0116, %for.end18.thread ], [ %21, %for.end34.loopexit.split.loop.exit ], [ %l.0116, %for.inc32 ]
%22 = sext i32 %.lcssa138145148 to i64
%23 = sext i32 %l.1 to i64
br label %for.cond36
for.cond36: ; preds = %for.body38, %for.end34
%indvars.iv128 = phi i64 [ %indvars.iv.next129, %for.body38 ], [ %22, %for.end34 ]
%indvars.iv.next129 = add nsw i64 %indvars.iv128, -1
%cmp37 = icmp sgt i64 %indvars.iv.next129, %23
br i1 %cmp37, label %for.body38, label %for.end48
for.body38: ; preds = %for.cond36
%arrayidx40 = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %indvars.iv.next129
%24 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%arrayidx42 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %indvars.iv.next129
%25 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%cmp43.not = icmp eq i32 %24, %25
br i1 %cmp43.not, label %for.cond36, label %for.end48.split.loop.exit, !llvm.loop !17
for.end48.split.loop.exit: ; preds = %for.body38
%26 = trunc i64 %indvars.iv.next129 to i32
br label %for.end48
for.end48: ; preds = %for.cond36, %for.end48.split.loop.exit
%r.1 = phi i32 [ %26, %for.end48.split.loop.exit ], [ %r.0117, %for.cond36 ]
%cmp50.not110 = icmp sgt i32 %l.1, %r.1
br i1 %cmp50.not110, label %if.end69, label %for.body51.preheader
for.body51.preheader: ; preds = %for.end48
%27 = add i32 %r.1, 1
%28 = sub i32 %r.1, %l.1
%29 = zext i32 %28 to i64
%30 = add nuw nsw i64 %29, 1
%min.iters.check = icmp ult i32 %28, 7
br i1 %min.iters.check, label %for.body51.preheader181, label %vector.ph
vector.ph: ; preds = %for.body51.preheader
%n.vec = and i64 %30, 8589934584
%ind.end = add nsw i64 %n.vec, %23
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 ], [ %39, %vector.body ]
%vec.phi158 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %40, %vector.body ]
%offset.idx = add i64 %index, %23
%31 = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %31, align 4, !tbaa !5
%32 = getelementptr inbounds i32, ptr %31, i64 4
%wide.load159 = load <4 x i32>, ptr %32, align 4, !tbaa !5
%33 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %offset.idx
%wide.load160 = load <4 x i32>, ptr %33, align 4, !tbaa !5
%34 = getelementptr inbounds i32, ptr %33, i64 4
%wide.load161 = load <4 x i32>, ptr %34, align 4, !tbaa !5
%35 = icmp eq <4 x i32> %wide.load, %wide.load160
%36 = icmp eq <4 x i32> %wide.load159, %wide.load161
%37 = zext <4 x i1> %35 to <4 x i32>
%38 = zext <4 x i1> %36 to <4 x i32>
%39 = add <4 x i32> %vec.phi, %37
%40 = add <4 x i32> %vec.phi158, %38
%index.next = add nuw i64 %index, 8
%41 = icmp eq i64 %index.next, %n.vec
br i1 %41, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %40, %39
%42 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %30, %n.vec
br i1 %cmp.n, label %for.end62, label %for.body51.preheader181
for.body51.preheader181: ; preds = %for.body51.preheader, %middle.block
%indvars.iv131.ph = phi i64 [ %23, %for.body51.preheader ], [ %ind.end, %middle.block ]
%count.2111.ph = phi i32 [ 0, %for.body51.preheader ], [ %42, %middle.block ]
br label %for.body51
for.body51: ; preds = %for.body51.preheader181, %for.body51
%indvars.iv131 = phi i64 [ %indvars.iv.next132, %for.body51 ], [ %indvars.iv131.ph, %for.body51.preheader181 ]
%count.2111 = phi i32 [ %spec.select99, %for.body51 ], [ %count.2111.ph, %for.body51.preheader181 ]
%arrayidx53 = getelementptr inbounds [200005 x i32], ptr %arr, i64 0, i64 %indvars.iv131
%43 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%arrayidx55 = getelementptr inbounds [200005 x i32], ptr %c, i64 0, i64 %indvars.iv131
%44 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%cmp56 = icmp eq i32 %43, %44
%inc58 = zext i1 %cmp56 to i32
%spec.select99 = add nuw nsw i32 %count.2111, %inc58
%indvars.iv.next132 = add nsw i64 %indvars.iv131, 1
%lftr.wideiv = trunc i64 %indvars.iv.next132 to i32
%exitcond134.not = icmp eq i32 %27, %lftr.wideiv
br i1 %exitcond134.not, label %for.end62, label %for.body51, !llvm.loop !19
for.end62: ; preds = %for.body51, %middle.block
%spec.select99.lcssa = phi i32 [ %42, %middle.block ], [ %spec.select99, %for.body51 ]
%cmp63 = icmp eq i32 %spec.select99.lcssa, 0
%spec.select155 = select i1 %cmp63, ptr @str.4, ptr @str
br label %if.end69
if.end69: ; preds = %for.end62, %for.end48, %for.end18, %for.end18.thread
%str.4.sink = phi ptr [ @str.5, %for.end18.thread ], [ @str.5, %for.end18 ], [ @str.4, %for.end48 ], [ %spec.select155, %for.end62 ]
%l.2 = phi i32 [ %l.0116, %for.end18.thread ], [ %l.0116, %for.end18 ], [ %l.1, %for.end48 ], [ %l.1, %for.end62 ]
%r.2 = phi i32 [ %r.0117, %for.end18.thread ], [ %r.0117, %for.end18 ], [ %r.1, %for.end48 ], [ %r.1, %for.end62 ]
%puts97 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
%45 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %45, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %45, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %if.end69, %entry
call void @llvm.lifetime.end.p0(i64 800020, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 800020, ptr nonnull %arr) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 @puts(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 i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !13, !14}
!19 = distinct !{!19, !10, !14, !13}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
int main(void)
{
int i, j;
// dic_t dic[200000];
int min, max;
int len, flg;
int cnt, maxcnt;
long aa,bb,cc,dd,ee;
scanf("%ld %ld %ld", &aa,&bb,&cc);
// printf("%ld %ld %ld", aa,bb,cc);
if(bb == 0){
printf("0\n");
return 0;
}
dd = aa /(bb+cc);
ee = aa %(bb+cc);
// printf("dd%ld ee%ld",dd,ee);
if(bb < ee){
printf("%ld",dd*bb+bb);
}
else{
printf("%ld",dd*bb+ee);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145753/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145753/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%ld %ld %ld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load 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:
%aa = alloca i64, align 8
%bb = alloca i64, align 8
%cc = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %aa) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %bb) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %cc) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %aa, ptr noundef nonnull %bb, ptr noundef nonnull %cc)
%0 = load i64, ptr %bb, align 8, !tbaa !9
%cmp = icmp eq i64 %0, 0
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 i64, ptr %aa, align 8, !tbaa !9
%2 = load i64, ptr %cc, align 8, !tbaa !9
%add = add nsw i64 %2, %0
%div = sdiv i64 %1, %add
%rem = srem i64 %1, %add
%cmp3 = icmp slt i64 %0, %rem
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %if.end
%mul25 = add i64 %div, 1
%add5 = mul i64 %mul25, %0
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add5)
br label %cleanup
if.else: ; preds = %if.end
%mul7 = mul nsw i64 %div, %0
%add8 = add nsw i64 %mul7, %rem
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add8)
br label %cleanup
cleanup: ; preds = %if.then4, %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %cc) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %bb) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %aa) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
|
// AOJ 2858: Prime-Factor Prime
// 2017.11.25 bal4u@uu
#include <stdio.h>
#include <string.h>
#include <math.h>
#define MAX 31623 // sqrt(1e9)
char tbl[MAX+3];
int sz; // max sz = 3402, prime[0] = 2, prime[3401] = 31623
int prime[3500] = { // prime[40] = 179, 179^2 = 32041
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97,101,103,107,109,113,
127,131,137,139,149,151,157,163,167,173,
179 };
int sqp[41] = { // squre of prime: sqp[i] = prime[i] * prime[i]
4, 9,25,49,121,169,289,361,529,841,961,
1369,1681,1849,2209,2809,3481,3721,4489,5041,
5329,6241,6889,7921,9409,10201,10609,11449,11881,12769,
16129,17161,18769,19321,22201,22801,24649,26569,27889,29929,
32041 };
char ptbl[31] = { 0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0 };
void sieve()
{
int i, j, k;
for (i = 1; i < 41; i++) {
k = prime[i];
for (j = sqp[i]; j < MAX; j += k) tbl[j] = 1;
}
for (sz = 40, i = 179; i <= MAX; i += 2) if (!tbl[i]) prime[sz++] = i;
}
int a[1000002];
int b[1000002];
int bsch(int x)
{
int m, l = 0, r = sz;
while (l < r) {
m = (l + r) >> 1;
if (prime[m] == x) return m;
if (prime[m] < x) l = m + 1; else r = m;
}
return l-1;
}
int main()
{
int l, r, i, k, ll, rr, p0, pp, ans;
long long j;
sieve();
scanf("%d%d", &l, &r);
if (r < 4) { puts("0"); return 0; }
sz = bsch((int)sqrt(r));
for (i = r-l; i >= 0; i--) b[i] = 1;
for (i = 0; i <= sz; i++) {
p0 = prime[i];
for (j = p0; j <= r; j *= p0) {
pp = (int)j;
ll = pp*(1+(l-1)/pp), rr = pp*(r/pp);
while (ll <= rr) a[ll-l]++, b[ll-l] *= p0, ll += pp;
}
}
ans = 0;
for (k = l, i = 0; k <= r; i++, k++) {
if (k != b[i]) a[i]++;
if (ptbl[a[i]]) ans++;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145797/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145797/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@prime = dso_local local_unnamed_addr global <{ [41 x i32], [3459 x i32] }> <{ [41 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 41, i32 43, i32 47, i32 53, i32 59, i32 61, i32 67, i32 71, i32 73, i32 79, i32 83, i32 89, i32 97, i32 101, i32 103, i32 107, i32 109, i32 113, i32 127, i32 131, i32 137, i32 139, i32 149, i32 151, i32 157, i32 163, i32 167, i32 173, i32 179], [3459 x i32] zeroinitializer }>, align 16
@sqp = dso_local local_unnamed_addr global [41 x i32] [i32 4, i32 9, i32 25, i32 49, i32 121, i32 169, i32 289, i32 361, i32 529, i32 841, i32 961, i32 1369, i32 1681, i32 1849, i32 2209, i32 2809, i32 3481, i32 3721, i32 4489, i32 5041, i32 5329, i32 6241, i32 6889, i32 7921, i32 9409, i32 10201, i32 10609, i32 11449, i32 11881, i32 12769, i32 16129, i32 17161, i32 18769, i32 19321, i32 22201, i32 22801, i32 24649, i32 26569, i32 27889, i32 29929, i32 32041], align 16
@ptbl = dso_local local_unnamed_addr global [31 x i8] c"\00\00\01\01\00\01\00\01\00\00\00\01\00\01\00\00\00\01\00\01\00\00\00\01\00\00\00\00\00\01\00", align 16
@tbl = dso_local local_unnamed_addr global [31626 x i8] zeroinitializer, align 16
@sz = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@b = dso_local local_unnamed_addr global [1000002 x i32] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global [1000002 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @sieve() local_unnamed_addr #0 {
entry:
br label %for.body
for.body: ; preds = %entry, %for.inc8
%indvars.iv38 = phi i64 [ 1, %entry ], [ %indvars.iv.next39, %for.inc8 ]
%arrayidx2 = getelementptr inbounds [41 x i32], ptr @sqp, i64 0, i64 %indvars.iv38
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp430 = icmp slt i32 %0, 31623
br i1 %cmp430, label %for.body5.preheader, label %for.inc8
for.body5.preheader: ; preds = %for.body
%arrayidx = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %indvars.iv38
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = sext i32 %0 to i64
%3 = sext i32 %1 to i64
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv = phi i64 [ %2, %for.body5.preheader ], [ %indvars.iv.next, %for.body5 ]
%arrayidx7 = getelementptr inbounds [31626 x i8], ptr @tbl, i64 0, i64 %indvars.iv
store i8 1, ptr %arrayidx7, align 1, !tbaa !9
%indvars.iv.next = add i64 %indvars.iv, %3
%cmp4 = icmp slt i64 %indvars.iv.next, 31623
br i1 %cmp4, label %for.body5, label %for.inc8, !llvm.loop !10
for.inc8: ; preds = %for.body5, %for.body
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond.not = icmp eq i64 %indvars.iv.next39, 41
br i1 %exitcond.not, label %for.end9, label %for.body, !llvm.loop !12
for.end9: ; preds = %for.inc8
store i32 40, ptr @sz, align 4, !tbaa !5
br label %for.body12
for.body12: ; preds = %for.inc18.1, %for.end9
%indvars.iv41 = phi i64 [ 179, %for.end9 ], [ %indvars.iv.next42.1, %for.inc18.1 ]
%inc153435 = phi i32 [ 40, %for.end9 ], [ %inc1533.1, %for.inc18.1 ]
%arrayidx14 = getelementptr inbounds [31626 x i8], ptr @tbl, i64 0, i64 %indvars.iv41
%4 = load i8, ptr %arrayidx14, align 1, !tbaa !9
%tobool.not = icmp eq i8 %4, 0
br i1 %tobool.not, label %if.then, label %for.inc18
if.then: ; preds = %for.body12
%inc15 = add nsw i32 %inc153435, 1
store i32 %inc15, ptr @sz, align 4, !tbaa !5
%idxprom16 = sext i32 %inc153435 to i64
%arrayidx17 = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %idxprom16
%5 = trunc i64 %indvars.iv41 to i32
store i32 %5, ptr %arrayidx17, align 4, !tbaa !5
br label %for.inc18
for.inc18: ; preds = %for.body12, %if.then
%inc1533 = phi i32 [ %inc153435, %for.body12 ], [ %inc15, %if.then ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 2
%cmp11 = icmp ult i64 %indvars.iv41, 31622
br i1 %cmp11, label %for.body12.1, label %for.end20, !llvm.loop !13
for.body12.1: ; preds = %for.inc18
%arrayidx14.1 = getelementptr inbounds [31626 x i8], ptr @tbl, i64 0, i64 %indvars.iv.next42
%6 = load i8, ptr %arrayidx14.1, align 1, !tbaa !9
%tobool.not.1 = icmp eq i8 %6, 0
br i1 %tobool.not.1, label %if.then.1, label %for.inc18.1
if.then.1: ; preds = %for.body12.1
%inc15.1 = add nsw i32 %inc1533, 1
store i32 %inc15.1, ptr @sz, align 4, !tbaa !5
%idxprom16.1 = sext i32 %inc1533 to i64
%arrayidx17.1 = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %idxprom16.1
%7 = trunc i64 %indvars.iv.next42 to i32
store i32 %7, ptr %arrayidx17.1, align 4, !tbaa !5
br label %for.inc18.1
for.inc18.1: ; preds = %if.then.1, %for.body12.1
%inc1533.1 = phi i32 [ %inc1533, %for.body12.1 ], [ %inc15.1, %if.then.1 ]
%indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 4
br label %for.body12
for.end20: ; preds = %for.inc18
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @bsch(i32 noundef %x) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @sz, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%r.021 = phi i32 [ %r.1, %if.end ], [ %0, %entry ]
%l.020 = phi i32 [ %l.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %r.021, %l.020
%shr = ashr i32 %add, 1
%idxprom = sext i32 %shr to i64
%arrayidx = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %x
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %x
%add6 = add nsw i32 %shr, 1
%l.1 = select i1 %cmp4, i32 %add6, i32 %l.020
%r.1 = select i1 %cmp4, i32 %r.021, i32 %shr
%cmp = icmp slt i32 %l.1, %r.1
br i1 %cmp, label %while.body, label %while.end.loopexit, !llvm.loop !14
while.end.loopexit: ; preds = %if.end
%2 = add nsw i32 %l.1, -1
br label %cleanup
cleanup: ; preds = %while.body, %entry, %while.end.loopexit
%retval.0 = phi i32 [ -1, %entry ], [ %2, %while.end.loopexit ], [ %shr, %while.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%l = alloca i32, align 4
%r = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
br label %for.body.i
for.body.i: ; preds = %for.inc8.i, %entry
%indvars.iv38.i = phi i64 [ 1, %entry ], [ %indvars.iv.next39.i, %for.inc8.i ]
%arrayidx2.i = getelementptr inbounds [41 x i32], ptr @sqp, i64 0, i64 %indvars.iv38.i
%0 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp430.i = icmp slt i32 %0, 31623
br i1 %cmp430.i, label %for.body5.preheader.i, label %for.inc8.i
for.body5.preheader.i: ; preds = %for.body.i
%arrayidx.i = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %indvars.iv38.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%2 = sext i32 %0 to i64
%3 = sext i32 %1 to i64
br label %for.body5.i
for.body5.i: ; preds = %for.body5.i, %for.body5.preheader.i
%indvars.iv.i = phi i64 [ %2, %for.body5.preheader.i ], [ %indvars.iv.next.i, %for.body5.i ]
%arrayidx7.i = getelementptr inbounds [31626 x i8], ptr @tbl, i64 0, i64 %indvars.iv.i
store i8 1, ptr %arrayidx7.i, align 1, !tbaa !9
%indvars.iv.next.i = add i64 %indvars.iv.i, %3
%cmp4.i = icmp slt i64 %indvars.iv.next.i, 31623
br i1 %cmp4.i, label %for.body5.i, label %for.inc8.i, !llvm.loop !10
for.inc8.i: ; preds = %for.body5.i, %for.body.i
%indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next39.i, 41
br i1 %exitcond.not.i, label %for.end9.i, label %for.body.i, !llvm.loop !12
for.end9.i: ; preds = %for.inc8.i
store i32 40, ptr @sz, align 4, !tbaa !5
br label %for.body12.i
for.body12.i: ; preds = %for.inc18.i.1, %for.end9.i
%indvars.iv41.i = phi i64 [ 179, %for.end9.i ], [ %indvars.iv.next42.i.1, %for.inc18.i.1 ]
%inc153435.i = phi i32 [ 40, %for.end9.i ], [ %inc1533.i.1, %for.inc18.i.1 ]
%arrayidx14.i = getelementptr inbounds [31626 x i8], ptr @tbl, i64 0, i64 %indvars.iv41.i
%4 = load i8, ptr %arrayidx14.i, align 1, !tbaa !9
%tobool.not.i = icmp eq i8 %4, 0
br i1 %tobool.not.i, label %if.then.i, label %for.inc18.i
if.then.i: ; preds = %for.body12.i
%inc15.i = add nsw i32 %inc153435.i, 1
store i32 %inc15.i, ptr @sz, align 4, !tbaa !5
%idxprom16.i = sext i32 %inc153435.i to i64
%arrayidx17.i = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %idxprom16.i
%5 = trunc i64 %indvars.iv41.i to i32
store i32 %5, ptr %arrayidx17.i, align 4, !tbaa !5
br label %for.inc18.i
for.inc18.i: ; preds = %if.then.i, %for.body12.i
%inc1533.i = phi i32 [ %inc153435.i, %for.body12.i ], [ %inc15.i, %if.then.i ]
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 2
%cmp11.i = icmp ult i64 %indvars.iv41.i, 31622
br i1 %cmp11.i, label %for.body12.i.1, label %sieve.exit, !llvm.loop !13
for.body12.i.1: ; preds = %for.inc18.i
%arrayidx14.i.1 = getelementptr inbounds [31626 x i8], ptr @tbl, i64 0, i64 %indvars.iv.next42.i
%6 = load i8, ptr %arrayidx14.i.1, align 1, !tbaa !9
%tobool.not.i.1 = icmp eq i8 %6, 0
br i1 %tobool.not.i.1, label %if.then.i.1, label %for.inc18.i.1
if.then.i.1: ; preds = %for.body12.i.1
%inc15.i.1 = add nsw i32 %inc1533.i, 1
store i32 %inc15.i.1, ptr @sz, align 4, !tbaa !5
%idxprom16.i.1 = sext i32 %inc1533.i to i64
%arrayidx17.i.1 = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %idxprom16.i.1
%7 = trunc i64 %indvars.iv.next42.i to i32
store i32 %7, ptr %arrayidx17.i.1, align 4, !tbaa !5
br label %for.inc18.i.1
for.inc18.i.1: ; preds = %if.then.i.1, %for.body12.i.1
%inc1533.i.1 = phi i32 [ %inc1533.i, %for.body12.i.1 ], [ %inc15.i.1, %if.then.i.1 ]
%indvars.iv.next42.i.1 = add nuw nsw i64 %indvars.iv41.i, 4
br label %for.body12.i
sieve.exit: ; preds = %for.inc18.i
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%8 = load i32, ptr %r, align 4, !tbaa !5
%cmp = icmp slt i32 %8, 4
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %sieve.exit
%call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %sieve.exit
%conv = sitofp i32 %8 to double
%call2 = call double @sqrt(double noundef %conv) #6
%conv3 = fptosi double %call2 to i32
%9 = load i32, ptr @sz, align 4, !tbaa !5
%cmp19.i = icmp sgt i32 %9, 0
br i1 %cmp19.i, label %while.body.i, label %bsch.exit
while.body.i: ; preds = %if.end, %if.end.i
%r.021.i = phi i32 [ %r.1.i, %if.end.i ], [ %9, %if.end ]
%l.020.i = phi i32 [ %l.1.i, %if.end.i ], [ 0, %if.end ]
%add.i = add nsw i32 %l.020.i, %r.021.i
%shr.i = ashr i32 %add.i, 1
%idxprom.i = sext i32 %shr.i to i64
%arrayidx.i97 = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %idxprom.i
%10 = load i32, ptr %arrayidx.i97, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %10, %conv3
br i1 %cmp1.i, label %bsch.exit, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp4.i98 = icmp slt i32 %10, %conv3
%add6.i = add nsw i32 %shr.i, 1
%l.1.i = select i1 %cmp4.i98, i32 %add6.i, i32 %l.020.i
%r.1.i = select i1 %cmp4.i98, i32 %r.021.i, i32 %shr.i
%cmp.i = icmp slt i32 %l.1.i, %r.1.i
br i1 %cmp.i, label %while.body.i, label %while.end.loopexit.i, !llvm.loop !14
while.end.loopexit.i: ; preds = %if.end.i
%11 = add nsw i32 %l.1.i, -1
br label %bsch.exit
bsch.exit: ; preds = %while.body.i, %if.end, %while.end.loopexit.i
%retval.0.i = phi i32 [ -1, %if.end ], [ %11, %while.end.loopexit.i ], [ %shr.i, %while.body.i ]
store i32 %retval.0.i, ptr @sz, align 4, !tbaa !5
%12 = load i32, ptr %r, align 4, !tbaa !5
%.fr = freeze i32 %12
%13 = load i32, ptr %l, align 4, !tbaa !5
%sub = sub nsw i32 %.fr, %13
%cmp5100 = icmp sgt i32 %sub, -1
br i1 %cmp5100, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %bsch.exit
%14 = zext i32 %sub to i64
%15 = add i32 %.fr, 1
%16 = sub i32 %15, %13
%17 = zext i32 %16 to i64
%min.iters.check = icmp ult i32 %16, 8
br i1 %min.iters.check, label %for.body.preheader128, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %17, 4294967288
%ind.end = sub nsw i64 %14, %n.vec
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = sub i64 %14, %index
%18 = getelementptr inbounds [1000002 x i32], ptr @b, i64 0, i64 %offset.idx
%19 = getelementptr inbounds i32, ptr %18, i64 -3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %18, i64 -7
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %20, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %17
br i1 %cmp.n, label %for.cond7.preheader, label %for.body.preheader128
for.body.preheader128: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %14, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.cond7.preheader: ; preds = %for.body, %middle.block, %bsch.exit
%cmp8.not106 = icmp slt i32 %retval.0.i, 0
br i1 %cmp8.not106, label %for.cond40.preheader, label %for.body10.lr.ph
for.body10.lr.ph: ; preds = %for.cond7.preheader
%conv15 = sext i32 %.fr to i64
%sub20 = add nsw i32 %13, -1
%22 = sext i32 %13 to i64
%23 = add nuw nsw i32 %retval.0.i, 1
%wide.trip.count = zext i32 %23 to i64
br label %for.body10
for.body: ; preds = %for.body.preheader128, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader128 ]
%arrayidx = getelementptr inbounds [1000002 x i32], ptr @b, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%24 = trunc i64 %indvars.iv to i32
%cmp5 = icmp sgt i32 %24, 0
br i1 %cmp5, label %for.body, label %for.cond7.preheader, !llvm.loop !18
for.cond40.preheader: ; preds = %for.inc37, %for.cond7.preheader
%cmp41.not108 = icmp sgt i32 %13, %.fr
br i1 %cmp41.not108, label %for.end63, label %for.body43.preheader
for.body43.preheader: ; preds = %for.cond40.preheader
%25 = add i32 %.fr, 1
%26 = sub i32 %25, %13
%wide.trip.count124 = zext i32 %26 to i64
br label %for.body43
for.body10: ; preds = %for.body10.lr.ph, %for.inc37
%indvars.iv118 = phi i64 [ 0, %for.body10.lr.ph ], [ %indvars.iv.next119, %for.inc37 ]
%arrayidx12 = getelementptr inbounds [3500 x i32], ptr @prime, i64 0, i64 %indvars.iv118
%27 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%conv13 = sext i32 %27 to i64
%cmp16.not104 = icmp sgt i32 %27, %.fr
br i1 %cmp16.not104, label %for.inc37, label %for.body18
for.body18: ; preds = %for.body10, %for.inc33
%j.0105 = phi i64 [ %mul35, %for.inc33 ], [ %conv13, %for.body10 ]
%conv19 = trunc i64 %j.0105 to i32
%div = sdiv i32 %sub20, %conv19
%add = add nsw i32 %div, 1
%mul = mul nsw i32 %add, %conv19
%28 = srem i32 %.fr, %conv19
%mul22 = sub nsw i32 %.fr, %28
%cmp23.not102 = icmp sgt i32 %mul, %mul22
br i1 %cmp23.not102, label %for.inc33, label %while.body.preheader
while.body.preheader: ; preds = %for.body18
%29 = sext i32 %mul to i64
%sext = shl i64 %j.0105, 32
%30 = ashr exact i64 %sext, 32
%31 = sext i32 %mul22 to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv114 = phi i64 [ %29, %while.body.preheader ], [ %indvars.iv.next115, %while.body ]
%32 = sub nsw i64 %indvars.iv114, %22
%arrayidx27 = getelementptr inbounds [1000002 x i32], ptr @a, i64 0, i64 %32
%33 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%inc = add nsw i32 %33, 1
store i32 %inc, ptr %arrayidx27, align 4, !tbaa !5
%arrayidx30 = getelementptr inbounds [1000002 x i32], ptr @b, i64 0, i64 %32
%34 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%mul31 = mul nsw i32 %34, %27
store i32 %mul31, ptr %arrayidx30, align 4, !tbaa !5
%indvars.iv.next115 = add i64 %indvars.iv114, %30
%cmp23.not = icmp sgt i64 %indvars.iv.next115, %31
br i1 %cmp23.not, label %for.inc33, label %while.body, !llvm.loop !19
for.inc33: ; preds = %while.body, %for.body18
%mul35 = mul nsw i64 %j.0105, %conv13
%cmp16.not = icmp sgt i64 %mul35, %conv15
br i1 %cmp16.not, label %for.inc37, label %for.body18, !llvm.loop !20
for.inc37: ; preds = %for.inc33, %for.body10
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count
br i1 %exitcond.not, label %for.cond40.preheader, label %for.body10, !llvm.loop !21
for.body43: ; preds = %for.body43.preheader, %if.end52
%indvars.iv121 = phi i64 [ 0, %for.body43.preheader ], [ %indvars.iv.next122, %if.end52 ]
%ans.0111 = phi i32 [ 0, %for.body43.preheader ], [ %spec.select, %if.end52 ]
%k.0109 = phi i32 [ %13, %for.body43.preheader ], [ %inc62, %if.end52 ]
%arrayidx45 = getelementptr inbounds [1000002 x i32], ptr @b, i64 0, i64 %indvars.iv121
%35 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%cmp46.not = icmp eq i32 %k.0109, %35
%arrayidx54.phi.trans.insert = getelementptr inbounds [1000002 x i32], ptr @a, i64 0, i64 %indvars.iv121
%.pre = load i32, ptr %arrayidx54.phi.trans.insert, align 4, !tbaa !5
br i1 %cmp46.not, label %if.end52, label %if.then48
if.then48: ; preds = %for.body43
%inc51 = add nsw i32 %.pre, 1
store i32 %inc51, ptr %arrayidx54.phi.trans.insert, align 4, !tbaa !5
br label %if.end52
if.end52: ; preds = %for.body43, %if.then48
%36 = phi i32 [ %inc51, %if.then48 ], [ %.pre, %for.body43 ]
%idxprom55 = sext i32 %36 to i64
%arrayidx56 = getelementptr inbounds [31 x i8], ptr @ptbl, i64 0, i64 %idxprom55
%37 = load i8, ptr %arrayidx56, align 1, !tbaa !9
%tobool.not = icmp ne i8 %37, 0
%inc58 = zext i1 %tobool.not to i32
%spec.select = add nuw nsw i32 %ans.0111, %inc58
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%inc62 = add nsw i32 %k.0109, 1
%exitcond125.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count124
br i1 %exitcond125.not, label %for.end63, label %for.body43, !llvm.loop !22
for.end63: ; preds = %if.end52, %for.cond40.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond40.preheader ], [ %spec.select, %if.end52 ]
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end63, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !11, !17, !16}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
|
#include <stdio.h>
int main(void)
{
int n=0,i;
char c;
for(i=0;i<4;i++){
scanf("%c",&c);
if(c=='+') n++;
else if(c=='-') n--;
}
printf("%d\n",n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145847/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145847/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%switch.selectcmp = icmp eq i8 %0, 45
%switch.select = sext i1 %switch.selectcmp to i32
%switch.selectcmp15 = icmp eq i8 %0, 43
%switch.select16 = select i1 %switch.selectcmp15, i32 1, i32 %switch.select
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%1 = load i8, ptr %c, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 43, label %if.then.1
i8 45, label %if.then6.1
]
if.then6.1: ; preds = %entry
%dec.1 = add nsw i32 %switch.select16, -1
br label %for.inc.1
if.then.1: ; preds = %entry
%inc.1 = add nsw i32 %switch.select16, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then6.1, %entry
%n.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %dec.1, %if.then6.1 ], [ %switch.select16, %entry ]
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%2 = load i8, ptr %c, align 1, !tbaa !5
switch i8 %2, label %for.inc.2 [
i8 43, label %if.then.2
i8 45, label %if.then6.2
]
if.then6.2: ; preds = %for.inc.1
%dec.2 = add nsw i32 %n.1.1, -1
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nsw i32 %n.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then6.2, %for.inc.1
%n.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ %dec.2, %if.then6.2 ], [ %n.1.1, %for.inc.1 ]
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%3 = load i8, ptr %c, align 1, !tbaa !5
switch i8 %3, label %for.inc.3 [
i8 43, label %if.then.3
i8 45, label %if.then6.3
]
if.then6.3: ; preds = %for.inc.2
%dec.3 = add nsw i32 %n.1.2, -1
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%inc.3 = add nsw i32 %n.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.then6.3, %for.inc.2
%n.1.3 = phi i32 [ %inc.3, %if.then.3 ], [ %dec.3, %if.then6.3 ], [ %n.1.2, %for.inc.2 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.1.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"}
|
#include<stdio.h>
int main()
{
char a[4];
for(int i=0;i<4;i++){
scanf("%c",&a[i]);
}
int c=0;
for(int i=0;i<4;i++){
if(a[i]=='+'){
c++;
}
else{
c--;
}
}
printf("%d",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145898/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145898/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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 [4 x i8], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%arrayidx.3 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%0 = load <4 x i8>, ptr %a, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int ANS=0, i;
char S[6];
scanf("%s", S);
for(i=0; i<4; i++){
if(S[i] == '+') ANS++;
else ANS--;
}
printf("%d\n", ANS);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145940/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145940/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8], align 4
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load <4 x i8>, ptr %S, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include <stdio.h>
int main(){
char a[4];
int ans = 0;
scanf("%s",a);
for(int i=0; i<4; i++){
if(a[i] == '+'){
ans++;
}else{
ans--;
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145984/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145984/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca [4 x i8], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load <4 x i8>, ptr %a, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
char s[55];
int i,k=0;
scanf("%s",s);
for(i=0; i<4; i++)
{
if(s[i] == '+')
k++;
else if(s[i] == '-')
k--;
}
printf("%d\n",k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146026/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146026/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [55 x i8], align 16
call void @llvm.lifetime.start.p0(i64 55, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%switch.selectcmp = icmp eq i8 %0, 45
%switch.select = sext i1 %switch.selectcmp to i32
%switch.selectcmp20 = icmp eq i8 %0, 43
%switch.select21 = select i1 %switch.selectcmp20, i32 1, i32 %switch.select
%arrayidx.1 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 43, label %if.then.1
i8 45, label %if.then8.1
]
if.then8.1: ; preds = %entry
%dec.1 = add nsw i32 %switch.select21, -1
br label %for.inc.1
if.then.1: ; preds = %entry
%inc.1 = add nsw i32 %switch.select21, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then8.1, %entry
%k.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %dec.1, %if.then8.1 ], [ %switch.select21, %entry ]
%arrayidx.2 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 2, !tbaa !5
switch i8 %2, label %for.inc.2 [
i8 43, label %if.then.2
i8 45, label %if.then8.2
]
if.then8.2: ; preds = %for.inc.1
%dec.2 = add nsw i32 %k.1.1, -1
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nsw i32 %k.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then8.2, %for.inc.1
%k.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ %dec.2, %if.then8.2 ], [ %k.1.1, %for.inc.1 ]
%arrayidx.3 = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
switch i8 %3, label %for.inc.3 [
i8 43, label %if.then.3
i8 45, label %if.then8.3
]
if.then8.3: ; preds = %for.inc.2
%dec.3 = add nsw i32 %k.1.2, -1
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%inc.3 = add nsw i32 %k.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.then8.3, %for.inc.2
%k.1.3 = phi i32 [ %inc.3, %if.then.3 ], [ %dec.3, %if.then8.3 ], [ %k.1.2, %for.inc.2 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.1.3)
call void @llvm.lifetime.end.p0(i64 55, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int t,n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
while(n--) printf("1 ");
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14607/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14607/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec11 = add nsw i32 %0, -1
store i32 %dec11, ptr %t, align 4, !tbaa !5
%tobool.not12 = icmp eq i32 %0, 0
br i1 %tobool.not12, label %while.end8, label %while.body
while.body: ; preds = %entry, %while.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%dec39 = add nsw i32 %1, -1
store i32 %dec39, ptr %n, align 4, !tbaa !5
%tobool4.not10 = icmp eq i32 %1, 0
br i1 %tobool4.not10, label %while.end, label %while.body5
while.body5: ; preds = %while.body, %while.body5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%2 = load i32, ptr %n, align 4, !tbaa !5
%dec3 = add nsw i32 %2, -1
store i32 %dec3, ptr %n, align 4, !tbaa !5
%tobool4.not = icmp eq i32 %2, 0
br i1 %tobool4.not, label %while.end, label %while.body5, !llvm.loop !9
while.end: ; preds = %while.body5, %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.end8, label %while.body, !llvm.loop !11
while.end8: ; preds = %while.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>
int main(){
char A[5];
scanf("%s",A);
int check=0;
for(int i=0;i<4;i++){
if('+'==A[i]){check++;}
if('-'==A[i]){check--;}
}
printf("%d",check);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146112/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146112/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [5 x i8], align 4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %A) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%0 = load <4 x i8>, ptr %A, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 45, i8 45, i8 45, i8 45>
%2 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%3 = bitcast <4 x i1> %1 to i4
%4 = call i4 @llvm.ctpop.i4(i4 %3), !range !8
%5 = zext i4 %4 to i32
%6 = bitcast <4 x i1> %2 to i4
%7 = call i4 @llvm.ctpop.i4(i4 %6), !range !8
%8 = zext i4 %7 to i32
%op.rdx = sub nsw i32 %8, %5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %op.rdx)
call void @llvm.lifetime.end.p0(i64 5, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #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 = !{i4 0, i4 5}
|
#include <stdio.h>
#include <string.h>
int main(void) {
char S[255];
int ans=0;
int i;
scanf("%s\n",S);
for (i=0; i<=3; i++) {
if (S[i] == '+') {
ans++;
} else {
ans--;
}
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146156/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146156/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s\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:
%S = alloca [255 x i8], align 16
call void @llvm.lifetime.start.p0(i64 255, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load <4 x i8>, ptr %S, align 16, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 255, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
int n = 0;
char S[5];
scanf("%s", S);
for (int i = 0; i < 4; i++) {
if (S[i] == '+') n++;
else n--;
}
printf("%d\n", n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146206/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146206/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8], align 4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load <4 x i8>, ptr %S, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int ih,im,is;
int oh,om,os;
int o3h,o3m,o3s;
while(1){
scanf("%d %d %d",&ih,&im,&is);
if(ih<0 && im<0 && is<0)break;
oh = 2 - ih;
om = 0 - im;
os = 0 - is;
if(os<0){
os += 60;
om--;
}
if(om<0){
om += 60;
oh--;
}
o3h = 3*oh;
o3m = 3*om;
o3s = 3*os;
while(o3s>=60){
o3s -= 60;
o3m++;
}
while(o3m>=60){
o3m -= 60;
o3h++;
}
if(oh<10)printf("0%d:",oh);
else printf("%d:",oh);
if(om<10)printf("0%d:",om);
else printf("%d:",om);
if(os<10)printf("0%d\n",os);
else printf("%d\n",os);
if(o3h<10)printf("0%d:",o3h);
else printf("%d:",o3h);
if(o3m<10)printf("0%d:",o3m);
else printf("%d:",o3m);
if(o3s<10)printf("0%d\n",o3s);
else printf("%d\n",o3s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146257/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146257/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"0%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"0%d\0A\00", align 1
@.str.4 = 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:
%ih = alloca i32, align 4
%im = alloca i32, align 4
%is = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ih) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %im) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %is) #4
%call101 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ih, ptr noundef nonnull %im, ptr noundef nonnull %is)
%0 = load i32, ptr %ih, align 4, !tbaa !5
%cmp102 = icmp slt i32 %0, 0
%1 = load i32, ptr %im, align 4
%cmp1103 = icmp slt i32 %1, 0
%or.cond104 = select i1 %cmp102, i1 %cmp1103, i1 false
%2 = load i32, ptr %is, align 4
%cmp3105 = icmp slt i32 %2, 0
%or.cond62106 = select i1 %or.cond104, i1 %cmp3105, i1 false
br i1 %or.cond62106, label %while.end61, label %if.end
if.end: ; preds = %entry, %while.end25
%3 = phi i32 [ %29, %while.end25 ], [ %2, %entry ]
%4 = phi i32 [ %28, %while.end25 ], [ %1, %entry ]
%5 = phi i32 [ %27, %while.end25 ], [ %0, %entry ]
%sub4 = sub nsw i32 0, %4
%cmp6 = icmp sgt i32 %3, 0
%dec = xor i32 %4, -1
%spec.select = select i1 %cmp6, i32 %dec, i32 %sub4
%spec.select91 = select i1 %cmp6, i32 60, i32 0
%os.0 = sub i32 %spec.select91, %3
%cmp9 = icmp sgt i32 %spec.select, -1
%add11 = add nsw i32 %spec.select, 60
%.pn90 = select i1 %cmp9, i32 2, i32 1
%om.1 = select i1 %cmp9, i32 %spec.select, i32 %add11
%oh.0 = sub i32 %.pn90, %5
%mul = mul nsw i32 %oh.0, 3
%mul14 = mul i32 %om.1, 3
%mul15 = mul i32 %os.0, 3
%cmp1792 = icmp sgt i32 %os.0, 19
br i1 %cmp1792, label %while.body18.preheader, label %while.cond20.preheader
while.body18.preheader: ; preds = %if.end
%6 = mul nuw nsw i32 %spec.select91, 3
%7 = mul i32 %3, 3
%8 = add nuw nsw i32 %6, 59
%smin = call i32 @llvm.smin.i32(i32 %mul15, i32 119)
%9 = add i32 %smin, %7
%10 = sub i32 %8, %9
%11 = udiv i32 %10, 60
%.neg = mul i32 %11, -60
%12 = add nuw nsw i32 %11, 1
%13 = add nsw i32 %6, -60
%14 = sub i32 %13, %7
%15 = add i32 %.neg, %14
%16 = add i32 %12, %mul14
br label %while.cond20.preheader
while.cond20.preheader: ; preds = %while.body18.preheader, %if.end
%o3m.0.lcssa = phi i32 [ %mul14, %if.end ], [ %16, %while.body18.preheader ]
%o3s.0.lcssa = phi i32 [ %mul15, %if.end ], [ %15, %while.body18.preheader ]
%cmp2196 = icmp sgt i32 %o3m.0.lcssa, 59
br i1 %cmp2196, label %while.body22.preheader, label %while.end25
while.body22.preheader: ; preds = %while.cond20.preheader
%17 = add nsw i32 %o3m.0.lcssa, -60
%18 = add nuw i32 %o3m.0.lcssa, 59
%smin107 = call i32 @llvm.smin.i32(i32 %o3m.0.lcssa, i32 119)
%19 = sub nuw i32 %18, %smin107
%20 = udiv i32 %19, 60
%.neg108 = mul nsw i32 %20, -60
%21 = add nsw i32 %.neg108, %17
%22 = zext i1 %cmp9 to i32
%23 = shl nuw nsw i32 3, %22
%.neg109 = mul i32 %5, -3
%24 = add nuw nsw i32 %20, 1
%25 = add nuw nsw i32 %24, %23
%26 = add i32 %.neg109, %25
br label %while.end25
while.end25: ; preds = %while.body22.preheader, %while.cond20.preheader
%o3h.0.lcssa = phi i32 [ %mul, %while.cond20.preheader ], [ %26, %while.body22.preheader ]
%o3m.1.lcssa = phi i32 [ %o3m.0.lcssa, %while.cond20.preheader ], [ %21, %while.body22.preheader ]
%cmp26 = icmp slt i32 %oh.0, 10
%.str.1..str.2 = select i1 %cmp26, ptr @.str.1, ptr @.str.2
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %oh.0)
%cmp31 = icmp slt i32 %om.1, 10
%.str.2.sink110 = select i1 %cmp31, ptr @.str.1, ptr @.str.2
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink110, i32 noundef %om.1)
%cmp37 = icmp slt i32 %os.0, 10
%.str.4.sink = select i1 %cmp37, ptr @.str.3, ptr @.str.4
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink, i32 noundef %os.0)
%cmp43 = icmp slt i32 %o3h.0.lcssa, 10
%.str.2.sink111 = select i1 %cmp43, ptr @.str.1, ptr @.str.2
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink111, i32 noundef %o3h.0.lcssa)
%cmp49 = icmp slt i32 %o3m.1.lcssa, 10
%.str.2.sink112 = select i1 %cmp49, ptr @.str.1, ptr @.str.2
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink112, i32 noundef %o3m.1.lcssa)
%cmp55 = icmp slt i32 %o3s.0.lcssa, 10
%.str.4.sink113 = select i1 %cmp55, ptr @.str.3, ptr @.str.4
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink113, i32 noundef %o3s.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ih, ptr noundef nonnull %im, ptr noundef nonnull %is)
%27 = load i32, ptr %ih, align 4, !tbaa !5
%cmp = icmp slt i32 %27, 0
%28 = load i32, ptr %im, align 4
%cmp1 = icmp slt i32 %28, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%29 = load i32, ptr %is, align 4
%cmp3 = icmp slt i32 %29, 0
%or.cond62 = select i1 %or.cond, i1 %cmp3, i1 false
br i1 %or.cond62, label %while.end61, label %if.end
while.end61: ; preds = %while.end25, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %is) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %im) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ih) #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"}
|
// AOJ 0330: Halting Problem
// 2017.10.27 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ADDV 1
#define ADDC 2
#define SUBV 3
#define SUBC 4
#define SETV 5
#define SETC 6
#define IFV 7
#define HALT 8
typedef struct { int lin, cmd, v1, v2, v3, con, to; } T;
T pgm[52]; int n;
int tr['z'+1];
char var[26]; int sz;
int lin[1002];
char tmp[110][26];
char mk[51][16][16][16][16][16];
void doprint()
{
int i;
for (i = 'a'; i <= 'z'; i++) if (tr[i] >= 0) printf("%c=%d\n", i, var[tr[i]]);
}
void calc(int id, int v)
{
if (v < 0 || v >= 16) { doprint(); exit(0); }
var[id] = v;
}
int varid(char x)
{
int r;
if (tr[x] < 0) r = sz++, tr[x] = r;
else r = tr[x];
return r;
}
int main()
{
int i, pc, cnt;
char cmd, b1[10], b2[10], b3[10];
T *tp;
memset(tr, -1, sizeof(tr)), memset(lin, -1, sizeof(lin)), sz = 0;
scanf("%d", &n);
for (tp = pgm, i = 0; i < n; i++, tp++) {
scanf("%d%s", &tp->lin, b1); lin[tp->lin] = i, cmd = *(b1+1);
if (cmd == 'A') tp->cmd = HALT;
else if (cmd == 'D' || cmd == 'U') {
scanf("%s%s%s", b1, b2, b3);
tp->v1 = varid(*b1), tp->v2 = varid(*b2);
if (*b3 >= 'a') {
tp->cmd = (cmd == 'D') ? ADDV : SUBV;
tp->v3 = varid(*b3);
} else {
tp->cmd = (cmd == 'D') ? ADDC : SUBC;
tp->con = atoi(b3);
}
} else if (cmd == 'E') {
scanf("%s%s", b1, b2);
tp->v1 = varid(*b1);
if (*b2 >= 'a') {
tp->cmd = SETV;
tp->v2 = varid(*b2);
} else {
tp->cmd = SETC;
tp->con = atoi(b2);
}
} else { // IF
scanf("%s%d", b1, &tp->to);
tp->cmd = IFV, tp->v1 = varid(*b1);
}
}
pc = 0, cnt = 0;
while (1) {
tp = pgm+pc;
if (tp->cmd == ADDV) calc(tp->v1, var[tp->v2] + var[tp->v3]);
else if (tp->cmd == ADDC) calc(tp->v1, var[tp->v2] + tp->con);
else if (tp->cmd == SUBV) calc(tp->v1, var[tp->v2] - var[tp->v3]);
else if (tp->cmd == SUBC) calc(tp->v1, var[tp->v2] - tp->con);
else if (tp->cmd == SETV) calc(tp->v1, var[tp->v2]);
else if (tp->cmd == SETC) calc(tp->v1, tp->con);
else if (tp->cmd == HALT) break;
if (tp->cmd == IFV && var[tp->v1] != 0) {
if (lin[tp->to] < 0) break;
if (mk[pc][var[0]][var[1]][var[2]][var[3]][var[4]]) { puts("inf"); return 0; }
mk[pc][var[0]][var[1]][var[2]][var[3]][var[4]] = 1;
pc = lin[tp->to];
} else {
pc++;
if (pc == n) break;
}
}
doprint();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146329/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146329/source.c"
target datalayout = "e-m:e-p270: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.T = type { i32, i32, i32, i32, i32, i32, i32 }
@tr = dso_local local_unnamed_addr global [123 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%c=%d\0A\00", align 1
@var = dso_local local_unnamed_addr global [26 x i8] zeroinitializer, align 16
@sz = dso_local local_unnamed_addr global i32 0, align 4
@lin = dso_local local_unnamed_addr global [1002 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@pgm = dso_local global [52 x %struct.T] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s%s%s\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%s%d\00", align 1
@mk = dso_local local_unnamed_addr global [51 x [16 x [16 x [16 x [16 x [16 x i8]]]]]] zeroinitializer, align 16
@.str.6 = private unnamed_addr constant [4 x i8] c"inf\00", align 1
@tmp = dso_local local_unnamed_addr global [110 x [26 x i8]] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local void @doprint() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 97), align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, -1
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %entry
%idxprom4 = zext i32 %0 to i64
%arrayidx5 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !9
%conv = sext i8 %1 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 97, i32 noundef %conv)
br label %for.inc
for.inc: ; preds = %entry, %if.then
%2 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 98), align 8, !tbaa !5
%cmp1.1 = icmp sgt i32 %2, -1
br i1 %cmp1.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%idxprom4.1 = zext i32 %2 to i64
%arrayidx5.1 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.1
%3 = load i8, ptr %arrayidx5.1, align 1, !tbaa !9
%conv.1 = sext i8 %3 to i32
%call.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 98, i32 noundef %conv.1)
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%4 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 99), align 4, !tbaa !5
%cmp1.2 = icmp sgt i32 %4, -1
br i1 %cmp1.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%idxprom4.2 = zext i32 %4 to i64
%arrayidx5.2 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.2
%5 = load i8, ptr %arrayidx5.2, align 1, !tbaa !9
%conv.2 = sext i8 %5 to i32
%call.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 99, i32 noundef %conv.2)
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%6 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 100), align 16, !tbaa !5
%cmp1.3 = icmp sgt i32 %6, -1
br i1 %cmp1.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%idxprom4.3 = zext i32 %6 to i64
%arrayidx5.3 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.3
%7 = load i8, ptr %arrayidx5.3, align 1, !tbaa !9
%conv.3 = sext i8 %7 to i32
%call.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 100, i32 noundef %conv.3)
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%8 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 101), align 4, !tbaa !5
%cmp1.4 = icmp sgt i32 %8, -1
br i1 %cmp1.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%idxprom4.4 = zext i32 %8 to i64
%arrayidx5.4 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.4
%9 = load i8, ptr %arrayidx5.4, align 1, !tbaa !9
%conv.4 = sext i8 %9 to i32
%call.4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 101, i32 noundef %conv.4)
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3
%10 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 102), align 8, !tbaa !5
%cmp1.5 = icmp sgt i32 %10, -1
br i1 %cmp1.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
%idxprom4.5 = zext i32 %10 to i64
%arrayidx5.5 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.5
%11 = load i8, ptr %arrayidx5.5, align 1, !tbaa !9
%conv.5 = sext i8 %11 to i32
%call.5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 102, i32 noundef %conv.5)
br label %for.inc.5
for.inc.5: ; preds = %if.then.5, %for.inc.4
%12 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 103), align 4, !tbaa !5
%cmp1.6 = icmp sgt i32 %12, -1
br i1 %cmp1.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
%idxprom4.6 = zext i32 %12 to i64
%arrayidx5.6 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.6
%13 = load i8, ptr %arrayidx5.6, align 1, !tbaa !9
%conv.6 = sext i8 %13 to i32
%call.6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 103, i32 noundef %conv.6)
br label %for.inc.6
for.inc.6: ; preds = %if.then.6, %for.inc.5
%14 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 104), align 16, !tbaa !5
%cmp1.7 = icmp sgt i32 %14, -1
br i1 %cmp1.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
%idxprom4.7 = zext i32 %14 to i64
%arrayidx5.7 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.7
%15 = load i8, ptr %arrayidx5.7, align 1, !tbaa !9
%conv.7 = sext i8 %15 to i32
%call.7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 104, i32 noundef %conv.7)
br label %for.inc.7
for.inc.7: ; preds = %if.then.7, %for.inc.6
%16 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 105), align 4, !tbaa !5
%cmp1.8 = icmp sgt i32 %16, -1
br i1 %cmp1.8, label %if.then.8, label %for.inc.8
if.then.8: ; preds = %for.inc.7
%idxprom4.8 = zext i32 %16 to i64
%arrayidx5.8 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.8
%17 = load i8, ptr %arrayidx5.8, align 1, !tbaa !9
%conv.8 = sext i8 %17 to i32
%call.8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 105, i32 noundef %conv.8)
br label %for.inc.8
for.inc.8: ; preds = %if.then.8, %for.inc.7
%18 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 106), align 8, !tbaa !5
%cmp1.9 = icmp sgt i32 %18, -1
br i1 %cmp1.9, label %if.then.9, label %for.inc.9
if.then.9: ; preds = %for.inc.8
%idxprom4.9 = zext i32 %18 to i64
%arrayidx5.9 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.9
%19 = load i8, ptr %arrayidx5.9, align 1, !tbaa !9
%conv.9 = sext i8 %19 to i32
%call.9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 106, i32 noundef %conv.9)
br label %for.inc.9
for.inc.9: ; preds = %if.then.9, %for.inc.8
%20 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 107), align 4, !tbaa !5
%cmp1.10 = icmp sgt i32 %20, -1
br i1 %cmp1.10, label %if.then.10, label %for.inc.10
if.then.10: ; preds = %for.inc.9
%idxprom4.10 = zext i32 %20 to i64
%arrayidx5.10 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.10
%21 = load i8, ptr %arrayidx5.10, align 1, !tbaa !9
%conv.10 = sext i8 %21 to i32
%call.10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 107, i32 noundef %conv.10)
br label %for.inc.10
for.inc.10: ; preds = %if.then.10, %for.inc.9
%22 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 108), align 16, !tbaa !5
%cmp1.11 = icmp sgt i32 %22, -1
br i1 %cmp1.11, label %if.then.11, label %for.inc.11
if.then.11: ; preds = %for.inc.10
%idxprom4.11 = zext i32 %22 to i64
%arrayidx5.11 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.11
%23 = load i8, ptr %arrayidx5.11, align 1, !tbaa !9
%conv.11 = sext i8 %23 to i32
%call.11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 108, i32 noundef %conv.11)
br label %for.inc.11
for.inc.11: ; preds = %if.then.11, %for.inc.10
%24 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 109), align 4, !tbaa !5
%cmp1.12 = icmp sgt i32 %24, -1
br i1 %cmp1.12, label %if.then.12, label %for.inc.12
if.then.12: ; preds = %for.inc.11
%idxprom4.12 = zext i32 %24 to i64
%arrayidx5.12 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.12
%25 = load i8, ptr %arrayidx5.12, align 1, !tbaa !9
%conv.12 = sext i8 %25 to i32
%call.12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 109, i32 noundef %conv.12)
br label %for.inc.12
for.inc.12: ; preds = %if.then.12, %for.inc.11
%26 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 110), align 8, !tbaa !5
%cmp1.13 = icmp sgt i32 %26, -1
br i1 %cmp1.13, label %if.then.13, label %for.inc.13
if.then.13: ; preds = %for.inc.12
%idxprom4.13 = zext i32 %26 to i64
%arrayidx5.13 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.13
%27 = load i8, ptr %arrayidx5.13, align 1, !tbaa !9
%conv.13 = sext i8 %27 to i32
%call.13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 110, i32 noundef %conv.13)
br label %for.inc.13
for.inc.13: ; preds = %if.then.13, %for.inc.12
%28 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 111), align 4, !tbaa !5
%cmp1.14 = icmp sgt i32 %28, -1
br i1 %cmp1.14, label %if.then.14, label %for.inc.14
if.then.14: ; preds = %for.inc.13
%idxprom4.14 = zext i32 %28 to i64
%arrayidx5.14 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.14
%29 = load i8, ptr %arrayidx5.14, align 1, !tbaa !9
%conv.14 = sext i8 %29 to i32
%call.14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 111, i32 noundef %conv.14)
br label %for.inc.14
for.inc.14: ; preds = %if.then.14, %for.inc.13
%30 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 112), align 16, !tbaa !5
%cmp1.15 = icmp sgt i32 %30, -1
br i1 %cmp1.15, label %if.then.15, label %for.inc.15
if.then.15: ; preds = %for.inc.14
%idxprom4.15 = zext i32 %30 to i64
%arrayidx5.15 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.15
%31 = load i8, ptr %arrayidx5.15, align 1, !tbaa !9
%conv.15 = sext i8 %31 to i32
%call.15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 112, i32 noundef %conv.15)
br label %for.inc.15
for.inc.15: ; preds = %if.then.15, %for.inc.14
%32 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 113), align 4, !tbaa !5
%cmp1.16 = icmp sgt i32 %32, -1
br i1 %cmp1.16, label %if.then.16, label %for.inc.16
if.then.16: ; preds = %for.inc.15
%idxprom4.16 = zext i32 %32 to i64
%arrayidx5.16 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.16
%33 = load i8, ptr %arrayidx5.16, align 1, !tbaa !9
%conv.16 = sext i8 %33 to i32
%call.16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 113, i32 noundef %conv.16)
br label %for.inc.16
for.inc.16: ; preds = %if.then.16, %for.inc.15
%34 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 114), align 8, !tbaa !5
%cmp1.17 = icmp sgt i32 %34, -1
br i1 %cmp1.17, label %if.then.17, label %for.inc.17
if.then.17: ; preds = %for.inc.16
%idxprom4.17 = zext i32 %34 to i64
%arrayidx5.17 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.17
%35 = load i8, ptr %arrayidx5.17, align 1, !tbaa !9
%conv.17 = sext i8 %35 to i32
%call.17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 114, i32 noundef %conv.17)
br label %for.inc.17
for.inc.17: ; preds = %if.then.17, %for.inc.16
%36 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 115), align 4, !tbaa !5
%cmp1.18 = icmp sgt i32 %36, -1
br i1 %cmp1.18, label %if.then.18, label %for.inc.18
if.then.18: ; preds = %for.inc.17
%idxprom4.18 = zext i32 %36 to i64
%arrayidx5.18 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.18
%37 = load i8, ptr %arrayidx5.18, align 1, !tbaa !9
%conv.18 = sext i8 %37 to i32
%call.18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 115, i32 noundef %conv.18)
br label %for.inc.18
for.inc.18: ; preds = %if.then.18, %for.inc.17
%38 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 116), align 16, !tbaa !5
%cmp1.19 = icmp sgt i32 %38, -1
br i1 %cmp1.19, label %if.then.19, label %for.inc.19
if.then.19: ; preds = %for.inc.18
%idxprom4.19 = zext i32 %38 to i64
%arrayidx5.19 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.19
%39 = load i8, ptr %arrayidx5.19, align 1, !tbaa !9
%conv.19 = sext i8 %39 to i32
%call.19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 116, i32 noundef %conv.19)
br label %for.inc.19
for.inc.19: ; preds = %if.then.19, %for.inc.18
%40 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 117), align 4, !tbaa !5
%cmp1.20 = icmp sgt i32 %40, -1
br i1 %cmp1.20, label %if.then.20, label %for.inc.20
if.then.20: ; preds = %for.inc.19
%idxprom4.20 = zext i32 %40 to i64
%arrayidx5.20 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.20
%41 = load i8, ptr %arrayidx5.20, align 1, !tbaa !9
%conv.20 = sext i8 %41 to i32
%call.20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 117, i32 noundef %conv.20)
br label %for.inc.20
for.inc.20: ; preds = %if.then.20, %for.inc.19
%42 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 118), align 8, !tbaa !5
%cmp1.21 = icmp sgt i32 %42, -1
br i1 %cmp1.21, label %if.then.21, label %for.inc.21
if.then.21: ; preds = %for.inc.20
%idxprom4.21 = zext i32 %42 to i64
%arrayidx5.21 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.21
%43 = load i8, ptr %arrayidx5.21, align 1, !tbaa !9
%conv.21 = sext i8 %43 to i32
%call.21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 118, i32 noundef %conv.21)
br label %for.inc.21
for.inc.21: ; preds = %if.then.21, %for.inc.20
%44 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 119), align 4, !tbaa !5
%cmp1.22 = icmp sgt i32 %44, -1
br i1 %cmp1.22, label %if.then.22, label %for.inc.22
if.then.22: ; preds = %for.inc.21
%idxprom4.22 = zext i32 %44 to i64
%arrayidx5.22 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.22
%45 = load i8, ptr %arrayidx5.22, align 1, !tbaa !9
%conv.22 = sext i8 %45 to i32
%call.22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 119, i32 noundef %conv.22)
br label %for.inc.22
for.inc.22: ; preds = %if.then.22, %for.inc.21
%46 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 120), align 16, !tbaa !5
%cmp1.23 = icmp sgt i32 %46, -1
br i1 %cmp1.23, label %if.then.23, label %for.inc.23
if.then.23: ; preds = %for.inc.22
%idxprom4.23 = zext i32 %46 to i64
%arrayidx5.23 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.23
%47 = load i8, ptr %arrayidx5.23, align 1, !tbaa !9
%conv.23 = sext i8 %47 to i32
%call.23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 120, i32 noundef %conv.23)
br label %for.inc.23
for.inc.23: ; preds = %if.then.23, %for.inc.22
%48 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 121), align 4, !tbaa !5
%cmp1.24 = icmp sgt i32 %48, -1
br i1 %cmp1.24, label %if.then.24, label %for.inc.24
if.then.24: ; preds = %for.inc.23
%idxprom4.24 = zext i32 %48 to i64
%arrayidx5.24 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.24
%49 = load i8, ptr %arrayidx5.24, align 1, !tbaa !9
%conv.24 = sext i8 %49 to i32
%call.24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 121, i32 noundef %conv.24)
br label %for.inc.24
for.inc.24: ; preds = %if.then.24, %for.inc.23
%50 = load i32, ptr getelementptr inbounds ([123 x i32], ptr @tr, i64 0, i64 122), align 8, !tbaa !5
%cmp1.25 = icmp sgt i32 %50, -1
br i1 %cmp1.25, label %if.then.25, label %for.inc.25
if.then.25: ; preds = %for.inc.24
%idxprom4.25 = zext i32 %50 to i64
%arrayidx5.25 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom4.25
%51 = load i8, ptr %arrayidx5.25, align 1, !tbaa !9
%conv.25 = sext i8 %51 to i32
%call.25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 122, i32 noundef %conv.25)
br label %for.inc.25
for.inc.25: ; preds = %if.then.25, %for.inc.24
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local void @calc(i32 noundef %id, i32 noundef %v) local_unnamed_addr #3 {
entry:
%or.cond = icmp ugt i32 %v, 15
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @doprint()
tail call void @exit(i32 noundef 0) #8
unreachable
if.end: ; preds = %entry
%conv = trunc i32 %v to i8
%idxprom = sext i32 %id to i64
%arrayidx = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom
store i8 %conv, ptr %arrayidx, align 1, !tbaa !9
ret void
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @varid(i8 noundef signext %x) local_unnamed_addr #5 {
entry:
%idxprom = sext i8 %x to i64
%arrayidx = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%1 = load i32, ptr @sz, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @sz, align 4, !tbaa !5
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %entry, %if.then
%r.0 = phi i32 [ %1, %if.then ], [ %0, %entry ]
ret i32 %r.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%b1 = alloca [10 x i8], align 1
%b2 = alloca [10 x i8], align 1
%b3 = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %b1) #9
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %b2) #9
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %b3) #9
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(492) @tr, i8 -1, i64 492, i1 false)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4008) @lin, i8 -1, i64 4008, i1 false)
store i32 0, ptr @sz, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp345 = icmp sgt i32 %0, 0
br i1 %cmp345, label %for.body.lr.ph, label %while.cond.preheader
for.body.lr.ph: ; preds = %entry
%add.ptr = getelementptr inbounds i8, ptr %b1, i64 1
br label %for.body
while.cond.preheader: ; preds = %for.inc, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %21, %for.inc ]
br label %while.cond
for.body: ; preds = %for.body.lr.ph, %for.inc
%tp.0347 = phi ptr [ @pgm, %for.body.lr.ph ], [ %incdec.ptr, %for.inc ]
%i.0346 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %tp.0347, ptr noundef nonnull %b1)
%1 = load i32, ptr %tp.0347, align 4, !tbaa !10
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [1002 x i32], ptr @lin, i64 0, i64 %idxprom
store i32 %i.0346, ptr %arrayidx, align 4, !tbaa !5
%2 = load i8, ptr %add.ptr, align 1, !tbaa !9
%cmp4 = icmp eq i8 %2, 65
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%cmd6 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 1
store i32 8, ptr %cmd6, align 4, !tbaa !12
br label %for.inc
if.else: ; preds = %for.body
%cmp8 = icmp eq i8 %2, 68
switch i8 %2, label %if.else67 [
i8 85, label %if.then13
i8 68, label %if.then13
i8 69, label %if.then45
]
if.then13: ; preds = %if.else, %if.else
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %b1, ptr noundef nonnull %b2, ptr noundef nonnull %b3)
%3 = load i8, ptr %b1, align 1, !tbaa !9
%idxprom.i = sext i8 %3 to i64
%arrayidx.i = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp.i = icmp slt i32 %4, 0
br i1 %cmp.i, label %if.then.i, label %varid.exit
if.then.i: ; preds = %if.then13
%5 = load i32, ptr @sz, align 4, !tbaa !5
%inc.i = add nsw i32 %5, 1
store i32 %inc.i, ptr @sz, align 4, !tbaa !5
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !5
br label %varid.exit
varid.exit: ; preds = %if.then13, %if.then.i
%r.0.i = phi i32 [ %5, %if.then.i ], [ %4, %if.then13 ]
%v1 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 2
store i32 %r.0.i, ptr %v1, align 4, !tbaa !13
%6 = load i8, ptr %b2, align 1, !tbaa !9
%idxprom.i274 = sext i8 %6 to i64
%arrayidx.i275 = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom.i274
%7 = load i32, ptr %arrayidx.i275, align 4, !tbaa !5
%cmp.i276 = icmp slt i32 %7, 0
br i1 %cmp.i276, label %if.then.i278, label %varid.exit280
if.then.i278: ; preds = %varid.exit
%8 = load i32, ptr @sz, align 4, !tbaa !5
%inc.i279 = add nsw i32 %8, 1
store i32 %inc.i279, ptr @sz, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.i275, align 4, !tbaa !5
br label %varid.exit280
varid.exit280: ; preds = %varid.exit, %if.then.i278
%r.0.i277 = phi i32 [ %8, %if.then.i278 ], [ %7, %varid.exit ]
%v2 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 3
store i32 %r.0.i277, ptr %v2, align 4, !tbaa !14
%9 = load i8, ptr %b3, align 1, !tbaa !9
%cmp24 = icmp sgt i8 %9, 96
%cmd30 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 1
br i1 %cmp24, label %if.then26, label %if.else33
if.then26: ; preds = %varid.exit280
%cond = select i1 %cmp8, i32 1, i32 3
store i32 %cond, ptr %cmd30, align 4, !tbaa !12
%idxprom.i281 = zext i8 %9 to i64
%arrayidx.i282 = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom.i281
%10 = load i32, ptr %arrayidx.i282, align 4, !tbaa !5
%cmp.i283 = icmp slt i32 %10, 0
br i1 %cmp.i283, label %if.then.i285, label %varid.exit287
if.then.i285: ; preds = %if.then26
%11 = load i32, ptr @sz, align 4, !tbaa !5
%inc.i286 = add nsw i32 %11, 1
store i32 %inc.i286, ptr @sz, align 4, !tbaa !5
store i32 %11, ptr %arrayidx.i282, align 4, !tbaa !5
br label %varid.exit287
varid.exit287: ; preds = %if.then26, %if.then.i285
%r.0.i284 = phi i32 [ %11, %if.then.i285 ], [ %10, %if.then26 ]
%v3 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 4
store i32 %r.0.i284, ptr %v3, align 4, !tbaa !15
br label %for.inc
if.else33: ; preds = %varid.exit280
%cond37 = select i1 %cmp8, i32 2, i32 4
store i32 %cond37, ptr %cmd30, align 4, !tbaa !12
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %b3, ptr noundef null, i32 noundef 10) #9
%conv.i = trunc i64 %call.i to i32
%con = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 5
store i32 %conv.i, ptr %con, align 4, !tbaa !16
br label %for.inc
if.then45: ; preds = %if.else
%call48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %b1, ptr noundef nonnull %b2)
%12 = load i8, ptr %b1, align 1, !tbaa !9
%idxprom.i288 = sext i8 %12 to i64
%arrayidx.i289 = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom.i288
%13 = load i32, ptr %arrayidx.i289, align 4, !tbaa !5
%cmp.i290 = icmp slt i32 %13, 0
br i1 %cmp.i290, label %if.then.i292, label %varid.exit294
if.then.i292: ; preds = %if.then45
%14 = load i32, ptr @sz, align 4, !tbaa !5
%inc.i293 = add nsw i32 %14, 1
store i32 %inc.i293, ptr @sz, align 4, !tbaa !5
store i32 %14, ptr %arrayidx.i289, align 4, !tbaa !5
br label %varid.exit294
varid.exit294: ; preds = %if.then45, %if.then.i292
%r.0.i291 = phi i32 [ %14, %if.then.i292 ], [ %13, %if.then45 ]
%v151 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 2
store i32 %r.0.i291, ptr %v151, align 4, !tbaa !13
%15 = load i8, ptr %b2, align 1, !tbaa !9
%cmp54 = icmp sgt i8 %15, 96
%cmd57 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 1
br i1 %cmp54, label %if.then56, label %if.else61
if.then56: ; preds = %varid.exit294
store i32 5, ptr %cmd57, align 4, !tbaa !12
%idxprom.i295 = zext i8 %15 to i64
%arrayidx.i296 = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom.i295
%16 = load i32, ptr %arrayidx.i296, align 4, !tbaa !5
%cmp.i297 = icmp slt i32 %16, 0
br i1 %cmp.i297, label %if.then.i299, label %varid.exit301
if.then.i299: ; preds = %if.then56
%17 = load i32, ptr @sz, align 4, !tbaa !5
%inc.i300 = add nsw i32 %17, 1
store i32 %inc.i300, ptr @sz, align 4, !tbaa !5
store i32 %17, ptr %arrayidx.i296, align 4, !tbaa !5
br label %varid.exit301
varid.exit301: ; preds = %if.then56, %if.then.i299
%r.0.i298 = phi i32 [ %17, %if.then.i299 ], [ %16, %if.then56 ]
%v260 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 3
store i32 %r.0.i298, ptr %v260, align 4, !tbaa !14
br label %for.inc
if.else61: ; preds = %varid.exit294
store i32 6, ptr %cmd57, align 4, !tbaa !12
%call.i302 = call i64 @strtol(ptr nocapture noundef nonnull %b2, ptr noundef null, i32 noundef 10) #9
%conv.i303 = trunc i64 %call.i302 to i32
%con65 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 5
store i32 %conv.i303, ptr %con65, align 4, !tbaa !16
br label %for.inc
if.else67: ; preds = %if.else
%to = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 6
%call69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %b1, ptr noundef nonnull %to)
%cmd70 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 1
store i32 7, ptr %cmd70, align 4, !tbaa !12
%18 = load i8, ptr %b1, align 1, !tbaa !9
%idxprom.i304 = sext i8 %18 to i64
%arrayidx.i305 = getelementptr inbounds [123 x i32], ptr @tr, i64 0, i64 %idxprom.i304
%19 = load i32, ptr %arrayidx.i305, align 4, !tbaa !5
%cmp.i306 = icmp slt i32 %19, 0
br i1 %cmp.i306, label %if.then.i308, label %varid.exit310
if.then.i308: ; preds = %if.else67
%20 = load i32, ptr @sz, align 4, !tbaa !5
%inc.i309 = add nsw i32 %20, 1
store i32 %inc.i309, ptr @sz, align 4, !tbaa !5
store i32 %20, ptr %arrayidx.i305, align 4, !tbaa !5
br label %varid.exit310
varid.exit310: ; preds = %if.else67, %if.then.i308
%r.0.i307 = phi i32 [ %20, %if.then.i308 ], [ %19, %if.else67 ]
%v173 = getelementptr inbounds %struct.T, ptr %tp.0347, i64 0, i32 2
store i32 %r.0.i307, ptr %v173, align 4, !tbaa !13
br label %for.inc
for.inc: ; preds = %if.then, %varid.exit310, %if.else61, %varid.exit301, %varid.exit287, %if.else33
%inc = add nuw nsw i32 %i.0346, 1
%incdec.ptr = getelementptr inbounds %struct.T, ptr %tp.0347, i64 1
%21 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %21
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !17
while.cond: ; preds = %while.cond.backedge, %while.cond.preheader
%pc.0 = phi i32 [ 0, %while.cond.preheader ], [ %pc.0.be, %while.cond.backedge ]
%idx.ext = sext i32 %pc.0 to i64
%cmd78 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 1
%22 = load i32, ptr %cmd78, align 4, !tbaa !12
switch i32 %22, label %if.else205 [
i32 1, label %if.then81
i32 2, label %if.then95
i32 3, label %if.then107
i32 4, label %if.then121
i32 5, label %if.then133
i32 6, label %if.then143
i32 8, label %while.end
i32 7, label %land.lhs.true
]
if.then81: ; preds = %while.cond
%v283 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 3
%23 = load i32, ptr %v283, align 4, !tbaa !14
%idxprom84 = sext i32 %23 to i64
%arrayidx85 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom84
%24 = load i8, ptr %arrayidx85, align 1, !tbaa !9
%conv86 = sext i8 %24 to i32
%v387 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 4
%25 = load i32, ptr %v387, align 4, !tbaa !15
%idxprom88 = sext i32 %25 to i64
%arrayidx89 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom88
%26 = load i8, ptr %arrayidx89, align 1, !tbaa !9
%conv90 = sext i8 %26 to i32
%add = add nsw i32 %conv90, %conv86
%or.cond.i = icmp ugt i32 %add, 15
br i1 %or.cond.i, label %if.then.i314, label %calc.exit
if.then.i314: ; preds = %if.then81
call void @doprint()
call void @exit(i32 noundef 0) #8
unreachable
calc.exit: ; preds = %if.then81
%conv.i311 = trunc i32 %add to i8
br label %if.else205.sink.split
if.then95: ; preds = %while.cond
%v297 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 3
%27 = load i32, ptr %v297, align 4, !tbaa !14
%idxprom98 = sext i32 %27 to i64
%arrayidx99 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom98
%28 = load i8, ptr %arrayidx99, align 1, !tbaa !9
%conv100 = sext i8 %28 to i32
%con101 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 5
%29 = load i32, ptr %con101, align 4, !tbaa !16
%add102 = add nsw i32 %29, %conv100
%or.cond.i315 = icmp ugt i32 %add102, 15
br i1 %or.cond.i315, label %if.then.i319, label %calc.exit320
if.then.i319: ; preds = %if.then95
call void @doprint()
call void @exit(i32 noundef 0) #8
unreachable
calc.exit320: ; preds = %if.then95
%conv.i316 = trunc i32 %add102 to i8
br label %if.else205.sink.split
if.then107: ; preds = %while.cond
%v2109 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 3
%30 = load i32, ptr %v2109, align 4, !tbaa !14
%idxprom110 = sext i32 %30 to i64
%arrayidx111 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom110
%31 = load i8, ptr %arrayidx111, align 1, !tbaa !9
%conv112 = sext i8 %31 to i32
%v3113 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 4
%32 = load i32, ptr %v3113, align 4, !tbaa !15
%idxprom114 = sext i32 %32 to i64
%arrayidx115 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom114
%33 = load i8, ptr %arrayidx115, align 1, !tbaa !9
%conv116 = sext i8 %33 to i32
%sub = sub nsw i32 %conv112, %conv116
%or.cond.i321 = icmp ugt i32 %sub, 15
br i1 %or.cond.i321, label %if.then.i325, label %calc.exit326
if.then.i325: ; preds = %if.then107
call void @doprint()
call void @exit(i32 noundef 0) #8
unreachable
calc.exit326: ; preds = %if.then107
%conv.i322 = trunc i32 %sub to i8
br label %if.else205.sink.split
if.then121: ; preds = %while.cond
%v2123 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 3
%34 = load i32, ptr %v2123, align 4, !tbaa !14
%idxprom124 = sext i32 %34 to i64
%arrayidx125 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom124
%35 = load i8, ptr %arrayidx125, align 1, !tbaa !9
%conv126 = sext i8 %35 to i32
%con127 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 5
%36 = load i32, ptr %con127, align 4, !tbaa !16
%sub128 = sub nsw i32 %conv126, %36
%or.cond.i327 = icmp ugt i32 %sub128, 15
br i1 %or.cond.i327, label %if.then.i331, label %calc.exit332
if.then.i331: ; preds = %if.then121
call void @doprint()
call void @exit(i32 noundef 0) #8
unreachable
calc.exit332: ; preds = %if.then121
%conv.i328 = trunc i32 %sub128 to i8
br label %if.else205.sink.split
if.then133: ; preds = %while.cond
%v2135 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 3
%37 = load i32, ptr %v2135, align 4, !tbaa !14
%idxprom136 = sext i32 %37 to i64
%arrayidx137 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom136
%38 = load i8, ptr %arrayidx137, align 1, !tbaa !9
%or.cond.i333 = icmp ugt i8 %38, 15
br i1 %or.cond.i333, label %if.then.i336, label %if.else205.sink.split
if.then.i336: ; preds = %if.then133
call void @doprint()
call void @exit(i32 noundef 0) #8
unreachable
if.then143: ; preds = %while.cond
%con145 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 5
%39 = load i32, ptr %con145, align 4, !tbaa !16
%or.cond.i338 = icmp ugt i32 %39, 15
br i1 %or.cond.i338, label %if.then.i342, label %calc.exit343
if.then.i342: ; preds = %if.then143
call void @doprint()
call void @exit(i32 noundef 0) #8
unreachable
calc.exit343: ; preds = %if.then143
%conv.i339 = trunc i32 %39 to i8
br label %if.else205.sink.split
land.lhs.true: ; preds = %while.cond
%v1161 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 2
%40 = load i32, ptr %v1161, align 4, !tbaa !13
%idxprom162 = sext i32 %40 to i64
%arrayidx163 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom162
%41 = load i8, ptr %arrayidx163, align 1, !tbaa !9
%cmp165.not = icmp eq i8 %41, 0
br i1 %cmp165.not, label %if.else205, label %if.then167
if.then167: ; preds = %land.lhs.true
%to168 = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 6
%42 = load i32, ptr %to168, align 4, !tbaa !19
%idxprom169 = sext i32 %42 to i64
%arrayidx170 = getelementptr inbounds [1002 x i32], ptr @lin, i64 0, i64 %idxprom169
%43 = load i32, ptr %arrayidx170, align 4, !tbaa !5
%cmp171 = icmp slt i32 %43, 0
br i1 %cmp171, label %while.end, label %if.end174
if.end174: ; preds = %if.then167
%44 = load i8, ptr @var, align 16, !tbaa !9
%idxprom177 = sext i8 %44 to i64
%45 = load i8, ptr getelementptr inbounds ([26 x i8], ptr @var, i64 0, i64 1), align 1, !tbaa !9
%idxprom179 = sext i8 %45 to i64
%46 = load i8, ptr getelementptr inbounds ([26 x i8], ptr @var, i64 0, i64 2), align 2, !tbaa !9
%idxprom181 = sext i8 %46 to i64
%47 = load i8, ptr getelementptr inbounds ([26 x i8], ptr @var, i64 0, i64 3), align 1, !tbaa !9
%idxprom183 = sext i8 %47 to i64
%48 = load i8, ptr getelementptr inbounds ([26 x i8], ptr @var, i64 0, i64 4), align 4, !tbaa !9
%idxprom185 = sext i8 %48 to i64
%arrayidx186 = getelementptr inbounds [51 x [16 x [16 x [16 x [16 x [16 x i8]]]]]], ptr @mk, i64 0, i64 %idx.ext, i64 %idxprom177, i64 %idxprom179, i64 %idxprom181, i64 %idxprom183, i64 %idxprom185
%49 = load i8, ptr %arrayidx186, align 1, !tbaa !9
%tobool.not = icmp eq i8 %49, 0
br i1 %tobool.not, label %if.end189, label %if.then187
if.then187: ; preds = %if.end174
%call188 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
br label %cleanup
if.end189: ; preds = %if.end174
store i8 1, ptr %arrayidx186, align 1, !tbaa !9
br label %while.cond.backedge
if.else205.sink.split: ; preds = %if.then133, %calc.exit320, %calc.exit332, %calc.exit343, %calc.exit326, %calc.exit
%conv.i311.sink = phi i8 [ %conv.i311, %calc.exit ], [ %conv.i322, %calc.exit326 ], [ %conv.i339, %calc.exit343 ], [ %conv.i328, %calc.exit332 ], [ %conv.i316, %calc.exit320 ], [ %38, %if.then133 ]
%.sink.in = getelementptr inbounds %struct.T, ptr @pgm, i64 %idx.ext, i32 2
%.sink = load i32, ptr %.sink.in, align 4, !tbaa !13
%idxprom.i312 = sext i32 %.sink to i64
%arrayidx.i313 = getelementptr inbounds [26 x i8], ptr @var, i64 0, i64 %idxprom.i312
store i8 %conv.i311.sink, ptr %arrayidx.i313, align 1, !tbaa !9
br label %if.else205
if.else205: ; preds = %if.else205.sink.split, %while.cond, %land.lhs.true
%inc206 = add nsw i32 %pc.0, 1
%cmp207 = icmp eq i32 %inc206, %.lcssa
br i1 %cmp207, label %while.end, label %while.cond.backedge
while.cond.backedge: ; preds = %if.else205, %if.end189
%pc.0.be = phi i32 [ %43, %if.end189 ], [ %inc206, %if.else205 ]
br label %while.cond
while.end: ; preds = %while.cond, %if.else205, %if.then167
call void @doprint()
br label %cleanup
cleanup: ; preds = %while.end, %if.then187
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %b3) #9
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %b2) #9
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %b1) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nofree 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 nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { mustprogress nofree nounwind willreturn "no-trapping-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 = { noreturn nounwind }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 0}
!11 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!12 = !{!11, !6, i64 4}
!13 = !{!11, !6, i64 8}
!14 = !{!11, !6, i64 12}
!15 = !{!11, !6, i64 16}
!16 = !{!11, !6, i64 20}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!11, !6, i64 24}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,k,n,F[100][10],P[100][11],d[10],bodays[100],t=0,sum=0,max=-1e+9;
scanf("%d",&n);
for (i=0;i<n;i++)
{
for (j=0;j<10;j++)
{
scanf("%d",&F[i][j]);
}
}
for (i=0;i<n;i++)
{
for (j=0;j<11;j++)
{
scanf("%d",&P[i][j]);
}
}
for (i=1;i<1024;i++)
{
for (j=0;j<10;j++)
d[j]=(i>>j)%2;
for (k=0;k<n;k++)
{
for (t=0,j=0;j<10;j++)
{
if (F[k][j]&&d[j]) t++;
}
bodays[k]=t;
}
for (sum=0,k=0;k<n;k++)
sum+=P[k][bodays[k]];
if (sum>max) max=sum;
}
printf("%d",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146387/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146387/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%F = alloca [100 x [10 x i32]], align 16
%P = alloca [100 x [11 x i32]], align 16
%bodays = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %F) #4
call void @llvm.lifetime.start.p0(i64 4400, ptr nonnull %P) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %bodays) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp113 = icmp sgt i32 %0, 0
br i1 %cmp113, label %for.cond1.preheader, label %for.end77
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%arrayidx5.1 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 3
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.4 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 4
%call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.4)
%arrayidx5.5 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 5
%call6.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.5)
%arrayidx5.6 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 6
%call6.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.6)
%arrayidx5.7 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 7
%call6.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.7)
%arrayidx5.8 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 8
%call6.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.8)
%arrayidx5.9 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv, i64 9
%call6.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.9)
%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.cond1.preheader, label %for.cond10.preheader, !llvm.loop !9
for.cond10.preheader: ; preds = %for.cond1.preheader
%cmp11116 = icmp sgt i32 %1, 0
br i1 %cmp11116, label %for.cond13.preheader, label %for.end77
for.cond13.preheader: ; preds = %for.cond10.preheader, %for.cond13.preheader
%indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.cond13.preheader ], [ 0, %for.cond10.preheader ]
%arrayidx19 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 0
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19)
%arrayidx19.1 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 1
%call20.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.1)
%arrayidx19.2 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 2
%call20.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.2)
%arrayidx19.3 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 3
%call20.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.3)
%arrayidx19.4 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 4
%call20.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.4)
%arrayidx19.5 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 5
%call20.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.5)
%arrayidx19.6 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 6
%call20.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.6)
%arrayidx19.7 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 7
%call20.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.7)
%arrayidx19.8 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 8
%call20.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.8)
%arrayidx19.9 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 9
%call20.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.9)
%arrayidx19.10 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv168, i64 10
%call20.10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx19.10)
%indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp11 = icmp slt i64 %indvars.iv.next169, %4
br i1 %cmp11, label %for.cond13.preheader, label %for.cond27.preheader, !llvm.loop !11
for.cond27.preheader: ; preds = %for.cond13.preheader
%cmp39121 = icmp sgt i32 %3, 0
br i1 %cmp39121, label %for.cond30.preheader.us.preheader, label %for.end77
for.cond30.preheader.us.preheader: ; preds = %for.cond27.preheader
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 4
%n.vec = and i64 %wide.trip.count, 4294967292
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%5 = icmp ult i32 %3, 4
%unroll_iter = and i64 %wide.trip.count, 4294967292
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond30.preheader.us
for.cond30.preheader.us: ; preds = %for.cond30.preheader.us.preheader, %for.end71.us
%6 = phi <2 x i32> [ %184, %for.end71.us ], [ <i32 1, i32 -1000000000>, %for.cond30.preheader.us.preheader ]
%7 = extractelement <2 x i32> %6, i64 0
%8 = lshr i32 %7, 1
%9 = lshr i32 %7, 2
%10 = lshr i32 %7, 3
%11 = lshr i32 %7, 4
%12 = lshr i32 %7, 5
%13 = lshr i32 %7, 6
%14 = lshr i32 %7, 7
%15 = shufflevector <2 x i32> %6, <2 x i32> poison, <8 x i32> <i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%16 = insertelement <8 x i32> %15, i32 %8, i64 1
%17 = insertelement <8 x i32> %16, i32 %9, i64 2
%18 = insertelement <8 x i32> %17, i32 %10, i64 3
%19 = insertelement <8 x i32> %18, i32 %11, i64 4
%20 = insertelement <8 x i32> %19, i32 %12, i64 5
%21 = insertelement <8 x i32> %20, i32 %13, i64 6
%22 = insertelement <8 x i32> %21, i32 %14, i64 7
%23 = and <8 x i32> %22, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%24 = lshr i32 %7, 8
%.lobit198 = and i32 %24, 1
%25 = lshr i32 %7, 9
%.lobit199 = and i32 %25, 1
br i1 %min.iters.check, label %for.cond41.preheader.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond30.preheader.us
%broadcast.splat = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splat208 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%broadcast.splat210 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
%broadcast.splat212 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
%broadcast.splat214 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 4, i32 4, i32 4, i32 4>
%broadcast.splat216 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 5, i32 5, i32 5, i32 5>
%broadcast.splat218 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 6, i32 6, i32 6, i32 6>
%broadcast.splat220 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 7, i32 7, i32 7, i32 7>
%broadcast.splatinsert221 = insertelement <4 x i32> poison, i32 %.lobit198, i64 0
%broadcast.splat222 = shufflevector <4 x i32> %broadcast.splatinsert221, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert223 = insertelement <4 x i32> poison, i32 %.lobit199, i64 0
%broadcast.splat224 = shufflevector <4 x i32> %broadcast.splatinsert223, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%26 = or i64 %index, 1
%27 = or i64 %index, 2
%28 = or i64 %index, 3
%29 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 0
%30 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 0
%31 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 0
%32 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 0
%33 = load i32, ptr %29, align 16, !tbaa !5
%34 = load i32, ptr %30, align 8, !tbaa !5
%35 = load i32, ptr %31, align 16, !tbaa !5
%36 = load i32, ptr %32, align 8, !tbaa !5
%37 = insertelement <4 x i32> poison, i32 %33, i64 0
%38 = insertelement <4 x i32> %37, i32 %34, i64 1
%39 = insertelement <4 x i32> %38, i32 %35, i64 2
%40 = insertelement <4 x i32> %39, i32 %36, i64 3
%41 = icmp eq <4 x i32> %40, zeroinitializer
%42 = select <4 x i1> %41, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat
%43 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 1
%44 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 1
%45 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 1
%46 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 1
%47 = load i32, ptr %43, align 4, !tbaa !5
%48 = load i32, ptr %44, align 4, !tbaa !5
%49 = load i32, ptr %45, align 4, !tbaa !5
%50 = load i32, ptr %46, align 4, !tbaa !5
%51 = insertelement <4 x i32> poison, i32 %47, i64 0
%52 = insertelement <4 x i32> %51, i32 %48, i64 1
%53 = insertelement <4 x i32> %52, i32 %49, i64 2
%54 = insertelement <4 x i32> %53, i32 %50, i64 3
%55 = icmp eq <4 x i32> %54, zeroinitializer
%56 = select <4 x i1> %55, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat208
%57 = add nuw nsw <4 x i32> %42, %56
%58 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 2
%59 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 2
%60 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 2
%61 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 2
%62 = load i32, ptr %58, align 8, !tbaa !5
%63 = load i32, ptr %59, align 16, !tbaa !5
%64 = load i32, ptr %60, align 8, !tbaa !5
%65 = load i32, ptr %61, align 16, !tbaa !5
%66 = insertelement <4 x i32> poison, i32 %62, i64 0
%67 = insertelement <4 x i32> %66, i32 %63, i64 1
%68 = insertelement <4 x i32> %67, i32 %64, i64 2
%69 = insertelement <4 x i32> %68, i32 %65, i64 3
%70 = icmp eq <4 x i32> %69, zeroinitializer
%71 = select <4 x i1> %70, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat210
%72 = add nuw nsw <4 x i32> %57, %71
%73 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 3
%74 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 3
%75 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 3
%76 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 3
%77 = load i32, ptr %73, align 4, !tbaa !5
%78 = load i32, ptr %74, align 4, !tbaa !5
%79 = load i32, ptr %75, align 4, !tbaa !5
%80 = load i32, ptr %76, align 4, !tbaa !5
%81 = insertelement <4 x i32> poison, i32 %77, i64 0
%82 = insertelement <4 x i32> %81, i32 %78, i64 1
%83 = insertelement <4 x i32> %82, i32 %79, i64 2
%84 = insertelement <4 x i32> %83, i32 %80, i64 3
%85 = icmp eq <4 x i32> %84, zeroinitializer
%86 = select <4 x i1> %85, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat212
%87 = add nuw nsw <4 x i32> %72, %86
%88 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 4
%89 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 4
%90 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 4
%91 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 4
%92 = load i32, ptr %88, align 16, !tbaa !5
%93 = load i32, ptr %89, align 8, !tbaa !5
%94 = load i32, ptr %90, align 16, !tbaa !5
%95 = load i32, ptr %91, align 8, !tbaa !5
%96 = insertelement <4 x i32> poison, i32 %92, i64 0
%97 = insertelement <4 x i32> %96, i32 %93, i64 1
%98 = insertelement <4 x i32> %97, i32 %94, i64 2
%99 = insertelement <4 x i32> %98, i32 %95, i64 3
%100 = icmp eq <4 x i32> %99, zeroinitializer
%101 = select <4 x i1> %100, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat214
%102 = add nuw nsw <4 x i32> %87, %101
%103 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 5
%104 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 5
%105 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 5
%106 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 5
%107 = load i32, ptr %103, align 4, !tbaa !5
%108 = load i32, ptr %104, align 4, !tbaa !5
%109 = load i32, ptr %105, align 4, !tbaa !5
%110 = load i32, ptr %106, align 4, !tbaa !5
%111 = insertelement <4 x i32> poison, i32 %107, i64 0
%112 = insertelement <4 x i32> %111, i32 %108, i64 1
%113 = insertelement <4 x i32> %112, i32 %109, i64 2
%114 = insertelement <4 x i32> %113, i32 %110, i64 3
%115 = icmp eq <4 x i32> %114, zeroinitializer
%116 = select <4 x i1> %115, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat216
%117 = add nuw nsw <4 x i32> %102, %116
%118 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 6
%119 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 6
%120 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 6
%121 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 6
%122 = load i32, ptr %118, align 8, !tbaa !5
%123 = load i32, ptr %119, align 16, !tbaa !5
%124 = load i32, ptr %120, align 8, !tbaa !5
%125 = load i32, ptr %121, align 16, !tbaa !5
%126 = insertelement <4 x i32> poison, i32 %122, i64 0
%127 = insertelement <4 x i32> %126, i32 %123, i64 1
%128 = insertelement <4 x i32> %127, i32 %124, i64 2
%129 = insertelement <4 x i32> %128, i32 %125, i64 3
%130 = icmp eq <4 x i32> %129, zeroinitializer
%131 = select <4 x i1> %130, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat218
%132 = add nsw <4 x i32> %117, %131
%133 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 7
%134 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 7
%135 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 7
%136 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 7
%137 = load i32, ptr %133, align 4, !tbaa !5
%138 = load i32, ptr %134, align 4, !tbaa !5
%139 = load i32, ptr %135, align 4, !tbaa !5
%140 = load i32, ptr %136, align 4, !tbaa !5
%141 = insertelement <4 x i32> poison, i32 %137, i64 0
%142 = insertelement <4 x i32> %141, i32 %138, i64 1
%143 = insertelement <4 x i32> %142, i32 %139, i64 2
%144 = insertelement <4 x i32> %143, i32 %140, i64 3
%145 = icmp eq <4 x i32> %144, zeroinitializer
%146 = select <4 x i1> %145, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat220
%147 = add nsw <4 x i32> %132, %146
%148 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 8
%149 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 8
%150 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 8
%151 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 8
%152 = load i32, ptr %148, align 16, !tbaa !5
%153 = load i32, ptr %149, align 8, !tbaa !5
%154 = load i32, ptr %150, align 16, !tbaa !5
%155 = load i32, ptr %151, align 8, !tbaa !5
%156 = insertelement <4 x i32> poison, i32 %152, i64 0
%157 = insertelement <4 x i32> %156, i32 %153, i64 1
%158 = insertelement <4 x i32> %157, i32 %154, i64 2
%159 = insertelement <4 x i32> %158, i32 %155, i64 3
%160 = icmp eq <4 x i32> %159, zeroinitializer
%161 = select <4 x i1> %160, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat222
%162 = add nsw <4 x i32> %147, %161
%163 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %index, i64 9
%164 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %26, i64 9
%165 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %27, i64 9
%166 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %28, i64 9
%167 = load i32, ptr %163, align 4, !tbaa !5
%168 = load i32, ptr %164, align 4, !tbaa !5
%169 = load i32, ptr %165, align 4, !tbaa !5
%170 = load i32, ptr %166, align 4, !tbaa !5
%171 = insertelement <4 x i32> poison, i32 %167, i64 0
%172 = insertelement <4 x i32> %171, i32 %168, i64 1
%173 = insertelement <4 x i32> %172, i32 %169, i64 2
%174 = insertelement <4 x i32> %173, i32 %170, i64 3
%175 = icmp eq <4 x i32> %174, zeroinitializer
%176 = select <4 x i1> %175, <4 x i32> zeroinitializer, <4 x i32> %broadcast.splat224
%177 = add nsw <4 x i32> %162, %176
%178 = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %index
store <4 x i32> %177, ptr %178, align 16, !tbaa !5
%index.next = add nuw i64 %index, 4
%179 = icmp eq i64 %index.next, %n.vec
br i1 %179, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.body62.us.preheader, label %for.cond41.preheader.us.preheader
for.cond41.preheader.us.preheader: ; preds = %for.cond30.preheader.us, %middle.block
%indvars.iv182.ph = phi i64 [ 0, %for.cond30.preheader.us ], [ %n.vec, %middle.block ]
br label %for.cond41.preheader.us
for.body62.us.preheader: ; preds = %for.cond41.preheader.us, %middle.block
br i1 %5, label %for.end71.us.unr-lcssa, label %for.body62.us
for.end71.us.unr-lcssa: ; preds = %for.body62.us, %for.body62.us.preheader
%add.us.lcssa.ph = phi i32 [ undef, %for.body62.us.preheader ], [ %add.us.3, %for.body62.us ]
%indvars.iv186.unr = phi i64 [ 0, %for.body62.us.preheader ], [ %indvars.iv.next187.3, %for.body62.us ]
%sum.0125.us.unr = phi i32 [ 0, %for.body62.us.preheader ], [ %add.us.3, %for.body62.us ]
br i1 %lcmp.mod.not, label %for.end71.us, label %for.body62.us.epil
for.body62.us.epil: ; preds = %for.end71.us.unr-lcssa, %for.body62.us.epil
%indvars.iv186.epil = phi i64 [ %indvars.iv.next187.epil, %for.body62.us.epil ], [ %indvars.iv186.unr, %for.end71.us.unr-lcssa ]
%sum.0125.us.epil = phi i32 [ %add.us.epil, %for.body62.us.epil ], [ %sum.0125.us.unr, %for.end71.us.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body62.us.epil ], [ 0, %for.end71.us.unr-lcssa ]
%arrayidx66.us.epil = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %indvars.iv186.epil
%180 = load i32, ptr %arrayidx66.us.epil, align 4, !tbaa !5
%idxprom67.us.epil = sext i32 %180 to i64
%arrayidx68.us.epil = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv186.epil, i64 %idxprom67.us.epil
%181 = load i32, ptr %arrayidx68.us.epil, align 4, !tbaa !5
%add.us.epil = add nsw i32 %181, %sum.0125.us.epil
%indvars.iv.next187.epil = add nuw nsw i64 %indvars.iv186.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.end71.us, label %for.body62.us.epil, !llvm.loop !15
for.end71.us: ; preds = %for.body62.us.epil, %for.end71.us.unr-lcssa
%add.us.lcssa = phi i32 [ %add.us.lcssa.ph, %for.end71.us.unr-lcssa ], [ %add.us.epil, %for.body62.us.epil ]
%182 = extractelement <2 x i32> %6, i64 1
%spec.select111.us = call i32 @llvm.smax.i32(i32 %add.us.lcssa, i32 %182)
%inc76.us = add nuw nsw i32 %7, 1
%exitcond191.not = icmp eq i32 %inc76.us, 1024
%183 = insertelement <2 x i32> poison, i32 %inc76.us, i64 0
%184 = insertelement <2 x i32> %183, i32 %spec.select111.us, i64 1
br i1 %exitcond191.not, label %for.end77, label %for.cond30.preheader.us, !llvm.loop !17
for.body62.us: ; preds = %for.body62.us.preheader, %for.body62.us
%indvars.iv186 = phi i64 [ %indvars.iv.next187.3, %for.body62.us ], [ 0, %for.body62.us.preheader ]
%sum.0125.us = phi i32 [ %add.us.3, %for.body62.us ], [ 0, %for.body62.us.preheader ]
%niter = phi i64 [ %niter.next.3, %for.body62.us ], [ 0, %for.body62.us.preheader ]
%arrayidx66.us = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %indvars.iv186
%185 = load i32, ptr %arrayidx66.us, align 16, !tbaa !5
%idxprom67.us = sext i32 %185 to i64
%arrayidx68.us = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv186, i64 %idxprom67.us
%186 = load i32, ptr %arrayidx68.us, align 4, !tbaa !5
%add.us = add nsw i32 %186, %sum.0125.us
%indvars.iv.next187 = or i64 %indvars.iv186, 1
%arrayidx66.us.1 = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %indvars.iv.next187
%187 = load i32, ptr %arrayidx66.us.1, align 4, !tbaa !5
%idxprom67.us.1 = sext i32 %187 to i64
%arrayidx68.us.1 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv.next187, i64 %idxprom67.us.1
%188 = load i32, ptr %arrayidx68.us.1, align 4, !tbaa !5
%add.us.1 = add nsw i32 %188, %add.us
%indvars.iv.next187.1 = or i64 %indvars.iv186, 2
%arrayidx66.us.2 = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %indvars.iv.next187.1
%189 = load i32, ptr %arrayidx66.us.2, align 8, !tbaa !5
%idxprom67.us.2 = sext i32 %189 to i64
%arrayidx68.us.2 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv.next187.1, i64 %idxprom67.us.2
%190 = load i32, ptr %arrayidx68.us.2, align 4, !tbaa !5
%add.us.2 = add nsw i32 %190, %add.us.1
%indvars.iv.next187.2 = or i64 %indvars.iv186, 3
%arrayidx66.us.3 = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %indvars.iv.next187.2
%191 = load i32, ptr %arrayidx66.us.3, align 4, !tbaa !5
%idxprom67.us.3 = sext i32 %191 to i64
%arrayidx68.us.3 = getelementptr inbounds [100 x [11 x i32]], ptr %P, i64 0, i64 %indvars.iv.next187.2, i64 %idxprom67.us.3
%192 = load i32, ptr %arrayidx68.us.3, align 4, !tbaa !5
%add.us.3 = add nsw i32 %192, %add.us.2
%indvars.iv.next187.3 = add nuw nsw i64 %indvars.iv186, 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.end71.us.unr-lcssa, label %for.body62.us, !llvm.loop !18
for.cond41.preheader.us: ; preds = %for.cond41.preheader.us.preheader, %for.cond41.preheader.us
%indvars.iv182 = phi i64 [ %indvars.iv.next183, %for.cond41.preheader.us ], [ %indvars.iv182.ph, %for.cond41.preheader.us.preheader ]
%arrayidx47.us = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv182, i64 0
%193 = load <8 x i32>, ptr %arrayidx47.us, align 8, !tbaa !5
%194 = icmp eq <8 x i32> %193, zeroinitializer
%195 = select <8 x i1> %194, <8 x i32> zeroinitializer, <8 x i32> %23
%arrayidx47.us.8 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv182, i64 8
%196 = load i32, ptr %arrayidx47.us.8, align 8, !tbaa !5
%tobool.not.us.8 = icmp eq i32 %196, 0
%spec.select.us.8 = select i1 %tobool.not.us.8, i32 0, i32 %.lobit198
%arrayidx47.us.9 = getelementptr inbounds [100 x [10 x i32]], ptr %F, i64 0, i64 %indvars.iv182, i64 9
%197 = load i32, ptr %arrayidx47.us.9, align 4, !tbaa !5
%tobool.not.us.9 = icmp eq i32 %197, 0
%spec.select.us.9 = select i1 %tobool.not.us.9, i32 0, i32 %.lobit199
%198 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %195)
%op.rdx = add i32 %198, %spec.select.us.8
%op.rdx225 = add i32 %op.rdx, %spec.select.us.9
%arrayidx56.us = getelementptr inbounds [100 x i32], ptr %bodays, i64 0, i64 %indvars.iv182
store i32 %op.rdx225, ptr %arrayidx56.us, align 4, !tbaa !5
%indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
%exitcond185.not = icmp eq i64 %indvars.iv.next183, %wide.trip.count
br i1 %exitcond185.not, label %for.body62.us.preheader, label %for.cond41.preheader.us, !llvm.loop !19
for.end77: ; preds = %for.end71.us, %entry, %for.cond10.preheader, %for.cond27.preheader
%.us-phi = phi i32 [ 0, %for.cond27.preheader ], [ 0, %for.cond10.preheader ], [ 0, %entry ], [ %spec.select111.us, %for.end71.us ]
%call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %bodays) #4
call void @llvm.lifetime.end.p0(i64 4400, ptr nonnull %P) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %F) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = 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}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !14, !13}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int ch[400000]= {0},cp[400000];
char kh[60000],arr[2000][200];
int a,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;
double z,go;
scanf("%d",&a);
j=k=l=m=n=0;
for(i=1; i<=a; i++)
{
scanf("%d",&b);
for(j=1;j<=b;j++)
printf("1 ");
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14643/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14643/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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
store i32 0, ptr %b, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not14 = icmp slt i32 %0, 1
br i1 %cmp.not14, label %for.end9, label %for.body
for.body: ; preds = %entry, %for.end
%i.015 = phi i32 [ %inc8, %for.end ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp3.not12 = icmp slt i32 %1, 1
br i1 %cmp3.not12, label %for.end, label %for.body4
for.body4: ; preds = %for.body, %for.body4
%j.013 = phi i32 [ %inc, %for.body4 ], [ 1, %for.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc = add nuw nsw i32 %j.013, 1
%2 = load i32, ptr %b, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %j.013, %2
br i1 %cmp3.not.not, label %for.body4, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body4, %for.body
%putchar = call i32 @putchar(i32 10)
%inc8 = add nuw nsw i32 %i.015, 1
%3 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.015, %3
br i1 %cmp.not.not, label %for.body, label %for.end9, !llvm.loop !11
for.end9: ; preds = %for.end, %entry
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 @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>
#include<string.h>
int main(){
int X,Y,Z;
scanf("%d %d %d",&X,&Y,&Z);
int len = X - Z;
int count = 0;
while(len >= (Y + Z)){
len -= Y;
len -= Z;
count ++;
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146473/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146473/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
%Y = alloca i32, align 4
%Z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %Y, ptr noundef nonnull %Z)
%0 = load i32, ptr %X, align 4, !tbaa !5
%1 = load i32, ptr %Z, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %Y, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp.not7 = icmp slt i32 %sub, %add
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%count.09 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%len.08 = phi i32 [ %sub2, %while.body ], [ %sub, %entry ]
%sub2 = sub i32 %len.08, %add
%inc = add nuw nsw i32 %count.09, 1
%cmp.not = icmp slt i32 %sub2, %add
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call3 = 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 %Z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int X, Y, Z;
scanf("%d%d%d", &X, &Y, &Z);
printf("%d", (X-Z) / (Z + Y));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
%Y = alloca i32, align 4
%Z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %Y, ptr noundef nonnull %Z)
%0 = load i32, ptr %X, align 4, !tbaa !5
%1 = load i32, ptr %Z, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %Y, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%div = sdiv i32 %sub, %add
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int X, Y, Z;
scanf("%d %d %d", &X, &Y, &Z);
printf("%d\n", (X-Z)/(Y+Z));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146567/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146567/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
%Y = alloca i32, align 4
%Z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %Y, ptr noundef nonnull %Z)
%0 = load i32, ptr %X, align 4, !tbaa !5
%1 = load i32, ptr %Z, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %Y, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%div = sdiv i32 %sub, %add
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
printf("%d\n",(x-z)/(y+z));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146617/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146617/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %z, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%div = sdiv i32 %sub, %add
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int X,Y,Z;
scanf("%d %d %d",&X,&Y,&Z);
if(X<=100000&&X>=1&&Y<=100000&&Y>=1&&Z<=100000&&Z>=1&&Y+2*Z<=X){
printf("%d\n",(X-Z)/(Y+Z));
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146668/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
%Y = alloca i32, align 4
%Z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %Y, ptr noundef nonnull %Z)
%0 = load i32, ptr %X, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 100000
%2 = load i32, ptr %Y, align 4
%cmp3 = icmp slt i32 %2, 100001
%or.cond14 = select i1 %or.cond, i1 %cmp3, i1 false
%cmp5 = icmp sgt i32 %2, 0
%or.cond15 = select i1 %or.cond14, i1 %cmp5, i1 false
%3 = load i32, ptr %Z, align 4
%cmp7 = icmp slt i32 %3, 100001
%or.cond16 = select i1 %or.cond15, i1 %cmp7, i1 false
%cmp9 = icmp sgt i32 %3, 0
%or.cond17 = select i1 %or.cond16, i1 %cmp9, i1 false
br i1 %or.cond17, label %land.lhs.true10, label %if.end
land.lhs.true10: ; preds = %entry
%mul = shl nuw nsw i32 %3, 1
%add = add nuw nsw i32 %mul, %2
%cmp11.not = icmp ugt i32 %add, %0
br i1 %cmp11.not, label %if.end, label %if.then
if.then: ; preds = %land.lhs.true10
%sub = sub nsw i32 %0, %3
%add12 = add nuw nsw i32 %3, %2
%div = sdiv i32 %sub, %add12
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true10, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<29;
long long llinf=1ll<<60;
int in(void){
int i;scanf("%d",&i);
return i;
}
long long llin(void){
long long i;scanf("%lld",&i);
return i;
}
double din(void){
double i;scanf("%lf",&i);
return i;
}
void chin(char s[]){
scanf("%s",s);
}
void print(int a){
printf("%d\n",a);
}
void llprint(long long a){
printf("%lld\n",a);
}
void dprint(double a){
printf("%.10f\n",a);
}
void print2(int a,int b){
printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
return a>b?a:b;
}
long long min(long long a,long long b){
return a<b?a:b;
}
int cmp(const void *a,const void *b){
return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
int t=*a;
*a=*b;
*b=t;
}
long long gcd(long long x,long long y){
return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
return x/gcd(x,y)*y;
}
// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
int i;
char s[10001];
int solve(void){
int j,k=0,tmp[10000],ret=0;
if(s[i+1]!='['){
while(s[++i]!=']')
ret=ret*10+s[i]-'0';
return (ret+1)/2;
}
while(s[++i]!=']')
tmp[k++]=solve();
sort(tmp,k);
rep(j,(k+1)/2)ret+=tmp[j];
return ret;
}
int main(void){
int n=in(),j;
while(n--){
chin(s);
i=0;
print(solve());
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@mod = dso_local local_unnamed_addr global i64 1000000007, align 8
@inf = dso_local local_unnamed_addr global i32 536870912, align 4
@llinf = dso_local local_unnamed_addr global i64 1152921504606846976, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%.10f\0A\00", align 1
@.str.7 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@s = dso_local global [10001 x i8] zeroinitializer, align 16
@i = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #11
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #11
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @din() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #11
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @chin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @llprint(i64 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dprint(double noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %a, i32 noundef %b)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
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: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #12
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #12
ret i32 %call
}
; 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 #7 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #8 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse ]
%y.tr = phi i64 [ %y, %entry ], [ %rem, %tailrecurse ]
%rem = srem i64 %x.tr, %y.tr
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %tailrecurse
cond.end: ; preds = %tailrecurse
ret i64 %y.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %x, i64 noundef %y) local_unnamed_addr #8 {
entry:
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %entry
%x.tr.i = phi i64 [ %x, %entry ], [ %y.tr.i, %tailrecurse.i ]
%y.tr.i = phi i64 [ %y, %entry ], [ %rem.i, %tailrecurse.i ]
%rem.i = srem i64 %x.tr.i, %y.tr.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %gcd.exit, label %tailrecurse.i
gcd.exit: ; preds = %tailrecurse.i
%div = sdiv i64 %x, %y.tr.i
%mul = mul nsw i64 %div, %y
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @solve() local_unnamed_addr #0 {
entry:
%tmp = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %tmp) #11
%0 = load i32, ptr @i, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds [10001 x i8], ptr @s, i64 0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !13
switch i8 %1, label %while.body.preheader [
i8 91, label %while.body19.preheader
i8 93, label %while.end
]
while.body.preheader: ; preds = %entry
%2 = sext i32 %0 to i64
%3 = add nsw i64 %2, 1
br label %while.body
while.body19.preheader: ; preds = %entry
store i32 %add, ptr @i, align 4, !tbaa !5
br label %while.body19
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv = phi i64 [ %3, %while.body.preheader ], [ %indvars.iv.next, %while.body ]
%4 = phi i8 [ %1, %while.body.preheader ], [ %5, %while.body ]
%ret.049 = phi i32 [ 0, %while.body.preheader ], [ %sub, %while.body ]
%conv4 = sext i8 %4 to i32
%mul = mul nsw i32 %ret.049, 10
%add10 = add i32 %mul, -48
%sub = add i32 %add10, %conv4
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [10001 x i8], ptr @s, i64 0, i64 %indvars.iv.next
%5 = load i8, ptr %arrayidx3, align 1, !tbaa !13
%cmp5.not = icmp eq i8 %5, 93
br i1 %cmp5.not, label %while.end.loopexit, label %while.body, !llvm.loop !14
while.end.loopexit: ; preds = %while.body
%6 = trunc i64 %indvars.iv.next to i32
%7 = add nsw i32 %sub, 1
%8 = sdiv i32 %7, 2
br label %while.end
while.end: ; preds = %entry, %while.end.loopexit
%inc.lcssa = phi i32 [ %6, %while.end.loopexit ], [ %add, %entry ]
%ret.0.lcssa = phi i32 [ %8, %while.end.loopexit ], [ 0, %entry ]
store i32 %inc.lcssa, ptr @i, align 4, !tbaa !5
br label %cleanup
while.body19: ; preds = %while.body19.preheader, %while.body19
%indvars.iv63 = phi i64 [ 0, %while.body19.preheader ], [ %indvars.iv.next64, %while.body19 ]
%call = tail call i32 @solve()
%indvars.iv.next64 = add nuw i64 %indvars.iv63, 1
%arrayidx22 = getelementptr inbounds [10000 x i32], ptr %tmp, i64 0, i64 %indvars.iv63
store i32 %call, ptr %arrayidx22, align 4, !tbaa !5
%9 = load i32, ptr @i, align 4, !tbaa !5
%inc13 = add nsw i32 %9, 1
store i32 %inc13, ptr @i, align 4, !tbaa !5
%idxprom14 = sext i32 %inc13 to i64
%arrayidx15 = getelementptr inbounds [10001 x i8], ptr @s, i64 0, i64 %idxprom14
%10 = load i8, ptr %arrayidx15, align 1, !tbaa !13
%cmp17.not = icmp eq i8 %10, 93
br i1 %cmp17.not, label %while.end23, label %while.body19, !llvm.loop !16
while.end23: ; preds = %while.body19
%11 = trunc i64 %indvars.iv.next64 to i32
%conv24 = and i64 %indvars.iv.next64, 4294967295
call void @qsort(ptr noundef nonnull %tmp, i64 noundef %conv24, i64 noundef 4, ptr noundef nonnull @cmp) #11
%cmp2758.not = icmp eq i32 %11, 0
br i1 %cmp2758.not, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %while.end23
%add25 = add i32 %11, 1
%div2643 = lshr i32 %add25, 1
%umax = call i32 @llvm.umax.i32(i32 %div2643, i32 1)
%wide.trip.count = zext i32 %umax to i64
%min.iters.check = icmp ult i32 %add25, 16
br i1 %min.iters.check, label %for.body.preheader71, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 2147483640
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi69 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%12 = getelementptr inbounds [10000 x i32], ptr %tmp, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load70 = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = add <4 x i32> %wide.load, %vec.phi
%15 = add <4 x i32> %wide.load70, %vec.phi69
%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 !17
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %15, %14
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %cleanup, label %for.body.preheader71
for.body.preheader71: ; preds = %for.body.preheader, %middle.block
%indvars.iv66.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%ret.160.ph = phi i32 [ 0, %for.body.preheader ], [ %17, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader71, %for.body
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body ], [ %indvars.iv66.ph, %for.body.preheader71 ]
%ret.160 = phi i32 [ %add31, %for.body ], [ %ret.160.ph, %for.body.preheader71 ]
%arrayidx30 = getelementptr inbounds [10000 x i32], ptr %tmp, i64 0, i64 %indvars.iv66
%18 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%add31 = add nsw i32 %18, %ret.160
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !20
cleanup: ; preds = %for.body, %middle.block, %while.end23, %while.end
%retval.0 = phi i32 [ %ret.0.lcssa, %while.end ], [ 0, %while.end23 ], [ %17, %middle.block ], [ %add31, %for.body ]
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %tmp) #11
ret i32 %retval.0
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #9
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #11
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i)
%0 = load i32, ptr %i.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #11
%tobool.not4 = icmp eq i32 %0, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%n.05 = phi i32 [ %dec, %while.body ], [ %0, %entry ]
%dec = add nsw i32 %n.05, -1
%call.i2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @s)
store i32 0, ptr @i, align 4, !tbaa !5
%call1 = call i32 @solve()
%call.i3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %call1)
%tobool.not = icmp eq i32 %dec, 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #10
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 #9 = { 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 #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !15, !19, !18}
!21 = distinct !{!21, !15}
|
#include<stdio.h>
int main(void)
{
int a,b;
int count=0;
scanf("%d %d",&a,&b);
int sum=1;
while(sum<b){
sum+=a;
sum-=1;
count++;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146754/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146754/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%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
%sum.07 = phi i32 [ 1, %while.body.lr.ph ], [ %sub, %while.body ]
%count.06 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%add = add i32 %sum.07, -1
%sub = add i32 %add, %1
%inc = add nuw nsw i32 %count.06, 1
%cmp = icmp slt i32 %sub, %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 ]
%call1 = 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;
scanf("%d %d",&a,&b);
int ans=0;
int outlet=1;
while (outlet < b) {
--outlet;
outlet += a;
++ans;
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%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
%outlet.07 = phi i32 [ 1, %while.body.lr.ph ], [ %add, %while.body ]
%ans.06 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%dec = add nsw i32 %outlet.07, -1
%add = add nsw i32 %dec, %1
%inc = add nuw nsw i32 %ans.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
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call1 = 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 %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"}
|
// B - Power Socket
#include <stdio.h>
int main(void){
int a, b, tap=0, sum=1;
scanf("%d%d", &a, &b);
if(a==b){
printf("1\n");
return 0;
}else{
while(sum<b){
sum--;
sum+=a;
tap++;
}
printf("%d\n", tap);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146840/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %if.then, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%cmp210 = icmp sgt i32 %1, 1
br i1 %cmp210, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %while.cond.preheader
%dec = add i32 %0, -1
br label %while.body
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
while.body: ; preds = %while.body.lr.ph, %while.body
%sum.012 = phi i32 [ 1, %while.body.lr.ph ], [ %add, %while.body ]
%tap.011 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%add = add i32 %dec, %sum.012
%inc = add nuw nsw i32 %tap.011, 1
%cmp2 = icmp slt i32 %add, %1
br i1 %cmp2, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%tap.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %inc, %while.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %tap.0.lcssa)
br label %cleanup
cleanup: ; preds = %while.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() {
int A, B, num, count;
count = 1;
scanf("%d%d", &A, &B);
num = A;
for (;;) {
if (num >= B) {
break;
}
num += A - 1;
++count;
}
if (B == 1) {
count = 0;
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146884/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146884/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp.not7 = icmp slt i32 %0, %1
br i1 %cmp.not7, label %if.end.lr.ph, label %for.end
if.end.lr.ph: ; preds = %entry
%sub = add nsw i32 %0, -1
br label %if.end
if.end: ; preds = %if.end.lr.ph, %if.end
%count.09 = phi i32 [ 1, %if.end.lr.ph ], [ %inc, %if.end ]
%num.08 = phi i32 [ %0, %if.end.lr.ph ], [ %add, %if.end ]
%add = add nsw i32 %sub, %num.08
%inc = add nuw nsw i32 %count.09, 1
%cmp.not = icmp slt i32 %add, %1
br i1 %cmp.not, label %if.end, label %for.end
for.end: ; preds = %if.end, %entry
%count.0.lcssa = phi i32 [ 1, %entry ], [ %inc, %if.end ]
%cmp1 = icmp eq i32 %1, 1
%spec.select = select i1 %cmp1, i32 0, i32 %count.0.lcssa
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
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);
printf("%d\n",(b-1+a-1-1)/(a-1));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146927/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #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
%1 = load i32, ptr %a, align 4, !tbaa !5
%add = add i32 %0, -3
%sub2 = add i32 %add, %1
%sub3 = add nsw i32 %1, -1
%div = sdiv i32 %sub2, %sub3
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
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;
int b;
int ans=0;
scanf("%d %d",&a,&b);
for(int i=1;i>0;i++){
if(b==1){
break;
}
if(1+(ans+1)*(a-1)<b){
ans=ans+1;
}
if(1+(ans+1)*(a-1)>=b){
ans=ans+1;
break;
}
}
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146970/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146970/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #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
%cmp1 = icmp eq i32 %0, 1
%1 = load i32, ptr %a, align 4
%sub = add nsw i32 %1, -1
br i1 %cmp1, label %cleanup, label %for.cond
for.cond: ; preds = %entry, %for.cond
%ans.0 = phi i32 [ %spec.select, %for.cond ], [ 0, %entry ]
%add = add nsw i32 %ans.0, 1
%mul = mul nsw i32 %sub, %add
%add2 = add nsw i32 %mul, 1
%cmp3 = icmp slt i32 %add2, %0
%spec.select = select i1 %cmp3, i32 %add, i32 %ans.0
%add7 = add nsw i32 %spec.select, 1
%mul9 = mul nsw i32 %add7, %sub
%add10 = add nsw i32 %mul9, 1
%cmp11.not = icmp slt i32 %add10, %0
br i1 %cmp11.not, label %for.cond, label %cleanup, !llvm.loop !9
cleanup: ; preds = %for.cond, %entry
%.us-phi = phi i32 [ 0, %entry ], [ %add7, %for.cond ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int A,B;
scanf("%d", &A);
scanf("%d", &B);
if(B == 1){
printf("0");
return 0;
}
if(A >= B){
printf("1");
return 0;
}
int n;
int sum = A;
int count = 1;
while(sum < B){
sum = sum +A-1;
count++;
}
printf("%d ",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147012/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, 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
%putchar13 = call i32 @putchar(i32 48)
br label %cleanup
if.end: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
%cmp3.not = icmp slt i32 %1, %0
br i1 %cmp3.not, label %while.cond.preheader, label %if.then4
while.cond.preheader: ; preds = %if.end
%add = add i32 %1, -1
br label %while.body
if.then4: ; preds = %if.end
%putchar = call i32 @putchar(i32 49)
br label %cleanup
while.body: ; preds = %while.cond.preheader, %while.body
%count.015 = phi i32 [ 1, %while.cond.preheader ], [ %inc, %while.body ]
%sum.014 = phi i32 [ %1, %while.cond.preheader ], [ %sub, %while.body ]
%sub = add i32 %add, %sum.014
%inc = add nuw nsw i32 %count.015, 1
%cmp7 = icmp slt i32 %sub, %0
br i1 %cmp7, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %inc)
br label %cleanup
cleanup: ; preds = %while.end, %if.then4, %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 @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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdlib.h>
int asc(const void* a, const void* b) { return *(int*)a - *(int*)b; }
int desc(const void* a, const void* b) { return *(int*)b - *(int*)a; }
//qsort(data,10,sizeof(int),compare_int);
int main(void)
{
int a, b;
int sum = 1;
int i = 0;
scanf("%d %d", &a, &b);
while (sum < b) {
i++;
sum--;
sum += a;
}
printf("%d\n", i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(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 @desc(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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
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
%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
%i.07 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%sum.06 = phi i32 [ 1, %while.body.lr.ph ], [ %add, %while.body ]
%inc = add nuw nsw i32 %i.07, 1
%dec = add nsw i32 %sum.06, -1
%add = add nsw i32 %dec, %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) #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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n,i;
char a[15],c[]={"01235789"};
while(scanf("%d",&n),n){
for(i=0;n;n/=8)a[i++]=c[n%8];
while(i--)printf("%c",a[i]);
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147113/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147113/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.c = private unnamed_addr constant [9 x i8] c"01235789\00", align 1
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [15 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %a) #4
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not19 = icmp eq i32 %0, 0
br i1 %tobool.not19, label %while.end11, label %for.body
while.cond4.preheader: ; preds = %for.body
store i32 %div, ptr %n, align 4, !tbaa !5
%1 = sext i32 %indvars.iv21 to i64
br label %while.body6
for.body: ; preds = %entry, %for.body.backedge
%indvars.iv21 = phi i32 [ %indvars.iv21.be, %for.body.backedge ], [ 1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.be, %for.body.backedge ], [ 0, %entry ]
%2 = phi i32 [ %.be, %for.body.backedge ], [ %0, %entry ]
%rem = srem i32 %2, 8
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [9 x i8], ptr @__const.main.c, i64 0, i64 %idxprom
%3 = load i8, ptr %arrayidx, align 1, !tbaa !9
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [15 x i8], ptr %a, i64 0, i64 %indvars.iv
store i8 %3, ptr %arrayidx3, align 1, !tbaa !9
%div = sdiv i32 %2, 8
%.off = add i32 %2, 7
%tobool1.not = icmp ult i32 %.off, 15
%indvars.iv.next22 = add nuw i32 %indvars.iv21, 1
br i1 %tobool1.not, label %while.cond4.preheader, label %for.body.backedge
for.body.backedge: ; preds = %for.body, %while.end
%indvars.iv21.be = phi i32 [ %indvars.iv.next22, %for.body ], [ 1, %while.end ]
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.end ]
%.be = phi i32 [ %div, %for.body ], [ %6, %while.end ]
br label %for.body, !llvm.loop !10
while.body6: ; preds = %while.cond4.preheader, %while.body6
%indvars.iv23 = phi i64 [ %1, %while.cond4.preheader ], [ %indvars.iv.next24, %while.body6 ]
%indvars.iv.next24 = add nsw i64 %indvars.iv23, -1
%arrayidx8 = getelementptr inbounds [15 x i8], ptr %a, i64 0, i64 %indvars.iv.next24
%4 = load i8, ptr %arrayidx8, align 1, !tbaa !9
%conv = sext i8 %4 to i32
%putchar14 = call i32 @putchar(i32 %conv)
%5 = and i64 %indvars.iv.next24, 4294967295
%tobool5.not = icmp eq i64 %5, 0
br i1 %tobool5.not, label %while.end, label %while.body6, !llvm.loop !12
while.end: ; preds = %while.body6
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%6 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end11, label %for.body.backedge
while.end11: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
typedef int32_t flow_type;
const flow_type flow_inf=400;
typedef struct flow_edge{
int vertex;
int next;
flow_type capacity;
} flow_edge;
typedef struct maxFlowGraph{
flow_edge *edge;
int *start;
int vertex_num;
int pointer;
int edge_length;
} graph;
graph* newGraph(const int vertex_num){
graph *g=(graph *)calloc(1,sizeof(graph));
g->vertex_num=vertex_num;
const int initial_length=4;
g->edge=(flow_edge *)calloc(initial_length,sizeof(flow_edge));
g->start=(int *)calloc(vertex_num,sizeof(int));
g->pointer=0;
g->edge_length=initial_length;
for(int i=0;i<vertex_num;i++) g->start[i]=-1;
return g;
}
void freeGraph(graph *g){
free(g->edge);
free(g->start);
free(g);
}
void addEdge(graph *g,int from,int to,flow_type capa){
if(g->pointer==g->edge_length){
g->edge_length*=2;
g->edge=(flow_edge *)realloc(g->edge,sizeof(flow_edge)*g->edge_length);
}
int p=g->pointer;
g->edge[p]=(flow_edge){to,g->start[from],capa};
g->start[from]=p;
g->edge[p+1]=(flow_edge){from,g->start[to],0};
g->start[to]=p+1;
g->pointer+=2;
}
flow_type dinic_dfs(int v,graph *g,int dst,int *level,int *iter,flow_type e){
if(v==dst) return e;
flow_type sum=0;
for(int p=iter[v];p!=-1 && e>0;p=g->edge[p].next,iter[v]=p){
int u=g->edge[p].vertex;
flow_type capa=g->edge[p].capacity;
if(level[u]<=level[v] || capa<=0) continue;
flow_type f=dinic_dfs(u,g,dst,level,iter,capa<e?capa:e);
if(f>0){
g->edge[p].capacity-=f;
g->edge[p^1].capacity+=f;
sum+=f;
e-=f;
if(e<=0) return sum;
}
}
return sum;
}
flow_type dinic(const graph *input_graph,const int src,const int dst){
const int vertex_num=input_graph->vertex_num;
const int edge_num=input_graph->pointer;
graph *g=(graph *)calloc(1,sizeof(graph));
g->edge=(flow_edge *)malloc(sizeof(flow_edge)*edge_num);
g->start=(int *)malloc(sizeof(int)*vertex_num);
memcpy(g->edge,input_graph->edge,sizeof(flow_edge)*edge_num);
memcpy(g->start,input_graph->start,sizeof(int)*vertex_num);
int *level=(int *)calloc(vertex_num,sizeof(int));
int *queue=(int *)calloc(vertex_num,sizeof(int));
int *iter=(int *)calloc(vertex_num,sizeof(int));
flow_type flow=0;
while(1){
memset(level,0,sizeof(int)*vertex_num);
int front=0,last=0;
level[src]=1;
queue[last++]=src;
while(front<last && level[dst]==0){
const int v=queue[front++];
for(int p=g->start[v];p!=-1;p=g->edge[p].next){
int u=g->edge[p].vertex;
if(g->edge[p].capacity>0 && level[u]==0){
level[u]=level[v]+1;
queue[last++]=u;
}
}
}
if(level[dst]==0) break;
memcpy(iter,g->start,sizeof(int)*vertex_num);
while(1){
flow_type f=dinic_dfs(src,g,dst,level,iter,flow_inf);
if(f<=0) break;
flow+=f;
}
}
freeGraph(g);
free(level);
free(queue);
free(iter);
return flow;
}
typedef int32_t i32;
void run (void) {
i32 h, w;
scanf("%" SCNi32 "%" SCNi32, &h, &w);
char *s = (char *) calloc (h * w + 1, sizeof (char));
for (i32 i = 0; i < h; ++i) {
scanf ("%s", s + i * w);
}
graph *g = newGraph (2 * h * w + 2);
i32 src = 2 * h * w;
i32 dst = src + 1;
for (i32 i = 0; i < h; ++i) {
for (i32 j = 0; j < w; ++j) {
if (i == 0 || i == h - 1 || j == 0 || j == w - 1) {
addEdge (g, i * w + j, dst, flow_inf);
}
if (s[i * w + j] == 'X') {
addEdge (g, src, i * w + j, flow_inf);
}
addEdge (g, h * w + i * w + j, i * w + j, 1);
i32 d[] = {-1, 0, 1, 0};
for (i32 k = 0; k < 4; ++k) {
i32 x = i + d[k];
i32 y = j + d[k ^ 1];
if (!(0 <= x && x < h && 0 <= y && y < w)) continue;
addEdge (g, i * w + j, h * w + x * w + y, flow_inf);
}
}
}
i32 ans = dinic(g, src, dst);
if (ans >= flow_inf) {
puts("-1");
} else {
printf("%" PRIi32 "\n", ans);
}
}
int main (void) {
run ();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147164/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147164/source.c"
target datalayout = "e-m:e-p270: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.maxFlowGraph = type { ptr, ptr, i32, i32, i32 }
%struct.flow_edge = type { i32, i32, i32 }
@flow_inf = dso_local local_unnamed_addr constant i32 400, align 4
@.str = private unnamed_addr constant [5 x i8] c"%i%i\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%i\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @newGraph(i32 noundef %vertex_num) local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #13
%vertex_num1 = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 2
store i32 %vertex_num, ptr %vertex_num1, align 8, !tbaa !5
%call2 = tail call noalias dereferenceable_or_null(48) ptr @calloc(i64 noundef 4, i64 noundef 12) #13
store ptr %call2, ptr %call, align 8, !tbaa !11
%conv = sext i32 %vertex_num to i64
%call3 = tail call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #13
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 1
store ptr %call3, ptr %start, align 8, !tbaa !12
%edge_length = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 4
store i32 4, ptr %edge_length, align 8, !tbaa !13
%cmp16 = icmp sgt i32 %vertex_num, 0
br i1 %cmp16, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = zext i32 %vertex_num to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr align 4 %call3, i8 -1, i64 %1, i1 false), !tbaa !14
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, 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: mustprogress nounwind willreturn uwtable
define dso_local void @freeGraph(ptr nocapture noundef %g) local_unnamed_addr #3 {
entry:
%0 = load ptr, ptr %g, align 8, !tbaa !11
tail call void @free(ptr noundef %0) #14
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 1
%1 = load ptr, ptr %start, align 8, !tbaa !12
tail call void @free(ptr noundef %1) #14
tail call void @free(ptr noundef %g) #14
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 nounwind willreturn uwtable
define dso_local void @addEdge(ptr nocapture noundef %g, i32 noundef %from, i32 noundef %to, i32 noundef %capa) local_unnamed_addr #3 {
entry:
%pointer = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 3
%0 = load i32, ptr %pointer, align 4, !tbaa !15
%edge_length = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 4
%1 = load i32, ptr %edge_length, align 8, !tbaa !13
%cmp = icmp eq i32 %0, %1
%.pre48 = load ptr, ptr %g, align 8, !tbaa !11
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%mul = shl nsw i32 %0, 1
store i32 %mul, ptr %edge_length, align 8, !tbaa !13
%conv = sext i32 %mul to i64
%mul3 = mul nsw i64 %conv, 12
%call = tail call ptr @realloc(ptr noundef %.pre48, i64 noundef %mul3) #15
store ptr %call, ptr %g, align 8, !tbaa !11
%.pre = load i32, ptr %pointer, align 4, !tbaa !15
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi ptr [ %call, %if.then ], [ %.pre48, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%idxprom = sext i32 %3 to i64
%arrayidx = getelementptr inbounds %struct.flow_edge, ptr %2, i64 %idxprom
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %g, i64 0, i32 1
%4 = load ptr, ptr %start, align 8, !tbaa !12
%idxprom7 = sext i32 %from to i64
%arrayidx8 = getelementptr inbounds i32, ptr %4, i64 %idxprom7
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !14
store i32 %to, ptr %arrayidx, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 %5, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i32 %capa, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx, align 4, !tbaa.struct !18
%6 = load ptr, ptr %start, align 8, !tbaa !12
%arrayidx11 = getelementptr inbounds i32, ptr %6, i64 %idxprom7
store i32 %3, ptr %arrayidx11, align 4, !tbaa !14
%7 = load ptr, ptr %g, align 8, !tbaa !11
%add = add nsw i32 %3, 1
%idxprom13 = sext i32 %add to i64
%arrayidx14 = getelementptr inbounds %struct.flow_edge, ptr %7, i64 %idxprom13
%idxprom19 = sext i32 %to to i64
%arrayidx20 = getelementptr inbounds i32, ptr %6, i64 %idxprom19
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !14
store i32 %from, ptr %arrayidx14, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx = getelementptr inbounds i8, ptr %arrayidx14, i64 4
store i32 %8, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx = getelementptr inbounds i8, ptr %arrayidx14, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx, align 4, !tbaa.struct !18
%9 = load ptr, ptr %start, align 8, !tbaa !12
%arrayidx25 = getelementptr inbounds i32, ptr %9, i64 %idxprom19
store i32 %add, ptr %arrayidx25, align 4, !tbaa !14
%10 = load i32, ptr %pointer, align 4, !tbaa !15
%add27 = add nsw i32 %10, 2
store i32 %add27, ptr %pointer, align 4, !tbaa !15
ret void
}
; 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 #5
; 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) #6
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @dinic_dfs(i32 noundef %v, ptr nocapture noundef readonly %g, i32 noundef %dst, ptr nocapture noundef readonly %level, ptr nocapture noundef %iter, i32 noundef %e) local_unnamed_addr #7 {
entry:
%cmp = icmp eq i32 %v, %dst
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %v to i64
%arrayidx = getelementptr inbounds i32, ptr %iter, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !14
%cmp185 = icmp eq i32 %0, -1
%cmp286 = icmp slt i32 %e, 1
%.not87 = or i1 %cmp185, %cmp286
br i1 %.not87, label %return, label %for.body.lr.ph
for.body.lr.ph: ; preds = %if.end
%arrayidx11 = getelementptr inbounds i32, ptr %level, i64 %idxprom
%.pre = load ptr, ptr %g, align 8, !tbaa !11
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%1 = phi ptr [ %.pre, %for.body.lr.ph ], [ %8, %for.inc ]
%e.addr.090 = phi i32 [ %e, %for.body.lr.ph ], [ %e.addr.3.ph, %for.inc ]
%sum.089 = phi i32 [ 0, %for.body.lr.ph ], [ %sum.3.ph, %for.inc ]
%p.088 = phi i32 [ %0, %for.body.lr.ph ], [ %9, %for.inc ]
%idxprom3 = sext i32 %p.088 to i64
%arrayidx4 = getelementptr inbounds %struct.flow_edge, ptr %1, i64 %idxprom3
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !19
%capacity = getelementptr inbounds %struct.flow_edge, ptr %1, i64 %idxprom3, i32 2
%3 = load i32, ptr %capacity, align 4, !tbaa !21
%idxprom8 = sext i32 %2 to i64
%arrayidx9 = getelementptr inbounds i32, ptr %level, i64 %idxprom8
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !14
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !14
%cmp12 = icmp sle i32 %4, %5
%cmp13 = icmp slt i32 %3, 1
%or.cond = select i1 %cmp12, i1 true, i1 %cmp13
br i1 %or.cond, label %for.inc, label %if.end15
if.end15: ; preds = %for.body
%cond = tail call i32 @llvm.smin.i32(i32 %3, i32 %e.addr.090)
%call = tail call i32 @dinic_dfs(i32 noundef %2, ptr noundef nonnull %g, i32 noundef %dst, ptr noundef nonnull %level, ptr noundef nonnull %iter, i32 noundef %cond)
%cmp17 = icmp sgt i32 %call, 0
%.pre92 = load ptr, ptr %g, align 8, !tbaa !11
br i1 %cmp17, label %if.then18, label %for.inc
if.then18: ; preds = %if.end15
%capacity22 = getelementptr inbounds %struct.flow_edge, ptr %.pre92, i64 %idxprom3, i32 2
%6 = load i32, ptr %capacity22, align 4, !tbaa !21
%sub = sub nsw i32 %6, %call
store i32 %sub, ptr %capacity22, align 4, !tbaa !21
%xor = xor i32 %p.088, 1
%idxprom24 = sext i32 %xor to i64
%capacity26 = getelementptr inbounds %struct.flow_edge, ptr %.pre92, i64 %idxprom24, i32 2
%7 = load i32, ptr %capacity26, align 4, !tbaa !21
%add = add nsw i32 %7, %call
store i32 %add, ptr %capacity26, align 4, !tbaa !21
%add27 = add nsw i32 %call, %sum.089
%sub28 = sub nsw i32 %e.addr.090, %call
%cmp29 = icmp slt i32 %sub28, 1
br i1 %cmp29, label %return, label %for.inc
for.inc: ; preds = %if.end15, %if.then18, %for.body
%8 = phi ptr [ %1, %for.body ], [ %.pre92, %if.then18 ], [ %.pre92, %if.end15 ]
%sum.3.ph = phi i32 [ %sum.089, %for.body ], [ %add27, %if.then18 ], [ %sum.089, %if.end15 ]
%e.addr.3.ph = phi i32 [ %e.addr.090, %for.body ], [ %sub28, %if.then18 ], [ %e.addr.090, %if.end15 ]
%next = getelementptr inbounds %struct.flow_edge, ptr %8, i64 %idxprom3, i32 1
%9 = load i32, ptr %next, align 4, !tbaa !22
store i32 %9, ptr %arrayidx, align 4, !tbaa !14
%cmp1 = icmp eq i32 %9, -1
br i1 %cmp1, label %return, label %for.body, !llvm.loop !23
return: ; preds = %if.then18, %for.inc, %if.end, %entry
%retval.5 = phi i32 [ %e, %entry ], [ 0, %if.end ], [ %add27, %if.then18 ], [ %sum.3.ph, %for.inc ]
ret i32 %retval.5
}
; Function Attrs: nounwind uwtable
define dso_local i32 @dinic(ptr nocapture noundef readonly %input_graph, i32 noundef %src, i32 noundef %dst) local_unnamed_addr #8 {
entry:
%vertex_num1 = getelementptr inbounds %struct.maxFlowGraph, ptr %input_graph, i64 0, i32 2
%0 = load i32, ptr %vertex_num1, align 8, !tbaa !5
%pointer = getelementptr inbounds %struct.maxFlowGraph, ptr %input_graph, i64 0, i32 3
%1 = load i32, ptr %pointer, align 4, !tbaa !15
%call = tail call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #13
%conv = sext i32 %1 to i64
%mul = mul nsw i64 %conv, 12
%call2 = tail call noalias ptr @malloc(i64 noundef %mul) #16
store ptr %call2, ptr %call, align 8, !tbaa !11
%conv3 = sext i32 %0 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #16
%start = getelementptr inbounds %struct.maxFlowGraph, ptr %call, i64 0, i32 1
store ptr %call5, ptr %start, align 8, !tbaa !12
%2 = load ptr, ptr %input_graph, align 8, !tbaa !11
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call2, ptr align 4 %2, i64 %mul, i1 false)
%start11 = getelementptr inbounds %struct.maxFlowGraph, ptr %input_graph, i64 0, i32 1
%3 = load ptr, ptr %start11, align 8, !tbaa !12
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call5, ptr align 4 %3, i64 %mul4, i1 false)
%call15 = tail call noalias ptr @calloc(i64 noundef %conv3, i64 noundef 4) #13
%call17 = tail call noalias ptr @calloc(i64 noundef %conv3, i64 noundef 4) #13
%call19 = tail call noalias ptr @calloc(i64 noundef %conv3, i64 noundef 4) #13
%idxprom = sext i32 %src to i64
%arrayidx = getelementptr inbounds i32, ptr %call15, i64 %idxprom
%idxprom26 = sext i32 %dst to i64
%arrayidx27 = getelementptr inbounds i32, ptr %call15, i64 %idxprom26
br label %while.cond
while.cond: ; preds = %while.cond70, %entry
%flow.0 = phi i32 [ 0, %entry ], [ %flow.1, %while.cond70 ]
tail call void @llvm.memset.p0.i64(ptr align 4 %call15, i8 0, i64 %mul4, i1 false)
store i32 1, ptr %arrayidx, align 4, !tbaa !14
store i32 %src, ptr %call17, align 4, !tbaa !14
br label %land.rhs
while.cond24.loopexit: ; preds = %if.end, %while.body30
%last.1.lcssa = phi i32 [ %last.0148, %while.body30 ], [ %last.2, %if.end ]
%4 = sext i32 %last.1.lcssa to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %land.rhs, label %while.end, !llvm.loop !25
land.rhs: ; preds = %while.cond, %while.cond24.loopexit
%indvars.iv = phi i64 [ 0, %while.cond ], [ %indvars.iv.next, %while.cond24.loopexit ]
%last.0148 = phi i32 [ 1, %while.cond ], [ %last.1.lcssa, %while.cond24.loopexit ]
%5 = load i32, ptr %arrayidx27, align 4, !tbaa !14
%cmp28 = icmp eq i32 %5, 0
br i1 %cmp28, label %while.body30, label %if.end66
while.body30: ; preds = %land.rhs
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx33 = getelementptr inbounds i32, ptr %call17, i64 %indvars.iv
%6 = load i32, ptr %arrayidx33, align 4, !tbaa !14
%idxprom35 = sext i32 %6 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %call5, i64 %idxprom35
%p.0144 = load i32, ptr %arrayidx36, align 4, !tbaa !14
%cmp37.not145 = icmp eq i32 %p.0144, -1
br i1 %cmp37.not145, label %while.cond24.loopexit, label %for.body.lr.ph
for.body.lr.ph: ; preds = %while.body30
%arrayidx52 = getelementptr inbounds i32, ptr %call15, i64 %idxprom35
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.end
%p.0147 = phi i32 [ %p.0144, %for.body.lr.ph ], [ %p.0, %if.end ]
%last.1146 = phi i32 [ %last.0148, %for.body.lr.ph ], [ %last.2, %if.end ]
%idxprom40 = sext i32 %p.0147 to i64
%arrayidx41 = getelementptr inbounds %struct.flow_edge, ptr %call2, i64 %idxprom40
%7 = load i32, ptr %arrayidx41, align 4, !tbaa !19
%capacity = getelementptr inbounds %struct.flow_edge, ptr %call2, i64 %idxprom40, i32 2
%8 = load i32, ptr %capacity, align 4, !tbaa !21
%cmp45 = icmp sgt i32 %8, 0
br i1 %cmp45, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %for.body
%idxprom47 = sext i32 %7 to i64
%arrayidx48 = getelementptr inbounds i32, ptr %call15, i64 %idxprom47
%9 = load i32, ptr %arrayidx48, align 4, !tbaa !14
%cmp49 = icmp eq i32 %9, 0
br i1 %cmp49, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
%10 = load i32, ptr %arrayidx52, align 4, !tbaa !14
%add = add nsw i32 %10, 1
store i32 %add, ptr %arrayidx48, align 4, !tbaa !14
%inc55 = add nsw i32 %last.1146, 1
%idxprom56 = sext i32 %last.1146 to i64
%arrayidx57 = getelementptr inbounds i32, ptr %call17, i64 %idxprom56
store i32 %7, ptr %arrayidx57, align 4, !tbaa !14
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true, %for.body
%last.2 = phi i32 [ %inc55, %if.then ], [ %last.1146, %land.lhs.true ], [ %last.1146, %for.body ]
%next = getelementptr inbounds %struct.flow_edge, ptr %call2, i64 %idxprom40, i32 1
%p.0 = load i32, ptr %next, align 4, !tbaa !14
%cmp37.not = icmp eq i32 %p.0, -1
br i1 %cmp37.not, label %while.cond24.loopexit, label %for.body, !llvm.loop !26
while.end: ; preds = %while.cond24.loopexit
%.pre = load i32, ptr %arrayidx27, align 4, !tbaa !14
%cmp63 = icmp eq i32 %.pre, 0
br i1 %cmp63, label %while.end83, label %if.end66
if.end66: ; preds = %land.rhs, %while.end
tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call19, ptr align 4 %call5, i64 %mul4, i1 false)
br label %while.cond70
while.cond70: ; preds = %while.cond70, %if.end66
%flow.1 = phi i32 [ %flow.0, %if.end66 ], [ %add77, %while.cond70 ]
%call72 = tail call i32 @dinic_dfs(i32 noundef %src, ptr noundef nonnull %call, i32 noundef %dst, ptr noundef %call15, ptr noundef %call19, i32 noundef 400)
%cmp73 = icmp slt i32 %call72, 1
%add77 = add nsw i32 %call72, %flow.1
br i1 %cmp73, label %while.cond, label %while.cond70
while.end83: ; preds = %while.end
tail call void @free(ptr noundef %call2) #14
tail call void @free(ptr noundef %call5) #14
tail call void @free(ptr noundef %call) #14
tail call void @free(ptr noundef nonnull %call15) #14
tail call void @free(ptr noundef %call17) #14
tail call void @free(ptr noundef %call19) #14
ret i32 %flow.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 #9
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #10
; Function Attrs: nounwind uwtable
define dso_local void @run() local_unnamed_addr #8 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #14
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #14
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !14
%1 = load i32, ptr %w, align 4, !tbaa !14
%mul = mul nsw i32 %1, %0
%add = add nsw i32 %mul, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 1) #13
%cmp233 = icmp sgt i32 %0, 0
br i1 %cmp233, label %for.body, label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %for.body
%.pre = load i32, ptr %w, align 4, !tbaa !14
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%2 = phi i32 [ %1, %entry ], [ %.pre, %for.cond.cleanup.loopexit ]
%3 = phi i32 [ %0, %entry ], [ %8, %for.cond.cleanup.loopexit ]
%mul5 = shl nsw i32 %3, 1
%mul6 = mul nsw i32 %2, %mul5
%add7 = add nsw i32 %mul6, 2
%call.i = call noalias dereferenceable_or_null(32) ptr @calloc(i64 noundef 1, i64 noundef 32) #13
%vertex_num1.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 2
store i32 %add7, ptr %vertex_num1.i, align 8, !tbaa !5
%call2.i = call noalias dereferenceable_or_null(48) ptr @calloc(i64 noundef 4, i64 noundef 12) #13
store ptr %call2.i, ptr %call.i, align 8, !tbaa !11
%conv.i = sext i32 %add7 to i64
%call3.i = call noalias ptr @calloc(i64 noundef %conv.i, i64 noundef 4) #13
%start.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 1
store ptr %call3.i, ptr %start.i, align 8, !tbaa !12
%edge_length.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 4
store i32 4, ptr %edge_length.i, align 8, !tbaa !13
%cmp16.i = icmp sgt i32 %mul6, -2
br i1 %cmp16.i, label %for.body.preheader.i, label %newGraph.exit
for.body.preheader.i: ; preds = %for.cond.cleanup
%4 = zext i32 %add7 to i64
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memset.p0.i64(ptr align 4 %call3.i, i8 -1, i64 %5, i1 false), !tbaa !14
br label %newGraph.exit
newGraph.exit: ; preds = %for.cond.cleanup, %for.body.preheader.i
%add11 = or i32 %mul6, 1
%cmp14256 = icmp sgt i32 %3, 0
br i1 %cmp14256, label %for.cond18.preheader.lr.ph, label %for.cond.cleanup16
for.cond18.preheader.lr.ph: ; preds = %newGraph.exit
%pointer.i = getelementptr inbounds %struct.maxFlowGraph, ptr %call.i, i64 0, i32 3
%idxprom19.i = sext i32 %add11 to i64
%arrayidx20.i = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i
%idxprom7.i156 = sext i32 %mul6 to i64
%arrayidx8.i157 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i156
%6 = icmp sgt i32 %2, 0
br i1 %6, label %for.cond18.preheader, label %for.cond.cleanup16
for.body: ; preds = %entry, %for.body
%i.0234 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%7 = load i32, ptr %w, align 4, !tbaa !14
%mul3 = mul nsw i32 %7, %i.0234
%idx.ext = sext i32 %mul3 to i64
%add.ptr = getelementptr inbounds i8, ptr %call1, i64 %idx.ext
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %add.ptr)
%inc = add nuw nsw i32 %i.0234, 1
%8 = load i32, ptr %h, align 4, !tbaa !14
%cmp = icmp slt i32 %inc, %8
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !27
for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.cond.cleanup21
%9 = phi i32 [ %11, %for.cond.cleanup21 ], [ %3, %for.cond18.preheader.lr.ph ]
%call.i.promoted = phi ptr [ %call.i.promoted266, %for.cond.cleanup21 ], [ %call2.i, %for.cond18.preheader.lr.ph ]
%edge_length.i.promoted = phi i32 [ %edge_length.i.promoted264, %for.cond.cleanup21 ], [ 4, %for.cond18.preheader.lr.ph ]
%pointer.i.promoted = phi i32 [ %pointer.i.promoted262, %for.cond.cleanup21 ], [ 0, %for.cond18.preheader.lr.ph ]
%10 = phi i32 [ %12, %for.cond.cleanup21 ], [ %2, %for.cond18.preheader.lr.ph ]
%i12.0257 = phi i32 [ %inc90.pre-phi, %for.cond.cleanup21 ], [ 0, %for.cond18.preheader.lr.ph ]
%cmp19236 = icmp sgt i32 %10, 0
br i1 %cmp19236, label %for.body22.lr.ph, label %for.cond18.preheader.for.cond.cleanup21_crit_edge
for.cond18.preheader.for.cond.cleanup21_crit_edge: ; preds = %for.cond18.preheader
%.pre273 = add nuw nsw i32 %i12.0257, 1
br label %for.cond.cleanup21
for.body22.lr.ph: ; preds = %for.cond18.preheader
%cmp23 = icmp eq i32 %i12.0257, 0
%add58 = add nsw i32 %i12.0257, -1
%cmp62 = icmp sgt i32 %i12.0257, 0
%add58.2 = add nuw nsw i32 %i12.0257, 1
br label %for.body22
for.cond.cleanup16: ; preds = %for.cond.cleanup21, %for.cond18.preheader.lr.ph, %newGraph.exit
%call93 = call i32 @dinic(ptr noundef nonnull %call.i, i32 noundef %mul6, i32 noundef %add11)
%cmp94 = icmp sgt i32 %call93, 399
br i1 %cmp94, label %if.then96, label %if.else
for.cond18.for.cond.cleanup21_crit_edge: ; preds = %cleanup.3
store i32 %add27.i240.3, ptr %pointer.i, align 4, !tbaa !15
store i32 %54, ptr %edge_length.i, align 8, !tbaa !13
store ptr %call.i230251.3, ptr %call.i, align 8, !tbaa !11
%.pre270 = load i32, ptr %h, align 4, !tbaa !14
br label %for.cond.cleanup21
for.cond.cleanup21: ; preds = %for.cond18.preheader.for.cond.cleanup21_crit_edge, %for.cond18.for.cond.cleanup21_crit_edge
%inc90.pre-phi = phi i32 [ %.pre273, %for.cond18.preheader.for.cond.cleanup21_crit_edge ], [ %add58.2, %for.cond18.for.cond.cleanup21_crit_edge ]
%11 = phi i32 [ %9, %for.cond18.preheader.for.cond.cleanup21_crit_edge ], [ %.pre270, %for.cond18.for.cond.cleanup21_crit_edge ]
%call.i.promoted266 = phi ptr [ %call.i.promoted, %for.cond18.preheader.for.cond.cleanup21_crit_edge ], [ %call.i230251.3, %for.cond18.for.cond.cleanup21_crit_edge ]
%edge_length.i.promoted264 = phi i32 [ %edge_length.i.promoted, %for.cond18.preheader.for.cond.cleanup21_crit_edge ], [ %54, %for.cond18.for.cond.cleanup21_crit_edge ]
%pointer.i.promoted262 = phi i32 [ %pointer.i.promoted, %for.cond18.preheader.for.cond.cleanup21_crit_edge ], [ %add27.i240.3, %for.cond18.for.cond.cleanup21_crit_edge ]
%12 = phi i32 [ %10, %for.cond18.preheader.for.cond.cleanup21_crit_edge ], [ %55, %for.cond18.for.cond.cleanup21_crit_edge ]
%cmp14 = icmp slt i32 %inc90.pre-phi, %11
br i1 %cmp14, label %for.cond18.preheader, label %for.cond.cleanup16, !llvm.loop !28
for.body22: ; preds = %for.body22.lr.ph, %cleanup.3
%call.i230249 = phi ptr [ %call.i.promoted, %for.body22.lr.ph ], [ %call.i230251.3, %cleanup.3 ]
%13 = phi i32 [ %edge_length.i.promoted, %for.body22.lr.ph ], [ %54, %cleanup.3 ]
%add27.i238 = phi i32 [ %pointer.i.promoted, %for.body22.lr.ph ], [ %add27.i240.3, %cleanup.3 ]
%14 = phi i32 [ %10, %for.body22.lr.ph ], [ %55, %cleanup.3 ]
%j.0237 = phi i32 [ 0, %for.body22.lr.ph ], [ %add61.3, %cleanup.3 ]
br i1 %cmp23, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body22
%15 = load i32, ptr %h, align 4, !tbaa !14
%sub = add nsw i32 %15, -1
%cmp25 = icmp eq i32 %i12.0257, %sub
%cmp28 = icmp eq i32 %j.0237, 0
%or.cond = or i1 %cmp28, %cmp25
%sub31 = add nsw i32 %14, -1
%cmp32 = icmp eq i32 %j.0237, %sub31
%or.cond144 = select i1 %or.cond, i1 true, i1 %cmp32
br i1 %or.cond144, label %if.then, label %if.end
if.then: ; preds = %lor.lhs.false, %for.body22
%mul34 = mul nsw i32 %14, %i12.0257
%add35 = add nsw i32 %mul34, %j.0237
%cmp.i = icmp eq i32 %add27.i238, %13
br i1 %cmp.i, label %if.then.i, label %addEdge.exit
if.then.i: ; preds = %if.then
%mul.i = shl nsw i32 %13, 1
%conv.i147 = sext i32 %mul.i to i64
%mul3.i = mul nsw i64 %conv.i147, 12
%call.i148 = call ptr @realloc(ptr noundef %call.i230249, i64 noundef %mul3.i) #15
br label %addEdge.exit
addEdge.exit: ; preds = %if.then, %if.then.i
%call.i230248 = phi ptr [ %call.i148, %if.then.i ], [ %call.i230249, %if.then ]
%16 = phi i32 [ %mul.i, %if.then.i ], [ %13, %if.then ]
%idxprom.i = sext i32 %add27.i238 to i64
%arrayidx.i = getelementptr inbounds %struct.flow_edge, ptr %call.i230248, i64 %idxprom.i
%idxprom7.i = sext i32 %add35 to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i
%17 = load i32, ptr %arrayidx8.i, align 4, !tbaa !14
store i32 %add11, ptr %arrayidx.i, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 4
store i32 %17, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 8
store i32 400, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i, align 4, !tbaa.struct !18
store i32 %add27.i238, ptr %arrayidx8.i, align 4, !tbaa !14
%add.i = add nsw i32 %add27.i238, 1
%idxprom13.i = sext i32 %add.i to i64
%arrayidx14.i = getelementptr inbounds %struct.flow_edge, ptr %call.i230248, i64 %idxprom13.i
%18 = load i32, ptr %arrayidx20.i, align 4, !tbaa !14
store i32 %add35, ptr %arrayidx14.i, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx14.i, i64 4
store i32 %18, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx14.i, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i, align 4, !tbaa.struct !18
store i32 %add.i, ptr %arrayidx20.i, align 4, !tbaa !14
%add27.i = add nsw i32 %add27.i238, 2
%.pre268 = load i32, ptr %w, align 4, !tbaa !14
br label %if.end
if.end: ; preds = %lor.lhs.false, %addEdge.exit
%19 = phi i32 [ %14, %lor.lhs.false ], [ %.pre268, %addEdge.exit ]
%call.i230247 = phi ptr [ %call.i230249, %lor.lhs.false ], [ %call.i230248, %addEdge.exit ]
%20 = phi i32 [ %13, %lor.lhs.false ], [ %16, %addEdge.exit ]
%add27.i241 = phi i32 [ %add27.i238, %lor.lhs.false ], [ %add27.i, %addEdge.exit ]
%mul36 = mul nsw i32 %19, %i12.0257
%add37 = add nsw i32 %mul36, %j.0237
%idxprom = sext i32 %add37 to i64
%arrayidx = getelementptr inbounds i8, ptr %call1, i64 %idxprom
%21 = load i8, ptr %arrayidx, align 1, !tbaa !30
%cmp39 = icmp eq i8 %21, 88
br i1 %cmp39, label %if.then41, label %if.end44
if.then41: ; preds = %if.end
%cmp.i151 = icmp eq i32 %add27.i241, %20
br i1 %cmp.i151, label %if.then.i170, label %addEdge.exit176
if.then.i170: ; preds = %if.then41
%mul.i171 = shl nsw i32 %20, 1
%conv.i172 = sext i32 %mul.i171 to i64
%mul3.i173 = mul nsw i64 %conv.i172, 12
%call.i174 = call ptr @realloc(ptr noundef %call.i230247, i64 noundef %mul3.i173) #15
br label %addEdge.exit176
addEdge.exit176: ; preds = %if.then41, %if.then.i170
%call.i230246 = phi ptr [ %call.i174, %if.then.i170 ], [ %call.i230247, %if.then41 ]
%22 = phi i32 [ %mul.i171, %if.then.i170 ], [ %20, %if.then41 ]
%idxprom.i153 = sext i32 %add27.i241 to i64
%arrayidx.i154 = getelementptr inbounds %struct.flow_edge, ptr %call.i230246, i64 %idxprom.i153
%23 = load i32, ptr %arrayidx8.i157, align 4, !tbaa !14
store i32 %add37, ptr %arrayidx.i154, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i158 = getelementptr inbounds i8, ptr %arrayidx.i154, i64 4
store i32 %23, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i158, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i159 = getelementptr inbounds i8, ptr %arrayidx.i154, i64 8
store i32 400, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i159, align 4, !tbaa.struct !18
store i32 %add27.i241, ptr %arrayidx8.i157, align 4, !tbaa !14
%add.i161 = add nsw i32 %add27.i241, 1
%idxprom13.i162 = sext i32 %add.i161 to i64
%arrayidx14.i163 = getelementptr inbounds %struct.flow_edge, ptr %call.i230246, i64 %idxprom13.i162
%arrayidx20.i165 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom
%24 = load i32, ptr %arrayidx20.i165, align 4, !tbaa !14
store i32 %mul6, ptr %arrayidx14.i163, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i166 = getelementptr inbounds i8, ptr %arrayidx14.i163, i64 4
store i32 %24, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i166, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i167 = getelementptr inbounds i8, ptr %arrayidx14.i163, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i167, align 4, !tbaa.struct !18
store i32 %add.i161, ptr %arrayidx20.i165, align 4, !tbaa !14
%add27.i169 = add nsw i32 %add27.i241, 2
%.pre269 = load i32, ptr %w, align 4, !tbaa !14
%.pre271 = mul nsw i32 %.pre269, %i12.0257
%.pre272 = add nsw i32 %.pre271, %j.0237
br label %if.end44
if.end44: ; preds = %addEdge.exit176, %if.end
%add50.pre-phi = phi i32 [ %.pre272, %addEdge.exit176 ], [ %add37, %if.end ]
%25 = phi i32 [ %.pre269, %addEdge.exit176 ], [ %19, %if.end ]
%call.i230245 = phi ptr [ %call.i230246, %addEdge.exit176 ], [ %call.i230247, %if.end ]
%26 = phi i32 [ %22, %addEdge.exit176 ], [ %20, %if.end ]
%add27.i242 = phi i32 [ %add27.i169, %addEdge.exit176 ], [ %add27.i241, %if.end ]
%27 = load i32, ptr %h, align 4, !tbaa !14
%mul45142 = add i32 %27, %i12.0257
%add47 = mul i32 %mul45142, %25
%add48 = add nsw i32 %add47, %j.0237
%cmp.i179 = icmp eq i32 %add27.i242, %26
br i1 %cmp.i179, label %if.then.i198, label %addEdge.exit204
if.then.i198: ; preds = %if.end44
%mul.i199 = shl nsw i32 %26, 1
%conv.i200 = sext i32 %mul.i199 to i64
%mul3.i201 = mul nsw i64 %conv.i200, 12
%call.i202 = call ptr @realloc(ptr noundef %call.i230245, i64 noundef %mul3.i201) #15
br label %addEdge.exit204
addEdge.exit204: ; preds = %if.end44, %if.then.i198
%call.i230244 = phi ptr [ %call.i202, %if.then.i198 ], [ %call.i230245, %if.end44 ]
%28 = phi i32 [ %mul.i199, %if.then.i198 ], [ %26, %if.end44 ]
%idxprom.i181 = sext i32 %add27.i242 to i64
%arrayidx.i182 = getelementptr inbounds %struct.flow_edge, ptr %call.i230244, i64 %idxprom.i181
%idxprom7.i184 = sext i32 %add48 to i64
%arrayidx8.i185 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i184
%29 = load i32, ptr %arrayidx8.i185, align 4, !tbaa !14
store i32 %add50.pre-phi, ptr %arrayidx.i182, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i186 = getelementptr inbounds i8, ptr %arrayidx.i182, i64 4
store i32 %29, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i186, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i187 = getelementptr inbounds i8, ptr %arrayidx.i182, i64 8
store i32 1, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i187, align 4, !tbaa.struct !18
store i32 %add27.i242, ptr %arrayidx8.i185, align 4, !tbaa !14
%add.i189 = add nsw i32 %add27.i242, 1
%idxprom13.i190 = sext i32 %add.i189 to i64
%arrayidx14.i191 = getelementptr inbounds %struct.flow_edge, ptr %call.i230244, i64 %idxprom13.i190
%idxprom19.i192 = sext i32 %add50.pre-phi to i64
%arrayidx20.i193 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i192
%30 = load i32, ptr %arrayidx20.i193, align 4, !tbaa !14
store i32 %add48, ptr %arrayidx14.i191, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i194 = getelementptr inbounds i8, ptr %arrayidx14.i191, i64 4
store i32 %30, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i194, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i195 = getelementptr inbounds i8, ptr %arrayidx14.i191, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i195, align 4, !tbaa.struct !18
store i32 %add.i189, ptr %arrayidx20.i193, align 4, !tbaa !14
%add27.i197 = add nsw i32 %add27.i242, 2
br i1 %cmp62, label %land.lhs.true, label %land.lhs.true.1
land.lhs.true: ; preds = %addEdge.exit204
%31 = load i32, ptr %h, align 4, !tbaa !14
%cmp64.not = icmp sgt i32 %i12.0257, %31
br i1 %cmp64.not, label %land.lhs.true.1, label %land.lhs.true69
land.lhs.true69: ; preds = %land.lhs.true
%32 = load i32, ptr %w, align 4, !tbaa !14
%cmp70 = icmp slt i32 %j.0237, %32
br i1 %cmp70, label %if.end73, label %land.lhs.true.1
if.end73: ; preds = %land.lhs.true69
%mul74 = mul nsw i32 %32, %i12.0257
%add75 = add nsw i32 %mul74, %j.0237
%mul76143 = add i32 %31, %add58
%add78 = mul i32 %32, %mul76143
%add79 = add nsw i32 %add78, %j.0237
%cmp.i207 = icmp eq i32 %add27.i197, %28
br i1 %cmp.i207, label %if.then.i226, label %addEdge.exit232
if.then.i226: ; preds = %if.end73
%mul.i227 = shl nsw i32 %28, 1
%conv.i228 = sext i32 %mul.i227 to i64
%mul3.i229 = mul nsw i64 %conv.i228, 12
%call.i230 = call ptr @realloc(ptr noundef nonnull %call.i230244, i64 noundef %mul3.i229) #15
br label %addEdge.exit232
addEdge.exit232: ; preds = %if.end73, %if.then.i226
%call.i230252 = phi ptr [ %call.i230, %if.then.i226 ], [ %call.i230244, %if.end73 ]
%33 = phi i32 [ %mul.i227, %if.then.i226 ], [ %28, %if.end73 ]
%idxprom.i209 = sext i32 %add27.i197 to i64
%arrayidx.i210 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252, i64 %idxprom.i209
%idxprom7.i212 = sext i32 %add75 to i64
%arrayidx8.i213 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i212
%34 = load i32, ptr %arrayidx8.i213, align 4, !tbaa !14
store i32 %add79, ptr %arrayidx.i210, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214 = getelementptr inbounds i8, ptr %arrayidx.i210, i64 4
store i32 %34, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215 = getelementptr inbounds i8, ptr %arrayidx.i210, i64 8
store i32 400, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215, align 4, !tbaa.struct !18
store i32 %add27.i197, ptr %arrayidx8.i213, align 4, !tbaa !14
%add.i217 = add nsw i32 %add27.i242, 3
%idxprom13.i218 = sext i32 %add.i217 to i64
%arrayidx14.i219 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252, i64 %idxprom13.i218
%idxprom19.i220 = sext i32 %add79 to i64
%arrayidx20.i221 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i220
%35 = load i32, ptr %arrayidx20.i221, align 4, !tbaa !14
store i32 %add75, ptr %arrayidx14.i219, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222 = getelementptr inbounds i8, ptr %arrayidx14.i219, i64 4
store i32 %35, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223 = getelementptr inbounds i8, ptr %arrayidx14.i219, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223, align 4, !tbaa.struct !18
store i32 %add.i217, ptr %arrayidx20.i221, align 4, !tbaa !14
%add27.i225 = add nsw i32 %add27.i242, 4
br label %land.lhs.true.1
land.lhs.true.1: ; preds = %addEdge.exit232, %land.lhs.true69, %land.lhs.true, %addEdge.exit204
%call.i230251 = phi ptr [ %call.i230244, %addEdge.exit204 ], [ %call.i230244, %land.lhs.true ], [ %call.i230244, %land.lhs.true69 ], [ %call.i230252, %addEdge.exit232 ]
%36 = phi i32 [ %28, %addEdge.exit204 ], [ %28, %land.lhs.true ], [ %28, %land.lhs.true69 ], [ %33, %addEdge.exit232 ]
%add27.i240 = phi i32 [ %add27.i197, %addEdge.exit204 ], [ %add27.i197, %land.lhs.true ], [ %add27.i197, %land.lhs.true69 ], [ %add27.i225, %addEdge.exit232 ]
%add61.1 = add nsw i32 %j.0237, -1
%37 = load i32, ptr %h, align 4, !tbaa !14
%cmp64.1 = icmp slt i32 %i12.0257, %37
%cmp67.1 = icmp ne i32 %j.0237, 0
%or.cond100.1 = select i1 %cmp64.1, i1 %cmp67.1, i1 false
br i1 %or.cond100.1, label %land.lhs.true69.1, label %land.lhs.true.2
land.lhs.true69.1: ; preds = %land.lhs.true.1
%38 = load i32, ptr %w, align 4, !tbaa !14
%cmp70.1.not = icmp sgt i32 %j.0237, %38
br i1 %cmp70.1.not, label %land.lhs.true.2, label %if.end73.1
if.end73.1: ; preds = %land.lhs.true69.1
%mul74.1 = mul nsw i32 %38, %i12.0257
%add75.1 = add nsw i32 %mul74.1, %j.0237
%mul76143.1 = add i32 %37, %i12.0257
%add78.1 = mul i32 %38, %mul76143.1
%add79.1 = add nsw i32 %add78.1, %add61.1
%cmp.i207.1 = icmp eq i32 %add27.i240, %36
br i1 %cmp.i207.1, label %if.then.i226.1, label %addEdge.exit232.1
if.then.i226.1: ; preds = %if.end73.1
%mul.i227.1 = shl nsw i32 %36, 1
%conv.i228.1 = sext i32 %mul.i227.1 to i64
%mul3.i229.1 = mul nsw i64 %conv.i228.1, 12
%call.i230.1 = call ptr @realloc(ptr noundef nonnull %call.i230251, i64 noundef %mul3.i229.1) #15
br label %addEdge.exit232.1
addEdge.exit232.1: ; preds = %if.then.i226.1, %if.end73.1
%call.i230252.1 = phi ptr [ %call.i230.1, %if.then.i226.1 ], [ %call.i230251, %if.end73.1 ]
%39 = phi i32 [ %mul.i227.1, %if.then.i226.1 ], [ %36, %if.end73.1 ]
%idxprom.i209.1 = sext i32 %add27.i240 to i64
%arrayidx.i210.1 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252.1, i64 %idxprom.i209.1
%idxprom7.i212.1 = sext i32 %add75.1 to i64
%arrayidx8.i213.1 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i212.1
%40 = load i32, ptr %arrayidx8.i213.1, align 4, !tbaa !14
store i32 %add79.1, ptr %arrayidx.i210.1, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214.1 = getelementptr inbounds i8, ptr %arrayidx.i210.1, i64 4
store i32 %40, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214.1, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215.1 = getelementptr inbounds i8, ptr %arrayidx.i210.1, i64 8
store i32 400, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215.1, align 4, !tbaa.struct !18
store i32 %add27.i240, ptr %arrayidx8.i213.1, align 4, !tbaa !14
%add.i217.1 = add nsw i32 %add27.i240, 1
%idxprom13.i218.1 = sext i32 %add.i217.1 to i64
%arrayidx14.i219.1 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252.1, i64 %idxprom13.i218.1
%idxprom19.i220.1 = sext i32 %add79.1 to i64
%arrayidx20.i221.1 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i220.1
%41 = load i32, ptr %arrayidx20.i221.1, align 4, !tbaa !14
store i32 %add75.1, ptr %arrayidx14.i219.1, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222.1 = getelementptr inbounds i8, ptr %arrayidx14.i219.1, i64 4
store i32 %41, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222.1, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223.1 = getelementptr inbounds i8, ptr %arrayidx14.i219.1, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223.1, align 4, !tbaa.struct !18
store i32 %add.i217.1, ptr %arrayidx20.i221.1, align 4, !tbaa !14
%add27.i225.1 = add nsw i32 %add27.i240, 2
br label %land.lhs.true.2
land.lhs.true.2: ; preds = %land.lhs.true.1, %land.lhs.true69.1, %addEdge.exit232.1
%call.i230251.1 = phi ptr [ %call.i230251, %land.lhs.true.1 ], [ %call.i230251, %land.lhs.true69.1 ], [ %call.i230252.1, %addEdge.exit232.1 ]
%42 = phi i32 [ %36, %land.lhs.true.1 ], [ %36, %land.lhs.true69.1 ], [ %39, %addEdge.exit232.1 ]
%add27.i240.1 = phi i32 [ %add27.i240, %land.lhs.true.1 ], [ %add27.i240, %land.lhs.true69.1 ], [ %add27.i225.1, %addEdge.exit232.1 ]
%43 = load i32, ptr %h, align 4, !tbaa !14
%cmp64.2 = icmp slt i32 %add58.2, %43
br i1 %cmp64.2, label %land.lhs.true69.2, label %land.lhs.true.3
land.lhs.true69.2: ; preds = %land.lhs.true.2
%44 = load i32, ptr %w, align 4, !tbaa !14
%cmp70.2 = icmp slt i32 %j.0237, %44
br i1 %cmp70.2, label %if.end73.2, label %land.lhs.true.3
if.end73.2: ; preds = %land.lhs.true69.2
%mul74.2 = mul nsw i32 %44, %i12.0257
%add75.2 = add nsw i32 %mul74.2, %j.0237
%mul76143.2 = add i32 %43, %add58.2
%add78.2 = mul i32 %44, %mul76143.2
%add79.2 = add nsw i32 %add78.2, %j.0237
%cmp.i207.2 = icmp eq i32 %add27.i240.1, %42
br i1 %cmp.i207.2, label %if.then.i226.2, label %addEdge.exit232.2
if.then.i226.2: ; preds = %if.end73.2
%mul.i227.2 = shl nsw i32 %42, 1
%conv.i228.2 = sext i32 %mul.i227.2 to i64
%mul3.i229.2 = mul nsw i64 %conv.i228.2, 12
%call.i230.2 = call ptr @realloc(ptr noundef nonnull %call.i230251.1, i64 noundef %mul3.i229.2) #15
br label %addEdge.exit232.2
addEdge.exit232.2: ; preds = %if.then.i226.2, %if.end73.2
%call.i230252.2 = phi ptr [ %call.i230.2, %if.then.i226.2 ], [ %call.i230251.1, %if.end73.2 ]
%45 = phi i32 [ %mul.i227.2, %if.then.i226.2 ], [ %42, %if.end73.2 ]
%idxprom.i209.2 = sext i32 %add27.i240.1 to i64
%arrayidx.i210.2 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252.2, i64 %idxprom.i209.2
%idxprom7.i212.2 = sext i32 %add75.2 to i64
%arrayidx8.i213.2 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i212.2
%46 = load i32, ptr %arrayidx8.i213.2, align 4, !tbaa !14
store i32 %add79.2, ptr %arrayidx.i210.2, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214.2 = getelementptr inbounds i8, ptr %arrayidx.i210.2, i64 4
store i32 %46, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214.2, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215.2 = getelementptr inbounds i8, ptr %arrayidx.i210.2, i64 8
store i32 400, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215.2, align 4, !tbaa.struct !18
store i32 %add27.i240.1, ptr %arrayidx8.i213.2, align 4, !tbaa !14
%add.i217.2 = add nsw i32 %add27.i240.1, 1
%idxprom13.i218.2 = sext i32 %add.i217.2 to i64
%arrayidx14.i219.2 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252.2, i64 %idxprom13.i218.2
%idxprom19.i220.2 = sext i32 %add79.2 to i64
%arrayidx20.i221.2 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i220.2
%47 = load i32, ptr %arrayidx20.i221.2, align 4, !tbaa !14
store i32 %add75.2, ptr %arrayidx14.i219.2, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222.2 = getelementptr inbounds i8, ptr %arrayidx14.i219.2, i64 4
store i32 %47, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222.2, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223.2 = getelementptr inbounds i8, ptr %arrayidx14.i219.2, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223.2, align 4, !tbaa.struct !18
store i32 %add.i217.2, ptr %arrayidx20.i221.2, align 4, !tbaa !14
%add27.i225.2 = add nsw i32 %add27.i240.1, 2
br label %land.lhs.true.3
land.lhs.true.3: ; preds = %land.lhs.true.2, %land.lhs.true69.2, %addEdge.exit232.2
%call.i230251.2 = phi ptr [ %call.i230251.1, %land.lhs.true.2 ], [ %call.i230251.1, %land.lhs.true69.2 ], [ %call.i230252.2, %addEdge.exit232.2 ]
%48 = phi i32 [ %42, %land.lhs.true.2 ], [ %42, %land.lhs.true69.2 ], [ %45, %addEdge.exit232.2 ]
%add27.i240.2 = phi i32 [ %add27.i240.1, %land.lhs.true.2 ], [ %add27.i240.1, %land.lhs.true69.2 ], [ %add27.i225.2, %addEdge.exit232.2 ]
%add61.3 = add nuw nsw i32 %j.0237, 1
%49 = load i32, ptr %h, align 4, !tbaa !14
%cmp64.3 = icmp slt i32 %i12.0257, %49
br i1 %cmp64.3, label %land.lhs.true69.3, label %cleanup.3
land.lhs.true69.3: ; preds = %land.lhs.true.3
%50 = load i32, ptr %w, align 4, !tbaa !14
%cmp70.3 = icmp slt i32 %add61.3, %50
br i1 %cmp70.3, label %if.end73.3, label %cleanup.3
if.end73.3: ; preds = %land.lhs.true69.3
%mul74.3 = mul nsw i32 %50, %i12.0257
%add75.3 = add nsw i32 %mul74.3, %j.0237
%mul76143.3 = add i32 %49, %i12.0257
%add78.3 = mul i32 %50, %mul76143.3
%add79.3 = add nsw i32 %add78.3, %add61.3
%cmp.i207.3 = icmp eq i32 %add27.i240.2, %48
br i1 %cmp.i207.3, label %if.then.i226.3, label %addEdge.exit232.3
if.then.i226.3: ; preds = %if.end73.3
%mul.i227.3 = shl nsw i32 %48, 1
%conv.i228.3 = sext i32 %mul.i227.3 to i64
%mul3.i229.3 = mul nsw i64 %conv.i228.3, 12
%call.i230.3 = call ptr @realloc(ptr noundef nonnull %call.i230251.2, i64 noundef %mul3.i229.3) #15
br label %addEdge.exit232.3
addEdge.exit232.3: ; preds = %if.then.i226.3, %if.end73.3
%call.i230252.3 = phi ptr [ %call.i230.3, %if.then.i226.3 ], [ %call.i230251.2, %if.end73.3 ]
%51 = phi i32 [ %mul.i227.3, %if.then.i226.3 ], [ %48, %if.end73.3 ]
%idxprom.i209.3 = sext i32 %add27.i240.2 to i64
%arrayidx.i210.3 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252.3, i64 %idxprom.i209.3
%idxprom7.i212.3 = sext i32 %add75.3 to i64
%arrayidx8.i213.3 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom7.i212.3
%52 = load i32, ptr %arrayidx8.i213.3, align 4, !tbaa !14
store i32 %add79.3, ptr %arrayidx.i210.3, align 4, !tbaa.struct !16
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214.3 = getelementptr inbounds i8, ptr %arrayidx.i210.3, i64 4
store i32 %52, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx.i214.3, align 4, !tbaa.struct !17
%.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215.3 = getelementptr inbounds i8, ptr %arrayidx.i210.3, i64 8
store i32 400, ptr %.compoundliteral.sroa.3.0.arrayidx.sroa_idx.i215.3, align 4, !tbaa.struct !18
store i32 %add27.i240.2, ptr %arrayidx8.i213.3, align 4, !tbaa !14
%add.i217.3 = add nsw i32 %add27.i240.2, 1
%idxprom13.i218.3 = sext i32 %add.i217.3 to i64
%arrayidx14.i219.3 = getelementptr inbounds %struct.flow_edge, ptr %call.i230252.3, i64 %idxprom13.i218.3
%idxprom19.i220.3 = sext i32 %add79.3 to i64
%arrayidx20.i221.3 = getelementptr inbounds i32, ptr %call3.i, i64 %idxprom19.i220.3
%53 = load i32, ptr %arrayidx20.i221.3, align 4, !tbaa !14
store i32 %add75.3, ptr %arrayidx14.i219.3, align 4, !tbaa.struct !16
%.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222.3 = getelementptr inbounds i8, ptr %arrayidx14.i219.3, i64 4
store i32 %53, ptr %.compoundliteral15.sroa.2.0.arrayidx14.sroa_idx.i222.3, align 4, !tbaa.struct !17
%.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223.3 = getelementptr inbounds i8, ptr %arrayidx14.i219.3, i64 8
store i32 0, ptr %.compoundliteral15.sroa.3.0.arrayidx14.sroa_idx.i223.3, align 4, !tbaa.struct !18
store i32 %add.i217.3, ptr %arrayidx20.i221.3, align 4, !tbaa !14
%add27.i225.3 = add nsw i32 %add27.i240.2, 2
br label %cleanup.3
cleanup.3: ; preds = %addEdge.exit232.3, %land.lhs.true69.3, %land.lhs.true.3
%call.i230251.3 = phi ptr [ %call.i230251.2, %land.lhs.true.3 ], [ %call.i230251.2, %land.lhs.true69.3 ], [ %call.i230252.3, %addEdge.exit232.3 ]
%54 = phi i32 [ %48, %land.lhs.true.3 ], [ %48, %land.lhs.true69.3 ], [ %51, %addEdge.exit232.3 ]
%add27.i240.3 = phi i32 [ %add27.i240.2, %land.lhs.true.3 ], [ %add27.i240.2, %land.lhs.true69.3 ], [ %add27.i225.3, %addEdge.exit232.3 ]
%55 = load i32, ptr %w, align 4, !tbaa !14
%cmp19 = icmp slt i32 %add61.3, %55
br i1 %cmp19, label %for.body22, label %for.cond18.for.cond.cleanup21_crit_edge, !llvm.loop !31
if.then96: ; preds = %for.cond.cleanup16
%call97 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end99
if.else: ; preds = %for.cond.cleanup16
%call98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %call93)
br label %if.end99
if.end99: ; preds = %if.else, %if.then96
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #14
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #12
attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,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 #3 = { mustprogress nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-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 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #10 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #11 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind allocsize(0,1) }
attributes #14 = { nounwind }
attributes #15 = { nounwind allocsize(1) }
attributes #16 = { 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, !10, i64 16}
!6 = !{!"maxFlowGraph", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 8}
!13 = !{!6, !10, i64 24}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 20}
!16 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14}
!17 = !{i64 0, i64 4, !14, i64 4, i64 4, !14}
!18 = !{i64 0, i64 4, !14}
!19 = !{!20, !10, i64 0}
!20 = !{!"flow_edge", !10, i64 0, !10, i64 4, !10, i64 8}
!21 = !{!20, !10, i64 8}
!22 = !{!20, !10, i64 4}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}
!28 = distinct !{!28, !24, !29}
!29 = !{!"llvm.loop.unswitch.partial.disable"}
!30 = !{!8, !8, i64 0}
!31 = distinct !{!31, !24}
|
#include <stdio.h>
int main() {
char s[100001];
int move = 1;
scanf("%s", s, 100000);
for (int i = 0;s[i + 1] != '\0';i++) {
if (s[i] != s[i + 1]) move++;
}
printf("%d\n", move-1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, i32 noundef 100000)
%arrayidx17 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 1
%0 = load i8, ptr %arrayidx17, align 1, !tbaa !5
%cmp.not18 = icmp eq i8 %0, 0
br i1 %cmp.not18, label %for.cond.cleanup, label %for.body
for.cond.cleanup.loopexit: ; preds = %for.body
%1 = add nsw i32 %spec.select, -1
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%move.0.lcssa = phi i32 [ 0, %entry ], [ %1, %for.cond.cleanup.loopexit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %move.0.lcssa)
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv22 = phi i64 [ %indvars.iv.next23, %for.body ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%2 = phi i8 [ %4, %for.body ], [ %0, %entry ]
%move.019 = phi i32 [ %spec.select, %for.body ], [ 1, %entry ]
%arrayidx3 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv22
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp9.not = icmp ne i8 %3, %2
%inc = zext i1 %cmp9.not to i32
%spec.select = add nuw nsw i32 %move.019, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %4, 0
%indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
br i1 %cmp.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !8
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int a,b,i,l,ans=0;
char s[100005];
scanf("%s",s);
l=strlen(s);
for(i=1;i<l;i++)
if(s[i]!=s[i-1])
ans++;
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147258/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [100005 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100005, 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 [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> %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 ]
%ans.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 ]
%ans.018 = phi i32 [ %spec.select, %for.body ], [ %ans.018.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
%cmp8.not = icmp ne i8 %13, %scalar.recur
%inc = zext i1 %cmp8.not to i32
%spec.select = add nuw nsw i32 %ans.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
%ans.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 %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 100005, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: 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}
|
/*************************************
*プログラム名:C.c
*
*************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <pthread.h>
//<<<<<>>>>>//
int main(void)
{
int i, N, num, sum = 0;
char S[100001];
scanf("%s", S);
//printf("%s\n", S);
N = strlen(S);
for (i = 0, num = 0; i < N; i++) {
if (S[i] == 'B') {
if (num != 1) {
sum++;
num = 1;
}
} else {
if (num != 2) {
sum++;
num = 2;
}
}
}
printf("%d\n", sum - 1);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147300/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147300/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%cmp24 = icmp sgt i32 %conv, 0
br i1 %cmp24, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader31, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call2, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%vec.phi29 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vector.recur = phi <4 x i32> [ <i32 poison, i32 poison, i32 poison, i32 0>, %vector.ph ], [ %5, %vector.body ]
%0 = getelementptr inbounds [100001 x i8], ptr %S, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load30 = load <4 x i8>, ptr %1, align 4, !tbaa !5
%2 = icmp eq <4 x i8> %wide.load, <i8 66, i8 66, i8 66, i8 66>
%3 = icmp eq <4 x i8> %wide.load30, <i8 66, i8 66, i8 66, i8 66>
%4 = select <4 x i1> %2, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
%5 = select <4 x i1> %3, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
%6 = shufflevector <4 x i32> %vector.recur, <4 x i32> %4, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%7 = shufflevector <4 x i32> %4, <4 x i32> %5, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%8 = icmp ne <4 x i32> %6, %4
%9 = icmp ne <4 x i32> %7, %5
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = add <4 x i32> %vec.phi, %10
%13 = add <4 x i32> %vec.phi29, %11
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %13, %12
%15 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
%vector.recur.extract = extractelement <4 x i32> %5, i64 3
br i1 %cmp.n, label %for.end.loopexit, label %for.body.preheader31
for.body.preheader31: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body.preheader ]
%sum.027.ph = phi i32 [ %15, %middle.block ], [ 0, %for.body.preheader ]
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
for.body: ; preds = %for.body.preheader31, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader31 ]
%sum.027 = phi i32 [ %sum.1, %for.body ], [ %sum.027.ph, %for.body.preheader31 ]
%scalar.recur = phi i32 [ %num.1, %for.body ], [ %scalar.recur.ph, %for.body.preheader31 ]
%arrayidx = getelementptr inbounds [100001 x i8], ptr %S, i64 0, i64 %indvars.iv
%16 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp5 = icmp eq i8 %16, 66
%num.1 = select i1 %cmp5, i32 1, i32 2
%inc.pn.in = icmp ne i32 %scalar.recur, %num.1
%inc.pn = zext i1 %inc.pn.in to i32
%sum.1 = add nuw nsw i32 %sum.027, %inc.pn
%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 !12
for.end.loopexit: ; preds = %for.body, %middle.block
%sum.1.lcssa = phi i32 [ %15, %middle.block ], [ %sum.1, %for.body ]
%17 = add nsw i32 %sum.1.lcssa, -1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%sum.0.lcssa = phi i32 [ -1, %entry ], [ %17, %for.end.loopexit ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.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}
|
#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+=10;
assert((v->data = realloc(v->data, v->max * v->data_size)) != NULL);
// assert(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 = 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(0, sizeof(int));
}
rep(i,0,n){
(ret->vec_cost[i]) = vector_init(0, 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);
// rep(i,0,n){
// rep(j,0,g->to[i]->n){
// // printf("%lld ",*(ll*) g->to[i].data[j]);
// printf("%d ", g->to[i]->g_int( g->to[i] ,j));
// }PN;
// }
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_147344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147344/source.c"
target datalayout = "e-m:e-p270: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_147344/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
%add = add nsw i32 %0, 10
store i32 %add, 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, %add
%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
%.pre26 = 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 496, 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 ], [ %.pre26, %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
%inc = add nsw i32 %7, 1
store i32 %inc, 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 512, 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 524, 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 512, 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 %n, 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 0, 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 ptr @calloc(i64 1, i64 0)
%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 0, 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 ptr @calloc(i64 1, i64 0)
%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 <string.h>
#include <math.h>
#include <stdlib.h>
// 配列の最大の大きさ
#define MAX_LENGTH 200010
typedef struct{
int array[MAX_LENGTH];
int first;
int last;
}QUEUE;
void init(QUEUE*);
int enqueue(QUEUE*,int);
int dequeue(QUEUE*,int*);
struct touple { int a; int b; };
int cmp_touple(const void*n1, const void*n2);
int bisect_left(int x,struct touple a[],int left,int right);
int bisect_right(int x,struct touple a[],int left,int right);
int main(void){
int N,M;
scanf("%d%d", &N,&M);
struct touple *ts = (struct touple *)malloc((M*2)*sizeof(struct touple));
for (int i = 0; i < M; i++) {
int x,y;
scanf("%d%d", &x,&y);
ts[i].a = x;ts[i].b = y;
//逆辺も入れとく
ts[i+M].a = y;ts[i+M].b = x;
}
qsort(ts,2*M,sizeof (ts), cmp_touple);
// その部屋が指し示してる方向
int *direction = (int *)malloc((N+1) * sizeof(int));
memset(direction,0xFF,sizeof(int)*(N+1));
//以下bfs やる
//queueには処理する部屋の順(頂点)が詰まってる
QUEUE q;
init(&q);
enqueue(&q,1);
direction[1] = 0;
while (q.first != q.last){
//queueの頭から一個取り出す
int v;
dequeue(&q,&v);
//printf("%d\n",v);
int index1 = bisect_left(v,ts,0,(2*M)-1); //<- 引数上手く書く
int index2 = bisect_right(v,ts,0,(2*M)-1); //<-引数上手く書く
//printf("%d %d index\n",index1,index2);
// 計算量は一番深いのがこの一個したのネストでO(Mlog(M)+N)
for (int index = index1; index < index2; index++) {
int nv = ts[index].b;
// nvは新しい頂点(行ける頂点)
if (direction[nv] != -1) continue;//到達しているのでいらん
direction[nv] = v;//普通 direction[nv] = direction[v] + 1で距離見る
enqueue(&q,nv);
}
}
// direction をうまいこと出力
printf("Yes\n");
for (int i = 2; i <= N; i++) {
printf("%d\n",direction[i]);
}
}
int bisect_left(int x,struct touple a[],int left,int right){
int mid; right++;
while (left < right) {
mid = (left + right) / 2;
if (a[mid].a < x) {
left = mid + 1;
} else {
right = mid;
}
}
return left;
}
int bisect_right(int x,struct touple a[],int left,int right){
int mid;
right++;
while (left < right) {
mid = (left + right) / 2;
if (a[mid].a <= x) {
left = mid + 1;
} else {
right = mid;
}
}
return left;
}
int cmp_touple(const void*n1, const void*n2){
return ((struct touple*)n1)->a - ((struct touple*)n2)->a;
}
// スタックの初期化
void init(QUEUE* pQueue)
{
int i;
for(i = 0; i < MAX_LENGTH; i++){
pQueue->array[i] = 0;
}
// 最初と最後の位置を先頭に。
pQueue->first = 0;
pQueue->last = 0;
}
// 値のプッシュ
int enqueue(QUEUE* pQueue,int value)
{
// lastの次が、firstならば、失敗
if((pQueue->last + 1) % MAX_LENGTH == pQueue->first){
return 0;
}
pQueue->array[pQueue->last] = value; // キューに新しい値を入れる
pQueue->last = (pQueue->last + 1) % MAX_LENGTH; // lastの更新
// データを格納しきれなかった
return 1;
}
// 値のポップ
int dequeue(QUEUE* pQueue,int* pValue)
{
// キューにデータが一つもないなら、失敗
if(pQueue->first == pQueue->last)
{
return 0;
}
*pValue = pQueue->array[pQueue->first]; // いちばん先頭のキューを返す準備
pQueue->first = (pQueue->first+1) % MAX_LENGTH; // キューの先頭を次に移動する
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147388/source.c"
target datalayout = "e-m:e-p270: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.QUEUE = type { [200010 x i32], i32, i32 }
%struct.touple = type { i32, i32 }
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%q = alloca %struct.QUEUE, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %M, align 4, !tbaa !5
%mul = shl nsw i32 %0, 1
%conv = sext i32 %mul to i64
%mul1 = shl nsw i64 %conv, 3
%call2 = call noalias ptr @malloc(i64 noundef %mul1) #12
%cmp132 = icmp sgt i32 %0, 0
br i1 %cmp132, label %for.body, label %dequeue.exit.lr.ph
for.cond.cleanup.loopexit: ; preds = %for.body
%.pre147 = shl nsw i32 %6, 1
%.pre148 = sext i32 %.pre147 to i64
br label %dequeue.exit.lr.ph
dequeue.exit.lr.ph: ; preds = %entry, %for.cond.cleanup.loopexit
%conv15.pre-phi = phi i64 [ %.pre148, %for.cond.cleanup.loopexit ], [ %conv, %entry ]
call void @qsort(ptr noundef %call2, i64 noundef %conv15.pre-phi, i64 noundef 8, ptr noundef nonnull @cmp_touple) #11
%1 = load i32, ptr %N, align 4, !tbaa !5
%add16 = add nsw i32 %1, 1
%conv17 = sext i32 %add16 to i64
%mul18 = shl nsw i64 %conv17, 2
%call19 = call noalias ptr @malloc(i64 noundef %mul18) #12
call void @llvm.memset.p0.i64(ptr align 4 %call19, i8 -1, i64 %mul18, i1 false)
call void @llvm.lifetime.start.p0(i64 800048, ptr nonnull %q) #11
%2 = getelementptr inbounds i8, ptr %q, i64 4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(800048) %2, i8 0, i64 800040, i1 false)
%last.i = getelementptr inbounds %struct.QUEUE, ptr %q, i64 0, i32 2
%first.i = getelementptr inbounds %struct.QUEUE, ptr %q, i64 0, i32 1
store i32 1, ptr %q, align 4, !tbaa !5
store i32 1, ptr %last.i, align 4, !tbaa !9
%arrayidx24 = getelementptr inbounds i32, ptr %call19, i64 1
store i32 0, ptr %arrayidx24, align 4, !tbaa !5
%3 = load i32, ptr %M, align 4, !tbaa !5
%mul28 = shl nsw i32 %3, 1
%cmp10.not.i = icmp slt i32 %3, 1
br i1 %cmp10.not.i, label %while.end, label %dequeue.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #11
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%4 = load i32, ptr %x, align 4, !tbaa !5
%arrayidx = getelementptr inbounds %struct.touple, ptr %call2, i64 %indvars.iv
store i32 %4, ptr %arrayidx, align 4, !tbaa !11
%5 = load i32, ptr %y, align 4, !tbaa !5
%b = getelementptr inbounds %struct.touple, ptr %call2, i64 %indvars.iv, i32 1
store i32 %5, ptr %b, align 4, !tbaa !13
%6 = load i32, ptr %M, align 4, !tbaa !5
%7 = trunc i64 %indvars.iv to i32
%add = add nsw i32 %6, %7
%idxprom7 = sext i32 %add to i64
%arrayidx8 = getelementptr inbounds %struct.touple, ptr %call2, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !11
%b13 = getelementptr inbounds %struct.touple, ptr %call2, i64 %idxprom7, i32 1
store i32 %4, ptr %b13, align 4, !tbaa !13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !14
while.cond.loopexit.loopexit: ; preds = %cleanup
%.pre = load i32, ptr %first.i, align 4, !tbaa !16
br label %while.cond.loopexit
while.cond.loopexit: ; preds = %while.cond.loopexit.loopexit, %bisect_right.exit.loopexit
%9 = phi i32 [ %23, %while.cond.loopexit.loopexit ], [ %11, %bisect_right.exit.loopexit ]
%10 = phi i32 [ %.pre, %while.cond.loopexit.loopexit ], [ %rem.i95, %bisect_right.exit.loopexit ]
%cmp25.not = icmp eq i32 %10, %9
br i1 %cmp25.not, label %while.end, label %dequeue.exit, !llvm.loop !17
dequeue.exit: ; preds = %dequeue.exit.lr.ph, %while.cond.loopexit
%11 = phi i32 [ %9, %while.cond.loopexit ], [ 1, %dequeue.exit.lr.ph ]
%12 = phi i32 [ %10, %while.cond.loopexit ], [ 0, %dequeue.exit.lr.ph ]
%idxprom.i92 = sext i32 %12 to i64
%arrayidx.i93 = getelementptr inbounds [200010 x i32], ptr %q, i64 0, i64 %idxprom.i92
%13 = load i32, ptr %arrayidx.i93, align 4, !tbaa !5
%add.i94 = add nsw i32 %12, 1
%rem.i95 = srem i32 %add.i94, 200010
store i32 %rem.i95, ptr %first.i, align 4, !tbaa !16
br label %while.body.i
while.body.i: ; preds = %dequeue.exit, %while.body.i
%left.addr.012.i = phi i32 [ %left.addr.1.i, %while.body.i ], [ 0, %dequeue.exit ]
%right.addr.011.i = phi i32 [ %right.addr.1.i, %while.body.i ], [ %mul28, %dequeue.exit ]
%add.i97 = add nsw i32 %right.addr.011.i, %left.addr.012.i
%div.i = sdiv i32 %add.i97, 2
%idxprom.i98 = sext i32 %div.i to i64
%arrayidx.i99 = getelementptr inbounds %struct.touple, ptr %call2, i64 %idxprom.i98
%14 = load i32, ptr %arrayidx.i99, align 4, !tbaa !11
%cmp2.i = icmp slt i32 %14, %13
%add3.i100 = add nsw i32 %div.i, 1
%right.addr.1.i = select i1 %cmp2.i, i32 %right.addr.011.i, i32 %div.i
%left.addr.1.i = select i1 %cmp2.i, i32 %add3.i100, i32 %left.addr.012.i
%cmp.i101 = icmp slt i32 %left.addr.1.i, %right.addr.1.i
br i1 %cmp.i101, label %while.body.i, label %while.body.i104, !llvm.loop !18
while.body.i104: ; preds = %while.body.i, %while.body.i104
%left.addr.012.i105 = phi i32 [ %left.addr.1.i113, %while.body.i104 ], [ 0, %while.body.i ]
%right.addr.011.i106 = phi i32 [ %right.addr.1.i112, %while.body.i104 ], [ %mul28, %while.body.i ]
%add.i107 = add nsw i32 %right.addr.011.i106, %left.addr.012.i105
%div.i108 = sdiv i32 %add.i107, 2
%idxprom.i109 = sext i32 %div.i108 to i64
%arrayidx.i110 = getelementptr inbounds %struct.touple, ptr %call2, i64 %idxprom.i109
%15 = load i32, ptr %arrayidx.i110, align 4, !tbaa !11
%cmp2.not.i = icmp sgt i32 %15, %13
%add3.i111 = add nsw i32 %div.i108, 1
%right.addr.1.i112 = select i1 %cmp2.not.i, i32 %div.i108, i32 %right.addr.011.i106
%left.addr.1.i113 = select i1 %cmp2.not.i, i32 %left.addr.012.i105, i32 %add3.i111
%cmp.i114 = icmp slt i32 %left.addr.1.i113, %right.addr.1.i112
br i1 %cmp.i114, label %while.body.i104, label %bisect_right.exit.loopexit, !llvm.loop !19
bisect_right.exit.loopexit: ; preds = %while.body.i104
%cmp34134 = icmp slt i32 %left.addr.1.i, %left.addr.1.i113
br i1 %cmp34134, label %for.body37.preheader, label %while.cond.loopexit
for.body37.preheader: ; preds = %bisect_right.exit.loopexit
%16 = sext i32 %left.addr.1.i to i64
%wide.trip.count = sext i32 %left.addr.1.i113 to i64
br label %for.body37
for.body37: ; preds = %for.body37.preheader, %cleanup
%17 = phi i32 [ %11, %for.body37.preheader ], [ %23, %cleanup ]
%18 = phi i32 [ %11, %for.body37.preheader ], [ %24, %cleanup ]
%indvars.iv141 = phi i64 [ %16, %for.body37.preheader ], [ %indvars.iv.next142, %cleanup ]
%b40 = getelementptr inbounds %struct.touple, ptr %call2, i64 %indvars.iv141, i32 1
%19 = load i32, ptr %b40, align 4, !tbaa !13
%idxprom41 = sext i32 %19 to i64
%arrayidx42 = getelementptr inbounds i32, ptr %call19, i64 %idxprom41
%20 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%cmp43.not = icmp eq i32 %20, -1
br i1 %cmp43.not, label %if.end, label %cleanup
if.end: ; preds = %for.body37
store i32 %13, ptr %arrayidx42, align 4, !tbaa !5
%add.i117 = add nsw i32 %18, 1
%rem.i118 = srem i32 %add.i117, 200010
%21 = load i32, ptr %first.i, align 4, !tbaa !16
%cmp.i120 = icmp eq i32 %rem.i118, %21
br i1 %cmp.i120, label %cleanup, label %if.end.i121
if.end.i121: ; preds = %if.end
%idxprom.i122 = sext i32 %18 to i64
%arrayidx.i123 = getelementptr inbounds [200010 x i32], ptr %q, i64 0, i64 %idxprom.i122
store i32 %19, ptr %arrayidx.i123, align 4, !tbaa !5
%22 = load i32, ptr %last.i, align 4, !tbaa !9
%add3.i124 = add nsw i32 %22, 1
%rem4.i125 = srem i32 %add3.i124, 200010
store i32 %rem4.i125, ptr %last.i, align 4, !tbaa !9
br label %cleanup
cleanup: ; preds = %if.end.i121, %if.end, %for.body37
%23 = phi i32 [ %rem4.i125, %if.end.i121 ], [ %17, %if.end ], [ %17, %for.body37 ]
%24 = phi i32 [ %rem4.i125, %if.end.i121 ], [ %18, %if.end ], [ %18, %for.body37 ]
%indvars.iv.next142 = add nsw i64 %indvars.iv141, 1
%exitcond.not = icmp eq i64 %indvars.iv.next142, %wide.trip.count
br i1 %exitcond.not, label %while.cond.loopexit.loopexit, label %for.body37, !llvm.loop !20
while.end: ; preds = %while.cond.loopexit, %dequeue.exit.lr.ph
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%25 = load i32, ptr %N, align 4, !tbaa !5
%cmp55.not137 = icmp slt i32 %25, 2
br i1 %cmp55.not137, label %for.cond.cleanup57, label %for.body58
for.cond.cleanup57: ; preds = %for.body58, %while.end
call void @llvm.lifetime.end.p0(i64 800048, ptr nonnull %q) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #11
ret i32 0
for.body58: ; preds = %while.end, %for.body58
%indvars.iv144 = phi i64 [ %indvars.iv.next145, %for.body58 ], [ 2, %while.end ]
%arrayidx60 = getelementptr inbounds i32, ptr %call19, i64 %indvars.iv144
%26 = load i32, ptr %arrayidx60, align 4, !tbaa !5
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%27 = load i32, ptr %N, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp55.not.not = icmp slt i64 %indvars.iv144, %28
br i1 %cmp55.not.not, label %for.body58, label %for.cond.cleanup57, !llvm.loop !21
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_touple(ptr nocapture noundef readonly %n1, ptr nocapture noundef readonly %n2) #5 {
entry:
%0 = load i32, ptr %n1, align 4, !tbaa !11
%1 = load i32, ptr %n2, align 4, !tbaa !11
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @init(ptr nocapture noundef writeonly %pQueue) local_unnamed_addr #7 {
entry:
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(800048) %pQueue, i8 0, i64 800048, i1 false)
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @enqueue(ptr nocapture noundef %pQueue, i32 noundef %value) local_unnamed_addr #8 {
entry:
%last = getelementptr inbounds %struct.QUEUE, ptr %pQueue, i64 0, i32 2
%0 = load i32, ptr %last, align 4, !tbaa !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 200010
%first = getelementptr inbounds %struct.QUEUE, ptr %pQueue, i64 0, i32 1
%1 = load i32, ptr %first, align 4, !tbaa !16
%cmp = icmp eq i32 %rem, %1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200010 x i32], ptr %pQueue, i64 0, i64 %idxprom
store i32 %value, ptr %arrayidx, align 4, !tbaa !5
%2 = load i32, ptr %last, align 4, !tbaa !9
%add3 = add nsw i32 %2, 1
%rem4 = srem i32 %add3, 200010
store i32 %rem4, ptr %last, align 4, !tbaa !9
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i32 [ 1, %if.end ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @dequeue(ptr nocapture noundef %pQueue, ptr nocapture noundef writeonly %pValue) local_unnamed_addr #8 {
entry:
%first = getelementptr inbounds %struct.QUEUE, ptr %pQueue, i64 0, i32 1
%0 = load i32, ptr %first, align 4, !tbaa !16
%last = getelementptr inbounds %struct.QUEUE, ptr %pQueue, i64 0, i32 2
%1 = load i32, ptr %last, align 4, !tbaa !9
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [200010 x i32], ptr %pQueue, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
store i32 %2, ptr %pValue, align 4, !tbaa !5
%3 = load i32, ptr %first, align 4, !tbaa !16
%add = add nsw i32 %3, 1
%rem = srem i32 %add, 200010
store i32 %rem, ptr %first, align 4, !tbaa !16
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i32 [ 1, %if.end ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @bisect_left(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #9 {
entry:
%cmp10.not = icmp slt i32 %right, %left
br i1 %cmp10.not, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%inc = add nsw i32 %right, 1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%left.addr.012 = phi i32 [ %left.addr.1, %while.body ], [ %left, %while.body.preheader ]
%right.addr.011 = phi i32 [ %right.addr.1, %while.body ], [ %inc, %while.body.preheader ]
%add = add nsw i32 %left.addr.012, %right.addr.011
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds %struct.touple, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%cmp2 = icmp slt i32 %0, %x
%add3 = add nsw i32 %div, 1
%right.addr.1 = select i1 %cmp2, i32 %right.addr.011, i32 %div
%left.addr.1 = select i1 %cmp2, i32 %add3, i32 %left.addr.012
%cmp = icmp slt i32 %left.addr.1, %right.addr.1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !18
while.end: ; preds = %while.body, %entry
%left.addr.0.lcssa = phi i32 [ %left, %entry ], [ %left.addr.1, %while.body ]
ret i32 %left.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @bisect_right(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #9 {
entry:
%cmp10.not = icmp slt i32 %right, %left
br i1 %cmp10.not, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%inc = add nsw i32 %right, 1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%left.addr.012 = phi i32 [ %left.addr.1, %while.body ], [ %left, %while.body.preheader ]
%right.addr.011 = phi i32 [ %right.addr.1, %while.body ], [ %inc, %while.body.preheader ]
%add = add nsw i32 %left.addr.012, %right.addr.011
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds %struct.touple, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !11
%cmp2.not = icmp sgt i32 %0, %x
%add3 = add nsw i32 %div, 1
%right.addr.1 = select i1 %cmp2.not, i32 %div, i32 %right.addr.011
%left.addr.1 = select i1 %cmp2.not, i32 %left.addr.012, i32 %add3
%cmp = icmp slt i32 %left.addr.1, %right.addr.1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !19
while.end: ; preds = %while.body, %entry
%left.addr.0.lcssa = phi i32 [ %left, %entry ], [ %left.addr.1, %while.body ]
ret i32 %left.addr.0.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #10
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { 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 #10 = { nofree nounwind }
attributes #11 = { nounwind }
attributes #12 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 800044}
!10 = !{!"", !7, i64 0, !6, i64 800040, !6, i64 800044}
!11 = !{!12, !6, i64 0}
!12 = !{!"touple", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 800040}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
|
#include <stdio.h>
void merge(int*, int, int, int);
void mergeSort(int*, int, int);
int count=0;
int main(){
int n,i,S[500000];
scanf("%d",&n);
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\n",S[i]);
printf("%d\n",count);
return 0;
}
void merge(int *A, 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]=A[left+i];
for(i=0;i<n2;i++) R[i]=A[mid+i];
L[n1]=1000000001;
R[n2]=1000000001;
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++;
}
}
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_147430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147430/source.c"
target datalayout = "e-m:e-p270: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
; Function Attrs: nofree 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) #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
%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 !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
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv29
%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.next30 = add nuw nsw i64 %indvars.iv29, 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.next30, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !11
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next30, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call14 = 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
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 @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 1000000001, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom20
store i32 1000000001, 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>
int ttt[5000000];
void merge(int *,int,int);
int co=0;
int main(){
int i,q,n,m;
int t[2500050],u[2500050];
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&t[i]);
}
merge(t, 0, q-1);
for(i=0;i<q;i++){
if(i!=q-1){
printf("%d ",t[i]);
}
else printf("%d",t[i]);
}
printf("\n%d\n",co);
}
void merge(int t[ ],int left,int right){
int md,i,j,o;
if(left>=right){
return;
}
md=(left+right)/2;
merge(t, left, md);
merge(t, md+1, right);
for(i=left;i<=md;i++)
ttt[i]=t[i];
for(i=md+1,j=right; i<=right; i++,j--){
ttt[i]=t[j];
}
i=left;
j=right;
for(o=left;o<=right;o++)
if(ttt[i]<=ttt[j]){
co++;
t[o]=ttt[i++];
}
else{
co++;
t[o]=ttt[j--];
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@co = 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 [5 x i8] c"\0A%d\0A\00", align 1
@ttt = dso_local local_unnamed_addr global [5000000 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%t = alloca [2500050 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 10000200, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%0 = load i32, ptr %q, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, 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 [2500050 x i32], ptr %t, 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 %q, 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 ]
%sub = add nsw i32 %.lcssa, -1
call void @merge(ptr noundef nonnull %t, i32 noundef 0, i32 noundef %sub)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp327 = icmp sgt i32 %3, 0
br i1 %cmp327, label %for.body4, label %for.end15
for.body4: ; preds = %for.end, %for.body4
%indvars.iv31 = phi i64 [ %indvars.iv.next32, %for.body4 ], [ 0, %for.end ]
%4 = phi i32 [ %7, %for.body4 ], [ %3, %for.end ]
%sub5 = add nsw i32 %4, -1
%5 = zext i32 %sub5 to i64
%cmp6.not = icmp eq i64 %indvars.iv31, %5
%arrayidx11 = getelementptr inbounds [2500050 x i32], ptr %t, i64 0, i64 %indvars.iv31
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%.str..str.1 = select i1 %cmp6.not, ptr @.str, ptr @.str.1
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, i32 noundef %6)
%indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next32, %8
br i1 %cmp3, label %for.body4, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body4, %for.end
%9 = load i32, ptr @co, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 10000200, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr noundef %t, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%t102 = ptrtoint ptr %t to i64
%cmp.not = icmp slt i32 %left, %right
br i1 %cmp.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%add = add nsw i32 %right, %left
%div = sdiv i32 %add, 2
tail call void @merge(ptr noundef %t, i32 noundef %left, i32 noundef %div)
%add1 = add nsw i32 %div, 1
tail call void @merge(ptr noundef %t, i32 noundef %add1, i32 noundef %right)
%cmp2.not77 = icmp slt i32 %div, %left
br i1 %cmp2.not77, label %for.cond6.preheader, label %for.body.preheader
for.body.preheader: ; preds = %if.end
%0 = sext i32 %left to i64
%1 = sub i32 %div, %left
%2 = zext i32 %1 to i64
%3 = add nuw nsw i64 %2, 1
%min.iters.check = icmp ult i32 %1, 15
br i1 %min.iters.check, label %for.body.preheader128, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%4 = shl nsw i64 %0, 2
%5 = add i64 %4, ptrtoint (ptr @ttt to i64)
%6 = add i64 %4, %t102
%7 = sub i64 %5, %6
%diff.check = icmp ult i64 %7, 32
br i1 %diff.check, label %for.body.preheader128, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %3, 8589934584
%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 ]
%offset.idx = add i64 %index, %0
%8 = getelementptr inbounds i32, ptr %t, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load103 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %offset.idx
store <4 x i32> %wide.load, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
store <4 x i32> %wide.load103, ptr %11, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.cond6.preheader, label %for.body.preheader128
for.body.preheader128: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %vector.memcheck ], [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%13 = add nsw i32 %div, 1
%14 = trunc i64 %indvars.iv.ph to i32
%15 = sub i32 %13, %14
%16 = sub i32 %div, %14
%xtraiter = and i32 %15, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader128, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader128 ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader128 ]
%arrayidx.prol = getelementptr inbounds i32, ptr %t, i64 %indvars.iv.prol
%17 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%arrayidx4.prol = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.prol
store i32 %17, ptr %arrayidx4.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !15
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader128
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader128 ], [ %indvars.iv.next.prol, %for.body.prol ]
%18 = icmp ult i32 %16, 3
br i1 %18, label %for.cond6.preheader, label %for.body
for.cond6.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %if.end
%cmp7.not79.not = icmp slt i32 %div, %right
br i1 %cmp7.not79.not, label %for.body8.preheader, label %for.cond16.preheader
for.body8.preheader: ; preds = %for.cond6.preheader
%19 = sext i32 %right to i64
%narrow = add nsw i32 %div, 1
%20 = sext i32 %narrow to i64
%21 = add i32 %right, 1
%22 = xor i32 %div, -1
%23 = add i32 %22, %right
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
%min.iters.check110 = icmp ult i32 %23, 27
br i1 %min.iters.check110, label %for.body8.preheader127, label %vector.memcheck104
vector.memcheck104: ; preds = %for.body8.preheader
%26 = sext i32 %div to i64
%27 = shl nsw i64 %26, 2
%28 = getelementptr i8, ptr @ttt, i64 %27
%29 = xor i32 %div, -1
%30 = add i32 %29, %right
%31 = zext i32 %30 to i64
%32 = shl nuw nsw i64 %31, 2
%33 = getelementptr i8, ptr @ttt, i64 %27
%34 = getelementptr i8, ptr %33, i64 %32
%scevgep105 = getelementptr i8, ptr %34, i64 8
%35 = shl nsw i64 %19, 2
%36 = sub nsw i64 %35, %32
%scevgep106 = getelementptr i8, ptr %t, i64 %36
%37 = getelementptr i8, ptr %t, i64 %35
%bound0 = icmp ult ptr %28, %37
%bound1 = icmp ult ptr %scevgep106, %scevgep105
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body8.preheader127, label %vector.ph111
vector.ph111: ; preds = %vector.memcheck104
%n.vec113 = and i64 %25, 8589934584
%ind.end114 = add nsw i64 %n.vec113, %20
%ind.end116 = sub nsw i64 %19, %n.vec113
br label %vector.body119
vector.body119: ; preds = %vector.body119, %vector.ph111
%index120 = phi i64 [ 0, %vector.ph111 ], [ %index.next126, %vector.body119 ]
%offset.idx121 = sub i64 %19, %index120
%offset.idx122 = add i64 %index120, %20
%38 = getelementptr inbounds i32, ptr %t, i64 %offset.idx121
%39 = getelementptr inbounds i32, ptr %38, i64 -3
%wide.load123 = load <4 x i32>, ptr %39, align 4, !tbaa !5, !alias.scope !17
%reverse = shufflevector <4 x i32> %wide.load123, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%40 = getelementptr inbounds i32, ptr %38, i64 -7
%wide.load124 = load <4 x i32>, ptr %40, align 4, !tbaa !5, !alias.scope !17
%reverse125 = shufflevector <4 x i32> %wide.load124, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%41 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %offset.idx122
store <4 x i32> %reverse, ptr %41, align 4, !tbaa !5, !alias.scope !20, !noalias !17
%42 = getelementptr inbounds i32, ptr %41, i64 4
store <4 x i32> %reverse125, ptr %42, align 4, !tbaa !5, !alias.scope !20, !noalias !17
%index.next126 = add nuw i64 %index120, 8
%43 = icmp eq i64 %index.next126, %n.vec113
br i1 %43, label %middle.block108, label %vector.body119, !llvm.loop !22
middle.block108: ; preds = %vector.body119
%cmp.n118 = icmp eq i64 %25, %n.vec113
br i1 %cmp.n118, label %for.cond16.preheader, label %for.body8.preheader127
for.body8.preheader127: ; preds = %vector.memcheck104, %for.body8.preheader, %middle.block108
%indvars.iv90.ph = phi i64 [ %20, %vector.memcheck104 ], [ %20, %for.body8.preheader ], [ %ind.end114, %middle.block108 ]
%indvars.iv88.ph = phi i64 [ %19, %vector.memcheck104 ], [ %19, %for.body8.preheader ], [ %ind.end116, %middle.block108 ]
%44 = add i32 %right, 1
%45 = trunc i64 %indvars.iv90.ph to i32
%46 = sub i32 %44, %45
%47 = sub i32 %right, %45
%xtraiter129 = and i32 %46, 3
%lcmp.mod130.not = icmp eq i32 %xtraiter129, 0
br i1 %lcmp.mod130.not, label %for.body8.prol.loopexit, label %for.body8.prol
for.body8.prol: ; preds = %for.body8.preheader127, %for.body8.prol
%indvars.iv90.prol = phi i64 [ %indvars.iv.next91.prol, %for.body8.prol ], [ %indvars.iv90.ph, %for.body8.preheader127 ]
%indvars.iv88.prol = phi i64 [ %indvars.iv.next89.prol, %for.body8.prol ], [ %indvars.iv88.ph, %for.body8.preheader127 ]
%prol.iter131 = phi i32 [ %prol.iter131.next, %for.body8.prol ], [ 0, %for.body8.preheader127 ]
%arrayidx10.prol = getelementptr inbounds i32, ptr %t, i64 %indvars.iv88.prol
%48 = load i32, ptr %arrayidx10.prol, align 4, !tbaa !5
%arrayidx12.prol = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv90.prol
store i32 %48, ptr %arrayidx12.prol, align 4, !tbaa !5
%indvars.iv.next91.prol = add nsw i64 %indvars.iv90.prol, 1
%indvars.iv.next89.prol = add nsw i64 %indvars.iv88.prol, -1
%prol.iter131.next = add i32 %prol.iter131, 1
%prol.iter131.cmp.not = icmp eq i32 %prol.iter131.next, %xtraiter129
br i1 %prol.iter131.cmp.not, label %for.body8.prol.loopexit, label %for.body8.prol, !llvm.loop !23
for.body8.prol.loopexit: ; preds = %for.body8.prol, %for.body8.preheader127
%indvars.iv90.unr = phi i64 [ %indvars.iv90.ph, %for.body8.preheader127 ], [ %indvars.iv.next91.prol, %for.body8.prol ]
%indvars.iv88.unr = phi i64 [ %indvars.iv88.ph, %for.body8.preheader127 ], [ %indvars.iv.next89.prol, %for.body8.prol ]
%49 = icmp ult i32 %47, 3
br i1 %49, label %for.cond16.preheader, label %for.body8.preheader127.new
for.body8.preheader127.new: ; preds = %for.body8.prol.loopexit
%invariant.gep = getelementptr i32, ptr %t, i64 -1
%invariant.gep132 = getelementptr i32, ptr %t, i64 -2
%invariant.gep134 = getelementptr i32, ptr %t, i64 -3
br label %for.body8
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 ]
%arrayidx = getelementptr inbounds i32, ptr %t, i64 %indvars.iv
%50 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv
store i32 %50, ptr %arrayidx4, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %t, i64 %indvars.iv.next
%51 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx4.1 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.next
store i32 %51, ptr %arrayidx4.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %t, i64 %indvars.iv.next.1
%52 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%arrayidx4.2 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.next.1
store i32 %52, ptr %arrayidx4.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %t, i64 %indvars.iv.next.2
%53 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx4.3 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.next.2
store i32 %53, ptr %arrayidx4.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nsw i64 %indvars.iv, 4
%lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32
%exitcond.not.3 = icmp eq i32 %add1, %lftr.wideiv.3
br i1 %exitcond.not.3, label %for.cond6.preheader, label %for.body, !llvm.loop !24
for.cond16.preheader: ; preds = %for.body8.prol.loopexit, %for.body8, %middle.block108, %for.cond6.preheader
%cmp17.not82 = icmp sgt i32 %left, %right
br i1 %cmp17.not82, label %cleanup, label %for.body18.preheader
for.body18.preheader: ; preds = %for.cond16.preheader
%54 = sext i32 %left to i64
%55 = add i32 %right, 1
br label %for.body18
for.body8: ; preds = %for.body8, %for.body8.preheader127.new
%indvars.iv90 = phi i64 [ %indvars.iv90.unr, %for.body8.preheader127.new ], [ %indvars.iv.next91.3, %for.body8 ]
%indvars.iv88 = phi i64 [ %indvars.iv88.unr, %for.body8.preheader127.new ], [ %indvars.iv.next89.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds i32, ptr %t, i64 %indvars.iv88
%56 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv90
store i32 %56, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next91 = add nsw i64 %indvars.iv90, 1
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv88
%57 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx12.1 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.next91
store i32 %57, ptr %arrayidx12.1, align 4, !tbaa !5
%indvars.iv.next91.1 = add nsw i64 %indvars.iv90, 2
%gep133 = getelementptr i32, ptr %invariant.gep132, i64 %indvars.iv88
%58 = load i32, ptr %gep133, align 4, !tbaa !5
%arrayidx12.2 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.next91.1
store i32 %58, ptr %arrayidx12.2, align 4, !tbaa !5
%indvars.iv.next91.2 = add nsw i64 %indvars.iv90, 3
%gep135 = getelementptr i32, ptr %invariant.gep134, i64 %indvars.iv88
%59 = load i32, ptr %gep135, align 4, !tbaa !5
%arrayidx12.3 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %indvars.iv.next91.2
store i32 %59, ptr %arrayidx12.3, align 4, !tbaa !5
%indvars.iv.next91.3 = add nsw i64 %indvars.iv90, 4
%indvars.iv.next89.3 = add nsw i64 %indvars.iv88, -4
%lftr.wideiv95.3 = trunc i64 %indvars.iv.next91.3 to i32
%exitcond96.not.3 = icmp eq i32 %21, %lftr.wideiv95.3
br i1 %exitcond96.not.3, label %for.cond16.preheader, label %for.body8, !llvm.loop !25
for.body18: ; preds = %for.body18.preheader, %for.body18
%indvars.iv97 = phi i64 [ %54, %for.body18.preheader ], [ %indvars.iv.next98, %for.body18 ]
%j.184 = phi i32 [ %right, %for.body18.preheader ], [ %j.2, %for.body18 ]
%i.283 = phi i32 [ %left, %for.body18.preheader ], [ %i.3, %for.body18 ]
%idxprom19 = sext i32 %i.283 to i64
%arrayidx20 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %idxprom19
%60 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%idxprom21 = sext i32 %j.184 to i64
%arrayidx22 = getelementptr inbounds [5000000 x i32], ptr @ttt, i64 0, i64 %idxprom21
%61 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.not = icmp sle i32 %60, %61
%.sink = tail call i32 @llvm.smin.i32(i32 %60, i32 %61)
%inc26 = zext i1 %cmp23.not to i32
%i.3 = add nsw i32 %i.283, %inc26
%not.cmp23.not = xor i1 %cmp23.not, true
%dec32 = sext i1 %not.cmp23.not to i32
%j.2 = add nsw i32 %j.184, %dec32
%inc25.sink.in = load i32, ptr @co, align 4, !tbaa !5
%inc25.sink = add nsw i32 %inc25.sink.in, 1
store i32 %inc25.sink, ptr @co, align 4
%62 = getelementptr inbounds i32, ptr %t, i64 %indvars.iv97
store i32 %.sink, ptr %62, align 4
%indvars.iv.next98 = add nsw i64 %indvars.iv97, 1
%lftr.wideiv100 = trunc i64 %indvars.iv.next98 to i32
%exitcond101.not = icmp eq i32 %55, %lftr.wideiv100
br i1 %exitcond101.not, label %cleanup, label %for.body18, !llvm.loop !26
cleanup: ; preds = %for.body18, %for.cond16.preheader, %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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = 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 = !{!18}
!18 = distinct !{!18, !19}
!19 = distinct !{!19, !"LVerDomain"}
!20 = !{!21}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !10, !13, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !10, !13}
!25 = distinct !{!25, !10, !13}
!26 = distinct !{!26, !10}
|
#include<stdio.h>
#include<stdlib.h>
void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int count=0;
int main(){
int n,S[500000],i;
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");
printf("%d\n",count);
return 0;
}
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);
}
}
void merge(int *A,int left,int mid,int right){
int i,j,k,n1,n2,*L,*R;
n1=mid - left;
n2=right - mid;
L=malloc(n1*sizeof(L));
R=malloc(n2*sizeof(R));
for(i=0;i<n1;i++){
L[i]=A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1]=2147483647;
R[n2]=2147483647;
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++;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147517/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147517/source.c"
target datalayout = "e-m:e-p270: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 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) #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
%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 %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
%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 %S, 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 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv28, %6
br i1 %cmp8.not, label %for.inc10, label %if.then
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 !11
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 2000000, ptr nonnull %S) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind 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
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 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, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #8
%conv2 = sext i32 %sub1 to i64
%mul3 = shl nsw i64 %conv2, 3
%call4 = tail call noalias ptr @malloc(i64 noundef %mul3) #8
%cmp82 = icmp sgt i32 %sub, 0
br i1 %cmp82, label %for.body.preheader, label %for.cond8.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.cond8.preheader
for.cond8.preheader: ; preds = %for.body.preheader, %entry
%cmp984 = icmp sgt i32 %sub1, 0
br i1 %cmp984, label %for.body11.preheader, label %for.end19
for.body11.preheader: ; preds = %for.cond8.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep92 = 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) %call4, ptr noundef nonnull align 4 dereferenceable(1) %scevgep92, i64 %13, i1 false), !tbaa !5
br label %for.end19
for.end19: ; preds = %for.body11.preheader, %for.cond8.preheader
%arrayidx21 = getelementptr inbounds i32, ptr %call, i64 %conv
store i32 2147483647, ptr %arrayidx21, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds i32, ptr %call4, i64 %conv2
store i32 2147483647, ptr %arrayidx23, align 4, !tbaa !5
%cmp2586 = icmp slt i32 %left, %right
br i1 %cmp2586, label %for.body27.preheader, label %for.end47
for.body27.preheader: ; preds = %for.end19
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body27
for.body27: ; preds = %for.body27.preheader, %for.body27
%indvars.iv = phi i64 [ %14, %for.body27.preheader ], [ %indvars.iv.next, %for.body27 ]
%i.289 = phi i32 [ 0, %for.body27.preheader ], [ %i.3, %for.body27 ]
%j.088 = phi i32 [ 0, %for.body27.preheader ], [ %j.1, %for.body27 ]
%15 = load i32, ptr @count, align 4, !tbaa !5
%inc28 = add nsw i32 %15, 1
store i32 %inc28, ptr @count, align 4, !tbaa !5
%idxprom29 = zext i32 %i.289 to i64
%arrayidx30 = getelementptr inbounds i32, ptr %call, i64 %idxprom29
%16 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%idxprom31 = zext i32 %j.088 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %call4, i64 %idxprom31
%17 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc44 = zext i1 %cmp33.not to i32
%j.1 = add nuw nsw i32 %j.088, %inc44
%not.cmp33.not = xor i1 %cmp33.not, true
%inc39 = zext i1 %not.cmp33.not to i32
%i.3 = add nuw nsw i32 %i.289, %inc39
%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.end47, label %for.body27, !llvm.loop !12
for.end47: ; preds = %for.body27, %for.end19
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define N 1000000000
#define RANGE 500000
void merge(int *,int ,int,int);
void mergesort(int *,int,int);
int *L,*R,cnt=0;
int main(void){
int n,S[RANGE],i;
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",cnt);
return 0;
}
void merge(int *S,int left,int mid, int right){
int n1,n2,i,k,j;
n1=mid-left;
n2=right-mid;
L=(int *)malloc((n1+1)*sizeof(int));
R=(int *)malloc((n2+1)*sizeof(int));
for(i=0;i<n1;i++) L[i]=S[left + i];
for(i=0;i<n2;i++) R[i]=S[mid + i];
L[n1]=N;
R[n2]=N;
i=0;
j=0;
for(k=left;k<right;k++){
cnt++;
if(L[i]<=R[j] ){
S[k]=L[i];
i++;
}else{
S[k]=R[j];
j++;
}
}
}
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);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147560/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147560/source.c"
target datalayout = "e-m:e-p270: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
@L = dso_local local_unnamed_addr global ptr null, align 8
@R = dso_local local_unnamed_addr global ptr null, align 8
; Function Attrs: nofree 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) #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 !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 %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 = 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 = 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 @cnt, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @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: 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 uwtable
define dso_local void @merge(ptr nocapture noundef %S, 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
store ptr %call, ptr @L, align 8, !tbaa !12
%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
store ptr %call5, ptr @R, align 8, !tbaa !12
%cmp78 = icmp sgt i32 %sub, 0
br i1 %cmp78, 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 %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 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
%cmp1180 = icmp sgt i32 %sub1, 0
br i1 %cmp1180, 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
%scevgep88 = 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 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep88, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %idxprom22
store i32 1000000000, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub1 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %idxprom24
store i32 1000000000, ptr %arrayidx25, align 4, !tbaa !5
%cmp2782 = icmp slt i32 %left, %right
br i1 %cmp2782, 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 ]
%j.085 = phi i32 [ 0, %for.body29.preheader ], [ %j.1, %for.body29 ]
%i.283 = phi i32 [ 0, %for.body29.preheader ], [ %i.3, %for.body29 ]
%15 = load i32, ptr @cnt, align 4, !tbaa !5
%inc30 = add nsw i32 %15, 1
store i32 %inc30, ptr @cnt, align 4, !tbaa !5
%idxprom31 = zext i32 %i.283 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %call, i64 %idxprom31
%16 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%idxprom33 = zext i32 %j.085 to i64
%arrayidx34 = getelementptr inbounds i32, ptr %call5, i64 %idxprom33
%17 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%cmp35.not = icmp sle i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc41 = zext i1 %cmp35.not to i32
%i.3 = add nuw nsw i32 %i.283, %inc41
%not.cmp35.not = xor i1 %cmp35.not, true
%inc46 = zext i1 %not.cmp35.not to i32
%j.1 = add nuw nsw i32 %j.085, %inc46
%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.end49, label %for.body29, !llvm.loop !14
for.end49: ; preds = %for.body29, %for.end21
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = 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}
|
#include <stdio.h>
#include <stdlib.h>
#define SENTINEL 1000000001
int *array;
int cnt = 0;
void mergeSort(int begin, int end);
int main(void)
{
int i;
int n;
scanf("%d", &n);
array = malloc(sizeof(int) * n);
if (array == NULL) {
printf("ERROR! Cannot allocate memory in main().\n");
return 1;
}
for (i = 0; i < n; i++) {
scanf("%d", &array[i]);
}
mergeSort(0, n);
for (i = 0; i < n; i++) {
if (i != 0) {
printf(" ");
}
printf("%d", array[i]);
}
printf("\n");
printf("%d\n", cnt);
free(array);
return 0;
}
void merge(int begin, int mid, int end);
void mergeSort(int begin, int end)
{
if (begin + 1 < end) {
int mid = (begin + end) / 2;
mergeSort(begin, mid);
mergeSort(mid, end);
merge(begin, mid, end);
}
}
void merge(int begin, int mid, int end)
{
int i, j, k;
int n_left = mid - begin;
int n_right = end - mid;
int *left, *right;
left = malloc(sizeof(int) * (n_left + 1));
right = malloc(sizeof(int) * (n_right + 1));
if (left == NULL || right == NULL) {
printf("ERROR! Cannot allocate memory in merge().\n");
exit(1);
}
for (i = 0; i < n_left; i++) {
left[i] = array[begin + i];
}
left[n_left] = SENTINEL;
for (i = 0; i < n_right; i++) {
right[i] = array[mid + i];
}
right[n_right] = SENTINEL;
i = j = 0;
for (k = begin; k < end; k++) {
if (left[i] <= right[j]) {
array[k] = left[i++];
} else {
array[k] = right[j++];
}
cnt++;
}
free(left);
free(right);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147603/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147603/source.c"
target datalayout = "e-m:e-p270: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
@array = dso_local local_unnamed_addr global ptr null, align 8
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [41 x i8] c"ERROR! Cannot allocate memory in main().\00", align 1
@str.6 = private unnamed_addr constant [42 x i8] c"ERROR! Cannot allocate memory in merge().\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #10
store ptr %call1, ptr @array, align 8, !tbaa !9
%cmp = icmp eq ptr %call1, null
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp432 = icmp sgt i32 %0, 0
br i1 %cmp432, label %for.body, label %for.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%1 = load ptr, ptr @array, align 8, !tbaa !9
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
%call6 = 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
%cmp4 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %for.cond.preheader
%.lcssa = phi i32 [ %0, %for.cond.preheader ], [ %2, %for.body ]
call void @mergeSort(i32 noundef 0, i32 noundef %.lcssa)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp834 = icmp sgt i32 %4, 0
br i1 %cmp834, label %if.end15.peel, label %for.end21
if.end15.peel: ; preds = %for.end
%.pre = load ptr, ptr @array, align 8, !tbaa !9
%.pre42 = load i32, ptr %.pre, align 4, !tbaa !5
%call18.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre42)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp8.peel = icmp sgt i32 %5, 1
br i1 %cmp8.peel, label %if.end15, label %for.end21
if.end15: ; preds = %if.end15.peel, %if.end15
%indvars.iv38 = phi i64 [ %indvars.iv.next39, %if.end15 ], [ 1, %if.end15.peel ]
%putchar31 = call i32 @putchar(i32 32)
%6 = load ptr, ptr @array, align 8, !tbaa !9
%arrayidx17 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv38
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %7)
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp8 = icmp slt i64 %indvars.iv.next39, %9
br i1 %cmp8, label %if.end15, label %for.end21, !llvm.loop !13
for.end21: ; preds = %if.end15, %if.end15.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%10 = load i32, ptr @cnt, align 4, !tbaa !5
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %10)
%11 = load ptr, ptr @array, align 8, !tbaa !9
call void @free(ptr noundef %11) #9
br label %cleanup
cleanup: ; preds = %for.end21, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ 0, %for.end21 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @mergeSort(i32 noundef %begin, i32 noundef %end) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %begin, 1
%cmp = icmp slt i32 %add, %end
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 %end, %begin
%div = sdiv i32 %add1, 2
tail call void @mergeSort(i32 noundef %begin, i32 noundef %div)
tail call void @mergeSort(i32 noundef %div, i32 noundef %end)
tail call void @merge(i32 noundef %begin, i32 noundef %div, i32 noundef %end)
br label %common.ret10
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local void @merge(i32 noundef %begin, i32 noundef %mid, i32 noundef %end) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %begin
%sub1 = sub nsw i32 %end, %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) #10
%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) #10
%cmp = icmp eq ptr %call, null
%cmp7 = icmp eq ptr %call5, null
%or.cond = or i1 %cmp, %cmp7
br i1 %or.cond, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp1090 = icmp sgt i32 %sub, 0
br i1 %cmp1090, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%0 = load ptr, ptr @array, align 8, !tbaa !9
%1 = sext i32 %begin to i64
%2 = shl nsw i64 %1, 2
%scevgep = getelementptr i8, ptr %0, i64 %2
%3 = xor i32 %begin, -1
%4 = add i32 %3, %mid
%5 = zext i32 %4 to i64
%6 = shl nuw nsw i64 %5, 2
%7 = add nuw nsw i64 %6, 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 %7, i1 false), !tbaa !5
br label %for.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
tail call void @exit(i32 noundef 1) #11
unreachable
for.end: ; preds = %for.body.lr.ph, %for.cond.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds i32, ptr %call, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%cmp1892 = icmp sgt i32 %sub1, 0
br i1 %cmp1892, label %for.body20.lr.ph, label %for.end28
for.body20.lr.ph: ; preds = %for.end
%8 = load ptr, ptr @array, align 8, !tbaa !9
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep100 = getelementptr i8, ptr %8, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %end
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 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 %15, i1 false), !tbaa !5
br label %for.end28
for.end28: ; preds = %for.body20.lr.ph, %for.end
%idxprom29 = sext i32 %sub1 to i64
%arrayidx30 = getelementptr inbounds i32, ptr %call5, i64 %idxprom29
store i32 1000000001, ptr %arrayidx30, align 4, !tbaa !5
%cmp3294 = icmp slt i32 %begin, %end
br i1 %cmp3294, label %for.body34.lr.ph, label %for.end56
for.body34.lr.ph: ; preds = %for.end28
%16 = load ptr, ptr @array, align 8
%17 = sext i32 %begin to i64
%wide.trip.count = sext i32 %end to i64
br label %for.body34
for.body34: ; preds = %for.body34.lr.ph, %for.body34
%indvars.iv = phi i64 [ %17, %for.body34.lr.ph ], [ %indvars.iv.next, %for.body34 ]
%i.297 = phi i32 [ 0, %for.body34.lr.ph ], [ %i.3, %for.body34 ]
%j.096 = phi i32 [ 0, %for.body34.lr.ph ], [ %j.1, %for.body34 ]
%idxprom35 = zext i32 %i.297 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %call, i64 %idxprom35
%18 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%idxprom37 = zext i32 %j.096 to i64
%arrayidx38 = getelementptr inbounds i32, ptr %call5, i64 %idxprom37
%19 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%cmp39.not = icmp sgt i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc47 = zext i1 %cmp39.not to i32
%j.1 = add nuw nsw i32 %j.096, %inc47
%not.cmp39.not = xor i1 %cmp39.not, true
%inc42 = zext i1 %not.cmp39.not to i32
%i.3 = add nuw nsw i32 %i.297, %inc42
%20 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%21 = load i32, ptr @cnt, align 4, !tbaa !5
%inc53 = add nsw i32 %21, 1
store i32 %inc53, 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.end56, label %for.body34, !llvm.loop !15
for.end56: ; preds = %for.body34, %for.end28
tail call void @free(ptr noundef nonnull %call) #9
tail call void @free(ptr noundef nonnull %call5) #9
ret void
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #8
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
#define INFTY 10000000000
int n;
long long int L[500000];
long long int R[500000];
long long int S[500000];
long long int count=0;
void merge(long long int *A,int l,int m,int r){
int n1=m-l;
int n2=r-m;
int i,j,k;
int t;
for(i=0;i<n1;i++)L[i]=A[l+i];
for(i=0;i<n2;i++)R[i]=A[m+i];
L[n1]=INFTY;
R[n2]=INFTY;
i=0;
j=0;
for(k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
count++;
}
else{
A[k]=R[j];
j++;
count++;
}
}
}
void mergesort(long long int *A,int l,int r){
int m;
if(l+1<r){
m=(l+r)/2;
mergesort(A,l,m);
mergesort(A,m,r);
merge(A,l,m,r);
}
}
int main(){
int i;
scanf("%lld",&n);
for(i=0;i<n;i++)scanf("%lld",&S[i]);
mergesort(S,0,n);
for(i=0;i<n-1;i++)printf("%lld ",S[i]);
printf("%lld\n",S[i]);
printf("%lld\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147676/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147676/source.c"
target datalayout = "e-m:e-p270: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 i64 0, align 8
@L = dso_local local_unnamed_addr global [500000 x i64] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [500000 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@n = dso_local global i32 0, align 4
@S = dso_local global [500000 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld \00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #0 {
entry:
%A91 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %m, %l
%sub1 = sub i32 %r, %m
%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 %l to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i64, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 10
br i1 %min.iters.check, label %for.body.preheader109, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 3
%2 = add i64 %1, %A91
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader109, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i64, ptr %invariant.gep, i64 %index
%wide.load = load <2 x i64>, ptr %4, align 8, !tbaa !5
%5 = getelementptr i64, ptr %4, i64 2
%wide.load92 = load <2 x i64>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %index
store <2 x i64> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i64, ptr %6, i64 2
store <2 x i64> %wide.load92, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 4
%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.preheader109
for.body.preheader109: ; 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.preheader109, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader109 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader109 ]
%gep.prol = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i64, ptr %gep.prol, align 8, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.prol
store i64 %11, ptr %arrayidx3.prol, align 8, !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.preheader109
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader109 ], [ %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
%cmp570 = icmp sgt i32 %sub1, 0
br i1 %cmp570, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %m to i64
%wide.trip.count82 = zext i32 %sub1 to i64
%invariant.gep89 = getelementptr i64, ptr %A, i64 %13
%min.iters.check97 = icmp ult i32 %sub1, 10
br i1 %min.iters.check97, label %for.body6.preheader108, label %vector.memcheck93
vector.memcheck93: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 3
%15 = add i64 %14, %A91
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check94 = icmp ult i64 %16, 32
br i1 %diff.check94, label %for.body6.preheader108, label %vector.ph98
vector.ph98: ; preds = %vector.memcheck93
%n.vec100 = and i64 %wide.trip.count82, 4294967292
br label %vector.body103
vector.body103: ; preds = %vector.body103, %vector.ph98
%index104 = phi i64 [ 0, %vector.ph98 ], [ %index.next107, %vector.body103 ]
%17 = getelementptr i64, ptr %invariant.gep89, i64 %index104
%wide.load105 = load <2 x i64>, ptr %17, align 8, !tbaa !5
%18 = getelementptr i64, ptr %17, i64 2
%wide.load106 = load <2 x i64>, ptr %18, align 8, !tbaa !5
%19 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %index104
store <2 x i64> %wide.load105, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i64, ptr %19, i64 2
store <2 x i64> %wide.load106, ptr %20, align 16, !tbaa !5
%index.next107 = add nuw i64 %index104, 4
%21 = icmp eq i64 %index.next107, %n.vec100
br i1 %21, label %middle.block95, label %vector.body103, !llvm.loop !15
middle.block95: ; preds = %vector.body103
%cmp.n102 = icmp eq i64 %n.vec100, %wide.trip.count82
br i1 %cmp.n102, label %for.end14, label %for.body6.preheader108
for.body6.preheader108: ; preds = %vector.memcheck93, %for.body6.preheader, %middle.block95
%indvars.iv78.ph = phi i64 [ 0, %vector.memcheck93 ], [ 0, %for.body6.preheader ], [ %n.vec100, %middle.block95 ]
%22 = xor i64 %indvars.iv78.ph, -1
%23 = add nsw i64 %22, %wide.trip.count82
%xtraiter110 = and i64 %wide.trip.count82, 3
%lcmp.mod111.not = icmp eq i64 %xtraiter110, 0
br i1 %lcmp.mod111.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader108, %for.body6.prol
%indvars.iv78.prol = phi i64 [ %indvars.iv.next79.prol, %for.body6.prol ], [ %indvars.iv78.ph, %for.body6.preheader108 ]
%prol.iter112 = phi i64 [ %prol.iter112.next, %for.body6.prol ], [ 0, %for.body6.preheader108 ]
%gep90.prol = getelementptr i64, ptr %invariant.gep89, i64 %indvars.iv78.prol
%24 = load i64, ptr %gep90.prol, align 8, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv78.prol
store i64 %24, ptr %arrayidx11.prol, align 8, !tbaa !5
%indvars.iv.next79.prol = add nuw nsw i64 %indvars.iv78.prol, 1
%prol.iter112.next = add i64 %prol.iter112, 1
%prol.iter112.cmp.not = icmp eq i64 %prol.iter112.next, %xtraiter110
br i1 %prol.iter112.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader108
%indvars.iv78.unr = phi i64 [ %indvars.iv78.ph, %for.body6.preheader108 ], [ %indvars.iv.next79.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 i64, ptr %invariant.gep, i64 %indvars.iv
%26 = load i64, ptr %gep, align 8, !tbaa !5
%arrayidx3 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv
store i64 %26, ptr %arrayidx3, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i64, ptr %gep.1, align 8, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.next
store i64 %27, ptr %arrayidx3.1, align 8, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i64, ptr %gep.2, align 8, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.next.1
store i64 %28, ptr %arrayidx3.2, align 8, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i64, ptr %gep.3, align 8, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.next.2
store i64 %29, ptr %arrayidx3.3, align 8, !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.iv78 = phi i64 [ %indvars.iv.next79.3, %for.body6 ], [ %indvars.iv78.unr, %for.body6.prol.loopexit ]
%gep90 = getelementptr i64, ptr %invariant.gep89, i64 %indvars.iv78
%30 = load i64, ptr %gep90, align 8, !tbaa !5
%arrayidx11 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv78
store i64 %30, ptr %arrayidx11, align 8, !tbaa !5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%gep90.1 = getelementptr i64, ptr %invariant.gep89, i64 %indvars.iv.next79
%31 = load i64, ptr %gep90.1, align 8, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv.next79
store i64 %31, ptr %arrayidx11.1, align 8, !tbaa !5
%indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 2
%gep90.2 = getelementptr i64, ptr %invariant.gep89, i64 %indvars.iv.next79.1
%32 = load i64, ptr %gep90.2, align 8, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv.next79.1
store i64 %32, ptr %arrayidx11.2, align 8, !tbaa !5
%indvars.iv.next79.2 = add nuw nsw i64 %indvars.iv78, 3
%gep90.3 = getelementptr i64, ptr %invariant.gep89, i64 %indvars.iv.next79.2
%33 = load i64, ptr %gep90.3, align 8, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv.next79.2
store i64 %33, ptr %arrayidx11.3, align 8, !tbaa !5
%indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 4
%exitcond83.not.3 = icmp eq i64 %indvars.iv.next79.3, %wide.trip.count82
br i1 %exitcond83.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block95, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %idxprom15
store i64 10000000000, ptr %arrayidx16, align 8, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %idxprom17
store i64 10000000000, ptr %arrayidx18, align 8, !tbaa !5
%cmp2072 = icmp slt i32 %l, %r
br i1 %cmp2072, label %for.body21.preheader, label %for.end41
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %l to i64
%wide.trip.count87 = sext i32 %r to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv84 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next85, %for.body21 ]
%i.275 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%idxprom22 = zext i32 %i.275 to i64
%arrayidx23 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %idxprom22
%35 = load i64, ptr %arrayidx23, align 8, !tbaa !5
%idxprom24 = zext i32 %j.073 to i64
%arrayidx25 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %idxprom24
%36 = load i64, ptr %arrayidx25, align 8, !tbaa !5
%cmp26.not = icmp sgt i64 %35, %36
%.sink = tail call i64 @llvm.smin.i64(i64 %35, i64 %36)
%inc37 = zext i1 %cmp26.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%not.cmp26.not = xor i1 %cmp26.not, true
%inc31 = zext i1 %not.cmp26.not to i32
%i.3 = add nuw nsw i32 %i.275, %inc31
%37 = getelementptr inbounds i64, ptr %A, i64 %indvars.iv84
store i64 %.sink, ptr %37, align 8
%storemerge.in = load i64, ptr @count, align 8, !tbaa !5
%storemerge = add nsw i64 %storemerge.in, 1
store i64 %storemerge, ptr @count, align 8, !tbaa !5
%indvars.iv.next85 = add nsw i64 %indvars.iv84, 1
%exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
br i1 %exitcond88.not, label %for.end41, label %for.body21, !llvm.loop !19
for.end41: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %A, i32 noundef %l, i32 noundef %r) local_unnamed_addr #0 {
entry:
%A12 = 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 @mergesort(ptr noundef %A, i32 noundef %l, i32 noundef %div)
tail call void @mergesort(ptr noundef %A, i32 noundef %div, i32 noundef %r)
%sub.i = sub nsw i32 %div, %l
%sub1.i = sub i32 %r, %div
%cmp68.i = icmp sgt i32 %sub.i, 0
br i1 %cmp68.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 i64, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 10
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, 3
%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, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i64, ptr %invariant.gep.i, i64 %index
%wide.load = load <2 x i64>, ptr %4, align 8, !tbaa !5
%5 = getelementptr i64, ptr %4, i64 2
%wide.load13 = load <2 x i64>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %index
store <2 x i64> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i64, ptr %6, i64 2
store <2 x i64> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 4
%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 i64, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i64, ptr %gep.i.prol, align 8, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i64 %11, ptr %arrayidx3.i.prol, align 8, !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
%cmp570.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp570.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.count82.i = zext i32 %sub1.i to i64
%invariant.gep89.i = getelementptr i64, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 10
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, 3
%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.count82.i, 4294967292
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i64, ptr %invariant.gep89.i, i64 %index25
%wide.load26 = load <2 x i64>, ptr %17, align 8, !tbaa !5
%18 = getelementptr i64, ptr %17, i64 2
%wide.load27 = load <2 x i64>, ptr %18, align 8, !tbaa !5
%19 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %index25
store <2 x i64> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i64, ptr %19, i64 2
store <2 x i64> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 4
%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.count82.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.iv78.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv78.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count82.i
%xtraiter29 = and i64 %wide.trip.count82.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.iv78.i.prol = phi i64 [ %indvars.iv.next79.i.prol, %for.body6.i.prol ], [ %indvars.iv78.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep90.i.prol = getelementptr i64, ptr %invariant.gep89.i, i64 %indvars.iv78.i.prol
%24 = load i64, ptr %gep90.i.prol, align 8, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv78.i.prol
store i64 %24, ptr %arrayidx11.i.prol, align 8, !tbaa !5
%indvars.iv.next79.i.prol = add nuw nsw i64 %indvars.iv78.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.iv78.i.unr = phi i64 [ %indvars.iv78.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next79.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 i64, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i64, ptr %gep.i, align 8, !tbaa !5
%arrayidx3.i = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.i
store i64 %26, ptr %arrayidx3.i, align 8, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i64, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i64, ptr %gep.i.1, align 8, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.next.i
store i64 %27, ptr %arrayidx3.i.1, align 8, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i64, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i64, ptr %gep.i.2, align 8, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i64 %28, ptr %arrayidx3.i.2, align 8, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i64, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i64, ptr %gep.i.3, align 8, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i64 %29, ptr %arrayidx3.i.3, align 8, !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.iv78.i = phi i64 [ %indvars.iv.next79.i.3, %for.body6.i ], [ %indvars.iv78.i.unr, %for.body6.i.prol.loopexit ]
%gep90.i = getelementptr i64, ptr %invariant.gep89.i, i64 %indvars.iv78.i
%30 = load i64, ptr %gep90.i, align 8, !tbaa !5
%arrayidx11.i = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv78.i
store i64 %30, ptr %arrayidx11.i, align 8, !tbaa !5
%indvars.iv.next79.i = add nuw nsw i64 %indvars.iv78.i, 1
%gep90.i.1 = getelementptr i64, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i
%31 = load i64, ptr %gep90.i.1, align 8, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv.next79.i
store i64 %31, ptr %arrayidx11.i.1, align 8, !tbaa !5
%indvars.iv.next79.i.1 = add nuw nsw i64 %indvars.iv78.i, 2
%gep90.i.2 = getelementptr i64, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i.1
%32 = load i64, ptr %gep90.i.2, align 8, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv.next79.i.1
store i64 %32, ptr %arrayidx11.i.2, align 8, !tbaa !5
%indvars.iv.next79.i.2 = add nuw nsw i64 %indvars.iv78.i, 3
%gep90.i.3 = getelementptr i64, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i.2
%33 = load i64, ptr %gep90.i.3, align 8, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %indvars.iv.next79.i.2
store i64 %33, ptr %arrayidx11.i.3, align 8, !tbaa !5
%indvars.iv.next79.i.3 = add nuw nsw i64 %indvars.iv78.i, 4
%exitcond83.not.i.3 = icmp eq i64 %indvars.iv.next79.i.3, %wide.trip.count82.i
br i1 %exitcond83.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 i64], ptr @L, i64 0, i64 %idxprom15.i
store i64 10000000000, ptr %arrayidx16.i, align 8, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %idxprom17.i
store i64 10000000000, ptr %arrayidx18.i, align 8, !tbaa !5
%34 = sext i32 %l to i64
%wide.trip.count87.i = sext i32 %r to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv84.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next85.i, %for.body21.i ]
%i.275.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 ]
%idxprom22.i = zext i32 %i.275.i to i64
%arrayidx23.i = getelementptr inbounds [500000 x i64], ptr @L, i64 0, i64 %idxprom22.i
%35 = load i64, ptr %arrayidx23.i, align 8, !tbaa !5
%idxprom24.i = zext i32 %j.073.i to i64
%arrayidx25.i = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %idxprom24.i
%36 = load i64, ptr %arrayidx25.i, align 8, !tbaa !5
%cmp26.not.i = icmp sgt i64 %35, %36
%.sink.i = tail call i64 @llvm.smin.i64(i64 %35, i64 %36)
%inc37.i = zext i1 %cmp26.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %inc37.i
%not.cmp26.not.i = xor i1 %cmp26.not.i, true
%inc31.i = zext i1 %not.cmp26.not.i to i32
%i.3.i = add nuw nsw i32 %i.275.i, %inc31.i
%37 = getelementptr inbounds i64, ptr %A, i64 %indvars.iv84.i
store i64 %.sink.i, ptr %37, align 8
%storemerge.in.i = load i64, ptr @count, align 8, !tbaa !5
%storemerge.i = add nsw i64 %storemerge.in.i, 1
store i64 %storemerge.i, ptr @count, align 8, !tbaa !5
%indvars.iv.next85.i = add nsw i64 %indvars.iv84.i, 1
%exitcond88.not.i = icmp eq i64 %indvars.iv.next85.i, %wide.trip.count87.i
br i1 %exitcond88.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 #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 !26
%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 i64], 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 !26
%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 !28
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
tail call void @mergesort(ptr noundef nonnull @S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @n, align 4, !tbaa !26
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i64], ptr @S, i64 0, i64 %indvars.iv29
%4 = load i64, ptr %arrayidx6, align 8, !tbaa !5
%call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %4)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%5 = load i32, ptr @n, align 4, !tbaa !26
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !29
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next30, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [500000 x i64], ptr @S, i64 0, i64 %i.1.lcssa
%8 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %8)
%9 = load i64, ptr @count, align 8, !tbaa !5
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !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 = !{!27, !27, i64 0}
!27 = !{!"int", !7, i64 0}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
|
#include <stdio.h>
#define N 500000
#define INF 2000000000
int S[N];
int count=0;
void merge(int[],int,int,int);
void mergeSort(int[],int ,int);
int main()
{
int i,n;
scanf("%d",&n);
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\n%d\n",S[i],count);
return 0;
}
void merge(int S[],int left,int mid,int right){
int n1,n2;
int i,j,k;
int L[N],R[N];
n1= mid-left;
n2=right-mid;
for(i=0;i<n1;i++){
L[i]=S[left +i];
}
for(j=0;j<n2;j++){
R[j]=S[mid+j];
}
L[n1]=INF;
R[n2]=INF;
i=0;
j=0;
for(k=left;k<right;k++){
count++;
if(L[i]<R[j]){
S[k]=L[i];
i=i+1;
}
else {
S[k]=R[j];
j=j+1;
}
}
}
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);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147719/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147719/source.c"
target datalayout = "e-m:e-p270: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
@S = 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 [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp323 = icmp sgt i32 %3, 1
br i1 %cmp323, label %for.body4, label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr @S, 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.1, i32 noundef %4)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 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.next29, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !11
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next29, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8, i32 noundef %9)
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 @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 %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: 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:
%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
%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 2000000000, 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 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.173 = phi i32 [ 0, %for.body21.preheader ], [ %j.2, %for.body21 ]
%i.172 = phi i32 [ 0, %for.body21.preheader ], [ %i.2, %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.172 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.173 to i64
%arrayidx26 = getelementptr inbounds [500000 x i32], ptr %R, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27 = icmp slt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%add32 = zext i1 %cmp27 to i32
%i.2 = add nuw nsw i32 %i.172, %add32
%not.cmp27 = xor i1 %cmp27, true
%add37 = zext i1 %not.cmp27 to i32
%j.2 = add nuw nsw i32 %j.173, %add37
%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 !12
for.end40: ; preds = %for.body21, %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: 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>
#define N 500000
#define SENTINEL 1000000000;
int compareCount=0;
void Merge(int* ,int, int ,int );
void MergeSort(int* ,int ,int );
int main(){
int n, A[N];
int i;
scanf("%d", &n);
for(i=0;i<n;i++)
scanf("%d", &A[i]);
MergeSort(A, 0, n);
printf("%d",A[0]);
for(i=1;i<n;i++)
printf(" %d", A[i]);
printf("\n%d\n", compareCount);
return 0;
}
void Merge(int* A,int left,int mid,int right){
int l,r;
int i, k;
l = mid - left;
r = right - mid;
int L[N/2+2], R[N/2+2];
for(i=0; i<l; i++) L[i] = A[left + i];
for(i=0; i<r; i++) R[i] = A[mid + i];
L[l] = SENTINEL;
R[r] = SENTINEL;
i = 0;
int j = 0;
for(k=left; k<right; k++){
compareCount++;
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);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147762/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147762/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@compareCount = 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 [5 x i8] c"\0A%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 [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
%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 !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 %A, align 16, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp521 = icmp sgt i32 %4, 1
br i1 %cmp521, label %for.body6, label %for.end12
for.body6: ; preds = %for.end, %for.body6
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %for.body6 ], [ 1, %for.end ]
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv25
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, 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
%cmp5 = icmp slt i64 %indvars.iv.next26, %7
br i1 %cmp5, label %for.body6, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.body6, %for.end
%8 = load i32, ptr @compareCount, 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 %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 @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:
%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) #6
call void @llvm.lifetime.start.p0(i64 1000008, 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 [250002 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 [250002 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 ]
%j.074 = 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 @compareCount, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 1
store i32 %inc22, ptr @compareCount, 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.074 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)
%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.074, %add37
%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 !12
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 1000008, ptr nonnull %R) #6
call void @llvm.lifetime.end.p0(i64 1000008, ptr nonnull %L) #6
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>
#define MAX 500000
#define INFTY 1000000000
int L[MAX], R[MAX];
int count;
void merge(int*, int, int, int);
void mergeSort(int*, int, int);
int main(){
int i;
int A[MAX], n;
count = 0;
scanf("%d", &n);
for ( i = 0; i < n; i++ ) {
scanf("%d", &A[i]);
if (A[i] >= INFTY ){
return 1;
}
}
mergeSort(A, 0, n);
for ( i = 0; i < n; i++ ) {
if ( i ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
printf("%d\n", count);
return 0;
}
void merge(int A[], int left, int mid, int right){
int i, j, k;
int 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 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_147805/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147805/source.c"
target datalayout = "e-m:e-p270: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 [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
%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 @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
%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 %if.end10.peel, label %for.end16
if.end10.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call13.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.end10, label %for.end16
if.end10: ; preds = %if.end10.peel, %if.end10
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %if.end10 ], [ 1, %if.end10.peel ]
%putchar28 = call i32 @putchar(i32 32)
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv36
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp6 = icmp slt i64 %indvars.iv.next37, %8
br i1 %cmp6, label %if.end10, label %for.end16, !llvm.loop !11
for.end16: ; preds = %if.end10, %if.end10.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
br label %cleanup
cleanup: ; preds = %for.body, %for.end16
%retval.0 = phi i32 [ 0, %for.end16 ], [ 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 !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 [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 !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
%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 !18
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 !19
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 !20
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 !21
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 ]
%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)
%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 !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 %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 !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.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 !24
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 !25
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 !26
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 !27
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 !28
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 ]
%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)
%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 !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 N 500000
#define INFTY 1000000000
int count=0;
void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int main(){
int i,n;
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-1;i++){
printf("%d ",S[i]);
}
printf("%d\n",S[n-1]);
printf("%d\n",count);
return 0;
}
void merge(int *S, int left, int mid, int right){
int n1,n2;
int i,j,k;
int L[N],R[N];
n1=mid-left;
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]=INFTY;
R[n2]=INFTY;
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++;
}
}
}
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);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147856/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147856/source.c"
target datalayout = "e-m:e-p270: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
; Function Attrs: nofree 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) #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
%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 !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
%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 %S, 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 [500000 x i32], ptr %S, 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 2000000, ptr nonnull %S) #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 @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 %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: 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:
%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
%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 ]
%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 @count, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 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
%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 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 %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 !12
for.end40: ; preds = %for.body21, %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: 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>
#define MAX 500000
#define Large 2000000000
int cnt;
int L[250000+2];
int R[250000+2];
int A[MAX];
void merge1(int l,int m,int r){
int n1,n2,i;
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]=Large;
R[n2]=Large;
int i1=0,i2=0,j;
for(j=l;j<r;j++){
if(L[i1]<=R[i2]){
A[j]=L[i1];
i1++;
}else{
A[j]=R[i2];
i2++;
}
cnt++;
}
}
void mergesort(int l, int r){
int m;
if(l+1<r){
m=(r+l)/2;
mergesort(l,m);
mergesort(m,r);
merge1(l,m,r);
}
}
int main() {
int n,i;
scanf("%d\n",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);
mergesort(0,n);
for(i=0;i<n;i++){
if(i==n-1)printf("%d\n",A[i]);
else printf("%d ",A[i]);
}
printf("%d\n",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147913/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147913/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@A = dso_local global [500000 x i32] zeroinitializer, align 16
@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 [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @merge1(i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %m, %l
%sub1 = sub nsw i32 %r, %m
%cmp63 = icmp sgt i32 %sub, 0
br i1 %cmp63, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr @A, i64 %1
%2 = xor i32 %l, -1
%3 = add i32 %2, %m
%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
%cmp565 = icmp sgt i32 %sub1, 0
br i1 %cmp565, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %m to i64
%8 = shl nsw i64 %7, 2
%scevgep75 = getelementptr i8, ptr @A, i64 %8
%9 = xor i32 %m, -1
%10 = add i32 %9, %r
%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) %scevgep75, 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 [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
%cmp2068 = icmp slt i32 %l, %r
br i1 %cmp2068, 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 %l to i64
%15 = add i32 %cnt.promoted, %r
%wide.trip.count = sext i32 %r 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 ]
%i2.071 = phi i32 [ 0, %for.body21.preheader ], [ %i2.1, %for.body21 ]
%i1.070 = phi i32 [ 0, %for.body21.preheader ], [ %i1.1, %for.body21 ]
%idxprom22 = zext i32 %i1.070 to i64
%arrayidx23 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom22
%16 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = zext i32 %i2.071 to i64
%arrayidx25 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom24
%17 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sle i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc31 = zext i1 %cmp26.not to i32
%i1.1 = add nuw nsw i32 %i1.070, %inc31
%not.cmp26.not = xor i1 %cmp26.not, true
%inc36 = zext i1 %not.cmp26.not to i32
%i2.1 = add nuw nsw i32 %i2.071, %inc36
%18 = getelementptr inbounds [500000 x i32], ptr @A, 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, %l
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: 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, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @mergesort(i32 noundef %l, i32 noundef %r) local_unnamed_addr #0 {
entry:
%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 @mergesort(i32 noundef %l, i32 noundef %div)
tail call void @mergesort(i32 noundef %div, i32 noundef %r)
%sub.i = sub nsw i32 %div, %l
%sub1.i = sub nsw i32 %r, %div
%cmp63.i = icmp sgt i32 %sub.i, 0
br i1 %cmp63.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %l to i64
%1 = shl nsw i64 %0, 2
%scevgep.i = getelementptr i8, ptr @A, i64 %1
%2 = xor i32 %l, -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
%cmp565.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp565.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
%scevgep75.i = getelementptr i8, ptr @A, i64 %8
%9 = xor i32 %div, -1
%10 = add i32 %9, %r
%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) %scevgep75.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 %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
%cnt.promoted.i = load i32, ptr @cnt, align 4, !tbaa !5
%14 = sext i32 %l to i64
%wide.trip.count.i = sext i32 %r 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 ]
%i2.071.i = phi i32 [ 0, %for.end14.i ], [ %i2.1.i, %for.body21.i ]
%i1.070.i = phi i32 [ 0, %for.end14.i ], [ %i1.1.i, %for.body21.i ]
%idxprom22.i = zext i32 %i1.070.i to i64
%arrayidx23.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom22.i
%15 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%idxprom24.i = zext i32 %i2.071.i to i64
%arrayidx25.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom24.i
%16 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp26.not.i = icmp sle i32 %15, %16
%.sink.i = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%inc31.i = zext i1 %cmp26.not.i to i32
%i1.1.i = add nuw nsw i32 %i1.070.i, %inc31.i
%not.cmp26.not.i = xor i1 %cmp26.not.i, true
%inc36.i = zext i1 %not.cmp26.not.i to i32
%i2.1.i = add nuw nsw i32 %i2.071.i, %inc36.i
%17 = getelementptr inbounds [500000 x i32], ptr @A, 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 %r, %l
%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 #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergesort(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 %for.body4, label %for.end14
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%4 = phi i32 [ %7, %for.body4 ], [ %3, %for.end ]
%sub = add nsw i32 %4, -1
%5 = zext i32 %sub to i64
%cmp5 = icmp eq i64 %indvars.iv30, %5
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv30
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%.str..str.2 = select i1 %cmp5, ptr @.str, ptr @.str.2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.2, 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 %for.body4, label %for.end14, !llvm.loop !12
for.end14: ; preds = %for.body4, %for.end
%9 = load i32, ptr @cnt, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
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, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: 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>
#define max 500000
int L[max/2+2];
int R[max/2+2];
int c=0;
int merge(int S[], 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] = S[left+i];
for (i = 0; i < n2; i++)
R[i] = S[mid+i];
L[n1] = R[n2] = 2000000000;
i = j = 0;
for ( k = left; k < right; k++){
c++;
if ( L[i] <= R[j]){
S[k] = L[i];
i++;
}
else{
S[k] = R[j];
j++;
}
}
}
void mergeSort(int S[], int n, int left, int right){
int mid;
if (left+1<right){
mid = (left+right) / 2;
mergeSort(S,n, left,mid);
mergeSort(S, n,mid,right);
merge(S,n, left,mid,right);
}
}
int main(){
int S[max], n, i;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &S[i]);
mergeSort(S, n, 0, n);
for (i = 0; i < n; i++){
if(i==0)
printf("%d", S[i]);
else
printf(" %d", S[i]);
}
printf("\n");
printf("%d\n", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147957/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147957/source.c"
target datalayout = "e-m:e-p270: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
@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
@.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.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 i32 @merge(ptr nocapture noundef %S, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%S90 = ptrtoint ptr %S 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 %S, 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, %S90
%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 %S, 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, %S90
%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 %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
%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 @c, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @c, 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)
%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 %S, 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 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 void @mergeSort(ptr noundef %S, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%S14 = 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 %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %S, 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 %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, %S14
%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 %S, 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, %S14
%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 %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.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 @c, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @c, 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)
%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 %S, 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:
%S = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #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
%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 [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 !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef %.lcssa, 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 %for.inc12.peel, label %for.end14
for.inc12.peel: ; preds = %for.end
%4 = load i32, ptr %S, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %.pre, 1
br i1 %cmp3.peel, label %for.inc12, label %for.end14
for.inc12: ; preds = %for.inc12.peel, %for.inc12
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.inc12 ], [ 1, %for.inc12.peel ]
%arrayidx10 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv30
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%.pre34 = load i32, ptr %n, align 4, !tbaa !5
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%6 = sext i32 %.pre34 to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %6
br i1 %cmp3, label %for.inc12, label %for.end14, !llvm.loop !27
for.end14: ; preds = %for.inc12, %for.inc12.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr @c, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #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>
#include<stdlib.h>
int main()
{
char seat [1000][4],ch;
int n,i,ck=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
getchar();
scanf("%c%c%c%c%c",&seat[i][0],&seat[i][1],&ch,&seat[i][2],&seat[i][3]);
if((seat[i][0]=='O')&&(seat[i][1]=='O')&&(ck==0))
{
ck=1;
seat[i][0]='+';
seat[i][1]='+';
}
else if((seat[i][2]=='O')&&(seat[i][3]=='O')&&(ck==0))
{
ck=1;
seat[i][2]='+';
seat[i][3]='+';
}
}
if(ck==0)
printf("No\n");
else
{
printf("Yes\n");
for(i=0;i<n;i++)
{
printf("%c%c|%c%c\n",seat[i][0],seat[i][1],seat[i][2],seat[i][3]);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1480/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%c%c%c%c%c\00", align 1
@.str.4 = private unnamed_addr constant [11 x i8] c"%c%c|%c%c\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@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:
%seat = alloca [1000 x [4 x i8]], align 16
%ch = alloca i8, align 1
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %seat) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #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
%cmp111 = icmp sgt i32 %0, 0
br i1 %cmp111, label %for.body, label %if.then59
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%ck.0113 = phi i32 [ %ck.1, %for.inc ], [ 0, %entry ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call.i = call i32 @getc(ptr noundef %1)
%arrayidx = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv, i64 1
%arrayidx8 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv, i64 2
%arrayidx11 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv, i64 3
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %ch, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx11)
%2 = load i8, ptr %arrayidx, align 4, !tbaa !11
%cmp16 = icmp eq i8 %2, 79
br i1 %cmp16, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %for.body
%3 = load i8, ptr %arrayidx5, align 1, !tbaa !11
%cmp22 = icmp eq i8 %3, 79
%cmp25 = icmp eq i32 %ck.0113, 0
%or.cond = select i1 %cmp22, i1 %cmp25, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %land.lhs.true
store i8 43, ptr %arrayidx, align 4, !tbaa !11
br label %for.inc.sink.split
if.else: ; preds = %land.lhs.true, %for.body
%4 = load i8, ptr %arrayidx8, align 2, !tbaa !11
%cmp37 = icmp eq i8 %4, 79
br i1 %cmp37, label %land.lhs.true39, label %for.inc
land.lhs.true39: ; preds = %if.else
%5 = load i8, ptr %arrayidx11, align 1, !tbaa !11
%cmp44 = icmp eq i8 %5, 79
%cmp47 = icmp eq i32 %ck.0113, 0
%or.cond88 = select i1 %cmp44, i1 %cmp47, i1 false
br i1 %or.cond88, label %if.then49, label %for.inc
if.then49: ; preds = %land.lhs.true39
store i8 43, ptr %arrayidx8, align 2, !tbaa !11
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %if.then49, %if.then
%arrayidx5.sink = phi ptr [ %arrayidx5, %if.then ], [ %arrayidx11, %if.then49 ]
store i8 43, ptr %arrayidx5.sink, align 1, !tbaa !11
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %land.lhs.true39, %if.else
%ck.1 = phi i32 [ %ck.0113, %land.lhs.true39 ], [ %ck.0113, %if.else ], [ 1, %for.inc.sink.split ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc
%8 = icmp eq i32 %ck.1, 0
br i1 %8, label %if.then59, label %if.else61
if.then59: ; preds = %entry, %for.end
%puts110 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end87
if.else61: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp64114 = icmp sgt i32 %9, 0
br i1 %cmp64114, label %for.body66, label %if.end87
for.body66: ; preds = %if.else61, %for.body66
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.body66 ], [ 0, %if.else61 ]
%arrayidx68 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv117
%10 = load i8, ptr %arrayidx68, align 4, !tbaa !11
%conv70 = sext i8 %10 to i32
%arrayidx73 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv117, i64 1
%11 = load i8, ptr %arrayidx73, align 1, !tbaa !11
%conv74 = sext i8 %11 to i32
%arrayidx77 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv117, i64 2
%12 = load i8, ptr %arrayidx77, align 2, !tbaa !11
%conv78 = sext i8 %12 to i32
%arrayidx81 = getelementptr inbounds [1000 x [4 x i8]], ptr %seat, i64 0, i64 %indvars.iv117, i64 3
%13 = load i8, ptr %arrayidx81, align 1, !tbaa !11
%conv82 = sext i8 %13 to i32
%call83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %conv70, i32 noundef %conv74, i32 noundef %conv78, i32 noundef %conv82)
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp64 = icmp slt i64 %indvars.iv.next118, %15
br i1 %cmp64, label %for.body66, label %if.end87, !llvm.loop !14
if.end87: ; preds = %for.body66, %if.else61, %if.then59
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %seat) #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 @getc(ptr nocapture noundef) local_unnamed_addr #2
; 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include<stdio.h>
#include<math.h>
#define INFINITY 1000000000
void merge(int*,int,int,int);
void mergesort(int*,int,int);
int count=0;
int main(){
int i;
int n;
int left,right;
scanf("%d",&n);
int N[n];
for(i=0;i<n;i++){
scanf("%d",&N[i]);
}
left=0;
right=n;
mergesort(N,left,right);
for(i=0;i<n;i++){
if(i==n-1) printf("%d\n",N[i]);
else printf("%d ",N[i]);
}
printf("%d\n",count);
return 0;
}
void merge(int *N,int left,int mid,int right){
int i,j,k;
int r,l;
l=mid-left;
r=right-mid;
int L[l],R[r];
for(i=0;i<l;i++){
L[i]=N[left+i];
}
for(i=0;i<r;i++){
R[i]=N[mid+i];
}
L[l]=INFINITY;
R[r]=INFINITY;
i=0;
j=0;
for(k=left;k<right;k++){
count++;
if(L[i]<R[j]){
N[k]=L[i];
i++;
}
else{
N[k]=R[j];
j++;
}
}
}
void mergesort(int *N,int left,int right){
int mid,i;
if(left+1<right){
mid=(left+right)/2;
mergesort(N,left,mid);
mergesort(N,mid,right);
merge(N,left,mid,right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148042/source.c"
target datalayout = "e-m:e-p270: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\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%cmp24 = icmp sgt i32 %3, 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 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 !9
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
%cmp326 = icmp sgt i32 %6, 0
br i1 %cmp326, label %for.body4, label %for.end14
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%7 = phi i32 [ %10, %for.body4 ], [ %6, %for.end ]
%sub = add nsw i32 %7, -1
%8 = zext i32 %sub to i64
%cmp5 = icmp eq i64 %indvars.iv30, %8
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv30
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp5, ptr @.str.1, ptr @.str.2
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %9)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %11
br i1 %cmp3, label %for.body4, label %for.end14, !llvm.loop !11
for.end14: ; preds = %for.body4, %for.end
%12 = load i32, ptr @count, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %N, 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 %N, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %N, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %N, 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
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %N, 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
%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
%cmp70 = icmp sgt i32 %sub, 0
br i1 %cmp70, 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 %N, 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
%cmp672 = icmp sgt i32 %sub1, 0
br i1 %cmp672, 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
%scevgep80 = getelementptr i8, ptr %N, 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) %scevgep80, 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 1000000000, ptr %arrayidx17, align 4, !tbaa !5
%idxprom18 = sext i32 %sub1 to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom18
store i32 1000000000, ptr %arrayidx19, align 4, !tbaa !5
%cmp2174 = icmp slt i32 %left, %right
br i1 %cmp2174, 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 ]
%i.277 = phi i32 [ 0, %for.body22.preheader ], [ %i.3, %for.body22 ]
%j.076 = phi i32 [ 0, %for.body22.preheader ], [ %j.1, %for.body22 ]
%17 = load i32, ptr @count, align 4, !tbaa !5
%inc23 = add nsw i32 %17, 1
store i32 %inc23, ptr @count, align 4, !tbaa !5
%idxprom24 = zext i32 %i.277 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %vla, i64 %idxprom24
%18 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = zext i32 %j.076 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom26
%19 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28 = icmp sge i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc38 = zext i1 %cmp28 to i32
%j.1 = add nuw nsw i32 %j.076, %inc38
%not.cmp28 = xor i1 %cmp28, true
%inc33 = zext i1 %not.cmp28 to i32
%i.3 = add nuw nsw i32 %i.277, %inc33
%20 = getelementptr inbounds i32, ptr %N, 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 !12
for.end41: ; preds = %for.body22, %for.end15
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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree 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 = { 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 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] = R[n2] = INFTY;
i = 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 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);
count = 0;
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){
printf(" ");
}
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148086/source.c"
target datalayout = "e-m:e-p270: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 %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
%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)
%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 %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 %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.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)
%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 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)
store i32 0, ptr @count, align 4, !tbaa !5
%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 !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
%cmp632 = icmp sgt i32 %4, 0
br i1 %cmp632, label %if.end10.peel, label %for.end16
if.end10.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call13.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.end10, label %for.end16
if.end10: ; preds = %if.end10.peel, %if.end10
%indvars.iv36 = phi i64 [ %indvars.iv.next37, %if.end10 ], [ 1, %if.end10.peel ]
%putchar28 = call i32 @putchar(i32 32)
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv36
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp6 = icmp slt i64 %indvars.iv.next37, %8
br i1 %cmp6, label %if.end10, label %for.end16, !llvm.loop !27
for.end16: ; preds = %if.end10, %if.end10.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
br label %cleanup
cleanup: ; preds = %for.body, %for.end16
%retval.0 = phi i32 [ 0, %for.end16 ], [ 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>
#define N 1000000
int A[N];
int count=0;
/* Merge */
void Merge(int A[],int l,int m,int r){
int n1,n2;
int i,j,k;
int L[N],R[N];
n1=m-l;
n2=r-m;
for(i=0;i<n1;i++)L[i]=A[l+i];
for(j=0;j<n2;j++)R[j]=A[m+j];
L[n1] = 2147483647;
R[n2] = 2147483647;
i=0;
j=0;
for(k=l;k<r;k++){
if(L[i]<=R[j]){
A[k]=L[i];
count++;
i++;
}else{
A[k]=R[j];
count++;
j++;
}
}
}
/* Merge Sort */
void Merge_Sort(int A[],int left,int right){
int mid;
if(left+1<right){
mid = (left + right)/2;
Merge_Sort(A,left,mid);
Merge_Sort(A,mid,right);
Merge(A,left,mid,right);
}
}// End Merge-Sort
int main(int argc , char *argv[]){
int n,i;
/* INCERT SERIES */
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
/* -------------- */
/* INCERT FUNCTION */
Merge_Sort(A,0,n);
/* -------------- */
for(i=0;i<n-1;i++){
printf("%d ",A[i]);
}
printf("%d\n",A[n-1]);
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148143/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148143/source.c"
target datalayout = "e-m:e-p270: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
@A = dso_local global [1000000 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Merge(ptr nocapture noundef %A, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #0 {
entry:
%L = alloca [1000000 x i32], align 16
%R = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %R) #5
%sub = sub nsw i32 %m, %l
%sub1 = sub nsw i32 %r, %m
%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 %l to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %l, -1
%3 = add i32 %2, %m
%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 %m to i64
%8 = shl nsw i64 %7, 2
%scevgep78 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %m, -1
%10 = add i32 %9, %r
%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 [1000000 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 2147483647, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [1000000 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 2147483647, ptr %arrayidx18, align 4, !tbaa !5
%cmp2072 = icmp slt i32 %l, %r
br i1 %cmp2072, label %for.body21.preheader, label %for.end41
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %l to i64
%wide.trip.count = sext i32 %r to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.inc39
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.inc39 ]
%j.174 = phi i32 [ 0, %for.body21.preheader ], [ %j.2, %for.inc39 ]
%i.173 = phi i32 [ 0, %for.body21.preheader ], [ %i.2, %for.inc39 ]
%idxprom22 = sext i32 %i.173 to i64
%arrayidx23 = getelementptr inbounds [1000000 x i32], ptr %L, i64 0, i64 %idxprom22
%15 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %j.174 to i64
%arrayidx25 = getelementptr inbounds [1000000 x i32], ptr %R, i64 0, i64 %idxprom24
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sgt i32 %15, %16
%arrayidx36 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
br i1 %cmp26.not, label %if.else, label %if.then
if.then: ; preds = %for.body21
store i32 %15, ptr %arrayidx36, align 4, !tbaa !5
%inc32 = add nsw i32 %i.173, 1
br label %for.inc39
if.else: ; preds = %for.body21
store i32 %16, ptr %arrayidx36, align 4, !tbaa !5
%inc38 = add nsw i32 %j.174, 1
br label %for.inc39
for.inc39: ; preds = %if.then, %if.else
%i.2 = phi i32 [ %inc32, %if.then ], [ %i.173, %if.else ]
%j.2 = phi i32 [ %j.174, %if.then ], [ %inc38, %if.else ]
%inc31.sink.in = load i32, ptr @count, align 4, !tbaa !5
%inc31.sink = add nsw i32 %inc31.sink.in, 1
store i32 %inc31.sink, ptr @count, 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.body21, !llvm.loop !9
for.end41: ; preds = %for.inc39, %for.end14
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %R) #5
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %L) #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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Merge_Sort(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 @Merge_Sort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @Merge_Sort(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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !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 !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @Merge_Sort(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 !12
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) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
/*
* FileName: merge_sort_fix
* CreatedDate: 2020-04-13 17:25:44 +0900
* LastModified: 2020-04-13 21:33:38 +0900
*/
#include <stdio.h>
#define INFTY 1000000001
int count=0;
void merge(long int *s,int left,int mid,int right){
int n1=mid-left;
int n2=right-mid;
long int L[n1+1],R[n2+1];
for(int i=0;i<n1;i++){
L[i]=s[left+i];
}
for(int i=0;i<n2;i++){
R[i]=s[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]){
s[k]=L[i++];
}
else{
s[k]=R[j++];
}
count++;
}
}
void mergesort(long int *s,int left,int right){
if(left+1<right){
int mid = (left+right)/2;
mergesort(s,left,mid);
mergesort(s,mid,right);
merge(s,left,mid,right);
}
}
int main(void){
int n;
scanf("%d",&n);
long int s[n];
for(int i=0;i<n;i++){
scanf("%ld",&s[i]);
}
mergesort(s,0,n);
printf("%ld",s[0]);
for(int i=1;i<n;i++){
printf(" %ld",s[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148208/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148208/source.c"
target datalayout = "e-m:e-p270: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"%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c" %ld\00", align 1
@.str.4 = 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 %s, 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
%0 = zext i32 %add to i64
%vla = alloca i64, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i64, i64 %1, align 16
%cmp72 = icmp sgt i32 %sub, 0
br i1 %cmp72, label %for.body.preheader, label %for.cond8.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 3
%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, 3
%8 = add nuw nsw i64 %7, 8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 8 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body.preheader, %entry
%cmp974 = icmp sgt i32 %sub1, 0
br i1 %cmp974, label %for.body11.preheader, label %for.cond.cleanup10
for.body11.preheader: ; preds = %for.cond8.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 3
%scevgep84 = 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, 3
%15 = add nuw nsw i64 %14, 8
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 8 dereferenceable(1) %scevgep84, i64 %15, i1 false), !tbaa !5
br label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.body11.preheader, %for.cond8.preheader
%idxprom20 = sext i32 %sub to i64
%arrayidx21 = getelementptr inbounds i64, ptr %vla, i64 %idxprom20
store i64 1000000001, ptr %arrayidx21, align 8, !tbaa !5
%idxprom22 = sext i32 %sub1 to i64
%arrayidx23 = getelementptr inbounds i64, ptr %vla3, i64 %idxprom22
store i64 1000000001, ptr %arrayidx23, align 8, !tbaa !5
%cmp2677 = icmp slt i32 %left, %right
br i1 %cmp2677, label %for.body28.preheader, label %for.cond.cleanup27
for.body28.preheader: ; preds = %for.cond.cleanup10
%count.promoted = load i32, ptr @count, align 4, !tbaa !9
%16 = sext i32 %left to i64
%17 = add i32 %count.promoted, %right
%wide.trip.count = sext i32 %right to i64
%18 = sub nsw i64 %wide.trip.count, %16
%xtraiter = and i64 %18, 1
%19 = sub nsw i64 0, %wide.trip.count
%20 = xor i64 %16, %19
%21 = icmp eq i64 %20, -1
br i1 %21, label %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa, label %for.body28.preheader.new
for.body28.preheader.new: ; preds = %for.body28.preheader
%unroll_iter = and i64 %18, -2
%invariant.gep = getelementptr i64, ptr %s, i64 1
br label %for.body28
for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa.loopexit: ; preds = %for.body28
%22 = zext i32 %i24.1.1 to i64
%23 = zext i32 %j.1.1 to i64
br label %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa
for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa: ; preds = %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa.loopexit, %for.body28.preheader
%indvars.iv.unr = phi i64 [ %16, %for.body28.preheader ], [ %indvars.iv.next.1, %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa.loopexit ]
%j.080.unr = phi i64 [ 0, %for.body28.preheader ], [ %23, %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa.loopexit ]
%i24.079.unr = phi i64 [ 0, %for.body28.preheader ], [ %22, %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond25.for.cond.cleanup27_crit_edge, label %for.body28.epil
for.body28.epil: ; preds = %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa
%arrayidx30.epil = getelementptr inbounds i64, ptr %vla, i64 %i24.079.unr
%24 = load i64, ptr %arrayidx30.epil, align 8, !tbaa !5
%arrayidx32.epil = getelementptr inbounds i64, ptr %vla3, i64 %j.080.unr
%25 = load i64, ptr %arrayidx32.epil, align 8, !tbaa !5
%.sink.epil = tail call i64 @llvm.smin.i64(i64 %24, i64 %25)
%26 = getelementptr inbounds i64, ptr %s, i64 %indvars.iv.unr
store i64 %.sink.epil, ptr %26, align 8
br label %for.cond25.for.cond.cleanup27_crit_edge
for.cond25.for.cond.cleanup27_crit_edge: ; preds = %for.cond25.for.cond.cleanup27_crit_edge.unr-lcssa, %for.body28.epil
%27 = sub i32 %17, %left
store i32 %27, ptr @count, align 4, !tbaa !9
br label %for.cond.cleanup27
for.cond.cleanup27: ; preds = %for.cond25.for.cond.cleanup27_crit_edge, %for.cond.cleanup10
ret void
for.body28: ; preds = %for.body28, %for.body28.preheader.new
%indvars.iv = phi i64 [ %16, %for.body28.preheader.new ], [ %indvars.iv.next.1, %for.body28 ]
%j.080 = phi i32 [ 0, %for.body28.preheader.new ], [ %j.1.1, %for.body28 ]
%i24.079 = phi i32 [ 0, %for.body28.preheader.new ], [ %i24.1.1, %for.body28 ]
%niter = phi i64 [ 0, %for.body28.preheader.new ], [ %niter.next.1, %for.body28 ]
%idxprom29 = zext i32 %i24.079 to i64
%arrayidx30 = getelementptr inbounds i64, ptr %vla, i64 %idxprom29
%28 = load i64, ptr %arrayidx30, align 8, !tbaa !5
%idxprom31 = zext i32 %j.080 to i64
%arrayidx32 = getelementptr inbounds i64, ptr %vla3, i64 %idxprom31
%29 = load i64, ptr %arrayidx32, align 8, !tbaa !5
%cmp33.not = icmp sle i64 %28, %29
%.sink = tail call i64 @llvm.smin.i64(i64 %28, i64 %29)
%inc34 = zext i1 %cmp33.not to i32
%i24.1 = add nuw nsw i32 %i24.079, %inc34
%not.cmp33.not = xor i1 %cmp33.not, true
%inc39 = zext i1 %not.cmp33.not to i32
%j.1 = add nuw nsw i32 %j.080, %inc39
%30 = getelementptr inbounds i64, ptr %s, i64 %indvars.iv
store i64 %.sink, ptr %30, align 8
%idxprom29.1 = zext i32 %i24.1 to i64
%arrayidx30.1 = getelementptr inbounds i64, ptr %vla, i64 %idxprom29.1
%31 = load i64, ptr %arrayidx30.1, align 8, !tbaa !5
%idxprom31.1 = zext i32 %j.1 to i64
%arrayidx32.1 = getelementptr inbounds i64, ptr %vla3, i64 %idxprom31.1
%32 = load i64, ptr %arrayidx32.1, align 8, !tbaa !5
%cmp33.not.1 = icmp sle i64 %31, %32
%.sink.1 = tail call i64 @llvm.smin.i64(i64 %31, i64 %32)
%inc34.1 = zext i1 %cmp33.not.1 to i32
%i24.1.1 = add nuw nsw i32 %i24.1, %inc34.1
%not.cmp33.not.1 = xor i1 %cmp33.not.1, true
%inc39.1 = zext i1 %not.cmp33.not.1 to i32
%j.1.1 = add nuw nsw i32 %j.1, %inc39.1
%gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv
store i64 %.sink.1, ptr %gep, align 8
%indvars.iv.next.1 = add 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.cond25.for.cond.cleanup27_crit_edge.unr-lcssa.loopexit, label %for.body28, !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: 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 %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: 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) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !9
%cmp21 = icmp sgt i32 %3, 0
br i1 %cmp21, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %3, %entry ], [ %6, %for.body ]
call void @mergesort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %.lcssa)
%4 = load i64, ptr %vla, align 16, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !9
%cmp623 = icmp sgt i32 %5, 1
br i1 %cmp623, label %for.body8, label %for.cond.cleanup7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !9
%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 !13
for.cond.cleanup7: ; preds = %for.body8, %for.cond.cleanup
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !9
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %8)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body8: ; preds = %for.cond.cleanup, %for.body8
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body8 ], [ 1, %for.cond.cleanup ]
%arrayidx10 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv27
%9 = load i64, ptr %arrayidx10, align 8, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %9)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%10 = load i32, ptr %n, align 4, !tbaa !9
%11 = sext i32 %10 to i64
%cmp6 = icmp slt i64 %indvars.iv.next28, %11
br i1 %cmp6, label %for.body8, label %for.cond.cleanup7, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; 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 i64 @llvm.smin.i64(i64, i64) #7
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 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !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}
|
#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 = 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(){
int A[MAX], n, i;
scanf("%d", &n);
cnt = 0;
for (i = 0; i < n; i++) {
scanf("%d", &A[i]);
if (A[i] >= SENTINEL){
return 1;
}
}
mergeSort(A, n, 0, n);
for (i = 0; i < n - 1; i++) {
printf("%d ", A[i]);
}
printf("%d", A[i]);
printf("\n");
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148259/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148259/source.c"
target datalayout = "e-m:e-p270: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.1 = private unnamed_addr constant [4 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:
%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
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
store i32 0, ptr @cnt, align 4, !tbaa !5
%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.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
%cmp632 = icmp sgt i32 %4, 1
br i1 %cmp632, label %for.body7, label %for.end13
for.body7: ; preds = %for.end, %for.body7
%indvars.iv37 = phi i64 [ %indvars.iv.next38, %for.body7 ], [ 0, %for.end ]
%arrayidx9 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv37
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp6 = icmp slt i64 %indvars.iv.next38, %7
br i1 %cmp6, label %for.body7, label %for.end13.loopexit, !llvm.loop !27
for.end13.loopexit: ; preds = %for.body7
%8 = and i64 %indvars.iv.next38, 4294967295
br label %for.end13
for.end13: ; preds = %for.end13.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %8, %for.end13.loopexit ]
%arrayidx15 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %i.1.lcssa
%9 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %9)
%putchar = call i32 @putchar(i32 10)
%10 = load i32, ptr @cnt, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
br label %cleanup
cleanup: ; preds = %for.body, %for.end13
%retval.0 = phi i32 [ 0, %for.end13 ], [ 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}
|
#include<stdio.h>
#include<math.h>
int count = 0;
void sum(int A[],int left,int mid,int right)
{
int n1=mid-left,n2=right-mid;
int L[n1],R[n2];
int i,j,k;
for(i=0;i<=n1-1;i++)L[i]=A[left + i];
for(i=0;i<=n2-1;i++)R[i]=A[mid + i];
L[n1]=1000000000;
R[n2]=1000000000;
i=0;j=0;
for(k=left;k<=right-1;k++){
if(L[i]<= R[j]){
A[k] = L[i];
i++;
}
else{
A[k] = R[j];
j++;
}
count++;
}
}
void num(int A[],int left,int right){
if(left+1<right){
int mid=(left + right)/2;
num(A,left,mid);
num(A,mid,right);
sum(A,left,mid,right);
}
}
int main()
{
int n,S[1000000],i;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&S[i]);
num(S,0,n);
for(i=0;i<n-1;i++)printf("%d ",S[i]);
printf("%d\n",S[i]);
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148301/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148301/source.c"
target datalayout = "e-m:e-p270: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
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @sum(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
%cmp.not.not73 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not73, label %for.body.preheader, label %for.cond6.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.cond6.preheader
for.cond6.preheader: ; preds = %for.body.preheader, %entry
%cmp8.not.not75 = icmp sgt i32 %sub1, 0
br i1 %cmp8.not.not75, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond6.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep83 = 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) %scevgep83, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond6.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 %vla2, i64 %idxprom20
store i32 1000000000, ptr %arrayidx21, align 4, !tbaa !5
%cmp24.not.not77 = icmp slt i32 %left, %right
br i1 %cmp24.not.not77, label %for.body25.preheader, label %for.end44
for.body25.preheader: ; preds = %for.end17
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body25
for.body25: ; preds = %for.body25.preheader, %for.body25
%indvars.iv = phi i64 [ %16, %for.body25.preheader ], [ %indvars.iv.next, %for.body25 ]
%j.079 = phi i32 [ 0, %for.body25.preheader ], [ %j.1, %for.body25 ]
%i.278 = phi i32 [ 0, %for.body25.preheader ], [ %i.3, %for.body25 ]
%idxprom26 = zext i32 %i.278 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %idxprom26
%17 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.079 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom28
%18 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sle i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc35 = zext i1 %cmp30.not to i32
%i.3 = add nuw nsw i32 %i.278, %inc35
%not.cmp30.not = xor i1 %cmp30.not, true
%inc40 = zext i1 %not.cmp30.not to i32
%j.1 = add nuw nsw i32 %j.079, %inc40
%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
%inc41 = add nsw i32 %20, 1
store i32 %inc41, 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.body25, !llvm.loop !9
for.end44: ; preds = %for.body25, %for.end17
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 @num(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 @num(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @num(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @sum(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 [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, 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 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 %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 @num(ptr noundef nonnull %S, 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.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv29
%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.next30 = add nuw nsw i64 %indvars.iv29, 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.next30, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !12
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next30, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4000000, 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>
#define MAX 500000
#define BUMP 10000000000
int count = 0;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
void marge(int A[], int left, int mid, int right){
int n1 = mid - left;
int n2 = right - mid;
int i, j, m;
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] = BUMP;
for(i = 0, j = 0, m = left; m < right; m++){
count++;
if(L[i] <= R[j]){
A[m] =L[i];
i++;
}else{
A[m] = R[j];
j++;
}
}
}
void margesort(int A[], int left, int right){
if(left + 1 < right ){
int mid = (right + left) / 2;
margesort(A, left, mid);
margesort(A, mid, right);
marge(A, left, mid, right);
}
}
int main(void){
int A[MAX];
int n, i;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &A[i]);
}
margesort(A, 0, n);
for(i = 0; i < n - 1; i++){
printf("%d ", A[i]);
}
printf("%d\n%d\n", A[i], count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148345/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148345/source.c"
target datalayout = "e-m:e-p270: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 [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 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 [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @marge(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 [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 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 1410065408, 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 1410065408, 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 [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 sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%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
%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 @margesort(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 @margesort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @margesort(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 [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 !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.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 [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 !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 [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.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 [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.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 1410065408, 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 1410065408, 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 [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 sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %inc32.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc37.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %inc37.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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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 !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @margesort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp323 = icmp sgt i32 %3, 1
br i1 %cmp323, label %for.body4, label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body4 ], [ 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.1, i32 noundef %4)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 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.next29, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !27
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next29, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8, i32 noundef %9)
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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, 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>
#include<limits.h>
//prototype
void merge(int,int,int);
void mergesort(int,int);
//global
int *data, cnt=0;
int main(){
int data_n, i;
//input
scanf("%d",&data_n);
data=(int *)malloc(sizeof(int)*data_n);
for(i=0;i<data_n;i++) scanf("%d",&data[i]);
//mergesort
mergesort(0,data_n);
//output
for(i=0;i<data_n-1;i++) printf("%d ",data[i]);
printf("%d\n%d\n",data[i],cnt);
free(data);
return 0;
}
void merge(int left,int mid,int right){
int n1, n2, *L, *R;
int i, j, k;
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;i++) L[i]=data[left+i];
for(i=0;i<n2;i++) R[i]=data[mid+i];
L[n1]=R[n2]=INT_MAX;
i=j=0;
for(k=left;k<right;k++){
if(L[i]<=R[j]){
data[k]=L[i];
i++;
}
else{
data[k]=R[j];
j++;
}
cnt++;
}
free(L);
free(R);
}
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);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148389/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148389/source.c"
target datalayout = "e-m:e-p270: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
@data = dso_local local_unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data_n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %data_n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data_n)
%0 = load i32, ptr %data_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) #8
store ptr %call1, ptr @data, align 8, !tbaa !9
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%1 = load ptr, ptr @data, align 8, !tbaa !9
%arrayidx = getelementptr inbounds i32, ptr %1, 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 %data_n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
call void @mergesort(i32 noundef 0, i32 noundef %.lcssa)
%4 = load i32, ptr %data_n, align 4, !tbaa !5
%cmp526 = icmp sgt i32 %4, 1
br i1 %cmp526, label %for.body7, label %for.end13
for.body7: ; preds = %for.end, %for.body7
%indvars.iv31 = phi i64 [ %indvars.iv.next32, %for.body7 ], [ 0, %for.end ]
%5 = load ptr, ptr @data, align 8, !tbaa !9
%arrayidx9 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv31
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
%7 = load i32, ptr %data_n, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%8 = sext i32 %sub to i64
%cmp5 = icmp slt i64 %indvars.iv.next32, %8
br i1 %cmp5, label %for.body7, label %for.end13.loopexit, !llvm.loop !13
for.end13.loopexit: ; preds = %for.body7
%9 = and i64 %indvars.iv.next32, 4294967295
br label %for.end13
for.end13: ; preds = %for.end13.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %9, %for.end13.loopexit ]
%10 = load ptr, ptr @data, align 8, !tbaa !9
%arrayidx15 = getelementptr inbounds i32, ptr %10, i64 %i.1.lcssa
%11 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%12 = load i32, ptr @cnt, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11, i32 noundef %12)
%13 = load ptr, ptr @data, align 8, !tbaa !9
call void @free(ptr noundef %13) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %data_n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nounwind 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 %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 #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind 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
%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
%cmp83 = icmp sgt i32 %sub, 0
br i1 %cmp83, label %for.body.lr.ph, label %for.cond10.preheader
for.body.lr.ph: ; preds = %entry
%0 = load ptr, ptr @data, align 8, !tbaa !9
%1 = sext i32 %left to i64
%2 = shl nsw i64 %1, 2
%scevgep = getelementptr i8, ptr %0, i64 %2
%3 = xor i32 %left, -1
%4 = add i32 %3, %mid
%5 = zext i32 %4 to i64
%6 = shl nuw nsw i64 %5, 2
%7 = add nuw nsw i64 %6, 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 %7, i1 false), !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body.lr.ph, %entry
%cmp1185 = icmp sgt i32 %sub1, 0
br i1 %cmp1185, label %for.body13.lr.ph, label %for.end21
for.body13.lr.ph: ; preds = %for.cond10.preheader
%8 = load ptr, ptr @data, align 8, !tbaa !9
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep93 = getelementptr i8, ptr %8, 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
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep93, i64 %15, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.lr.ph, %for.cond10.preheader
%idxprom22 = sext i32 %sub1 to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call5, i64 %idxprom22
store i32 2147483647, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call, i64 %idxprom24
store i32 2147483647, ptr %arrayidx25, align 4, !tbaa !5
%cmp2787 = icmp slt i32 %left, %right
br i1 %cmp2787, label %for.body29.lr.ph, label %for.end49
for.body29.lr.ph: ; preds = %for.end21
%16 = load ptr, ptr @data, align 8
%17 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body29
for.body29: ; preds = %for.body29.lr.ph, %for.body29
%indvars.iv = phi i64 [ %17, %for.body29.lr.ph ], [ %indvars.iv.next, %for.body29 ]
%j.089 = phi i32 [ 0, %for.body29.lr.ph ], [ %j.1, %for.body29 ]
%i.288 = phi i32 [ 0, %for.body29.lr.ph ], [ %i.3, %for.body29 ]
%idxprom30 = zext i32 %i.288 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call, i64 %idxprom30
%18 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%idxprom32 = zext i32 %j.089 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %call5, i64 %idxprom32
%19 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp sle i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc40 = zext i1 %cmp34.not to i32
%i.3 = add nuw nsw i32 %i.288, %inc40
%not.cmp34.not = xor i1 %cmp34.not, true
%inc45 = zext i1 %not.cmp34.not to i32
%j.1 = add nuw nsw i32 %j.089, %inc45
%20 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%21 = load i32, ptr @cnt, align 4, !tbaa !5
%inc46 = add nsw i32 %21, 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 !14
for.end49: ; preds = %for.body29, %for.end21
tail call void @free(ptr noundef nonnull %call) #7
tail call void @free(ptr noundef nonnull %call5) #7
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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 10000000
int cnt;
void Merge( int[], int, int, int );
void MergeSort( int[], int, int );
int main( void ){
int i, L;
int a[N];
cnt = 0;
scanf("%d", &L );
for( i = 0; i < L; i++ ){
scanf("%d", &a[i] );
}
MergeSort( a, 0, L );
for( i = 0; i < L; i++ ){
printf("%d", a[i] );
if( i < L-1 ){
printf(" ");
}
}
printf("\n");
printf("%d\n", cnt );
return 0;
}
void Merge( int a[], int left, int mid, int right ){
int i, j, k;
int n_1 = mid-left;
int n_2 = right-mid;
int L[n_1+1], R[n_2+1];
for( i = 0; i < n_1; i++ ){
L[i] = a[left+i];
}
for( i = 0; i < n_2; i++ ){
R[i] = a[mid+i];
}
L[n_1] = (int)INFINITY;
R[n_2] = (int)INFINITY;
i = 0; j = 0;
for( k = left; k < right; k++ ){
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 ){
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_148431/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148431/source.c"
target datalayout = "e-m:e-p270: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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%L = alloca i32, align 4
%a = alloca [10000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 40000000, ptr nonnull %a) #7
store i32 0, ptr @cnt, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L)
%0 = load i32, ptr %L, 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 [10000000 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 %L, 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 %L, 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 [10000000 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 %L, 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 %L, 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 !11
for.end12: ; preds = %for.inc10, %for.end
%putchar = call i32 @putchar(i32 10)
%9 = load i32, ptr @cnt, 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 40000000, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #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 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.cond22.preheader
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.cond22.preheader
for.cond22.preheader: ; preds = %for.body9.preheader, %for.cond7.preheader
%cmp2376 = icmp slt i32 %left, %right
br i1 %cmp2376, label %for.body24.preheader, label %for.end43
for.body24.preheader: ; preds = %for.cond22.preheader
%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 @cnt, align 4, !tbaa !5
%inc25 = add nsw i32 %17, 1
store i32 %inc25, ptr @cnt, 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 %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.end43, label %for.body24, !llvm.loop !12
for.end43: ; preds = %for.body24, %for.cond22.preheader
ret void
}
; 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 = { nofree nounwind "no-trapping-math"="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 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>
#define SENTINEL (1<<30)
int Merge(int *A, int left, int mid, int right) {
int cnt = 0;
int i,j,k;
int n1, n2;
int *L, *R;
n1 = mid - left;
n2 = right - mid;
L = malloc(sizeof(int)*(n1+1));
R = malloc(sizeof(int)*(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] = SENTINEL;
R[n2] = SENTINEL;
i = 0;
j = 0;
for(k = left; k < right; ++k) {
++cnt;
if(L[i] <= R[j]) {
A[k] = L[i];
i = i + 1;
} else {
A[k] = R[j];
j = j + 1;
}
}
free(L);
free(R);
return cnt;
}
int Merge_Sort(int *A, int left, int right) {
int cnt = 0;
int mid;
if(left+1 < right) {
mid = (left + right)/2;
cnt += Merge_Sort(A, left, mid);
cnt += Merge_Sort(A, mid, right);
cnt += Merge(A, left, mid, right);
}
return cnt;
}
int main() {
int i;
int n, A[500000], cnt;
scanf("%d", &n);
for(i = 0; i < n; ++i) {
scanf("%d", A+i);
}
cnt = Merge_Sort(A,0,n);
for(i = 0; i < n; ++i) {
printf(i ? " %d" : "%d", A[i]);
}
printf("\n%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148475/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148475/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @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
%cmp87 = icmp sgt i32 %sub, 0
br i1 %cmp87, 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
%cmp1189 = icmp sgt i32 %sub1, 0
br i1 %cmp1189, 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
%scevgep98 = 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) %scevgep98, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %idxprom22
store i32 1073741824, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub1 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %idxprom24
store i32 1073741824, ptr %arrayidx25, align 4, !tbaa !5
%cmp2791 = icmp slt i32 %left, %right
br i1 %cmp2791, 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
%15 = sub nsw i64 %wide.trip.count, %14
%xtraiter = and i64 %15, 1
%16 = sub nsw i64 0, %wide.trip.count
%17 = xor i64 %14, %16
%18 = icmp eq i64 %17, -1
br i1 %18, label %for.end49.loopexit.unr-lcssa, label %for.body29.preheader.new
for.body29.preheader.new: ; preds = %for.body29.preheader
%unroll_iter = and i64 %15, -2
%invariant.gep = getelementptr i32, ptr %A, i64 1
br label %for.body29
for.body29: ; preds = %for.body29, %for.body29.preheader.new
%indvars.iv = phi i64 [ %14, %for.body29.preheader.new ], [ %indvars.iv.next.1, %for.body29 ]
%i.294 = phi i32 [ 0, %for.body29.preheader.new ], [ %i.3.1, %for.body29 ]
%j.093 = phi i32 [ 0, %for.body29.preheader.new ], [ %j.1.1, %for.body29 ]
%niter = phi i64 [ 0, %for.body29.preheader.new ], [ %niter.next.1, %for.body29 ]
%idxprom31 = zext i32 %i.294 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %call, i64 %idxprom31
%19 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%idxprom33 = zext i32 %j.093 to i64
%arrayidx34 = getelementptr inbounds i32, ptr %call5, i64 %idxprom33
%20 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%cmp35.not = icmp sgt i32 %19, %20
%.sink = tail call i32 @llvm.smin.i32(i32 %19, i32 %20)
%add46 = zext i1 %cmp35.not to i32
%j.1 = add nuw nsw i32 %j.093, %add46
%not.cmp35.not = xor i1 %cmp35.not, true
%add41 = zext i1 %not.cmp35.not to i32
%i.3 = add nuw nsw i32 %i.294, %add41
%21 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %21, align 4
%idxprom31.1 = zext i32 %i.3 to i64
%arrayidx32.1 = getelementptr inbounds i32, ptr %call, i64 %idxprom31.1
%22 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5
%idxprom33.1 = zext i32 %j.1 to i64
%arrayidx34.1 = getelementptr inbounds i32, ptr %call5, i64 %idxprom33.1
%23 = load i32, ptr %arrayidx34.1, align 4, !tbaa !5
%cmp35.not.1 = icmp sgt i32 %22, %23
%.sink.1 = tail call i32 @llvm.smin.i32(i32 %22, i32 %23)
%add46.1 = zext i1 %cmp35.not.1 to i32
%j.1.1 = add nuw nsw i32 %j.1, %add46.1
%not.cmp35.not.1 = xor i1 %cmp35.not.1, true
%add41.1 = zext i1 %not.cmp35.not.1 to i32
%i.3.1 = add nuw nsw i32 %i.3, %add41.1
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
store i32 %.sink.1, ptr %gep, align 4
%indvars.iv.next.1 = add 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.end49.loopexit.unr-lcssa.loopexit, label %for.body29, !llvm.loop !9
for.end49.loopexit.unr-lcssa.loopexit: ; preds = %for.body29
%24 = zext i32 %i.3.1 to i64
%25 = zext i32 %j.1.1 to i64
br label %for.end49.loopexit.unr-lcssa
for.end49.loopexit.unr-lcssa: ; preds = %for.end49.loopexit.unr-lcssa.loopexit, %for.body29.preheader
%indvars.iv.unr = phi i64 [ %14, %for.body29.preheader ], [ %indvars.iv.next.1, %for.end49.loopexit.unr-lcssa.loopexit ]
%i.294.unr = phi i64 [ 0, %for.body29.preheader ], [ %24, %for.end49.loopexit.unr-lcssa.loopexit ]
%j.093.unr = phi i64 [ 0, %for.body29.preheader ], [ %25, %for.end49.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end49.loopexit, label %for.body29.epil
for.body29.epil: ; preds = %for.end49.loopexit.unr-lcssa
%arrayidx32.epil = getelementptr inbounds i32, ptr %call, i64 %i.294.unr
%26 = load i32, ptr %arrayidx32.epil, align 4, !tbaa !5
%arrayidx34.epil = getelementptr inbounds i32, ptr %call5, i64 %j.093.unr
%27 = load i32, ptr %arrayidx34.epil, align 4, !tbaa !5
%.sink.epil = tail call i32 @llvm.smin.i32(i32 %26, i32 %27)
%28 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.unr
store i32 %.sink.epil, ptr %28, align 4
br label %for.end49.loopexit
for.end49.loopexit: ; preds = %for.end49.loopexit.unr-lcssa, %for.body29.epil
%29 = sub i32 %right, %left
br label %for.end49
for.end49: ; preds = %for.end49.loopexit, %for.end21
%cnt.0.lcssa = phi i32 [ 0, %for.end21 ], [ %29, %for.end49.loopexit ]
tail call void @free(ptr noundef nonnull %call) #8
tail call void @free(ptr noundef nonnull %call5) #8
ret i32 %cnt.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 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 i32 @Merge_Sort(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.ret20
common.ret20: ; preds = %entry, %if.then
%common.ret20.op = phi i32 [ %add6, %if.then ], [ 0, %entry ]
ret i32 %common.ret20.op
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
%call = tail call i32 @Merge_Sort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
%call3 = tail call i32 @Merge_Sort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%add4 = add nsw i32 %call3, %call
%call5 = tail call i32 @Merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
%add6 = add nsw i32 %add4, %call5
br label %common.ret20
}
; Function Attrs: 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) #8
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%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 ]
%call3 = call i32 @Merge_Sort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp520 = icmp sgt i32 %3, 0
br i1 %cmp520, label %for.body6.preheader, label %for.end10
for.body6.preheader: ; preds = %for.end
%4 = load i32, ptr %A, align 16, !tbaa !5
%call7.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp5.peel = icmp sgt i32 %5, 1
br i1 %cmp5.peel, label %for.body6, label %for.end10
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv24 = phi i64 [ %indvars.iv.next25, %for.body6 ], [ 1, %for.body6.preheader ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv24
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp5 = icmp slt i64 %indvars.iv.next25, %8
br i1 %cmp5, label %for.body6, label %for.end10, !llvm.loop !12
for.end10: ; preds = %for.body6, %for.body6.preheader, %for.end
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call3)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: 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 = { 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 = { 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, !13}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#define N 500000
#define inf 2000000000
int cnt;
int L[N/2+2],R[N/2+2];
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] = inf;
R[n2] = inf;
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()
{
int n,A[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");
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148518/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148518/source.c"
target datalayout = "e-m:e-p270: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.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:
%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 %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
%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 %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.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:
%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
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
%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 %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
%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 %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.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 %A, 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 !27
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @cnt, 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 %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 @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}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.