Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int s, w;
scanf("%d%d", &s, &w);
if (s <= w)
printf("unsafe");
else
printf("safe");
return EXIT_SUCCESS;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117932/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117932/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"unsafe\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int s,w;
scanf("%d", &s);
scanf("%d", &w);
if (s>w)
printf("safe");
else
printf("unsafe");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_117976/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_117976/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
int S, W;
scanf("%d %d", &S, &W);
if(W >= S){
printf("unsafe\n");
}else{
printf("safe");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118018/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118018/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@str = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %W)
%0 = load i32, ptr %W, align 4, !tbaa !5
%1 = load i32, ptr %S, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int s,w;
scanf("%d %d",&s,&w);
if(w>=s)
printf("unsafe\n");
else
printf("safe\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118061/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@str = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@str.3 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4, !tbaa !5
%1 = load i32, ptr %s, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int S,W;
scanf("%d %d",&S,&W);
if(S>W){
printf("safe");
}
else{
printf("unsafe");
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118104/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118104/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %W)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%.str.1..str.2 = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int S,W;
scanf("%d",&S);
scanf("%d",&W);
if(S<=W){
printf("unsafe\n");
}else{
printf("safe\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118155/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118155/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"safe\00", align 1
@str.3 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i32, align 4
%W = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %W)
%0 = load i32, ptr %S, align 4, !tbaa !5
%1 = load i32, ptr %W, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %W) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int s;
int w;
scanf("%d %d",&s,&w);
if(s <= w){
printf("unsafe");
}else{
printf("safe");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118199/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118199/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"unsafe\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int s,w;
scanf("%d%d",&s,&w);
if(s<=w){printf("unsafe\n");}
else{printf("safe\n");}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118241/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118241/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@str.3 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
int main(void) {
int scan; // scanf result
int s; // to input
int w; // to input
scan = scanf("%d", &s);
scan = scanf("%d", &w);
if (s <= w)
printf("unsafe");
else
printf("safe");
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118285/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118285/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"unsafe\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%.str.2..str.1 = select i1 %cmp.not, ptr @.str.2, ptr @.str.1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(){
int s,w;
scanf("%d%d",&s,&w);
if(s<=w) printf("unsafe\n");
else printf("safe\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118328/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118328/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@str.3 = private unnamed_addr constant [7 x i8] c"unsafe\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %w)
%0 = load i32, ptr %s, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%str.str.3 = select i1 %cmp.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main ()
{
int m,n,i,score,check;
int a[1001];
scanf("%d %d",&n,&m);
score=0;
for (i=1;i<=n;i++)
{
scanf("%d",&a[i]);
score+=a[i];
}
check=0;
for (i=1;i<=n;i++)
{
//printf("%f\n",(double) score / (4*m));
if (a[i] >= (double) score / (4*m))
{
check+=1;
}
}
if (check >= m )
{
printf("Yes");
return 0;
}
printf("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118379/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118379/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not36 = icmp slt i32 %0, 1
br i1 %cmp.not36, label %for.cond4.preheader.thread, label %for.body
for.cond4.preheader.thread: ; preds = %entry
%.pre52 = load i32, ptr %m, align 4, !tbaa !5
br label %for.end16
for.cond4.preheader: ; preds = %for.body
%cmp5.not40 = icmp slt i32 %17, 1
%.pre = load i32, ptr %m, align 4, !tbaa !5
br i1 %cmp5.not40, label %for.end16, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.cond4.preheader
%1 = sitofp i32 %add to double
%mul = shl nsw i32 %.pre, 2
%conv10 = sitofp i32 %mul to double
%div = fdiv double %1, %conv10
%2 = add nuw i32 %17, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %17, 8
br i1 %min.iters.check, label %for.body6.preheader, label %vector.ph
vector.ph: ; preds = %for.body6.lr.ph
%n.vec = and i64 %3, -8
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x double> poison, double %div, i64 0
%broadcast.splat = shufflevector <4 x double> %broadcast.splatinsert, <4 x double> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%vec.phi54 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%offset.idx = or i64 %index, 1
%4 = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load55 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = sitofp <4 x i32> %wide.load to <4 x double>
%7 = sitofp <4 x i32> %wide.load55 to <4 x double>
%8 = fcmp ole <4 x double> %broadcast.splat, %6
%9 = fcmp ole <4 x double> %broadcast.splat, %7
%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.phi54, %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 !9
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 %3, %n.vec
br i1 %cmp.n, label %for.end16, label %for.body6.preheader
for.body6.preheader: ; preds = %for.body6.lr.ph, %middle.block
%indvars.iv46.ph = phi i64 [ 1, %for.body6.lr.ph ], [ %ind.end, %middle.block ]
%check.042.ph = phi i32 [ 0, %for.body6.lr.ph ], [ %15, %middle.block ]
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%score.038 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%16 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %16, %score.038
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %18
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !13
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body6 ], [ %indvars.iv46.ph, %for.body6.preheader ]
%check.042 = phi i32 [ %check.1, %for.body6 ], [ %check.042.ph, %for.body6.preheader ]
%arrayidx8 = getelementptr inbounds [1001 x i32], ptr %a, i64 0, i64 %indvars.iv46
%19 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%conv = sitofp i32 %19 to double
%cmp11 = fcmp ole double %div, %conv
%add13 = zext i1 %cmp11 to i32
%check.1 = add nuw nsw i32 %check.042, %add13
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body6, !llvm.loop !14
for.end16: ; preds = %for.body6, %middle.block, %for.cond4.preheader.thread, %for.cond4.preheader
%.pre53 = phi i32 [ %.pre, %for.cond4.preheader ], [ %.pre52, %for.cond4.preheader.thread ], [ %.pre, %middle.block ], [ %.pre, %for.body6 ]
%check.0.lcssa = phi i32 [ 0, %for.cond4.preheader ], [ 0, %for.cond4.preheader.thread ], [ %15, %middle.block ], [ %check.1, %for.body6 ]
%cmp17.not = icmp slt i32 %check.0.lcssa, %.pre53
%.str.3..str.2 = select i1 %cmp17.not, ptr @.str.3, ptr @.str.2
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2)
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include<stdio.h>
int main(){
int n,m;
scanf("%d %d",&n,&m);
int a[n];
int i;
double sum=0;
int count=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
double x=sum/(4*m);
for(i=0;i<n;i++){
if(a[i]>=x){
count++;
}
}
if(count>=m){
printf("Yes");
}else{
printf("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118421/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118421/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp32 = icmp sgt i32 %3, 0
br i1 %cmp32, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%4 = load i32, ptr %m, align 4, !tbaa !5
br label %for.end17
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.034 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sitofp i32 %5 to double
%add = fadd double %sum.034, %conv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%8 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %8, 2
%conv4 = sitofp i32 %mul to double
%div = fdiv double %add, %conv4
%cmp636 = icmp sgt i32 %6, 0
br i1 %cmp636, label %for.body8.preheader, label %for.end17
for.body8.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %6 to i64
%min.iters.check = icmp ult i32 %6, 8
br i1 %min.iters.check, label %for.body8.preheader53, label %vector.ph
vector.ph: ; preds = %for.body8.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x double> poison, double %div, i64 0
%broadcast.splat = shufflevector <4 x double> %broadcast.splatinsert, <4 x double> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%vec.phi51 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ]
%9 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load52 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = sitofp <4 x i32> %wide.load to <4 x double>
%12 = sitofp <4 x i32> %wide.load52 to <4 x double>
%13 = fcmp ole <4 x double> %broadcast.splat, %11
%14 = fcmp ole <4 x double> %broadcast.splat, %12
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = zext <4 x i1> %14 to <4 x i32>
%17 = add <4 x i32> %vec.phi, %15
%18 = add <4 x i32> %vec.phi51, %16
%index.next = add nuw i64 %index, 8
%19 = icmp eq i64 %index.next, %n.vec
br i1 %19, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %18, %17
%20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end17, label %for.body8.preheader53
for.body8.preheader53: ; preds = %for.body8.preheader, %middle.block
%indvars.iv42.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec, %middle.block ]
%count.038.ph = phi i32 [ 0, %for.body8.preheader ], [ %20, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader53, %for.body8
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body8 ], [ %indvars.iv42.ph, %for.body8.preheader53 ]
%count.038 = phi i32 [ %count.1, %for.body8 ], [ %count.038.ph, %for.body8.preheader53 ]
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv42
%21 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%conv11 = sitofp i32 %21 to double
%cmp12 = fcmp ole double %div, %conv11
%inc14 = zext i1 %cmp12 to i32
%count.1 = add nuw nsw i32 %count.038, %inc14
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.end17, label %for.body8, !llvm.loop !14
for.end17: ; preds = %for.body8, %middle.block, %for.end.thread, %for.end
%22 = phi i32 [ %8, %for.end ], [ %4, %for.end.thread ], [ %8, %middle.block ], [ %8, %for.body8 ]
%count.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %20, %middle.block ], [ %count.1, %for.body8 ]
%cmp18.not = icmp slt i32 %count.0.lcssa, %22
%.str.3..str.2 = select i1 %cmp18.not, ptr @.str.3, ptr @.str.2
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare 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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include <stdio.h>
int main(){
int N,M,S=0,V=0;
int A[102];
scanf("%d %d",&N,&M);
for(int i=1;i<=N;i++){
scanf("%d",A+i);
V+=A[i];
A[i]*=4*M;
}
for(int i=1;i<=N;i++){
if(A[i]>=V) S++;
}
if(S>=M) printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118465/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118465/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%A = alloca [102 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %A) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %for.cond.cleanup8, label %for.body
for.cond6.preheader: ; preds = %for.body
%cmp7.not35 = icmp slt i32 %15, 1
br i1 %cmp7.not35, label %for.cond.cleanup8, label %for.body9.preheader
for.body9.preheader: ; preds = %for.cond6.preheader
%1 = add nuw i32 %15, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %15, 8
br i1 %min.iters.check, label %for.body9.preheader49, label %vector.ph
vector.ph: ; preds = %for.body9.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi47 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%3 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load48 = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = icmp sge <4 x i32> %wide.load, %broadcast.splat
%6 = icmp sge <4 x i32> %wide.load48, %broadcast.splat
%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.phi47, %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 !9
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 %2, %n.vec
br i1 %cmp.n, label %for.cond.cleanup8, label %for.body9.preheader49
for.body9.preheader49: ; preds = %for.body9.preheader, %middle.block
%indvars.iv41.ph = phi i64 [ 1, %for.body9.preheader ], [ %ind.end, %middle.block ]
%S.036.ph = phi i32 [ 0, %for.body9.preheader ], [ %12, %middle.block ]
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%V.032 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%13 = load i32, ptr %add.ptr, align 4, !tbaa !5
%add = add nsw i32 %13, %V.032
%14 = load i32, ptr %M, align 4, !tbaa !5
%mul = shl i32 %13, 2
%mul4 = mul i32 %mul, %14
store i32 %mul4, ptr %add.ptr, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %N, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %16
br i1 %cmp.not.not, label %for.body, label %for.cond6.preheader, !llvm.loop !13
for.cond.cleanup8: ; preds = %for.body9, %middle.block, %entry, %for.cond6.preheader
%S.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body9 ]
%17 = load i32, ptr %M, align 4, !tbaa !5
%cmp17.not = icmp slt i32 %S.0.lcssa, %17
%str.str.4 = select i1 %cmp17.not, ptr @str, ptr @str.4
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4)
call void @llvm.lifetime.end.p0(i64 408, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.body9: ; preds = %for.body9.preheader49, %for.body9
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body9 ], [ %indvars.iv41.ph, %for.body9.preheader49 ]
%S.036 = phi i32 [ %spec.select, %for.body9 ], [ %S.036.ph, %for.body9.preheader49 ]
%arrayidx11 = getelementptr inbounds [102 x i32], ptr %A, i64 0, i64 %indvars.iv41
%18 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12.not = icmp sge i32 %18, %add
%inc13 = zext i1 %cmp12.not to i32
%spec.select = add nuw nsw i32 %S.036, %inc13
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup8, label %for.body9, !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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !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){
int n, m, i, f = 0;
int a[100];
double t, g = 0;
scanf("%d %d", &n, &m);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
for(i = 0; i < n; i++){
g += a[i];
}
t = (g/(4*m));
for(i = 0; i < n; i++){
if(a[i] >= t){
f++;
}
}
if(f >= m){
printf("Yes");
}else{
printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118508/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118508/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end9.thread
for.cond2.preheader: ; preds = %for.body
%cmp342 = icmp sgt i32 %2, 0
br i1 %cmp342, label %for.body4.preheader, label %for.end9.thread
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.end9.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv52 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next53.3, %for.body4 ]
%g.044 = phi double [ 0.000000e+00, %for.body4.preheader.new ], [ %add.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv52
%4 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%conv = sitofp i32 %4 to double
%add = fadd double %g.044, %conv
%indvars.iv.next53 = or i64 %indvars.iv52, 1
%arrayidx6.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next53
%5 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %5 to double
%add.1 = fadd double %add, %conv.1
%indvars.iv.next53.1 = or i64 %indvars.iv52, 2
%arrayidx6.2 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next53.1
%6 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%conv.2 = sitofp i32 %6 to double
%add.2 = fadd double %add.1, %conv.2
%indvars.iv.next53.2 = or i64 %indvars.iv52, 3
%arrayidx6.3 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next53.2
%7 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%conv.3 = sitofp i32 %7 to double
%add.3 = fadd double %add.2, %conv.3
%indvars.iv.next53.3 = add nuw nsw i64 %indvars.iv52, 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.end9.unr-lcssa, label %for.body4, !llvm.loop !11
for.end9.thread: ; preds = %for.cond2.preheader, %entry
%8 = load i32, ptr %m, align 4, !tbaa !5
br label %for.end23
for.end9.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%add.lcssa.ph = phi double [ undef, %for.body4.preheader ], [ %add.3, %for.body4 ]
%indvars.iv52.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next53.3, %for.body4 ]
%g.044.unr = phi double [ 0.000000e+00, %for.body4.preheader ], [ %add.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end9, label %for.body4.epil
for.body4.epil: ; preds = %for.end9.unr-lcssa, %for.body4.epil
%indvars.iv52.epil = phi i64 [ %indvars.iv.next53.epil, %for.body4.epil ], [ %indvars.iv52.unr, %for.end9.unr-lcssa ]
%g.044.epil = phi double [ %add.epil, %for.body4.epil ], [ %g.044.unr, %for.end9.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.end9.unr-lcssa ]
%arrayidx6.epil = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv52.epil
%9 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %9 to double
%add.epil = fadd double %g.044.epil, %conv.epil
%indvars.iv.next53.epil = add nuw nsw i64 %indvars.iv52.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.end9, label %for.body4.epil, !llvm.loop !12
for.end9: ; preds = %for.body4.epil, %for.end9.unr-lcssa
%add.lcssa = phi double [ %add.lcssa.ph, %for.end9.unr-lcssa ], [ %add.epil, %for.body4.epil ]
%10 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %10, 2
%conv10 = sitofp i32 %mul to double
%div = fdiv double %add.lcssa, %conv10
br i1 %cmp342, label %for.body14.preheader, label %for.end23
for.body14.preheader: ; preds = %for.end9
%wide.trip.count58 = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body14.preheader72, label %vector.ph
vector.ph: ; preds = %for.body14.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x double> poison, double %div, i64 0
%broadcast.splat = shufflevector <4 x double> %broadcast.splatinsert, <4 x double> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.phi70 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%11 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load71 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = sitofp <4 x i32> %wide.load to <4 x double>
%14 = sitofp <4 x i32> %wide.load71 to <4 x double>
%15 = fcmp ole <4 x double> %broadcast.splat, %13
%16 = fcmp ole <4 x double> %broadcast.splat, %14
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = zext <4 x i1> %16 to <4 x i32>
%19 = add <4 x i32> %vec.phi, %17
%20 = add <4 x i32> %vec.phi70, %18
%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 !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %20, %19
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end23, label %for.body14.preheader72
for.body14.preheader72: ; preds = %for.body14.preheader, %middle.block
%indvars.iv55.ph = phi i64 [ 0, %for.body14.preheader ], [ %n.vec, %middle.block ]
%f.047.ph = phi i32 [ 0, %for.body14.preheader ], [ %22, %middle.block ]
br label %for.body14
for.body14: ; preds = %for.body14.preheader72, %for.body14
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.body14 ], [ %indvars.iv55.ph, %for.body14.preheader72 ]
%f.047 = phi i32 [ %f.1, %for.body14 ], [ %f.047.ph, %for.body14.preheader72 ]
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv55
%23 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%conv17 = sitofp i32 %23 to double
%cmp18 = fcmp ole double %div, %conv17
%inc20 = zext i1 %cmp18 to i32
%f.1 = add nuw nsw i32 %f.047, %inc20
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
br i1 %exitcond59.not, label %for.end23, label %for.body14, !llvm.loop !17
for.end23: ; preds = %for.body14, %middle.block, %for.end9.thread, %for.end9
%24 = phi i32 [ %10, %for.end9 ], [ %8, %for.end9.thread ], [ %10, %middle.block ], [ %10, %for.body14 ]
%f.0.lcssa = phi i32 [ 0, %for.end9 ], [ 0, %for.end9.thread ], [ %22, %middle.block ], [ %f.1, %for.body14 ]
%cmp24.not = icmp slt i32 %f.0.lcssa, %24
%.str.3..str.2 = select i1 %cmp24.not, ptr @.str.3, ptr @.str.2
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
|
#include<stdio.h>
#include<stdlib.h>
int cmpfunc(const void*a,const void*b)
{
if((*(int*)a - *(int*)b)>0)
{
return -1;
}
if((*(int*)a - *(int*)b)<0)
{
return 1;
}
if(*(int*)a == *(int*)b)
{
return 0;
}
}
int main(void)
{
int n,m,a[100],sum=0,count=0;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum = sum + a[i];
}
qsort(a,n,sizeof(a[0]),cmpfunc);
float judge = (float)sum/(4*m);
for(int i=0;i<m;i++)
{
if(a[i]>=judge)
{
count++;
}
}
if(m<=count)
{
printf("Yes");
}
else
{
printf("No");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118551/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmpfunc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cmp = icmp sgt i32 %sub, 0
%sub.lobit = lshr i32 %sub, 31
%retval.0 = select i1 %cmp, i32 -1, i32 %sub.lobit
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp35 = icmp sgt i32 %0, 0
br i1 %cmp35, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %for.body
%1 = sitofp i32 %add to float
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %entry.for.cond.cleanup_crit_edge, %for.cond.cleanup.loopexit
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %17, %for.cond.cleanup.loopexit ]
%sum.0.lcssa = phi float [ 0.000000e+00, %entry.for.cond.cleanup_crit_edge ], [ %1, %for.cond.cleanup.loopexit ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @cmpfunc) #6
%2 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %2, 2
%conv5 = sitofp i32 %mul to float
%div = fdiv float %sum.0.lcssa, %conv5
%cmp839 = icmp sgt i32 %2, 0
br i1 %cmp839, label %for.body11.preheader, label %if.end26
for.body11.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body11.preheader52, label %vector.ph
vector.ph: ; preds = %for.body11.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x float> poison, float %div, i64 0
%broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi50 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%3 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load51 = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = sitofp <4 x i32> %wide.load to <4 x float>
%6 = sitofp <4 x i32> %wide.load51 to <4 x float>
%7 = fcmp ole <4 x float> %broadcast.splat, %5
%8 = fcmp ole <4 x float> %broadcast.splat, %6
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi50, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup10, label %for.body11.preheader52
for.body11.preheader52: ; preds = %for.body11.preheader, %middle.block
%indvars.iv45.ph = phi i64 [ 0, %for.body11.preheader ], [ %n.vec, %middle.block ]
%count.040.ph = phi i32 [ 0, %for.body11.preheader ], [ %14, %middle.block ]
br label %for.body11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.037 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%15 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %15, %sum.037
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp = icmp slt i64 %indvars.iv.next, %17
br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !13
for.cond.cleanup10: ; preds = %for.body11, %middle.block
%count.1.lcssa = phi i32 [ %14, %middle.block ], [ %count.1, %for.body11 ]
%cmp21.not = icmp sgt i32 %2, %count.1.lcssa
%spec.select = select i1 %cmp21.not, ptr @.str.3, ptr @.str.2
br label %if.end26
for.body11: ; preds = %for.body11.preheader52, %for.body11
%indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body11 ], [ %indvars.iv45.ph, %for.body11.preheader52 ]
%count.040 = phi i32 [ %count.1, %for.body11 ], [ %count.040.ph, %for.body11.preheader52 ]
%arrayidx13 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv45
%18 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%conv14 = sitofp i32 %18 to float
%cmp15 = fcmp ole float %div, %conv14
%inc17 = zext i1 %cmp15 to i32
%count.1 = add nuw nsw i32 %count.040, %inc17
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !14
if.end26: ; preds = %for.cond.cleanup10, %for.cond.cleanup
%.str.3.sink = phi ptr [ @.str.2, %for.cond.cleanup ], [ %spec.select, %for.cond.cleanup10 ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include <stdio.h>
#define MAX 200
void sort(int*,int );
int input(int*, int);
int main()
{
int a[MAX];
int n, m;
int count = 0;
int sum;
float standard;
scanf("%d %d", &n, &m);
sum=input(a, n);
standard = (float)1 / (4 * m) * sum;
sort(a, n);
for (int i = 0; i < n; i++) {
if (a[i] < standard)
break;
count++;
}
if (count >= m)
printf("Yes\n");
else
printf("No");
return 0;
}
int input(int* a, int n)
{
int sum = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
sum+=a[i];
}
return sum;
}
void sort(int* a, int n)
{
int i, j;
int temp;
for (i = 0; i < n; i++){
for (j = i + 1; j < n; j++) {
if (a[i] < a[j]) {
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118595/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118595/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [200 x i32], align 16
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp8.i = icmp sgt i32 %0, 0
br i1 %cmp8.i, label %for.body.preheader.i, label %input.exit.thread
input.exit.thread: ; preds = %entry
%1 = load i32, ptr %m, align 4, !tbaa !5
br label %cleanup
for.body.preheader.i: ; preds = %entry
%wide.trip.count.i = zext i32 %0 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%sum.09.i = phi i32 [ 0, %for.body.preheader.i ], [ %add.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx.i)
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%add.i = add nsw i32 %2, %sum.09.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %input.exit, label %for.body.i, !llvm.loop !9
input.exit: ; preds = %for.body.i
%.pre = load i32, ptr %n, align 4, !tbaa !5
%3 = sitofp i32 %add.i to float
%4 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %4, 2
%conv = sitofp i32 %mul to float
%div = fdiv float 1.000000e+00, %conv
%mul3 = fmul float %div, %3
%cmp36.i = icmp sgt i32 %.pre, 0
br i1 %cmp36.i, label %for.body.preheader.i25, label %cleanup
for.body.preheader.i25: ; preds = %input.exit
%5 = zext i32 %.pre to i64
br label %for.body.i26
for.cond.loopexit.i: ; preds = %for.inc.i, %for.body.i26
%indvars.iv.next.i28 = add nuw nsw i64 %indvars.iv.i27, 1
%exitcond45.not.i = icmp eq i64 %indvars.iv.next42.i, %5
br i1 %exitcond45.not.i, label %sort.exit, label %for.body.i26, !llvm.loop !11
for.body.i26: ; preds = %for.cond.loopexit.i, %for.body.preheader.i25
%indvars.iv41.i = phi i64 [ 0, %for.body.preheader.i25 ], [ %indvars.iv.next42.i, %for.cond.loopexit.i ]
%indvars.iv.i27 = phi i64 [ 1, %for.body.preheader.i25 ], [ %indvars.iv.next.i28, %for.cond.loopexit.i ]
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp234.i = icmp ult i64 %indvars.iv.next42.i, %5
br i1 %cmp234.i, label %for.body3.lr.ph.i, label %for.cond.loopexit.i
for.body3.lr.ph.i: ; preds = %for.body.i26
%arrayidx.i29 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv41.i
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.body3.lr.ph.i
%indvars.iv38.i = phi i64 [ %indvars.iv.i27, %for.body3.lr.ph.i ], [ %indvars.iv.next39.i, %for.inc.i ]
%6 = load i32, ptr %arrayidx.i29, align 4, !tbaa !5
%arrayidx5.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv38.i
%7 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp slt i32 %6, %7
br i1 %cmp6.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
store i32 %7, ptr %arrayidx.i29, align 4, !tbaa !5
store i32 %6, ptr %arrayidx5.i, align 4, !tbaa !5
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1
%exitcond.not.i30 = icmp eq i64 %indvars.iv.next39.i, %5
br i1 %exitcond.not.i30, label %for.cond.loopexit.i, label %for.body3.i, !llvm.loop !12
sort.exit: ; preds = %for.cond.loopexit.i
br i1 %cmp36.i, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %sort.exit
%wide.trip.count = zext i32 %.pre to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %if.end
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.end ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv6 = sitofp i32 %8 to float
%cmp7 = fcmp ogt float %mul3, %conv6
br i1 %cmp7, label %cleanup.loopexit.split.loop.exit, label %if.end
if.end: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !13
cleanup.loopexit.split.loop.exit: ; preds = %for.body
%indvars37.le = trunc i64 %indvars.iv to i32
br label %cleanup
cleanup: ; preds = %if.end, %cleanup.loopexit.split.loop.exit, %input.exit, %input.exit.thread, %sort.exit
%9 = phi i32 [ %4, %sort.exit ], [ %4, %input.exit ], [ %1, %input.exit.thread ], [ %4, %cleanup.loopexit.split.loop.exit ], [ %4, %if.end ]
%count.0.lcssa = phi i32 [ 0, %sort.exit ], [ 0, %input.exit ], [ 0, %input.exit.thread ], [ %indvars37.le, %cleanup.loopexit.split.loop.exit ], [ %.pre, %if.end ]
%cmp10.not = icmp slt i32 %count.0.lcssa, %9
br i1 %cmp10.not, label %if.else, label %if.then12
if.then12: ; preds = %cleanup
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end15
if.else: ; preds = %cleanup
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end15
if.end15: ; preds = %if.else, %if.then12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @input(ptr noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %n, 0
br i1 %cmp8, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
ret i32 %sum.0.lcssa
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%sum.09 = phi i32 [ 0, %for.body.preheader ], [ %add, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %arrayidx)
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %0, %sum.09
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp36 = icmp sgt i32 %n, 0
br i1 %cmp36, label %for.body.preheader, label %for.end17
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count44 = zext i32 %n to i64
br label %for.body
for.cond.loopexit: ; preds = %for.inc, %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond45.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count44
br i1 %exitcond45.not, label %for.end17, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv41 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next42, %for.cond.loopexit ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond.loopexit ]
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp234 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp234, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv41
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.inc
%indvars.iv38 = phi i64 [ %indvars.iv, %for.body3.lr.ph ], [ %indvars.iv.next39, %for.inc ]
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv38
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp slt i32 %1, %2
br i1 %cmp6, label %if.then, label %for.inc
if.then: ; preds = %for.body3
store i32 %2, ptr %arrayidx, align 4, !tbaa !5
store i32 %1, ptr %arrayidx5, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count44
br i1 %exitcond.not, label %for.cond.loopexit, label %for.body3, !llvm.loop !12
for.end17: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int a,b,c=0,d=0,f,i,j,m,n,r;
scanf("%d%d",&n,&m);
int x[n];
for(i=0;i<n;i++)
{
scanf("%d",&x[i]);
c=c+x[i];
}
a=(4*m);
b=c/a;
if(c%a!=0){b++;}
for(i=0;i<n;i++)
{
if(x[i]>=b) {d++;}
}
if(d>=m) {printf("Yes\n");}
else {printf("No\n");}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118638/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118638/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp36 = icmp sgt i32 %3, 0
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%c.038 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %4, %c.038
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %3, %entry ], [ %5, %for.body ]
%7 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %7, 2
%div = sdiv i32 %c.0.lcssa, %mul
%rem = srem i32 %c.0.lcssa, %mul
%cmp4.not = icmp ne i32 %rem, 0
%inc5 = zext i1 %cmp4.not to i32
%spec.select = add nsw i32 %div, %inc5
%cmp740 = icmp sgt i32 %.lcssa, 0
br i1 %cmp740, label %for.body8.preheader, label %for.end17
for.body8.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %.lcssa to i64
%min.iters.check = icmp ult i32 %.lcssa, 8
br i1 %min.iters.check, label %for.body8.preheader53, label %vector.ph
vector.ph: ; preds = %for.body8.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %spec.select, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi51 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%8 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load52 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = icmp sge <4 x i32> %wide.load, %broadcast.splat
%11 = icmp sge <4 x i32> %wide.load52, %broadcast.splat
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = add <4 x i32> %vec.phi, %12
%15 = add <4 x i32> %vec.phi51, %13
%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 !11
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 %for.end17, label %for.body8.preheader53
for.body8.preheader53: ; preds = %for.body8.preheader, %middle.block
%indvars.iv46.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec, %middle.block ]
%d.042.ph = phi i32 [ 0, %for.body8.preheader ], [ %17, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader53, %for.body8
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body8 ], [ %indvars.iv46.ph, %for.body8.preheader53 ]
%d.042 = phi i32 [ %spec.select35, %for.body8 ], [ %d.042.ph, %for.body8.preheader53 ]
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46
%18 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp sge i32 %18, %spec.select
%inc13 = zext i1 %cmp11.not to i32
%spec.select35 = add nuw nsw i32 %d.042, %inc13
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count
br i1 %exitcond.not, label %for.end17, label %for.body8, !llvm.loop !14
for.end17: ; preds = %for.body8, %middle.block, %for.end
%d.0.lcssa = phi i32 [ 0, %for.end ], [ %17, %middle.block ], [ %spec.select35, %for.body8 ]
%cmp18.not = icmp slt i32 %d.0.lcssa, %7
%str.str.4 = select i1 %cmp18.not, ptr @str, ptr @str.4
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!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}
|
#include <stdio.h>
int main(void){
int N = 0;
int M = 0;
int count = 0;
int check = 0;
double sikii = 0;
scanf("%d %d", &N, &M);
int A[N];
check = N;
for (int i = 0; i < N; i++){
scanf("%d", &A[i]);
count = count + A[i];
}
sikii = (double)count / (double)(4 * M);
for (int j = 0; j < N; j++){
if ((double)A[j] < sikii){
check--;
}
}
if (M > check){
printf("No\n");
} else {
printf("Yes\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118689/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118689/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #6
store i32 0, ptr %M, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4, !tbaa !5
%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
%cmp32 = icmp sgt i32 %3, 0
br i1 %cmp32, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%4 = load i32, ptr %M, align 4, !tbaa !5
br label %for.cond.cleanup8
for.cond.cleanup: ; preds = %for.body
%5 = sitofp i32 %add to double
%6 = load i32, ptr %M, align 4, !tbaa !5
%mul = shl nsw i32 %6, 2
%conv4 = sitofp i32 %mul to double
%div = fdiv double %5, %conv4
%cmp636 = icmp sgt i32 %21, 0
br i1 %cmp636, label %for.body9.preheader, label %for.cond.cleanup8
for.body9.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %21 to i64
%min.iters.check = icmp ult i32 %21, 8
br i1 %min.iters.check, label %for.body9.preheader53, label %vector.ph
vector.ph: ; preds = %for.body9.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %3, i64 0
%broadcast.splatinsert = insertelement <4 x double> poison, double %div, i64 0
%broadcast.splat = shufflevector <4 x double> %broadcast.splatinsert, <4 x double> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %7, %vector.ph ], [ %16, %vector.body ]
%vec.phi51 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%8 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load52 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = sitofp <4 x i32> %wide.load to <4 x double>
%11 = sitofp <4 x i32> %wide.load52 to <4 x double>
%12 = fcmp ogt <4 x double> %broadcast.splat, %10
%13 = fcmp ogt <4 x double> %broadcast.splat, %11
%14 = sext <4 x i1> %12 to <4 x i32>
%15 = sext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi51, %15
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup8, label %for.body9.preheader53
for.body9.preheader53: ; preds = %for.body9.preheader, %middle.block
%indvars.iv42.ph = phi i64 [ 0, %for.body9.preheader ], [ %n.vec, %middle.block ]
%check.037.ph = phi i32 [ %3, %for.body9.preheader ], [ %19, %middle.block ]
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%count.033 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%20 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %20, %count.033
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%21 = load i32, ptr %N, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp = icmp slt i64 %indvars.iv.next, %22
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup8: ; preds = %for.body9, %middle.block, %for.cond.cleanup.thread, %for.cond.cleanup
%23 = phi i32 [ %6, %for.cond.cleanup ], [ %4, %for.cond.cleanup.thread ], [ %6, %middle.block ], [ %6, %for.body9 ]
%check.0.lcssa = phi i32 [ %3, %for.cond.cleanup ], [ %3, %for.cond.cleanup.thread ], [ %19, %middle.block ], [ %check.1, %for.body9 ]
%cmp18 = icmp sgt i32 %23, %check.0.lcssa
%str.4.str = select i1 %cmp18, ptr @str.4, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
for.body9: ; preds = %for.body9.preheader53, %for.body9
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body9 ], [ %indvars.iv42.ph, %for.body9.preheader53 ]
%check.037 = phi i32 [ %check.1, %for.body9 ], [ %check.037.ph, %for.body9.preheader53 ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv42
%24 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%conv12 = sitofp i32 %24 to double
%cmp13 = fcmp ogt double %div, %conv12
%dec = sext i1 %cmp13 to i32
%check.1 = add nsw i32 %check.037, %dec
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup8, label %for.body9, !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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include<stdio.h>
int main(){
int n, m;
int a[105];
int i, sum = 0;
int reg, cnt = 0;
scanf("%d %d", &n, &m);
for(i=0; i<n; i++){
scanf("%d", a+i);
sum += a[i];
}
reg = sum / (4*m);
if(sum % (4*m) != 0){
reg++;
}
for(i=0; i<n; i++){
if(a[i] >= reg){
cnt++;
}
}
if(cnt < m){
printf("No");
}else{
printf("Yes");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118731/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118731/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [105 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.035 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%1 = load i32, ptr %add.ptr, align 4, !tbaa !5
%add = add nsw i32 %1, %sum.035
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%4 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %4, 2
%div = sdiv i32 %sum.0.lcssa, %mul
%rem = srem i32 %sum.0.lcssa, %mul
%cmp3.not = icmp ne i32 %rem, 0
%inc4 = zext i1 %cmp3.not to i32
%spec.select = add nsw i32 %div, %inc4
%cmp637 = icmp sgt i32 %.lcssa, 0
br i1 %cmp637, label %for.body7.preheader, label %for.end16
for.body7.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %.lcssa to i64
%min.iters.check = icmp ult i32 %.lcssa, 8
br i1 %min.iters.check, label %for.body7.preheader50, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %spec.select, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi48 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load49 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = icmp sge <4 x i32> %wide.load, %broadcast.splat
%8 = icmp sge <4 x i32> %wide.load49, %broadcast.splat
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi48, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end16, label %for.body7.preheader50
for.body7.preheader50: ; preds = %for.body7.preheader, %middle.block
%indvars.iv43.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec, %middle.block ]
%cnt.039.ph = phi i32 [ 0, %for.body7.preheader ], [ %14, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader50, %for.body7
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body7 ], [ %indvars.iv43.ph, %for.body7.preheader50 ]
%cnt.039 = phi i32 [ %spec.select32, %for.body7 ], [ %cnt.039.ph, %for.body7.preheader50 ]
%arrayidx9 = getelementptr inbounds [105 x i32], ptr %a, i64 0, i64 %indvars.iv43
%15 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10.not = icmp sge i32 %15, %spec.select
%inc12 = zext i1 %cmp10.not to i32
%spec.select32 = add nuw nsw i32 %cnt.039, %inc12
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body7, !llvm.loop !14
for.end16: ; preds = %for.body7, %middle.block, %for.end
%cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %14, %middle.block ], [ %spec.select32, %for.body7 ]
%cmp17 = icmp slt i32 %cnt.0.lcssa, %4
%.str.2..str.3 = select i1 %cmp17, ptr @.str.2, ptr @.str.3
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!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}
|
#include<stdio.h>
int main()
{
int n,m;
scanf("%d %d",&n,&m);
int a[n],sum=0,c=0;
for (int i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
int x=4*m;
int h=sum/x;
if (sum%x!=0)
h++;
for (int i=0;i<n;i++)
{
if (a[i]>=h)
c++;
}
if (c>=m)
printf("Yes\n");
else
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118775/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118775/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp37 = icmp sgt i32 %3, 0
br i1 %cmp37, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %3, %entry ], [ %16, %for.body ]
%4 = load i32, ptr %m, align 4, !tbaa !5
%mul = shl nsw i32 %4, 2
%div = sdiv i32 %sum.0.lcssa, %mul
%rem = srem i32 %sum.0.lcssa, %mul
%cmp4.not = icmp ne i32 %rem, 0
%inc5 = zext i1 %cmp4.not to i32
%spec.select = add nsw i32 %div, %inc5
%cmp841 = icmp sgt i32 %.lcssa, 0
br i1 %cmp841, label %for.body10.preheader, label %for.cond.cleanup9
for.body10.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %.lcssa to i64
%min.iters.check = icmp ult i32 %.lcssa, 8
br i1 %min.iters.check, label %for.body10.preheader54, label %vector.ph
vector.ph: ; preds = %for.body10.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %spec.select, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi52 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load53 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = icmp sge <4 x i32> %wide.load, %broadcast.splat
%8 = icmp sge <4 x i32> %wide.load53, %broadcast.splat
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi52, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup9, label %for.body10.preheader54
for.body10.preheader54: ; preds = %for.body10.preheader, %middle.block
%indvars.iv47.ph = phi i64 [ 0, %for.body10.preheader ], [ %n.vec, %middle.block ]
%c.042.ph = phi i32 [ 0, %for.body10.preheader ], [ %14, %middle.block ]
br label %for.body10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.038 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%15 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %15, %sum.038
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp = icmp slt i64 %indvars.iv.next, %17
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup9: ; preds = %for.body10, %middle.block, %for.cond.cleanup
%c.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %14, %middle.block ], [ %spec.select36, %for.body10 ]
%cmp20.not = icmp slt i32 %c.0.lcssa, %4
%str.str.4 = select i1 %cmp20.not, ptr @str, ptr @str.4
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body10: ; preds = %for.body10.preheader54, %for.body10
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body10 ], [ %indvars.iv47.ph, %for.body10.preheader54 ]
%c.042 = phi i32 [ %spec.select36, %for.body10 ], [ %c.042.ph, %for.body10.preheader54 ]
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47
%18 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13.not = icmp sge i32 %18, %spec.select
%inc15 = zext i1 %cmp13.not to i32
%spec.select36 = add nuw nsw i32 %c.042, %inc15
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup9, label %for.body10, !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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include <stdio.h>
#include <inttypes.h>
#define INF INT64_C(77777777777777777)
int64_t kugyu(int64_t sakura, int64_t oonisi) {
int64_t nadukakaori = sakura + oonisi;
if (nadukakaori > INF) nadukakaori = INF;
if (nadukakaori < -INF) nadukakaori = -INF;
return nadukakaori;
}
int N, M, P;
int A[7777], B[7777], C[7777];
int64_t hanazawakana[7777];
char hayamisaori[7777];
int64_t igutiyuka[7777];
int main(void) {
int i;
if (scanf("%d%d%d", &N, &M, &P) != 3) return 1;
for (i = 0; i < M; i++) {
if (scanf("%d%d%d", &A[i], &B[i], &C[i]) != 3) return 1;
C[i] -= P;
}
/* 最大スコア探索と、ゴールに行けるか判定 */
for (i = 1; i <= N; i++) {
hanazawakana[i] = -INF;
hayamisaori[i] = 0;
}
hanazawakana[1] = 0;
hayamisaori[N] = 1;
for (i = 0; i < M; i++) {
int j;
for (j = 0; j < M; j++) {
if (hanazawakana[A[j]] > -INF && kugyu(hanazawakana[A[j]], C[j]) > hanazawakana[B[j]]) {
hanazawakana[B[j]] = kugyu(hanazawakana[A[j]], C[j]);
}
if (hayamisaori[B[j]]) hayamisaori[A[j]] = 1;
}
}
/* この時点での最大スコアを保存して */
for (i = 1; i <= N; i++) igutiyuka[i] = hanazawakana[i];
/* スコアがもっと伸びるかをチェックする */
for (i = 0; i < M; i++) {
int j;
for (j = 0; j < M; j++) {
if (hanazawakana[A[j]] > -INF && kugyu(hanazawakana[A[j]], C[j]) > hanazawakana[B[j]]) {
hanazawakana[B[j]] = kugyu(hanazawakana[A[j]], C[j]);
}
}
}
for (i = 1; i <= N; i++) {
if (hayamisaori[i] && hanazawakana[i] > igutiyuka[i]) {
puts("-1");
return 0;
}
}
printf("%" PRId64 "\n", hanazawakana[N] < 0 ? 0 : hanazawakana[N]);
return 0;
}
/*
3 4 0
1 3 100000
1 2 1
2 2 1
2 3 1
*/
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118825/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@N = dso_local global i32 0, align 4
@M = dso_local global i32 0, align 4
@P = dso_local global i32 0, align 4
@A = dso_local global [7777 x i32] zeroinitializer, align 16
@B = dso_local global [7777 x i32] zeroinitializer, align 16
@C = dso_local global [7777 x i32] zeroinitializer, align 16
@hanazawakana = dso_local local_unnamed_addr global [7777 x i64] zeroinitializer, align 16
@hayamisaori = dso_local local_unnamed_addr global [7777 x i8] zeroinitializer, align 16
@igutiyuka = dso_local local_unnamed_addr global [7777 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @kugyu(i64 noundef %sakura, i64 noundef %oonisi) local_unnamed_addr #0 {
entry:
%add = add nsw i64 %oonisi, %sakura
%spec.store.select = tail call i64 @llvm.smin.i64(i64 %add, i64 77777777777777777)
%spec.store.select4 = tail call i64 @llvm.smax.i64(i64 %spec.store.select, i64 -77777777777777777)
ret i64 %spec.store.select4
}
; 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, ptr noundef nonnull @M, ptr noundef nonnull @P)
%cmp.not = icmp eq i32 %call, 3
br i1 %cmp.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %entry
%0 = load i32, ptr @M, align 4, !tbaa !5
%cmp1221 = icmp sgt i32 %0, 0
br i1 %cmp1221, label %for.body, label %for.cond12.preheader
for.cond12.preheader: ; preds = %if.end9, %for.cond.preheader
%.lcssa219 = phi i32 [ %0, %for.cond.preheader ], [ %10, %if.end9 ]
%1 = load i32, ptr @N, align 4, !tbaa !5
%cmp13.not223 = icmp slt i32 %1, 1
br i1 %cmp13.not223, label %for.end21, label %for.body14.preheader
for.body14.preheader: ; preds = %for.cond12.preheader
%2 = zext i32 %1 to i64
tail call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds ([7777 x i8], ptr @hayamisaori, i64 0, i64 1), i8 0, i64 %2, i1 false), !tbaa !9
%3 = add nuw i32 %1, 1
%wide.trip.count = zext i32 %3 to i64
%4 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %1, 4
br i1 %min.iters.check, label %for.body14.preheader263, label %vector.ph
vector.ph: ; preds = %for.body14.preheader
%n.vec = and i64 %4, -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 ]
%offset.idx = or i64 %index, 1
%5 = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %offset.idx
store <2 x i64> <i64 -77777777777777777, i64 -77777777777777777>, ptr %5, align 8, !tbaa !10
%6 = getelementptr inbounds i64, ptr %5, i64 2
store <2 x i64> <i64 -77777777777777777, i64 -77777777777777777>, ptr %6, align 8, !tbaa !10
%index.next = add nuw i64 %index, 4
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end21, label %for.body14.preheader263
for.body14.preheader263: ; preds = %for.body14.preheader, %middle.block
%indvars.iv239.ph = phi i64 [ 1, %for.body14.preheader ], [ %ind.end, %middle.block ]
br label %for.body14
for.body: ; preds = %for.cond.preheader, %if.end9
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end9 ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [7777 x i32], ptr @A, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [7777 x i32], ptr @B, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [7777 x i32], ptr @C, i64 0, i64 %indvars.iv
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx5)
%cmp7.not = icmp eq i32 %call6, 3
br i1 %cmp7.not, label %if.end9, label %cleanup
if.end9: ; preds = %for.body
%8 = load i32, ptr @P, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%sub = sub nsw i32 %9, %8
store i32 %sub, ptr %arrayidx5, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr @M, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp1, label %for.body, label %for.cond12.preheader, !llvm.loop !16
for.body14: ; preds = %for.body14.preheader263, %for.body14
%indvars.iv239 = phi i64 [ %indvars.iv.next240, %for.body14 ], [ %indvars.iv239.ph, %for.body14.preheader263 ]
%arrayidx16 = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %indvars.iv239
store i64 -77777777777777777, ptr %arrayidx16, align 8, !tbaa !10
%indvars.iv.next240 = add nuw nsw i64 %indvars.iv239, 1
%exitcond.not = icmp eq i64 %indvars.iv.next240, %wide.trip.count
br i1 %exitcond.not, label %for.end21, label %for.body14, !llvm.loop !17
for.end21: ; preds = %for.body14, %middle.block, %for.cond12.preheader
store i64 0, ptr getelementptr inbounds ([7777 x i64], ptr @hanazawakana, i64 0, i64 1), align 8, !tbaa !10
%idxprom22 = sext i32 %1 to i64
%arrayidx23 = getelementptr inbounds [7777 x i8], ptr @hayamisaori, i64 0, i64 %idxprom22
store i8 1, ptr %arrayidx23, align 1, !tbaa !9
%cmp25228 = icmp sgt i32 %.lcssa219, 0
br i1 %cmp25228, label %for.cond27.preheader.us.preheader, label %for.cond78.preheader
for.cond27.preheader.us.preheader: ; preds = %for.end21
%wide.trip.count245 = zext i32 %.lcssa219 to i64
br label %for.cond27.preheader.us
for.cond27.preheader.us: ; preds = %for.cond27.preheader.us.preheader, %for.cond27.for.end74_crit_edge.us
%i.2229.us = phi i32 [ %inc76.us, %for.cond27.for.end74_crit_edge.us ], [ 0, %for.cond27.preheader.us.preheader ]
br label %for.body29.us
for.body29.us: ; preds = %for.cond27.preheader.us, %for.inc72.us
%indvars.iv242 = phi i64 [ 0, %for.cond27.preheader.us ], [ %indvars.iv.next243, %for.inc72.us ]
%arrayidx31.us = getelementptr inbounds [7777 x i32], ptr @A, i64 0, i64 %indvars.iv242
%12 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5
%idxprom32.us = sext i32 %12 to i64
%arrayidx33.us = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %idxprom32.us
%13 = load i64, ptr %arrayidx33.us, align 8, !tbaa !10
%cmp34.us = icmp sgt i64 %13, -77777777777777777
br i1 %cmp34.us, label %land.lhs.true.us, label %for.body29.us.if.end61.us_crit_edge
for.body29.us.if.end61.us_crit_edge: ; preds = %for.body29.us
%arrayidx63.us.phi.trans.insert = getelementptr inbounds [7777 x i32], ptr @B, i64 0, i64 %indvars.iv242
%.pre = load i32, ptr %arrayidx63.us.phi.trans.insert, align 4, !tbaa !5
%.pre262 = sext i32 %.pre to i64
br label %if.end61.us
land.lhs.true.us: ; preds = %for.body29.us
%arrayidx40.us = getelementptr inbounds [7777 x i32], ptr @C, i64 0, i64 %indvars.iv242
%14 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5
%conv.us = sext i32 %14 to i64
%add.i.us = add nsw i64 %13, %conv.us
%spec.store.select.i.us = tail call i64 @llvm.smin.i64(i64 %add.i.us, i64 77777777777777777)
%spec.store.select4.i.us = tail call i64 @llvm.smax.i64(i64 %spec.store.select.i.us, i64 -77777777777777777)
%arrayidx43.us = getelementptr inbounds [7777 x i32], ptr @B, i64 0, i64 %indvars.iv242
%15 = load i32, ptr %arrayidx43.us, align 4, !tbaa !5
%idxprom44.us = sext i32 %15 to i64
%arrayidx45.us = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %idxprom44.us
%16 = load i64, ptr %arrayidx45.us, align 8, !tbaa !10
%cmp46.us = icmp sgt i64 %spec.store.select4.i.us, %16
br i1 %cmp46.us, label %if.then48.us, label %if.end61.us
if.then48.us: ; preds = %land.lhs.true.us
store i64 %spec.store.select4.i.us, ptr %arrayidx45.us, align 8, !tbaa !10
br label %if.end61.us
if.end61.us: ; preds = %for.body29.us.if.end61.us_crit_edge, %if.then48.us, %land.lhs.true.us
%idxprom64.us.pre-phi = phi i64 [ %.pre262, %for.body29.us.if.end61.us_crit_edge ], [ %idxprom44.us, %if.then48.us ], [ %idxprom44.us, %land.lhs.true.us ]
%arrayidx65.us = getelementptr inbounds [7777 x i8], ptr @hayamisaori, i64 0, i64 %idxprom64.us.pre-phi
%17 = load i8, ptr %arrayidx65.us, align 1, !tbaa !9
%tobool.not.us = icmp eq i8 %17, 0
br i1 %tobool.not.us, label %for.inc72.us, label %if.then66.us
if.then66.us: ; preds = %if.end61.us
%arrayidx70.us = getelementptr inbounds [7777 x i8], ptr @hayamisaori, i64 0, i64 %idxprom32.us
store i8 1, ptr %arrayidx70.us, align 1, !tbaa !9
br label %for.inc72.us
for.inc72.us: ; preds = %if.then66.us, %if.end61.us
%indvars.iv.next243 = add nuw nsw i64 %indvars.iv242, 1
%exitcond246.not = icmp eq i64 %indvars.iv.next243, %wide.trip.count245
br i1 %exitcond246.not, label %for.cond27.for.end74_crit_edge.us, label %for.body29.us, !llvm.loop !18
for.cond27.for.end74_crit_edge.us: ; preds = %for.inc72.us
%inc76.us = add nuw nsw i32 %i.2229.us, 1
%exitcond247.not = icmp eq i32 %inc76.us, %.lcssa219
br i1 %exitcond247.not, label %for.cond78.preheader, label %for.cond27.preheader.us, !llvm.loop !19
for.cond78.preheader: ; preds = %for.cond27.for.end74_crit_edge.us, %for.end21
br i1 %cmp13.not223, label %for.cond89.preheader, label %for.body81.preheader
for.body81.preheader: ; preds = %for.cond78.preheader
%18 = zext i32 %1 to i64
%19 = shl nuw nsw i64 %18, 3
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 getelementptr inbounds ([7777 x i64], ptr @igutiyuka, i64 0, i64 1), ptr nonnull align 8 getelementptr inbounds ([7777 x i64], ptr @hanazawakana, i64 0, i64 1), i64 %19, i1 false), !tbaa !10
br label %for.cond89.preheader
for.cond89.preheader: ; preds = %for.body81.preheader, %for.cond78.preheader
br i1 %cmp25228, label %for.cond94.preheader.us.preheader, label %for.cond139.preheader
for.cond94.preheader.us.preheader: ; preds = %for.cond89.preheader
%wide.trip.count254 = zext i32 %.lcssa219 to i64
br label %for.cond94.preheader.us
for.cond94.preheader.us: ; preds = %for.cond94.preheader.us.preheader, %for.cond94.for.end135_crit_edge.us
%i.4235.us = phi i32 [ %inc137.us, %for.cond94.for.end135_crit_edge.us ], [ 0, %for.cond94.preheader.us.preheader ]
br label %for.body97.us
for.body97.us: ; preds = %for.cond94.preheader.us, %for.inc133.us
%indvars.iv251 = phi i64 [ 0, %for.cond94.preheader.us ], [ %indvars.iv.next252, %for.inc133.us ]
%arrayidx99.us = getelementptr inbounds [7777 x i32], ptr @A, i64 0, i64 %indvars.iv251
%20 = load i32, ptr %arrayidx99.us, align 4, !tbaa !5
%idxprom100.us = sext i32 %20 to i64
%arrayidx101.us = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %idxprom100.us
%21 = load i64, ptr %arrayidx101.us, align 8, !tbaa !10
%cmp102.us = icmp sgt i64 %21, -77777777777777777
br i1 %cmp102.us, label %land.lhs.true104.us, label %for.inc133.us
land.lhs.true104.us: ; preds = %for.body97.us
%arrayidx110.us = getelementptr inbounds [7777 x i32], ptr @C, i64 0, i64 %indvars.iv251
%22 = load i32, ptr %arrayidx110.us, align 4, !tbaa !5
%conv111.us = sext i32 %22 to i64
%add.i213.us = add nsw i64 %21, %conv111.us
%spec.store.select.i214.us = tail call i64 @llvm.smin.i64(i64 %add.i213.us, i64 77777777777777777)
%spec.store.select4.i215.us = tail call i64 @llvm.smax.i64(i64 %spec.store.select.i214.us, i64 -77777777777777777)
%arrayidx114.us = getelementptr inbounds [7777 x i32], ptr @B, i64 0, i64 %indvars.iv251
%23 = load i32, ptr %arrayidx114.us, align 4, !tbaa !5
%idxprom115.us = sext i32 %23 to i64
%arrayidx116.us = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %idxprom115.us
%24 = load i64, ptr %arrayidx116.us, align 8, !tbaa !10
%cmp117.us = icmp sgt i64 %spec.store.select4.i215.us, %24
br i1 %cmp117.us, label %if.then119.us, label %for.inc133.us
if.then119.us: ; preds = %land.lhs.true104.us
store i64 %spec.store.select4.i215.us, ptr %arrayidx116.us, align 8, !tbaa !10
br label %for.inc133.us
for.inc133.us: ; preds = %if.then119.us, %land.lhs.true104.us, %for.body97.us
%indvars.iv.next252 = add nuw nsw i64 %indvars.iv251, 1
%exitcond255.not = icmp eq i64 %indvars.iv.next252, %wide.trip.count254
br i1 %exitcond255.not, label %for.cond94.for.end135_crit_edge.us, label %for.body97.us, !llvm.loop !20
for.cond94.for.end135_crit_edge.us: ; preds = %for.inc133.us
%inc137.us = add nuw nsw i32 %i.4235.us, 1
%exitcond256.not = icmp eq i32 %inc137.us, %.lcssa219
br i1 %exitcond256.not, label %for.cond139.preheader, label %for.cond94.preheader.us, !llvm.loop !21
for.cond139.preheader: ; preds = %for.cond94.for.end135_crit_edge.us, %for.cond89.preheader
br i1 %cmp13.not223, label %for.end159, label %for.body142.preheader
for.body142.preheader: ; preds = %for.cond139.preheader
%25 = add nuw i32 %1, 1
%wide.trip.count260 = zext i32 %25 to i64
br label %for.body142
for.body142: ; preds = %for.body142.preheader, %for.inc157
%indvars.iv257 = phi i64 [ 1, %for.body142.preheader ], [ %indvars.iv.next258, %for.inc157 ]
%arrayidx144 = getelementptr inbounds [7777 x i8], ptr @hayamisaori, i64 0, i64 %indvars.iv257
%26 = load i8, ptr %arrayidx144, align 1, !tbaa !9
%tobool146.not = icmp eq i8 %26, 0
br i1 %tobool146.not, label %for.inc157, label %land.lhs.true147
land.lhs.true147: ; preds = %for.body142
%arrayidx149 = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %indvars.iv257
%27 = load i64, ptr %arrayidx149, align 8, !tbaa !10
%arrayidx151 = getelementptr inbounds [7777 x i64], ptr @igutiyuka, i64 0, i64 %indvars.iv257
%28 = load i64, ptr %arrayidx151, align 8, !tbaa !10
%cmp152 = icmp sgt i64 %27, %28
br i1 %cmp152, label %if.then154, label %for.inc157
if.then154: ; preds = %land.lhs.true147
%call155 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
for.inc157: ; preds = %for.body142, %land.lhs.true147
%indvars.iv.next258 = add nuw nsw i64 %indvars.iv257, 1
%exitcond261.not = icmp eq i64 %indvars.iv.next258, %wide.trip.count260
br i1 %exitcond261.not, label %for.end159, label %for.body142, !llvm.loop !22
for.end159: ; preds = %for.inc157, %for.cond139.preheader
%arrayidx161 = getelementptr inbounds [7777 x i64], ptr @hanazawakana, i64 0, i64 %idxprom22
%29 = load i64, ptr %arrayidx161, align 8, !tbaa !10
%spec.select = tail call i64 @llvm.smax.i64(i64 %29, i64 0)
%call166 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select)
br label %cleanup
cleanup: ; preds = %for.body, %entry, %for.end159, %if.then154
%retval.0 = phi i32 [ 0, %if.then154 ], [ 0, %for.end159 ], [ 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 #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = distinct !{!12, !13, !14, !15}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13, !15, !14}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
|
//#include "oj/atcoder.h"
//#include "std.h"
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <float.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define SWAP(T,a,b) do { T _tmp=a; a=b; b=_tmp; } while (0)
//#include "oj/io.h"
void print_ai(int *a, int n) {
for (int i=0; i<n; i++) {
if (i) printf(" ");
printf("%d", a[i]);
}
printf("\n");
}
void scan_ai(int *a, int n) {
for (int i=0; i<n; i++)
scanf("%d", &a[i]);
}
//#include "oj/debug.h"
void print_hr() {
printf("---------------------------\n");
}
int main() {
int n;
while (scanf("%d", &n)==1) {
int a[n];
scan_ai(a, n);
// 2 0 1 3
// 4 2 0 1 3
int p = n-1;
printf("%d", a[n-1]);
p -= 2;
while (p >=0) {
printf(" %d", a[p]);
p -= 2;
}
p = (n%2==0 ? 0: 1);
while (p < n) {
printf(" %d", a[p]);
p += 2;
}
printf("\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118876/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118876/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@str = private unnamed_addr constant [28 x i8] c"---------------------------\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_ai(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.cond.cleanup
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %a, align 4, !tbaa !5
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.cond.cleanup, label %if.end
for.cond.cleanup: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %if.end, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 @scan_ai(ptr noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i32 %n, 0
br i1 %cmp3, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !12
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_hr() local_unnamed_addr #0 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%cmp32 = icmp eq i32 %call31, 1
br i1 %cmp32, label %while.body, label %while.end20
while.body: ; preds = %entry, %while.end18
%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
%cmp3.i = icmp sgt i32 %3, 0
br i1 %cmp3.i, label %for.body.preheader.i, label %scan_ai.exit
for.body.preheader.i: ; preds = %while.body
%wide.trip.count.i = zext i32 %3 to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx.i)
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %scan_ai.exit.loopexit, label %for.body.i, !llvm.loop !12
scan_ai.exit.loopexit: ; preds = %for.body.i
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %scan_ai.exit
scan_ai.exit: ; preds = %scan_ai.exit.loopexit, %while.body
%4 = phi i32 [ %.pre, %scan_ai.exit.loopexit ], [ %3, %while.body ]
%sub = add nsw i32 %4, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %idxprom
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%cmp527 = icmp sgt i32 %4, 2
br i1 %cmp527, label %while.body6.preheader, label %while.end
while.body6.preheader: ; preds = %scan_ai.exit
%sub3 = add nsw i32 %4, -3
br label %while.body6
while.body6: ; preds = %while.body6.preheader, %while.body6
%p.028 = phi i32 [ %sub10, %while.body6 ], [ %sub3, %while.body6.preheader ]
%idxprom7 = zext i32 %p.028 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %6)
%sub10 = add nsw i32 %p.028, -2
%cmp5 = icmp ugt i32 %p.028, 1
br i1 %cmp5, label %while.body6, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body6, %scan_ai.exit
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp1329 = icmp sgt i32 %7, 1
br i1 %cmp1329, label %while.body14.preheader, label %while.end18
while.body14.preheader: ; preds = %while.end
%8 = and i32 %7, 1
%9 = zext i32 %8 to i64
br label %while.body14
while.body14: ; preds = %while.body14.preheader, %while.body14
%indvars.iv = phi i64 [ %9, %while.body14.preheader ], [ %indvars.iv.next, %while.body14 ]
%arrayidx16 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %10)
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = trunc i64 %indvars.iv.next to i32
%cmp13 = icmp sgt i32 %11, %12
br i1 %cmp13, label %while.body14, label %while.end18, !llvm.loop !14
while.end18: ; preds = %while.body14, %while.end
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%cmp = icmp eq i32 %call, 1
br i1 %cmp, label %while.body, label %while.end20, !llvm.loop !15
while.end20: ; preds = %while.end18, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
int main(void)
{
int q1, b, c1, c2, q2;
while (scanf("%d %d %d %d %d", &q1, &b, &c1, &c2, &q2), q1){
int jidori = min(b / c1, q2);
int chicken = (b - c1 * jidori) / c2;
int remain = q1 - jidori - chicken;
b -= jidori * c1 + chicken * c2;
while (c1 > c2 && jidori > 1 && remain > 0){
jidori--;
b += c1;
chicken += b / c2;
remain -= b / c2 - 1;
b %= c2;
}
if (jidori + chicken < q1 || jidori == 0){
puts("NA");
}
else {
printf("%d %d\n", jidori, chicken);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118919/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118919/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"NA\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q1 = alloca i32, align 4
%b = alloca i32, align 4
%c1 = alloca i32, align 4
%c2 = alloca i32, align 4
%q2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q2) #4
%call52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q1, ptr noundef nonnull %b, ptr noundef nonnull %c1, ptr noundef nonnull %c2, ptr noundef nonnull %q2)
%0 = load i32, ptr %q1, align 4, !tbaa !5
%tobool.not53 = icmp eq i32 %0, 0
br i1 %tobool.not53, label %while.end24, label %while.body
while.body: ; preds = %entry, %if.end
%1 = phi i32 [ %8, %if.end ], [ %0, %entry ]
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %c1, align 4, !tbaa !5
%div = sdiv i32 %2, %3
%4 = load i32, ptr %q2, align 4, !tbaa !5
%div. = call i32 @llvm.smin.i32(i32 %div, i32 %4)
%mul = mul nsw i32 %div., %3
%sub = sub nsw i32 %2, %mul
%5 = load i32, ptr %c2, align 4, !tbaa !5
%div2 = sdiv i32 %sub, %5
%6 = add i32 %div., %div2
%sub4 = sub i32 %1, %6
%mul6 = mul nsw i32 %div2, %5
%7 = add i32 %mul, %mul6
%sub7 = sub i32 %2, %7
%cmp9 = icmp sgt i32 %3, %5
%cmp9.fr = freeze i1 %cmp9
%cmp1040 = icmp sgt i32 %div., 1
%or.cond41 = select i1 %cmp9.fr, i1 %cmp1040, i1 false
%cmp1142 = icmp sgt i32 %sub4, 0
%or.cond2643 = select i1 %or.cond41, i1 %cmp1142, i1 false
br i1 %or.cond2643, label %while.body12, label %while.end
while.body12: ; preds = %while.body, %while.body12
%remain.047 = phi i32 [ %sub18, %while.body12 ], [ %sub4, %while.body ]
%chicken.046 = phi i32 [ %add15, %while.body12 ], [ %div2, %while.body ]
%jidori.045 = phi i32 [ %dec, %while.body12 ], [ %div., %while.body ]
%storemerge44 = phi i32 [ %rem, %while.body12 ], [ %sub7, %while.body ]
%dec = add nsw i32 %jidori.045, -1
%add13 = add nsw i32 %storemerge44, %3
%div14 = sdiv i32 %add13, %5
%add15 = add nsw i32 %div14, %chicken.046
%sub17.neg = add nuw i32 %remain.047, 1
%sub18 = sub i32 %sub17.neg, %div14
%rem = srem i32 %add13, %5
%cmp10 = icmp ugt i32 %jidori.045, 2
%cmp11 = icmp sgt i32 %sub18, 0
%or.cond26 = select i1 %cmp10, i1 %cmp11, i1 false
br i1 %or.cond26, label %while.body12, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body12, %while.body
%storemerge.lcssa = phi i32 [ %sub7, %while.body ], [ %rem, %while.body12 ]
%jidori.0.lcssa = phi i32 [ %div., %while.body ], [ %dec, %while.body12 ]
%chicken.0.lcssa = phi i32 [ %div2, %while.body ], [ %add15, %while.body12 ]
store i32 %storemerge.lcssa, ptr %b, align 4, !tbaa !5
%add19 = add nsw i32 %chicken.0.lcssa, %jidori.0.lcssa
%cmp20 = icmp slt i32 %add19, %1
%cmp21 = icmp eq i32 %jidori.0.lcssa, 0
%or.cond25 = or i1 %cmp21, %cmp20
br i1 %or.cond25, label %if.then, label %if.else
if.then: ; preds = %while.end
%call22 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %while.end
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %jidori.0.lcssa, i32 noundef %chicken.0.lcssa)
br label %if.end
if.end: ; preds = %if.else, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q1, ptr noundef nonnull %b, ptr noundef nonnull %c1, ptr noundef nonnull %c2, ptr noundef nonnull %q2)
%8 = load i32, ptr %q1, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %while.end24, label %while.body, !llvm.loop !11
while.end24: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q1) #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: 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int n;
int a[20][20];
void rot(int r, int c, int size, int angle){
int time = angle/90, i;
for(i=0;i<time;i++){
int temp[20][20];
int j, k;
for(j=0;j<n;j++){
for(k=0;k<n;k++) temp[j][k] = a[j][k];
}
int l=r-1;
for(j=size-1;j>=0;j--){
for(k=0;k<size;k++) a[r-1+k][c-1+j] = temp[l][c-1+k];
l++;
}
}
return;
}
void rev(int r, int c, int size){
int i, j;
for(i=r-1;i<r+size-1;i++){
for(j=c-1;j<c+size-1;j++) a[i][j] = (a[i][j]+1)%2;
}
return;
}
void shf(int r, int o){
int lr;
if(o==2) lr=1;
else lr=-1;
int i, temp[n];
for(i=0;i<n;i++) temp[i]=a[r-1][i];
for(i=0;i<n;i++){
a[r-1][i] = temp[(i+lr+n)%n];
}
return;
}
void irev(int r, int c, int is){
int ser[4]={0, 1, 0, -1};
int i;
a[r][c] = is;
for(i=0;i<4;i++){
int nr = r+ser[i], nc = c+ser[i^1];
if(a[nr][nc]!=is && nr>=0 && nc>=0 && nr<n && nc<n){
irev(nr, nc, is);
}
}
return;
}
int main(){
int m;
scanf("%d %d", &n, &m);
int i, j;
for(i=0;i<n;i++){
for(j=0;j<n;j++) scanf("%d", &a[i][j]);
}
int ope;
for(ope=0;ope<m;ope++){
int o;
scanf("%d", &o);
if(o==0){
int r, c, size, angle;
scanf("%d %d %d %d", &r, &c, &size, &angle);
rot(r, c, size, angle);
}
else if(o==1){
int r, c, size;
scanf("%d %d %d", &r, &c, &size);
rev(r, c, size);
}
else if(o==2 || o==3){
int r;
scanf("%d", &r);
shf(r, o);
}
else if(o==4){
int r, c;
scanf("%d %d", &r, &c);
irev(r-1, c-1, (a[r-1][c-1]+1)%2);
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++) printf("%d%c", a[i][j], " \n"[j==n-1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_118962/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_118962/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@a = dso_local global [20 x [20 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.4 = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.5 = private unnamed_addr constant [3 x i8] c" \0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @rot(i32 noundef %r, i32 noundef %c, i32 noundef %size, i32 noundef %angle) local_unnamed_addr #0 {
entry:
%temp = alloca [20 x [20 x i32]], align 16
%div = sdiv i32 %angle, 90
%cmp73 = icmp sgt i32 %angle, 89
br i1 %cmp73, label %for.body.lr.ph, label %for.end44
for.body.lr.ph: ; preds = %entry
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp265 = icmp sgt i32 %0, 0
%sub = add i32 %r, -1
%cmp1870 = icmp sgt i32 %size, 0
%sub25 = add nsw i32 %c, -1
br i1 %cmp1870, label %for.body.lr.ph.split.us, label %for.body.lr.ph.split
for.body.lr.ph.split.us: ; preds = %for.body.lr.ph
br i1 %cmp265, label %for.body.us.us.preheader, label %for.body.us.preheader
for.body.us.preheader: ; preds = %for.body.lr.ph.split.us
%1 = sext i32 %sub25 to i64
%2 = sext i32 %sub to i64
%3 = zext i32 %size to i64
%wide.trip.count105 = zext i32 %size to i64
%xtraiter148 = and i64 %wide.trip.count105, 1
%4 = icmp eq i32 %size, 1
%unroll_iter151 = and i64 %wide.trip.count105, 4294967294
%lcmp.mod150.not = icmp eq i64 %xtraiter148, 0
br label %for.body.us
for.body.us.us.preheader: ; preds = %for.body.lr.ph.split.us
%5 = zext i32 %0 to i64
%6 = shl nuw nsw i64 %5, 2
%7 = sext i32 %sub25 to i64
%8 = sext i32 %sub to i64
%9 = zext i32 %size to i64
%wide.trip.count131 = zext i32 %size to i64
%xtraiter153 = and i64 %5, 3
%10 = icmp ult i32 %0, 4
%unroll_iter156 = and i64 %5, 4294967292
%lcmp.mod155.not = icmp eq i64 %xtraiter153, 0
%xtraiter158 = and i64 %wide.trip.count131, 1
%11 = icmp eq i32 %size, 1
%unroll_iter161 = and i64 %wide.trip.count131, 4294967294
%lcmp.mod160.not = icmp eq i64 %xtraiter158, 0
br label %for.body.us.us
for.body.us.us: ; preds = %for.body.us.us.preheader, %for.cond17.for.end41_crit_edge.split.us.us.us
%i.074.us.us = phi i32 [ %inc43.us.us, %for.cond17.for.end41_crit_edge.split.us.us.us ], [ 0, %for.body.us.us.preheader ]
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %temp) #6
br i1 %10, label %for.cond20.preheader.us.us.us.preheader.unr-lcssa, label %for.cond4.preheader.us.us.us
for.cond4.preheader.us.us.us: ; preds = %for.body.us.us, %for.cond4.preheader.us.us.us
%indvar116 = phi i64 [ %indvar.next117.3, %for.cond4.preheader.us.us.us ], [ 0, %for.body.us.us ]
%niter157 = phi i64 [ %niter157.next.3, %for.cond4.preheader.us.us.us ], [ 0, %for.body.us.us ]
%12 = mul nuw nsw i64 %indvar116, 80
%scevgep118 = getelementptr i8, ptr %temp, i64 %12
%scevgep119 = getelementptr i8, ptr @a, i64 %12
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep118, ptr align 16 %scevgep119, i64 %6, i1 false), !tbaa !5
%13 = mul nuw i64 %indvar116, 80
%14 = add nuw i64 %13, 80
%scevgep118.1 = getelementptr i8, ptr %temp, i64 %14
%scevgep119.1 = getelementptr i8, ptr @a, i64 %14
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep118.1, ptr align 16 %scevgep119.1, i64 %6, i1 false), !tbaa !5
%15 = mul nuw i64 %indvar116, 80
%16 = add nuw i64 %15, 160
%scevgep118.2 = getelementptr i8, ptr %temp, i64 %16
%scevgep119.2 = getelementptr i8, ptr @a, i64 %16
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep118.2, ptr align 16 %scevgep119.2, i64 %6, i1 false), !tbaa !5
%17 = mul nuw i64 %indvar116, 80
%18 = add nuw i64 %17, 240
%scevgep118.3 = getelementptr i8, ptr %temp, i64 %18
%scevgep119.3 = getelementptr i8, ptr @a, i64 %18
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep118.3, ptr align 16 %scevgep119.3, i64 %6, i1 false), !tbaa !5
%indvar.next117.3 = add nuw nsw i64 %indvar116, 4
%niter157.next.3 = add i64 %niter157, 4
%niter157.ncmp.3 = icmp eq i64 %niter157.next.3, %unroll_iter156
br i1 %niter157.ncmp.3, label %for.cond20.preheader.us.us.us.preheader.unr-lcssa, label %for.cond4.preheader.us.us.us, !llvm.loop !9
for.cond20.preheader.us.us.us.preheader.unr-lcssa: ; preds = %for.cond4.preheader.us.us.us, %for.body.us.us
%indvar116.unr = phi i64 [ 0, %for.body.us.us ], [ %indvar.next117.3, %for.cond4.preheader.us.us.us ]
br i1 %lcmp.mod155.not, label %for.cond20.preheader.us.us.us.preheader, label %for.cond4.preheader.us.us.us.epil
for.cond4.preheader.us.us.us.epil: ; preds = %for.cond20.preheader.us.us.us.preheader.unr-lcssa, %for.cond4.preheader.us.us.us.epil
%indvar116.epil = phi i64 [ %indvar.next117.epil, %for.cond4.preheader.us.us.us.epil ], [ %indvar116.unr, %for.cond20.preheader.us.us.us.preheader.unr-lcssa ]
%epil.iter154 = phi i64 [ %epil.iter154.next, %for.cond4.preheader.us.us.us.epil ], [ 0, %for.cond20.preheader.us.us.us.preheader.unr-lcssa ]
%19 = mul nuw nsw i64 %indvar116.epil, 80
%scevgep118.epil = getelementptr i8, ptr %temp, i64 %19
%scevgep119.epil = getelementptr i8, ptr @a, i64 %19
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep118.epil, ptr align 16 %scevgep119.epil, i64 %6, i1 false), !tbaa !5
%indvar.next117.epil = add nuw nsw i64 %indvar116.epil, 1
%epil.iter154.next = add i64 %epil.iter154, 1
%epil.iter154.cmp.not = icmp eq i64 %epil.iter154.next, %xtraiter153
br i1 %epil.iter154.cmp.not, label %for.cond20.preheader.us.us.us.preheader, label %for.cond4.preheader.us.us.us.epil, !llvm.loop !11
for.cond20.preheader.us.us.us.preheader: ; preds = %for.cond4.preheader.us.us.us.epil, %for.cond20.preheader.us.us.us.preheader.unr-lcssa
br label %for.cond20.preheader.us.us.us
for.cond20.preheader.us.us.us: ; preds = %for.cond20.preheader.us.us.us.preheader, %for.cond20.for.end38_crit_edge.us.us.us
%indvars.iv136 = phi i64 [ %indvars.iv.next137, %for.cond20.for.end38_crit_edge.us.us.us ], [ %8, %for.cond20.preheader.us.us.us.preheader ]
%indvars.iv133.in = phi i64 [ %indvars.iv133, %for.cond20.for.end38_crit_edge.us.us.us ], [ %9, %for.cond20.preheader.us.us.us.preheader ]
%indvars.iv133 = add nsw i64 %indvars.iv133.in, -1
%20 = add nsw i64 %indvars.iv133, %7
br i1 %11, label %for.cond20.for.end38_crit_edge.us.us.us.unr-lcssa, label %for.body22.us.us.us
for.body22.us.us.us: ; preds = %for.cond20.preheader.us.us.us, %for.body22.us.us.us
%indvars.iv126 = phi i64 [ %indvars.iv.next127.1, %for.body22.us.us.us ], [ 0, %for.cond20.preheader.us.us.us ]
%niter162 = phi i64 [ %niter162.next.1, %for.body22.us.us.us ], [ 0, %for.cond20.preheader.us.us.us ]
%21 = add nsw i64 %indvars.iv126, %7
%arrayidx27.us.us.us = getelementptr inbounds [20 x [20 x i32]], ptr %temp, i64 0, i64 %indvars.iv136, i64 %21
%22 = load i32, ptr %arrayidx27.us.us.us, align 4, !tbaa !5
%23 = add nsw i64 %indvars.iv126, %8
%arrayidx35.us.us.us = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %23, i64 %20
store i32 %22, ptr %arrayidx35.us.us.us, align 4, !tbaa !5
%indvars.iv.next127 = or i64 %indvars.iv126, 1
%24 = add nsw i64 %indvars.iv.next127, %7
%arrayidx27.us.us.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr %temp, i64 0, i64 %indvars.iv136, i64 %24
%25 = load i32, ptr %arrayidx27.us.us.us.1, align 4, !tbaa !5
%26 = add nsw i64 %indvars.iv.next127, %8
%arrayidx35.us.us.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %26, i64 %20
store i32 %25, ptr %arrayidx35.us.us.us.1, align 4, !tbaa !5
%indvars.iv.next127.1 = add nuw nsw i64 %indvars.iv126, 2
%niter162.next.1 = add i64 %niter162, 2
%niter162.ncmp.1 = icmp eq i64 %niter162.next.1, %unroll_iter161
br i1 %niter162.ncmp.1, label %for.cond20.for.end38_crit_edge.us.us.us.unr-lcssa, label %for.body22.us.us.us, !llvm.loop !13
for.cond20.for.end38_crit_edge.us.us.us.unr-lcssa: ; preds = %for.body22.us.us.us, %for.cond20.preheader.us.us.us
%indvars.iv126.unr = phi i64 [ 0, %for.cond20.preheader.us.us.us ], [ %indvars.iv.next127.1, %for.body22.us.us.us ]
br i1 %lcmp.mod160.not, label %for.cond20.for.end38_crit_edge.us.us.us, label %for.body22.us.us.us.epil
for.body22.us.us.us.epil: ; preds = %for.cond20.for.end38_crit_edge.us.us.us.unr-lcssa
%27 = add nsw i64 %indvars.iv126.unr, %7
%arrayidx27.us.us.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr %temp, i64 0, i64 %indvars.iv136, i64 %27
%28 = load i32, ptr %arrayidx27.us.us.us.epil, align 4, !tbaa !5
%29 = add nsw i64 %indvars.iv126.unr, %8
%arrayidx35.us.us.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %29, i64 %20
store i32 %28, ptr %arrayidx35.us.us.us.epil, align 4, !tbaa !5
br label %for.cond20.for.end38_crit_edge.us.us.us
for.cond20.for.end38_crit_edge.us.us.us: ; preds = %for.cond20.for.end38_crit_edge.us.us.us.unr-lcssa, %for.body22.us.us.us.epil
%indvars.iv.next137 = add nsw i64 %indvars.iv136, 1
%cmp18.us.us.us = icmp sgt i64 %indvars.iv133.in, 1
br i1 %cmp18.us.us.us, label %for.cond20.preheader.us.us.us, label %for.cond17.for.end41_crit_edge.split.us.us.us, !llvm.loop !14
for.cond17.for.end41_crit_edge.split.us.us.us: ; preds = %for.cond20.for.end38_crit_edge.us.us.us
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %temp) #6
%inc43.us.us = add nuw nsw i32 %i.074.us.us, 1
%exitcond141.not = icmp eq i32 %inc43.us.us, %div
br i1 %exitcond141.not, label %for.end44, label %for.body.us.us, !llvm.loop !15
for.body.us: ; preds = %for.body.us.preheader, %for.cond17.for.end41_crit_edge.split.us.us
%i.074.us = phi i32 [ %inc43.us, %for.cond17.for.end41_crit_edge.split.us.us ], [ 0, %for.body.us.preheader ]
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %temp) #6
br label %for.cond20.preheader.us.us
for.cond20.preheader.us.us: ; preds = %for.cond20.for.end38_crit_edge.us.us, %for.body.us
%indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.cond20.for.end38_crit_edge.us.us ], [ %2, %for.body.us ]
%indvars.iv107.in = phi i64 [ %indvars.iv107, %for.cond20.for.end38_crit_edge.us.us ], [ %3, %for.body.us ]
%indvars.iv107 = add nsw i64 %indvars.iv107.in, -1
%30 = add nsw i64 %indvars.iv107, %1
br i1 %4, label %for.cond20.for.end38_crit_edge.us.us.unr-lcssa, label %for.body22.us.us
for.body22.us.us: ; preds = %for.cond20.preheader.us.us, %for.body22.us.us
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body22.us.us ], [ 0, %for.cond20.preheader.us.us ]
%niter152 = phi i64 [ %niter152.next.1, %for.body22.us.us ], [ 0, %for.cond20.preheader.us.us ]
%31 = add nsw i64 %indvars.iv, %1
%arrayidx27.us.us = getelementptr inbounds [20 x [20 x i32]], ptr %temp, i64 0, i64 %indvars.iv110, i64 %31
%32 = load i32, ptr %arrayidx27.us.us, align 4, !tbaa !5
%33 = add nsw i64 %indvars.iv, %2
%arrayidx35.us.us = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %33, i64 %30
store i32 %32, ptr %arrayidx35.us.us, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%34 = add nsw i64 %indvars.iv.next, %1
%arrayidx27.us.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr %temp, i64 0, i64 %indvars.iv110, i64 %34
%35 = load i32, ptr %arrayidx27.us.us.1, align 4, !tbaa !5
%36 = add nsw i64 %indvars.iv.next, %2
%arrayidx35.us.us.1 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %36, i64 %30
store i32 %35, ptr %arrayidx35.us.us.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter152.next.1 = add i64 %niter152, 2
%niter152.ncmp.1 = icmp eq i64 %niter152.next.1, %unroll_iter151
br i1 %niter152.ncmp.1, label %for.cond20.for.end38_crit_edge.us.us.unr-lcssa, label %for.body22.us.us, !llvm.loop !13
for.cond20.for.end38_crit_edge.us.us.unr-lcssa: ; preds = %for.body22.us.us, %for.cond20.preheader.us.us
%indvars.iv.unr = phi i64 [ 0, %for.cond20.preheader.us.us ], [ %indvars.iv.next.1, %for.body22.us.us ]
br i1 %lcmp.mod150.not, label %for.cond20.for.end38_crit_edge.us.us, label %for.body22.us.us.epil
for.body22.us.us.epil: ; preds = %for.cond20.for.end38_crit_edge.us.us.unr-lcssa
%37 = add nsw i64 %indvars.iv.unr, %1
%arrayidx27.us.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr %temp, i64 0, i64 %indvars.iv110, i64 %37
%38 = load i32, ptr %arrayidx27.us.us.epil, align 4, !tbaa !5
%39 = add nsw i64 %indvars.iv.unr, %2
%arrayidx35.us.us.epil = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %39, i64 %30
store i32 %38, ptr %arrayidx35.us.us.epil, align 4, !tbaa !5
br label %for.cond20.for.end38_crit_edge.us.us
for.cond20.for.end38_crit_edge.us.us: ; preds = %for.cond20.for.end38_crit_edge.us.us.unr-lcssa, %for.body22.us.us.epil
%indvars.iv.next111 = add nsw i64 %indvars.iv110, 1
%cmp18.us.us = icmp sgt i64 %indvars.iv107.in, 1
br i1 %cmp18.us.us, label %for.cond20.preheader.us.us, label %for.cond17.for.end41_crit_edge.split.us.us, !llvm.loop !14
for.cond17.for.end41_crit_edge.split.us.us: ; preds = %for.cond20.for.end38_crit_edge.us.us
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %temp) #6
%inc43.us = add nuw nsw i32 %i.074.us, 1
%exitcond115.not = icmp eq i32 %inc43.us, %div
br i1 %exitcond115.not, label %for.end44, label %for.body.us, !llvm.loop !15
for.body.lr.ph.split: ; preds = %for.body.lr.ph
br i1 %cmp265, label %for.body.us75.preheader, label %for.end44
for.body.us75.preheader: ; preds = %for.body.lr.ph.split
%40 = zext i32 %0 to i64
%41 = shl nuw nsw i64 %40, 2
%xtraiter = and i64 %40, 3
%42 = icmp ult i32 %0, 4
%unroll_iter = and i64 %40, 4294967292
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body.us75
for.body.us75: ; preds = %for.body.us75.preheader, %for.cond1.for.end15_crit_edge.split.us.us94
%i.074.us76 = phi i32 [ %inc43.us78, %for.cond1.for.end15_crit_edge.split.us.us94 ], [ 0, %for.body.us75.preheader ]
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %temp) #6
br i1 %42, label %for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa, label %for.cond4.preheader.us.us81
for.cond4.preheader.us.us81: ; preds = %for.body.us75, %for.cond4.preheader.us.us81
%indvar = phi i64 [ %indvar.next.3, %for.cond4.preheader.us.us81 ], [ 0, %for.body.us75 ]
%niter = phi i64 [ %niter.next.3, %for.cond4.preheader.us.us81 ], [ 0, %for.body.us75 ]
%43 = mul nuw nsw i64 %indvar, 80
%scevgep = getelementptr i8, ptr %temp, i64 %43
%scevgep98 = getelementptr i8, ptr @a, i64 %43
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep, ptr align 16 %scevgep98, i64 %41, i1 false), !tbaa !5
%44 = mul nuw i64 %indvar, 80
%45 = add nuw i64 %44, 80
%scevgep.1 = getelementptr i8, ptr %temp, i64 %45
%scevgep98.1 = getelementptr i8, ptr @a, i64 %45
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep.1, ptr align 16 %scevgep98.1, i64 %41, i1 false), !tbaa !5
%46 = mul nuw i64 %indvar, 80
%47 = add nuw i64 %46, 160
%scevgep.2 = getelementptr i8, ptr %temp, i64 %47
%scevgep98.2 = getelementptr i8, ptr @a, i64 %47
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep.2, ptr align 16 %scevgep98.2, i64 %41, i1 false), !tbaa !5
%48 = mul nuw i64 %indvar, 80
%49 = add nuw i64 %48, 240
%scevgep.3 = getelementptr i8, ptr %temp, i64 %49
%scevgep98.3 = getelementptr i8, ptr @a, i64 %49
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep.3, ptr align 16 %scevgep98.3, i64 %41, i1 false), !tbaa !5
%indvar.next.3 = add nuw nsw i64 %indvar, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa, label %for.cond4.preheader.us.us81, !llvm.loop !9
for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa: ; preds = %for.cond4.preheader.us.us81, %for.body.us75
%indvar.unr = phi i64 [ 0, %for.body.us75 ], [ %indvar.next.3, %for.cond4.preheader.us.us81 ]
br i1 %lcmp.mod.not, label %for.cond1.for.end15_crit_edge.split.us.us94, label %for.cond4.preheader.us.us81.epil
for.cond4.preheader.us.us81.epil: ; preds = %for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa, %for.cond4.preheader.us.us81.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond4.preheader.us.us81.epil ], [ %indvar.unr, %for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond4.preheader.us.us81.epil ], [ 0, %for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa ]
%50 = mul nuw nsw i64 %indvar.epil, 80
%scevgep.epil = getelementptr i8, ptr %temp, i64 %50
%scevgep98.epil = getelementptr i8, ptr @a, i64 %50
call void @llvm.memcpy.p0.p0.i64(ptr align 16 %scevgep.epil, ptr align 16 %scevgep98.epil, i64 %41, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.for.end15_crit_edge.split.us.us94, label %for.cond4.preheader.us.us81.epil, !llvm.loop !16
for.cond1.for.end15_crit_edge.split.us.us94: ; preds = %for.cond4.preheader.us.us81.epil, %for.cond1.for.end15_crit_edge.split.us.us94.unr-lcssa
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %temp) #6
%inc43.us78 = add nuw nsw i32 %i.074.us76, 1
%exitcond101.not = icmp eq i32 %inc43.us78, %div
br i1 %exitcond101.not, label %for.end44, label %for.body.us75, !llvm.loop !15
for.end44: ; preds = %for.cond1.for.end15_crit_edge.split.us.us94, %for.cond17.for.end41_crit_edge.split.us.us, %for.cond17.for.end41_crit_edge.split.us.us.us, %for.body.lr.ph.split, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @rev(i32 noundef %r, i32 noundef %c, i32 noundef %size) local_unnamed_addr #2 {
entry:
%add = add i32 %r, -1
%sub1 = add i32 %add, %size
%cmp29.not = icmp slt i32 %sub1, %r
br i1 %cmp29.not, label %for.end17, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%sub2 = add i32 %c, -1
%sub5 = add i32 %sub2, %size
%cmp627.not = icmp slt i32 %sub5, %c
br i1 %cmp627.not, label %for.end17, label %for.body.us.preheader
for.body.us.preheader: ; preds = %for.body.lr.ph
%0 = sext i32 %sub2 to i64
%1 = sext i32 %add to i64
%2 = add i32 %size, -1
%3 = zext i32 %2 to i64
%4 = add nuw nsw i64 %3, 1
%min.iters.check = icmp ult i32 %2, 7
%n.vec = and i64 %4, 8589934584
%ind.end = add nsw i64 %n.vec, %0
%cmp.n = icmp eq i64 %4, %n.vec
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond3.for.inc15_crit_edge.us
%indvars.iv33 = phi i64 [ %1, %for.body.us.preheader ], [ %indvars.iv.next34, %for.cond3.for.inc15_crit_edge.us ]
br i1 %min.iters.check, label %for.body7.us.preheader, label %vector.body
vector.body: ; preds = %for.body.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body.us ]
%offset.idx = add i64 %index, %0
%5 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv33, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load38 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%8 = add nsw <4 x i32> %wide.load38, <i32 1, i32 1, i32 1, i32 1>
%9 = srem <4 x i32> %7, <i32 2, i32 2, i32 2, i32 2>
%10 = srem <4 x i32> %8, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %9, ptr %5, align 4, !tbaa !5
store <4 x i32> %10, ptr %6, align 4, !tbaa !5
%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 !17
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond3.for.inc15_crit_edge.us, label %for.body7.us.preheader
for.body7.us.preheader: ; preds = %for.body.us, %middle.block
%indvars.iv.ph = phi i64 [ %0, %for.body.us ], [ %ind.end, %middle.block ]
br label %for.body7.us
for.body7.us: ; preds = %for.body7.us.preheader, %for.body7.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body7.us ], [ %indvars.iv.ph, %for.body7.us.preheader ]
%arrayidx9.us = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv33, i64 %indvars.iv
%12 = load i32, ptr %arrayidx9.us, align 4, !tbaa !5
%add10.us = add nsw i32 %12, 1
%rem.us = srem i32 %add10.us, 2
store i32 %rem.us, ptr %arrayidx9.us, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %sub5, %lftr.wideiv
br i1 %exitcond.not, label %for.cond3.for.inc15_crit_edge.us, label %for.body7.us, !llvm.loop !20
for.cond3.for.inc15_crit_edge.us: ; preds = %for.body7.us, %middle.block
%indvars.iv.next34 = add nsw i64 %indvars.iv33, 1
%lftr.wideiv36 = trunc i64 %indvars.iv.next34 to i32
%exitcond37.not = icmp eq i32 %sub1, %lftr.wideiv36
br i1 %exitcond37.not, label %for.end17, label %for.body.us, !llvm.loop !21
for.end17: ; preds = %for.cond3.for.inc15_crit_edge.us, %for.body.lr.ph, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @shf(i32 noundef %r, i32 noundef %o) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%vla = alloca i32, i64 %1, align 16
%cmp128 = icmp sgt i32 %0, 0
br i1 %cmp128, label %for.body8.lr.ph, label %for.end19
for.body8.lr.ph: ; preds = %entry
%cmp = icmp eq i32 %o, 2
%. = select i1 %cmp, i32 1, i32 -1
%sub = add nsw i32 %r, -1
%idxprom = sext i32 %sub to i64
%2 = mul nsw i64 %idxprom, 80
%scevgep = getelementptr i8, ptr @a, i64 %2
%3 = shl nuw nsw i64 %1, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla, ptr align 16 %scevgep, i64 %3, i1 false), !tbaa !5
%add = add i32 %0, %.
%sub12 = add nsw i32 %r, -1
%idxprom13 = sext i32 %sub12 to i64
%xtraiter = and i64 %1, 1
%4 = icmp eq i32 %0, 1
br i1 %4, label %for.end19.loopexit.unr-lcssa, label %for.body8.lr.ph.new
for.body8.lr.ph.new: ; preds = %for.body8.lr.ph
%unroll_iter = and i64 %1, 4294967294
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.lr.ph.new
%indvars.iv = phi i64 [ 0, %for.body8.lr.ph.new ], [ %indvars.iv.next.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.lr.ph.new ], [ %niter.next.1, %for.body8 ]
%5 = trunc i64 %indvars.iv to i32
%add9 = add i32 %add, %5
%rem = srem i32 %add9, %0
%idxprom10 = sext i32 %rem to i64
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom13, i64 %indvars.iv
store i32 %6, ptr %arrayidx16, align 8, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%7 = trunc i64 %indvars.iv.next to i32
%add9.1 = add i32 %add, %7
%rem.1 = srem i32 %add9.1, %0
%idxprom10.1 = sext i32 %rem.1 to i64
%arrayidx11.1 = getelementptr inbounds i32, ptr %vla, i64 %idxprom10.1
%8 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%arrayidx16.1 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom13, i64 %indvars.iv.next
store i32 %8, ptr %arrayidx16.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end19.loopexit.unr-lcssa, label %for.body8, !llvm.loop !22
for.end19.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.lr.ph
%indvars.iv.unr = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end19, label %for.body8.epil
for.body8.epil: ; preds = %for.end19.loopexit.unr-lcssa
%9 = trunc i64 %indvars.iv.unr to i32
%add9.epil = add i32 %add, %9
%rem.epil = srem i32 %add9.epil, %0
%idxprom10.epil = sext i32 %rem.epil to i64
%arrayidx11.epil = getelementptr inbounds i32, ptr %vla, i64 %idxprom10.epil
%10 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%arrayidx16.epil = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom13, i64 %indvars.iv.unr
store i32 %10, ptr %arrayidx16.epil, align 4, !tbaa !5
br label %for.end19
for.end19: ; preds = %for.body8.epil, %for.end19.loopexit.unr-lcssa, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @irev(i32 noundef %r, i32 noundef %c, i32 noundef %is) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %land.lhs.true16.3, %entry
%r.tr = phi i32 [ %r, %entry ], [ %add.3, %land.lhs.true16.3 ]
%idxprom = sext i32 %r.tr to i64
%idxprom1 = sext i32 %c to i64
%arrayidx2 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom1
store i32 %is, ptr %arrayidx2, align 4, !tbaa !5
%add7 = add nsw i32 %c, 1
%idxprom10 = sext i32 %add7 to i64
%arrayidx11 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom10
%0 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%cmp12 = icmp ne i32 %0, %is
%1 = or i32 %add7, %r.tr
%2 = icmp sgt i32 %1, -1
%or.cond20 = and i1 %cmp12, %2
br i1 %or.cond20, label %land.lhs.true16, label %if.end
land.lhs.true16: ; preds = %tailrecurse
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %3, %r.tr
%cmp19 = icmp slt i32 %add7, %3
%or.cond = and i1 %cmp17, %cmp19
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true16
tail call void @irev(i32 noundef %r.tr, i32 noundef %add7, i32 noundef %is)
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true16, %tailrecurse
%add.1 = add nsw i32 %r.tr, 1
%idxprom8.1 = sext i32 %add.1 to i64
%arrayidx11.1 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom8.1, i64 %idxprom1
%4 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%cmp12.1 = icmp ne i32 %4, %is
%5 = or i32 %add.1, %c
%6 = icmp sgt i32 %5, -1
%or.cond20.1 = and i1 %cmp12.1, %6
br i1 %or.cond20.1, label %land.lhs.true16.1, label %if.end.1
land.lhs.true16.1: ; preds = %if.end
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp17.1 = icmp slt i32 %add.1, %7
%cmp19.1 = icmp sgt i32 %7, %c
%or.cond.1 = and i1 %cmp17.1, %cmp19.1
br i1 %or.cond.1, label %if.then.1, label %if.end.1
if.then.1: ; preds = %land.lhs.true16.1
tail call void @irev(i32 noundef %add.1, i32 noundef %c, i32 noundef %is)
br label %if.end.1
if.end.1: ; preds = %if.then.1, %land.lhs.true16.1, %if.end
%add7.2 = add nsw i32 %c, -1
%idxprom10.2 = sext i32 %add7.2 to i64
%arrayidx11.2 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom10.2
%8 = load i32, ptr %arrayidx11.2, align 4, !tbaa !5
%cmp12.2 = icmp ne i32 %8, %is
%9 = or i32 %add7.2, %r.tr
%10 = icmp sgt i32 %9, -1
%or.cond20.2 = and i1 %cmp12.2, %10
br i1 %or.cond20.2, label %land.lhs.true16.2, label %if.end.2
land.lhs.true16.2: ; preds = %if.end.1
%11 = load i32, ptr @n, align 4, !tbaa !5
%cmp17.2 = icmp sgt i32 %11, %r.tr
%cmp19.2 = icmp sge i32 %11, %c
%or.cond.2 = and i1 %cmp17.2, %cmp19.2
br i1 %or.cond.2, label %if.then.2, label %if.end.2
if.then.2: ; preds = %land.lhs.true16.2
tail call void @irev(i32 noundef %r.tr, i32 noundef %add7.2, i32 noundef %is)
br label %if.end.2
if.end.2: ; preds = %if.then.2, %land.lhs.true16.2, %if.end.1
%add.3 = add nsw i32 %r.tr, -1
%idxprom8.3 = sext i32 %add.3 to i64
%arrayidx11.3 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom8.3, i64 %idxprom1
%12 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5
%cmp12.3 = icmp ne i32 %12, %is
%13 = or i32 %add.3, %c
%14 = icmp sgt i32 %13, -1
%or.cond20.3 = and i1 %cmp12.3, %14
br i1 %or.cond20.3, label %land.lhs.true16.3, label %if.end.3
land.lhs.true16.3: ; preds = %if.end.2
%15 = load i32, ptr @n, align 4, !tbaa !5
%cmp17.3 = icmp sge i32 %15, %r.tr
%cmp19.3 = icmp sgt i32 %15, %c
%or.cond.3 = and i1 %cmp17.3, %cmp19.3
br i1 %or.cond.3, label %tailrecurse, label %if.end.3
if.end.3: ; preds = %land.lhs.true16.3, %if.end.2
ret void
}
; 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) #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%m = alloca i32, align 4
%o = alloca i32, align 4
%r = alloca i32, align 4
%c = alloca i32, align 4
%size = alloca i32, align 4
%angle = alloca i32, align 4
%r18 = alloca i32, align 4
%c19 = alloca i32, align 4
%size20 = alloca i32, align 4
%r26 = alloca i32, align 4
%r31 = alloca i32, align 4
%c32 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %m)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp84 = icmp sgt i32 %0, 0
br i1 %cmp84, label %for.cond1.preheader, label %for.cond10.preheader
for.cond1.preheader: ; preds = %entry, %for.inc7
%1 = phi i32 [ %6, %for.inc7 ], [ %0, %entry ]
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.inc7 ], [ 0, %entry ]
%cmp282 = icmp sgt i32 %1, 0
br i1 %cmp282, label %for.body3, label %for.cond1.preheader.for.inc7_crit_edge
for.cond1.preheader.for.inc7_crit_edge: ; preds = %for.cond1.preheader
%.pre104 = sext i32 %1 to i64
br label %for.inc7
for.cond10.preheader: ; preds = %for.inc7, %entry
%2 = phi i32 [ %0, %entry ], [ %6, %for.inc7 ]
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp1186 = icmp sgt i32 %3, 0
br i1 %cmp1186, label %for.body12, label %for.cond47.preheader
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv95, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !23
for.inc7: ; preds = %for.body3, %for.cond1.preheader.for.inc7_crit_edge
%.pre-phi = phi i64 [ %.pre104, %for.cond1.preheader.for.inc7_crit_edge ], [ %5, %for.body3 ]
%6 = phi i32 [ %1, %for.cond1.preheader.for.inc7_crit_edge ], [ %4, %for.body3 ]
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%cmp = icmp slt i64 %indvars.iv.next96, %.pre-phi
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !24
for.cond47.preheader.loopexit: ; preds = %if.end43
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond47.preheader
for.cond47.preheader: ; preds = %for.cond47.preheader.loopexit, %for.cond10.preheader
%7 = phi i32 [ %.pre, %for.cond47.preheader.loopexit ], [ %2, %for.cond10.preheader ]
%cmp4890 = icmp sgt i32 %7, 0
br i1 %cmp4890, label %for.cond50.preheader, label %for.end68
for.body12: ; preds = %for.cond10.preheader, %if.end43
%ope.087 = phi i32 [ %inc45, %if.end43 ], [ 0, %for.cond10.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %o) #6
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %o)
%8 = load i32, ptr %o, align 4
switch i32 %8, label %if.else22 [
i32 0, label %if.then
i32 1, label %if.then17
]
if.then: ; preds = %for.body12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %angle) #6
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %r, ptr noundef nonnull %c, ptr noundef nonnull %size, ptr noundef nonnull %angle)
%9 = load i32, ptr %r, align 4, !tbaa !5
%10 = load i32, ptr %c, align 4, !tbaa !5
%11 = load i32, ptr %size, align 4, !tbaa !5
%12 = load i32, ptr %angle, align 4, !tbaa !5
call void @rot(i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %angle) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
br label %if.end43
if.then17: ; preds = %for.body12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r18) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c19) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size20) #6
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %r18, ptr noundef nonnull %c19, ptr noundef nonnull %size20)
%13 = load i32, ptr %r18, align 4, !tbaa !5
%14 = load i32, ptr %size20, align 4, !tbaa !5
%add.i = add i32 %13, -1
%sub1.i = add i32 %add.i, %14
%cmp29.not.i = icmp slt i32 %sub1.i, %13
br i1 %cmp29.not.i, label %rev.exit, label %for.body.lr.ph.i
for.body.lr.ph.i: ; preds = %if.then17
%15 = load i32, ptr %c19, align 4, !tbaa !5
%sub2.i = add i32 %15, -1
%sub5.i = add i32 %sub2.i, %14
%cmp627.not.i = icmp slt i32 %sub5.i, %15
br i1 %cmp627.not.i, label %rev.exit, label %for.body.us.preheader.i
for.body.us.preheader.i: ; preds = %for.body.lr.ph.i
%16 = sext i32 %sub2.i to i64
%17 = sext i32 %add.i to i64
%18 = add i32 %14, -1
%19 = zext i32 %18 to i64
%20 = add nuw nsw i64 %19, 1
%min.iters.check = icmp ult i32 %18, 7
%n.vec = and i64 %20, 8589934584
%ind.end = add nsw i64 %n.vec, %16
%cmp.n = icmp eq i64 %20, %n.vec
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond3.for.inc15_crit_edge.us.i, %for.body.us.preheader.i
%indvars.iv33.i = phi i64 [ %17, %for.body.us.preheader.i ], [ %indvars.iv.next34.i, %for.cond3.for.inc15_crit_edge.us.i ]
br i1 %min.iters.check, label %for.body7.us.i.preheader, label %vector.body
vector.body: ; preds = %for.body.us.i, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body.us.i ]
%offset.idx = add i64 %index, %16
%21 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv33.i, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %21, align 4, !tbaa !5
%22 = getelementptr inbounds i32, ptr %21, i64 4
%wide.load115 = load <4 x i32>, ptr %22, align 4, !tbaa !5
%23 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%24 = add nsw <4 x i32> %wide.load115, <i32 1, i32 1, i32 1, i32 1>
%25 = srem <4 x i32> %23, <i32 2, i32 2, i32 2, i32 2>
%26 = srem <4 x i32> %24, <i32 2, i32 2, i32 2, i32 2>
store <4 x i32> %25, ptr %21, align 4, !tbaa !5
store <4 x i32> %26, ptr %22, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%27 = icmp eq i64 %index.next, %n.vec
br i1 %27, label %middle.block, label %vector.body, !llvm.loop !26
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond3.for.inc15_crit_edge.us.i, label %for.body7.us.i.preheader
for.body7.us.i.preheader: ; preds = %for.body.us.i, %middle.block
%indvars.iv.i.ph = phi i64 [ %16, %for.body.us.i ], [ %ind.end, %middle.block ]
br label %for.body7.us.i
for.body7.us.i: ; preds = %for.body7.us.i.preheader, %for.body7.us.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body7.us.i ], [ %indvars.iv.i.ph, %for.body7.us.i.preheader ]
%arrayidx9.us.i = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv33.i, i64 %indvars.iv.i
%28 = load i32, ptr %arrayidx9.us.i, align 4, !tbaa !5
%add10.us.i = add nsw i32 %28, 1
%rem.us.i = srem i32 %add10.us.i, 2
store i32 %rem.us.i, ptr %arrayidx9.us.i, align 4, !tbaa !5
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
%lftr.wideiv.i = trunc i64 %indvars.iv.next.i to i32
%exitcond.not.i = icmp eq i32 %sub5.i, %lftr.wideiv.i
br i1 %exitcond.not.i, label %for.cond3.for.inc15_crit_edge.us.i, label %for.body7.us.i, !llvm.loop !27
for.cond3.for.inc15_crit_edge.us.i: ; preds = %for.body7.us.i, %middle.block
%indvars.iv.next34.i = add nsw i64 %indvars.iv33.i, 1
%lftr.wideiv36.i = trunc i64 %indvars.iv.next34.i to i32
%exitcond37.not.i = icmp eq i32 %sub1.i, %lftr.wideiv36.i
br i1 %exitcond37.not.i, label %rev.exit, label %for.body.us.i, !llvm.loop !21
rev.exit: ; preds = %for.cond3.for.inc15_crit_edge.us.i, %if.then17, %for.body.lr.ph.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size20) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c19) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r18) #6
br label %if.end43
if.else22: ; preds = %for.body12
%29 = and i32 %8, -2
%or.cond = icmp eq i32 %29, 2
br i1 %or.cond, label %if.then25, label %if.else28
if.then25: ; preds = %if.else22
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r26) #6
%call27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %r26)
%30 = load i32, ptr %r26, align 4, !tbaa !5
%31 = load i32, ptr %o, align 4, !tbaa !5
call void @shf(i32 noundef %30, i32 noundef %31)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r26) #6
br label %if.end43
if.else28: ; preds = %if.else22
%cmp29 = icmp eq i32 %8, 4
br i1 %cmp29, label %if.then30, label %if.end43
if.then30: ; preds = %if.else28
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r31) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c32) #6
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r31, ptr noundef nonnull %c32)
%32 = load i32, ptr %r31, align 4, !tbaa !5
%sub = add nsw i32 %32, -1
%33 = load i32, ptr %c32, align 4, !tbaa !5
%sub34 = add nsw i32 %33, -1
%idxprom36 = sext i32 %sub to i64
%idxprom39 = sext i32 %sub34 to i64
%arrayidx40 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %idxprom36, i64 %idxprom39
%34 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%add = add nsw i32 %34, 1
%rem = srem i32 %add, 2
call void @irev(i32 noundef %sub, i32 noundef %sub34, i32 noundef %rem)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c32) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r31) #6
br label %if.end43
if.end43: ; preds = %rev.exit, %if.else28, %if.then30, %if.then25, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %o) #6
%inc45 = add nuw nsw i32 %ope.087, 1
%35 = load i32, ptr %m, align 4, !tbaa !5
%cmp11 = icmp slt i32 %inc45, %35
br i1 %cmp11, label %for.body12, label %for.cond47.preheader.loopexit, !llvm.loop !28
for.cond50.preheader: ; preds = %for.cond47.preheader, %for.inc66
%36 = phi i32 [ %43, %for.inc66 ], [ %7, %for.cond47.preheader ]
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.inc66 ], [ 0, %for.cond47.preheader ]
%cmp5188 = icmp sgt i32 %36, 0
br i1 %cmp5188, label %for.body52, label %for.cond50.preheader.for.inc66_crit_edge
for.cond50.preheader.for.inc66_crit_edge: ; preds = %for.cond50.preheader
%.pre105 = sext i32 %36 to i64
br label %for.inc66
for.body52: ; preds = %for.cond50.preheader, %for.body52
%indvars.iv98 = phi i64 [ %indvars.iv.next99, %for.body52 ], [ 0, %for.cond50.preheader ]
%37 = phi i32 [ %41, %for.body52 ], [ %36, %for.cond50.preheader ]
%arrayidx56 = getelementptr inbounds [20 x [20 x i32]], ptr @a, i64 0, i64 %indvars.iv101, i64 %indvars.iv98
%38 = load i32, ptr %arrayidx56, align 4, !tbaa !5
%sub57 = add nsw i32 %37, -1
%39 = zext i32 %sub57 to i64
%cmp58 = icmp eq i64 %indvars.iv98, %39
%idxprom59 = zext i1 %cmp58 to i64
%arrayidx60 = getelementptr inbounds [3 x i8], ptr @.str.5, i64 0, i64 %idxprom59
%40 = load i8, ptr %arrayidx60, align 1, !tbaa !29
%conv61 = sext i8 %40 to i32
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %38, i32 noundef %conv61)
%indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
%41 = load i32, ptr @n, align 4, !tbaa !5
%42 = sext i32 %41 to i64
%cmp51 = icmp slt i64 %indvars.iv.next99, %42
br i1 %cmp51, label %for.body52, label %for.inc66, !llvm.loop !30
for.inc66: ; preds = %for.body52, %for.cond50.preheader.for.inc66_crit_edge
%.pre-phi106 = phi i64 [ %.pre105, %for.cond50.preheader.for.inc66_crit_edge ], [ %42, %for.body52 ]
%43 = phi i32 [ %36, %for.cond50.preheader.for.inc66_crit_edge ], [ %41, %for.body52 ]
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%cmp48 = icmp slt i64 %indvars.iv.next102, %.pre-phi106
br i1 %cmp48, label %for.cond50.preheader, label %for.end68, !llvm.loop !31
for.end68: ; preds = %for.inc66, %for.cond47.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !10, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !10, !19, !18}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10, !25}
!25 = !{!"llvm.loop.unswitch.partial.disable"}
!26 = distinct !{!26, !10, !18, !19}
!27 = distinct !{!27, !10, !19, !18}
!28 = distinct !{!28, !10}
!29 = !{!7, !7, i64 0}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !10, !25}
|
#include <stdio.h>
#include <math.h>
int insertionSort(int a[1000010],int n, int g){
int count = 0;
for(int i = g; i < n; i++){
int v = a[i];
int j = i - g;
while(j >= 0 && a[j] > v){
a[j + g] = a[j];
j = j - g;
count++;
}
a[j + g] = v;
}
return count;
}
int main(void){
int a[1000010],n,m,i,g[1000010],count = 0;
int arr[] = {0,3,12,39,120,363,1092,3279,9840,29523,88572,265719,797160};
scanf("%d",&n);
for(i = 0; i < n; i++)scanf("%d",&a[i]);
for(i = 1; i < 13; i++){
if(arr[i - 1] < n && n <= arr[i])break;
}
m = i;
printf("%d\n",m);
for(i = 0; i < n; i++){
g[i] = arr[i] + 1;
}
for(i = m - 1; i >= 0; i--){
if(i != m - 1)printf(" ");
printf("%d",g[i]);
}
for(i = m - 1; i >= 0; i--){
count += insertionSort(a,n,g[i]);
}
printf("\n%d",count);
for(i = 0; i < n; i++)printf("\n%d",a[i]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119019/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119019/source.c"
target datalayout = "e-m:e-p270: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.arr = private unnamed_addr constant [13 x i32] [i32 0, i32 3, i32 12, i32 39, i32 120, i32 363, i32 1092, i32 3279, i32 9840, i32 29523, i32 88572, i32 265719, i32 797160], align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"\0A%d\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @insertionSort(ptr nocapture noundef %a, i32 noundef %n, i32 noundef %g) local_unnamed_addr #0 {
entry:
%cmp40 = icmp slt i32 %g, %n
br i1 %cmp40, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
for.cond.cleanup: ; preds = %while.end, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.lcssa.ph, %while.end ]
ret i32 %count.0.lcssa
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%count.042 = phi i32 [ 0, %for.body.preheader ], [ %count.1.lcssa.ph, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%j.036 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%i.0.pn35 = phi i32 [ %j.036, %while.body ], [ %2, %land.rhs.preheader ]
%count.134 = phi i32 [ %inc, %while.body ], [ %count.042, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.036 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn35 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nsw i32 %count.134, 1
%j.0 = sub nsw i32 %j.036, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !9
while.end: ; preds = %land.rhs, %while.body
%count.1.lcssa.ph = phi i32 [ %count.134, %land.rhs ], [ %inc, %while.body ]
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn35, %land.rhs ], [ %j.036, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %a, i64 %idxprom11
store i32 %1, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %land.rhs.preheader, !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 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 [1000010 x i32], align 16
%n = alloca i32, align 4
%g = alloca [1000010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000040, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4000040, ptr nonnull %g) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp87 = icmp sgt i32 %0, 0
br i1 %cmp87, label %for.body, label %for.inc11.11
for.cond2.preheader: ; preds = %for.body
%cmp7 = icmp sgt i32 %1, 0
br i1 %cmp7, label %land.lhs.true, label %for.inc11.11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000010 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !12
land.lhs.true: ; preds = %for.cond2.preheader
%cmp10.not = icmp ugt i32 %1, 3
br i1 %cmp10.not, label %land.lhs.true.1, label %for.end13
land.lhs.true.1: ; preds = %land.lhs.true
%cmp10.not.1 = icmp ugt i32 %1, 12
br i1 %cmp10.not.1, label %land.lhs.true.2, label %for.end13
land.lhs.true.2: ; preds = %land.lhs.true.1
%cmp10.not.2 = icmp ugt i32 %1, 39
br i1 %cmp10.not.2, label %land.lhs.true.3, label %for.end13
land.lhs.true.3: ; preds = %land.lhs.true.2
%cmp10.not.3 = icmp ugt i32 %1, 120
br i1 %cmp10.not.3, label %land.lhs.true.4, label %for.end13
land.lhs.true.4: ; preds = %land.lhs.true.3
%cmp10.not.4 = icmp ugt i32 %1, 363
br i1 %cmp10.not.4, label %land.lhs.true.5, label %for.end13
land.lhs.true.5: ; preds = %land.lhs.true.4
%cmp10.not.5 = icmp ugt i32 %1, 1092
br i1 %cmp10.not.5, label %land.lhs.true.6, label %for.end13
land.lhs.true.6: ; preds = %land.lhs.true.5
%cmp10.not.6 = icmp ugt i32 %1, 3279
br i1 %cmp10.not.6, label %land.lhs.true.7, label %for.end13
land.lhs.true.7: ; preds = %land.lhs.true.6
%cmp10.not.7 = icmp ugt i32 %1, 9840
br i1 %cmp10.not.7, label %land.lhs.true.8, label %for.end13
land.lhs.true.8: ; preds = %land.lhs.true.7
%cmp10.not.8 = icmp ugt i32 %1, 29523
br i1 %cmp10.not.8, label %land.lhs.true.9, label %for.end13
land.lhs.true.9: ; preds = %land.lhs.true.8
%cmp10.not.9 = icmp ugt i32 %1, 88572
br i1 %cmp10.not.9, label %land.lhs.true.10, label %for.end13
land.lhs.true.10: ; preds = %land.lhs.true.9
%cmp10.not.10 = icmp ugt i32 %1, 265719
br i1 %cmp10.not.10, label %land.lhs.true.11, label %for.end13
land.lhs.true.11: ; preds = %land.lhs.true.10
%cmp10.not.11 = icmp ugt i32 %1, 797160
br i1 %cmp10.not.11, label %for.inc11.11, label %for.end13
for.inc11.11: ; preds = %entry, %for.cond2.preheader, %land.lhs.true.11
br label %for.end13
for.end13: ; preds = %for.inc11.11, %land.lhs.true.11, %land.lhs.true.10, %land.lhs.true.9, %land.lhs.true.8, %land.lhs.true.7, %land.lhs.true.6, %land.lhs.true.5, %land.lhs.true.4, %land.lhs.true.3, %land.lhs.true.2, %land.lhs.true.1, %land.lhs.true
%i.1.lcssa = phi i32 [ 1, %land.lhs.true ], [ 2, %land.lhs.true.1 ], [ 3, %land.lhs.true.2 ], [ 4, %land.lhs.true.3 ], [ 5, %land.lhs.true.4 ], [ 6, %land.lhs.true.5 ], [ 7, %land.lhs.true.6 ], [ 8, %land.lhs.true.7 ], [ 9, %land.lhs.true.8 ], [ 10, %land.lhs.true.9 ], [ 11, %land.lhs.true.10 ], [ 12, %land.lhs.true.11 ], [ 13, %for.inc11.11 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.1.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp1690 = icmp sgt i32 %3, 0
br i1 %cmp1690, label %for.body17.preheader, label %if.end33.peel
for.body17.preheader: ; preds = %for.end13
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body17.preheader157, label %vector.ph
vector.ph: ; preds = %for.body17.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr inbounds [13 x i32], ptr @__const.main.arr, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load156 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%7 = add nsw <4 x i32> %wide.load156, <i32 1, i32 1, i32 1, i32 1>
%8 = getelementptr inbounds [1000010 x i32], ptr %g, i64 0, i64 %index
store <4 x i32> %6, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> %7, ptr %9, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %if.end33.peel, label %for.body17.preheader157
for.body17.preheader157: ; preds = %for.body17.preheader, %middle.block
%indvars.iv103.ph = phi i64 [ 0, %for.body17.preheader ], [ %n.vec, %middle.block ]
br label %for.body17
for.body17: ; preds = %for.body17.preheader157, %for.body17
%indvars.iv103 = phi i64 [ %indvars.iv.next104, %for.body17 ], [ %indvars.iv103.ph, %for.body17.preheader157 ]
%arrayidx19 = getelementptr inbounds [13 x i32], ptr @__const.main.arr, i64 0, i64 %indvars.iv103
%11 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%add = add nsw i32 %11, 1
%arrayidx21 = getelementptr inbounds [1000010 x i32], ptr %g, i64 0, i64 %indvars.iv103
store i32 %add, ptr %arrayidx21, align 4, !tbaa !5
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%exitcond.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count
br i1 %exitcond.not, label %if.end33.peel, label %for.body17, !llvm.loop !16
if.end33.peel: ; preds = %for.body17, %middle.block, %for.end13
%sub25 = add nsw i32 %i.1.lcssa, -1
%12 = zext i32 %sub25 to i64
%arrayidx35.peel = getelementptr inbounds [1000010 x i32], ptr %g, i64 0, i64 %12
%13 = load i32, ptr %arrayidx35.peel, align 4, !tbaa !5
%call36.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
%cmp27.peel.not = icmp eq i32 %sub25, 0
br i1 %cmp27.peel.not, label %for.cond40.preheader, label %if.end33
for.cond40.preheader: ; preds = %if.end33, %if.end33.peel
%14 = load i32, ptr %n, align 4, !tbaa !5
%wide.trip.count.i = sext i32 %14 to i64
br label %for.body42
if.end33: ; preds = %if.end33.peel, %if.end33
%indvars.iv106.in = phi i64 [ %indvars.iv106, %if.end33 ], [ %12, %if.end33.peel ]
%indvars.iv106 = add nsw i64 %indvars.iv106.in, -1
%putchar86 = call i32 @putchar(i32 32)
%arrayidx35 = getelementptr inbounds [1000010 x i32], ptr %g, i64 0, i64 %indvars.iv106
%15 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15)
%cmp27 = icmp ugt i64 %indvars.iv106.in, 1
br i1 %cmp27, label %if.end33, label %for.cond40.preheader, !llvm.loop !17
for.body42: ; preds = %for.cond40.preheader, %insertionSort.exit
%indvars.iv110 = phi i64 [ %12, %for.cond40.preheader ], [ %indvars.iv.next111, %insertionSort.exit ]
%count.094 = phi i32 [ 0, %for.cond40.preheader ], [ %add46, %insertionSort.exit ]
%arrayidx44 = getelementptr inbounds [1000010 x i32], ptr %g, i64 0, i64 %indvars.iv110
%16 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%cmp40.i = icmp slt i32 %16, %14
br i1 %cmp40.i, label %for.body.preheader.i, label %insertionSort.exit
for.body.preheader.i: ; preds = %for.body42
%17 = sext i32 %16 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %17, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%count.042.i = phi i32 [ 0, %for.body.preheader.i ], [ %count.1.lcssa.ph.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%18 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%19 = trunc i64 %indvars.iv.i to i32
%20 = sub i32 %19, %16
br label %land.rhs.i
land.rhs.i: ; preds = %while.body.i, %land.rhs.preheader.i
%j.036.i = phi i32 [ %j.0.i, %while.body.i ], [ %20, %land.rhs.preheader.i ]
%i.0.pn35.i = phi i32 [ %j.036.i, %while.body.i ], [ %19, %land.rhs.preheader.i ]
%count.134.i = phi i32 [ %inc.i, %while.body.i ], [ %count.042.i, %land.rhs.preheader.i ]
%idxprom2.i = zext i32 %j.036.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %a, i64 %idxprom2.i
%21 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %21, %18
br i1 %cmp4.i, label %while.body.i, label %while.end.i
while.body.i: ; preds = %land.rhs.i
%idxprom7.i = sext i32 %i.0.pn35.i to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %a, i64 %idxprom7.i
store i32 %21, ptr %arrayidx8.i, align 4, !tbaa !5
%inc.i = add nsw i32 %count.134.i, 1
%j.0.i = sub nsw i32 %j.036.i, %16
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i, !llvm.loop !9
while.end.i: ; preds = %while.body.i, %land.rhs.i
%count.1.lcssa.ph.i = phi i32 [ %count.134.i, %land.rhs.i ], [ %inc.i, %while.body.i ]
%i.0.pn.lcssa.ph.i = phi i32 [ %i.0.pn35.i, %land.rhs.i ], [ %j.036.i, %while.body.i ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %a, i64 %idxprom11.i
store i32 %18, ptr %arrayidx12.i, align 4, !tbaa !5
%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 %insertionSort.exit, label %land.rhs.preheader.i, !llvm.loop !11
insertionSort.exit: ; preds = %while.end.i, %for.body42
%count.0.lcssa.i = phi i32 [ 0, %for.body42 ], [ %count.1.lcssa.ph.i, %while.end.i ]
%add46 = add nsw i32 %count.0.lcssa.i, %count.094
%indvars.iv.next111 = add nsw i64 %indvars.iv110, -1
%cmp41 = icmp sgt i64 %indvars.iv110, 0
br i1 %cmp41, label %for.body42, label %for.end49, !llvm.loop !19
for.end49: ; preds = %insertionSort.exit
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add46)
%22 = load i32, ptr %n, align 4, !tbaa !5
%cmp5295 = icmp sgt i32 %22, 0
br i1 %cmp5295, label %for.body53, label %for.end59
for.body53: ; preds = %for.end49, %for.body53
%indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.body53 ], [ 0, %for.end49 ]
%arrayidx55 = getelementptr inbounds [1000010 x i32], ptr %a, i64 0, i64 %indvars.iv113
%23 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %23)
%indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
%24 = load i32, ptr %n, align 4, !tbaa !5
%25 = sext i32 %24 to i64
%cmp52 = icmp slt i64 %indvars.iv.next114, %25
br i1 %cmp52, label %for.body53, label %for.end59, !llvm.loop !20
for.end59: ; preds = %for.body53, %for.end49
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4000040, ptr nonnull %g) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4000040, 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
int main(void){
int T, x;
scanf("%d", &T);
while(T--){
scanf("%d", &x);
printf("%d\n", (x+1)/10);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11907/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11907/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%T = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%0 = load i32, ptr %T, align 4, !tbaa !5
%dec3 = add nsw i32 %0, -1
store i32 %dec3, ptr %T, align 4, !tbaa !5
%tobool.not4 = icmp eq i32 %0, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%add = add nsw i32 %1, 1
%div = sdiv i32 %add, 10
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
%2 = load i32, ptr %T, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %T, align 4, !tbaa !5
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int insertionSort(int A[], int N,int g,int cnt);
void shellSort(int A[], int n);
int main(){
int *A, n, i;
scanf("%d", &n);
A = (int *)malloc(sizeof(int)*n);
for (i = 0; i < n; ++i) scanf("%d", A + i);
shellSort(A, n);
free(A);
return 0;
}
int insertionSort(int A[], int N,int g,int cnt){
int i, j, v;
for (i = g; i < N ; i++) {
v = A[i];
j = i - g;
while (j >= 0 && A[j] > v) {
A[j + g] = A[j];
j = j - g;
cnt++;
}
A[j + g] = v;
}
return cnt;
}
void shellSort(int A[], int n){
int cnt = 0, m=0;
int *G;
int i;
for (i = 1; (int)(pow(3, i) - 1) / 2.0<n; i++) m++;
if (n == 1) m = 1;
G = (int *)malloc(sizeof(int)*m);
for (i = m-1; i >= 0; --i) G[m-i-1] = (int)((pow(3, i+1) - 1) / 2.0);
for (i = 0; i < m; i++) {
cnt=insertionSort(A, n, G[i],cnt);
}
printf("%d\n", m);
for (i = 0; i < m; ++i) printf("%d%c", G[i], i < m - 1 ? ' ' : '\n');
printf("%d\n", cnt);
for (i = 0; i < n; i++) printf("%d\n", A[i]);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119127/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119127/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%c\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) #8
%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) #9
%cmp8 = icmp sgt i32 %0, 0
br i1 %cmp8, 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 %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %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 !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @shellSort(ptr noundef %call1, i32 noundef %.lcssa)
call void @free(ptr noundef %call1) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @shellSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #4 {
entry:
%conv3 = sitofp i32 %n to double
%cmp89 = icmp sgt i32 %n, 1
br i1 %cmp89, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.091 = phi i32 [ %inc5, %for.body ], [ 1, %entry ]
%m.090 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%inc = add nuw nsw i32 %m.090, 1
%inc5 = add nuw nsw i32 %i.091, 1
%conv = sitofp i32 %inc5 to double
%call = tail call double @pow(double noundef 3.000000e+00, double noundef %conv) #8
%sub = fadd double %call, -1.000000e+00
%conv1 = fptosi double %sub to i32
%conv2 = sitofp i32 %conv1 to double
%div = fmul double %conv2, 5.000000e-01
%cmp = fcmp olt double %div, %conv3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%m.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%cmp6 = icmp eq i32 %n, 1
%spec.select = select i1 %cmp6, i32 1, i32 %m.0.lcssa
%conv8 = zext i32 %spec.select to i64
%mul = shl nuw nsw i64 %conv8, 2
%call9 = tail call noalias ptr @malloc(i64 noundef %mul) #9
%sub10 = add nsw i32 %spec.select, -1
%cmp1292 = icmp sgt i32 %spec.select, 0
br i1 %cmp1292, label %for.body14.preheader, label %for.cond24.preheader
for.body14.preheader: ; preds = %for.end
%0 = zext i32 %spec.select to i64
%xtraiter = and i64 %0, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body14.prol.loopexit, label %for.body14.prol
for.body14.prol: ; preds = %for.body14.preheader
%indvars.iv.prol = add nsw i64 %0, -1
%conv15.prol = sitofp i32 %spec.select to double
%call16.prol = tail call double @pow(double noundef 3.000000e+00, double noundef %conv15.prol) #8
%sub17.prol = fadd double %call16.prol, -1.000000e+00
%div18.prol = fmul double %sub17.prol, 5.000000e-01
%conv19.prol = fptosi double %div18.prol to i32
%1 = trunc i64 %indvars.iv.prol to i32
%2 = xor i32 %1, -1
%sub21.prol = add i32 %spec.select, %2
%idxprom.prol = sext i32 %sub21.prol to i64
%arrayidx.prol = getelementptr inbounds i32, ptr %call9, i64 %idxprom.prol
store i32 %conv19.prol, ptr %arrayidx.prol, align 4, !tbaa !5
br label %for.body14.prol.loopexit
for.body14.prol.loopexit: ; preds = %for.body14.prol, %for.body14.preheader
%indvars.iv.in.unr = phi i64 [ %0, %for.body14.preheader ], [ %indvars.iv.prol, %for.body14.prol ]
%3 = icmp eq i32 %spec.select, 1
br i1 %3, label %for.cond24.preheader, label %for.body14
for.cond24.preheader: ; preds = %for.body14.prol.loopexit, %for.body14, %for.end
%cmp2594.not = icmp eq i32 %spec.select, 0
br i1 %cmp2594.not, label %for.end33.thread, label %for.body27.lr.ph
for.end33.thread: ; preds = %for.cond24.preheader
%call34118 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
br label %for.end47
for.body27.lr.ph: ; preds = %for.cond24.preheader
%wide.trip.count.i = sext i32 %n to i64
br label %for.body27
for.body14: ; preds = %for.body14.prol.loopexit, %for.body14
%indvars.iv.in = phi i64 [ %indvars.iv.1, %for.body14 ], [ %indvars.iv.in.unr, %for.body14.prol.loopexit ]
%indvars.iv = add nsw i64 %indvars.iv.in, -1
%4 = trunc i64 %indvars.iv.in to i32
%conv15 = sitofp i32 %4 to double
%call16 = tail call double @pow(double noundef 3.000000e+00, double noundef %conv15) #8
%sub17 = fadd double %call16, -1.000000e+00
%div18 = fmul double %sub17, 5.000000e-01
%conv19 = fptosi double %div18 to i32
%5 = trunc i64 %indvars.iv to i32
%6 = xor i32 %5, -1
%sub21 = add i32 %spec.select, %6
%idxprom = sext i32 %sub21 to i64
%arrayidx = getelementptr inbounds i32, ptr %call9, i64 %idxprom
store i32 %conv19, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.1 = add nsw i64 %indvars.iv.in, -2
%7 = trunc i64 %indvars.iv to i32
%conv15.1 = sitofp i32 %7 to double
%call16.1 = tail call double @pow(double noundef 3.000000e+00, double noundef %conv15.1) #8
%sub17.1 = fadd double %call16.1, -1.000000e+00
%div18.1 = fmul double %sub17.1, 5.000000e-01
%conv19.1 = fptosi double %div18.1 to i32
%8 = trunc i64 %indvars.iv.1 to i32
%9 = xor i32 %8, -1
%sub21.1 = add i32 %spec.select, %9
%idxprom.1 = sext i32 %sub21.1 to i64
%arrayidx.1 = getelementptr inbounds i32, ptr %call9, i64 %idxprom.1
store i32 %conv19.1, ptr %arrayidx.1, align 4, !tbaa !5
%cmp12.1 = icmp ugt i64 %indvars.iv, 1
br i1 %cmp12.1, label %for.body14, label %for.cond24.preheader, !llvm.loop !12
for.body27: ; preds = %for.body27.lr.ph, %insertionSort.exit
%indvars.iv104 = phi i64 [ 0, %for.body27.lr.ph ], [ %indvars.iv.next105, %insertionSort.exit ]
%cnt.095 = phi i32 [ 0, %for.body27.lr.ph ], [ %cnt.addr.0.lcssa.i, %insertionSort.exit ]
%arrayidx29 = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv104
%10 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp40.i = icmp slt i32 %10, %n
br i1 %cmp40.i, label %for.body.preheader.i, label %insertionSort.exit
for.body.preheader.i: ; preds = %for.body27
%11 = sext i32 %10 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %11, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%cnt.addr.042.i = phi i32 [ %cnt.095, %for.body.preheader.i ], [ %cnt.addr.1.lcssa.ph.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%13 = trunc i64 %indvars.iv.i to i32
%14 = sub i32 %13, %10
br label %land.rhs.i
land.rhs.i: ; preds = %while.body.i, %land.rhs.preheader.i
%j.036.i = phi i32 [ %j.0.i, %while.body.i ], [ %14, %land.rhs.preheader.i ]
%cnt.addr.135.i = phi i32 [ %inc.i, %while.body.i ], [ %cnt.addr.042.i, %land.rhs.preheader.i ]
%i.0.pn34.i = phi i32 [ %j.036.i, %while.body.i ], [ %13, %land.rhs.preheader.i ]
%idxprom2.i = zext i32 %j.036.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.i
%15 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %15, %12
br i1 %cmp4.i, label %while.body.i, label %while.end.i
while.body.i: ; preds = %land.rhs.i
%idxprom7.i = sext i32 %i.0.pn34.i to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %A, i64 %idxprom7.i
store i32 %15, ptr %arrayidx8.i, align 4, !tbaa !5
%inc.i = add nsw i32 %cnt.addr.135.i, 1
%j.0.i = sub nsw i32 %j.036.i, %10
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i, !llvm.loop !13
while.end.i: ; preds = %while.body.i, %land.rhs.i
%i.0.pn.lcssa.ph.i = phi i32 [ %i.0.pn34.i, %land.rhs.i ], [ %j.036.i, %while.body.i ]
%cnt.addr.1.lcssa.ph.i = phi i32 [ %cnt.addr.135.i, %land.rhs.i ], [ %inc.i, %while.body.i ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i
store i32 %12, ptr %arrayidx12.i, align 4, !tbaa !5
%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 %insertionSort.exit, label %land.rhs.preheader.i, !llvm.loop !14
insertionSort.exit: ; preds = %while.end.i, %for.body27
%cnt.addr.0.lcssa.i = phi i32 [ %cnt.095, %for.body27 ], [ %cnt.addr.1.lcssa.ph.i, %while.end.i ]
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%exitcond.not = icmp eq i64 %indvars.iv.next105, %conv8
br i1 %exitcond.not, label %for.end33, label %for.body27, !llvm.loop !15
for.end33: ; preds = %insertionSort.exit
%call34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
br i1 %cmp2594.not, label %for.end47, label %for.body38.preheader
for.body38.preheader: ; preds = %for.end33
%16 = sext i32 %sub10 to i64
br label %for.body38
for.body38: ; preds = %for.body38.preheader, %for.body38
%indvars.iv107 = phi i64 [ 0, %for.body38.preheader ], [ %indvars.iv.next108, %for.body38 ]
%arrayidx40 = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv107
%17 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cmp42 = icmp slt i64 %indvars.iv107, %16
%cond = select i1 %cmp42, i32 32, i32 10
%call44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %17, i32 noundef %cond)
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next108, %conv8
br i1 %exitcond111.not, label %for.end47, label %for.body38, !llvm.loop !16
for.end47: ; preds = %for.body38, %for.end33.thread, %for.end33
%cnt.0.lcssa119 = phi i32 [ 0, %for.end33.thread ], [ %cnt.addr.0.lcssa.i, %for.end33 ], [ %cnt.addr.0.lcssa.i, %for.body38 ]
%call48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa119)
%cmp50100 = icmp sgt i32 %n, 0
br i1 %cmp50100, label %for.body52.preheader, label %for.end58
for.body52.preheader: ; preds = %for.end47
%wide.trip.count115 = zext i32 %n to i64
br label %for.body52
for.body52: ; preds = %for.body52.preheader, %for.body52
%indvars.iv112 = phi i64 [ 0, %for.body52.preheader ], [ %indvars.iv.next113, %for.body52 ]
%arrayidx54 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv112
%18 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%call55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%exitcond116.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count115
br i1 %exitcond116.not, label %for.end58, label %for.body52, !llvm.loop !17
for.end58: ; preds = %for.body52, %for.end47
ret void
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: 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(argmem: readwrite) uwtable
define dso_local i32 @insertionSort(ptr nocapture noundef %A, i32 noundef %N, i32 noundef %g, i32 noundef %cnt) local_unnamed_addr #6 {
entry:
%cmp40 = icmp slt i32 %g, %N
br i1 %cmp40, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %N to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%cnt.addr.042 = phi i32 [ %cnt, %for.body.preheader ], [ %cnt.addr.1.lcssa.ph, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%j.036 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%cnt.addr.135 = phi i32 [ %inc, %while.body ], [ %cnt.addr.042, %land.rhs.preheader ]
%i.0.pn34 = phi i32 [ %j.036, %while.body ], [ %2, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.036 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn34 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nsw i32 %cnt.addr.135, 1
%j.0 = sub nsw i32 %j.036, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !13
while.end: ; preds = %land.rhs, %while.body
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn34, %land.rhs ], [ %j.036, %while.body ]
%cnt.addr.1.lcssa.ph = phi i32 [ %cnt.addr.135, %land.rhs ], [ %inc, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %A, i64 %idxprom11
store i32 %1, ptr %arrayidx12, 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.end, label %land.rhs.preheader, !llvm.loop !14
for.end: ; preds = %while.end, %entry
%cnt.addr.0.lcssa = phi i32 [ %cnt, %entry ], [ %cnt.addr.1.lcssa.ph, %while.end ]
ret i32 %cnt.addr.0.lcssa
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define N 1000000
int insertionSort(int *A, int n, int g){
int i;
int j;
int v;
int cnt=0;
for(i=g;i<n;i++){
v = A[i];
j = i - g;
while( j >= 0 && A[j] > v){
A[j+g] = A[j];
j = j - g;
cnt++;
}
A[j+g] = v;
}
return cnt;
}
void shellSort(int *A, int n){
int i;
int m=5;
int cnt=0;
int m_cnt=0;
int G[5]={1000,100,10,4,1};
for(i=0;i<m;i++){
if(G[i]<=n){
cnt += insertionSort(A, n, G[i]);
m_cnt++;
}
}
printf("%d\n",m_cnt);
for(i=0;i<m-1;i++){
if(G[i]<=n){
printf("%d ",G[i]);
}
}
printf("%d\n",G[i]);
printf("%d\n",cnt);
for(i=0;i<n;i++){
printf("%d\n",A[i]);
}
}
int main(){
int g=1;
int i;
int j;
int n;
int data[N];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&data[i]);
}
shellSort(data,n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119170/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119170/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @insertionSort(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %g) local_unnamed_addr #0 {
entry:
%cmp40 = icmp slt i32 %g, %n
br i1 %cmp40, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%cnt.042 = phi i32 [ 0, %for.body.preheader ], [ %cnt.1.lcssa.ph, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%j.036 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%cnt.135 = phi i32 [ %inc, %while.body ], [ %cnt.042, %land.rhs.preheader ]
%i.0.pn34 = phi i32 [ %j.036, %while.body ], [ %2, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.036 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn34 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nsw i32 %cnt.135, 1
%j.0 = sub nsw i32 %j.036, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !9
while.end: ; preds = %land.rhs, %while.body
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn34, %land.rhs ], [ %j.036, %while.body ]
%cnt.1.lcssa.ph = phi i32 [ %cnt.135, %land.rhs ], [ %inc, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %A, i64 %idxprom11
store i32 %1, ptr %arrayidx12, 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.end, label %land.rhs.preheader, !llvm.loop !11
for.end: ; preds = %while.end, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.1.lcssa.ph, %while.end ]
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 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 @shellSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #2 {
entry:
%wide.trip.count.i = sext i32 %n to i64
%cmp1.not = icmp slt i32 %n, 1000
br i1 %cmp1.not, label %for.inc, label %if.then
if.then: ; preds = %entry
%cmp40.i.not = icmp eq i32 %n, 1000
br i1 %cmp40.i.not, label %for.body.preheader.i.1, label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %if.then, %while.end.i
%indvars.iv105 = phi i64 [ %indvars.iv.next106, %while.end.i ], [ 0, %if.then ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.end.i ], [ 1000, %if.then ]
%cnt.042.i = phi i32 [ %cnt.1.lcssa.ph.i, %while.end.i ], [ 0, %if.then ]
%indvars116 = trunc i64 %indvars.iv105 to i32
%0 = udiv i32 %indvars116, 1000
%.neg = mul i32 %0, -1000
%1 = add i32 %.neg, %indvars116
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%3 = add i32 %cnt.042.i, 1
%4 = add i32 %3, %0
br label %land.rhs.i
land.rhs.i: ; preds = %while.body.i, %land.rhs.preheader.i
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %while.body.i ], [ %indvars.iv.i, %land.rhs.preheader.i ]
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %while.body.i ], [ %indvars.iv105, %land.rhs.preheader.i ]
%cnt.135.i = phi i32 [ %inc.i, %while.body.i ], [ %cnt.042.i, %land.rhs.preheader.i ]
%arrayidx3.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv107
%5 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %5, %2
br i1 %cmp4.i, label %while.body.i, label %while.end.i.split.loop.exit154
while.body.i: ; preds = %land.rhs.i
%indvars.iv.next110 = add nsw i64 %indvars.iv109, -1000
%arrayidx8.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv109
store i32 %5, ptr %arrayidx8.i, align 4, !tbaa !5
%inc.i = add nsw i32 %cnt.135.i, 1
%indvars.iv.next108 = add nsw i64 %indvars.iv107, -1000
%cmp1.i = icmp sgt i64 %indvars.iv107, 999
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i, !llvm.loop !9
while.end.i.split.loop.exit154: ; preds = %land.rhs.i
%6 = trunc i64 %indvars.iv109 to i32
br label %while.end.i
while.end.i: ; preds = %while.body.i, %while.end.i.split.loop.exit154
%i.0.pn.lcssa.ph.i = phi i32 [ %6, %while.end.i.split.loop.exit154 ], [ %1, %while.body.i ]
%cnt.1.lcssa.ph.i = phi i32 [ %cnt.135.i, %while.end.i.split.loop.exit154 ], [ %4, %while.body.i ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i
store i32 %2, ptr %arrayidx12.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
%indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
br i1 %exitcond.not.i, label %for.inc, label %land.rhs.preheader.i, !llvm.loop !11
for.inc: ; preds = %while.end.i, %entry
%cnt.1 = phi i32 [ 0, %entry ], [ %cnt.1.lcssa.ph.i, %while.end.i ]
%m_cnt.1 = phi i32 [ 0, %entry ], [ 1, %while.end.i ]
%cmp1.not.1 = icmp slt i32 %n, 100
br i1 %cmp1.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%cmp40.i.1.not = icmp eq i32 %n, 100
br i1 %cmp40.i.1.not, label %insertionSort.exit.1, label %for.body.preheader.i.1
for.body.preheader.i.1: ; preds = %if.then, %if.then.1
%cnt.1131143 = phi i32 [ %cnt.1, %if.then.1 ], [ 0, %if.then ]
%m_cnt.1132141 = phi i32 [ %m_cnt.1, %if.then.1 ], [ 1, %if.then ]
br label %land.rhs.preheader.i.1
land.rhs.preheader.i.1: ; preds = %while.end.i.1, %for.body.preheader.i.1
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %while.end.i.1 ], [ 0, %for.body.preheader.i.1 ]
%indvars.iv.i.1 = phi i64 [ %indvars.iv.next.i.1, %while.end.i.1 ], [ 100, %for.body.preheader.i.1 ]
%cnt.042.i.1 = phi i32 [ %cnt.1.lcssa.ph.i.1, %while.end.i.1 ], [ 0, %for.body.preheader.i.1 ]
%indvars104 = trunc i64 %indvars.iv93 to i32
%7 = udiv i32 %indvars104, 100
%.neg125 = mul i32 %7, -100
%8 = add i32 %.neg125, %indvars104
%arrayidx.i.1 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.1
%9 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%10 = add i32 %cnt.042.i.1, 1
%11 = add i32 %10, %7
br label %land.rhs.i.1
land.rhs.i.1: ; preds = %while.body.i.1, %land.rhs.preheader.i.1
%indvars.iv97 = phi i64 [ %indvars.iv.next98, %while.body.i.1 ], [ %indvars.iv.i.1, %land.rhs.preheader.i.1 ]
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %while.body.i.1 ], [ %indvars.iv93, %land.rhs.preheader.i.1 ]
%cnt.135.i.1 = phi i32 [ %inc.i.1, %while.body.i.1 ], [ %cnt.042.i.1, %land.rhs.preheader.i.1 ]
%arrayidx3.i.1 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv95
%12 = load i32, ptr %arrayidx3.i.1, align 4, !tbaa !5
%cmp4.i.1 = icmp sgt i32 %12, %9
br i1 %cmp4.i.1, label %while.body.i.1, label %while.end.i.1.split.loop.exit157
while.body.i.1: ; preds = %land.rhs.i.1
%indvars.iv.next98 = add nsw i64 %indvars.iv97, -100
%arrayidx8.i.1 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv97
store i32 %12, ptr %arrayidx8.i.1, align 4, !tbaa !5
%inc.i.1 = add nsw i32 %cnt.135.i.1, 1
%indvars.iv.next96 = add nsw i64 %indvars.iv95, -100
%cmp1.i.1 = icmp sgt i64 %indvars.iv95, 99
br i1 %cmp1.i.1, label %land.rhs.i.1, label %while.end.i.1, !llvm.loop !9
while.end.i.1.split.loop.exit157: ; preds = %land.rhs.i.1
%13 = trunc i64 %indvars.iv97 to i32
br label %while.end.i.1
while.end.i.1: ; preds = %while.body.i.1, %while.end.i.1.split.loop.exit157
%i.0.pn.lcssa.ph.i.1 = phi i32 [ %13, %while.end.i.1.split.loop.exit157 ], [ %8, %while.body.i.1 ]
%cnt.1.lcssa.ph.i.1 = phi i32 [ %cnt.135.i.1, %while.end.i.1.split.loop.exit157 ], [ %11, %while.body.i.1 ]
%idxprom11.i.1 = sext i32 %i.0.pn.lcssa.ph.i.1 to i64
%arrayidx12.i.1 = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i.1
store i32 %9, ptr %arrayidx12.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i.1, 1
%exitcond.not.i.1 = icmp eq i64 %indvars.iv.next.i.1, %wide.trip.count.i
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
br i1 %exitcond.not.i.1, label %insertionSort.exit.1, label %land.rhs.preheader.i.1, !llvm.loop !11
insertionSort.exit.1: ; preds = %while.end.i.1, %if.then.1
%cnt.1131144 = phi i32 [ %cnt.1, %if.then.1 ], [ %cnt.1131143, %while.end.i.1 ]
%m_cnt.1132142 = phi i32 [ %m_cnt.1, %if.then.1 ], [ %m_cnt.1132141, %while.end.i.1 ]
%cnt.0.lcssa.i.1 = phi i32 [ 0, %if.then.1 ], [ %cnt.1.lcssa.ph.i.1, %while.end.i.1 ]
%add.1 = add nsw i32 %cnt.0.lcssa.i.1, %cnt.1131144
%inc.1 = add nuw nsw i32 %m_cnt.1132142, 1
br label %for.inc.1
for.inc.1: ; preds = %insertionSort.exit.1, %for.inc
%cmp1.not.1134 = phi i1 [ false, %insertionSort.exit.1 ], [ true, %for.inc ]
%cnt.1.1 = phi i32 [ %add.1, %insertionSort.exit.1 ], [ %cnt.1, %for.inc ]
%m_cnt.1.1 = phi i32 [ %inc.1, %insertionSort.exit.1 ], [ %m_cnt.1, %for.inc ]
%cmp1.not.2 = icmp slt i32 %n, 10
br i1 %cmp1.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%cmp40.i.2.not = icmp eq i32 %n, 10
br i1 %cmp40.i.2.not, label %insertionSort.exit.2, label %land.rhs.preheader.i.2
land.rhs.preheader.i.2: ; preds = %if.then.2, %while.end.i.2
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %while.end.i.2 ], [ 0, %if.then.2 ]
%indvars.iv.i.2 = phi i64 [ %indvars.iv.next.i.2, %while.end.i.2 ], [ 10, %if.then.2 ]
%cnt.042.i.2 = phi i32 [ %cnt.1.lcssa.ph.i.2, %while.end.i.2 ], [ 0, %if.then.2 ]
%indvars92 = trunc i64 %indvars.iv81 to i32
%14 = udiv i32 %indvars92, 10
%.neg126 = mul i32 %14, -10
%15 = add i32 %.neg126, %indvars92
%arrayidx.i.2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.2
%16 = load i32, ptr %arrayidx.i.2, align 4, !tbaa !5
%17 = add i32 %cnt.042.i.2, 1
%18 = add i32 %17, %14
br label %land.rhs.i.2
land.rhs.i.2: ; preds = %while.body.i.2, %land.rhs.preheader.i.2
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %while.body.i.2 ], [ %indvars.iv.i.2, %land.rhs.preheader.i.2 ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %while.body.i.2 ], [ %indvars.iv81, %land.rhs.preheader.i.2 ]
%cnt.135.i.2 = phi i32 [ %inc.i.2, %while.body.i.2 ], [ %cnt.042.i.2, %land.rhs.preheader.i.2 ]
%arrayidx3.i.2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
%19 = load i32, ptr %arrayidx3.i.2, align 4, !tbaa !5
%cmp4.i.2 = icmp sgt i32 %19, %16
br i1 %cmp4.i.2, label %while.body.i.2, label %while.end.i.2.split.loop.exit160
while.body.i.2: ; preds = %land.rhs.i.2
%indvars.iv.next86 = add nsw i64 %indvars.iv85, -10
%arrayidx8.i.2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv85
store i32 %19, ptr %arrayidx8.i.2, align 4, !tbaa !5
%inc.i.2 = add nsw i32 %cnt.135.i.2, 1
%indvars.iv.next84 = add nsw i64 %indvars.iv83, -10
%cmp1.i.2 = icmp sgt i64 %indvars.iv83, 9
br i1 %cmp1.i.2, label %land.rhs.i.2, label %while.end.i.2, !llvm.loop !9
while.end.i.2.split.loop.exit160: ; preds = %land.rhs.i.2
%20 = trunc i64 %indvars.iv85 to i32
br label %while.end.i.2
while.end.i.2: ; preds = %while.body.i.2, %while.end.i.2.split.loop.exit160
%i.0.pn.lcssa.ph.i.2 = phi i32 [ %20, %while.end.i.2.split.loop.exit160 ], [ %15, %while.body.i.2 ]
%cnt.1.lcssa.ph.i.2 = phi i32 [ %cnt.135.i.2, %while.end.i.2.split.loop.exit160 ], [ %18, %while.body.i.2 ]
%idxprom11.i.2 = sext i32 %i.0.pn.lcssa.ph.i.2 to i64
%arrayidx12.i.2 = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i.2
store i32 %16, ptr %arrayidx12.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i.2, 1
%exitcond.not.i.2 = icmp eq i64 %indvars.iv.next.i.2, %wide.trip.count.i
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
br i1 %exitcond.not.i.2, label %insertionSort.exit.2, label %land.rhs.preheader.i.2, !llvm.loop !11
insertionSort.exit.2: ; preds = %while.end.i.2, %if.then.2
%cnt.0.lcssa.i.2 = phi i32 [ 0, %if.then.2 ], [ %cnt.1.lcssa.ph.i.2, %while.end.i.2 ]
%add.2 = add nsw i32 %cnt.0.lcssa.i.2, %cnt.1.1
%inc.2 = add nuw nsw i32 %m_cnt.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %insertionSort.exit.2, %for.inc.1
%cnt.1.2 = phi i32 [ %add.2, %insertionSort.exit.2 ], [ %cnt.1.1, %for.inc.1 ]
%m_cnt.1.2 = phi i32 [ %inc.2, %insertionSort.exit.2 ], [ %m_cnt.1.1, %for.inc.1 ]
%cmp1.not.3 = icmp slt i32 %n, 4
br i1 %cmp1.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%cmp40.i.3.not = icmp eq i32 %n, 4
br i1 %cmp40.i.3.not, label %insertionSort.exit.3, label %land.rhs.preheader.i.3
land.rhs.preheader.i.3: ; preds = %if.then.3, %while.end.i.3
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %while.end.i.3 ], [ 0, %if.then.3 ]
%indvars.iv.i.3 = phi i64 [ %indvars.iv.next.i.3, %while.end.i.3 ], [ 4, %if.then.3 ]
%cnt.042.i.3 = phi i32 [ %cnt.1.lcssa.ph.i.3, %while.end.i.3 ], [ 0, %if.then.3 ]
%indvars80 = trunc i64 %indvars.iv69 to i32
%21 = lshr i32 %indvars80, 2
%22 = and i64 %indvars.iv69, 3
%arrayidx.i.3 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.3
%23 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5
%24 = add i32 %cnt.042.i.3, 1
%25 = add i32 %24, %21
br label %land.rhs.i.3
land.rhs.i.3: ; preds = %while.body.i.3, %land.rhs.preheader.i.3
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %while.body.i.3 ], [ %indvars.iv.i.3, %land.rhs.preheader.i.3 ]
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %while.body.i.3 ], [ %indvars.iv69, %land.rhs.preheader.i.3 ]
%cnt.135.i.3 = phi i32 [ %inc.i.3, %while.body.i.3 ], [ %cnt.042.i.3, %land.rhs.preheader.i.3 ]
%arrayidx3.i.3 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv71
%26 = load i32, ptr %arrayidx3.i.3, align 4, !tbaa !5
%cmp4.i.3 = icmp sgt i32 %26, %23
br i1 %cmp4.i.3, label %while.body.i.3, label %while.end.i.3
while.body.i.3: ; preds = %land.rhs.i.3
%indvars.iv.next74 = add nsw i64 %indvars.iv73, -4
%arrayidx8.i.3 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv73
store i32 %26, ptr %arrayidx8.i.3, align 4, !tbaa !5
%inc.i.3 = add nsw i32 %cnt.135.i.3, 1
%indvars.iv.next72 = add nsw i64 %indvars.iv71, -4
%cmp1.i.3 = icmp sgt i64 %indvars.iv71, 3
br i1 %cmp1.i.3, label %land.rhs.i.3, label %while.end.i.3, !llvm.loop !9
while.end.i.3: ; preds = %while.body.i.3, %land.rhs.i.3
%i.0.pn.lcssa.ph.i.3 = phi i64 [ %indvars.iv73, %land.rhs.i.3 ], [ %22, %while.body.i.3 ]
%cnt.1.lcssa.ph.i.3 = phi i32 [ %cnt.135.i.3, %land.rhs.i.3 ], [ %25, %while.body.i.3 ]
%sext = shl i64 %i.0.pn.lcssa.ph.i.3, 32
%idxprom11.i.3 = ashr exact i64 %sext, 32
%arrayidx12.i.3 = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i.3
store i32 %23, ptr %arrayidx12.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i.3, 1
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
br i1 %exitcond.not.i.3, label %insertionSort.exit.3, label %land.rhs.preheader.i.3, !llvm.loop !11
insertionSort.exit.3: ; preds = %while.end.i.3, %if.then.3
%cnt.0.lcssa.i.3 = phi i32 [ 0, %if.then.3 ], [ %cnt.1.lcssa.ph.i.3, %while.end.i.3 ]
%add.3 = add nsw i32 %cnt.0.lcssa.i.3, %cnt.1.2
%inc.3 = add nuw nsw i32 %m_cnt.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %insertionSort.exit.3, %for.inc.2
%cnt.1.3 = phi i32 [ %add.3, %insertionSort.exit.3 ], [ %cnt.1.2, %for.inc.2 ]
%m_cnt.1.3 = phi i32 [ %inc.3, %insertionSort.exit.3 ], [ %m_cnt.1.2, %for.inc.2 ]
%cmp1.not.4 = icmp slt i32 %n, 1
br i1 %cmp1.not.4, label %for.inc.4.thread, label %if.then.4
for.inc.4.thread: ; preds = %for.inc.3
%call5147 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %m_cnt.1.3)
br label %for.inc17
if.then.4: ; preds = %for.inc.3
%cmp40.i.4.not = icmp eq i32 %n, 1
br i1 %cmp40.i.4.not, label %for.inc.4.thread149, label %land.rhs.preheader.i.4
for.inc.4.thread149: ; preds = %if.then.4
%inc.4152 = add nuw nsw i32 %m_cnt.1.3, 1
%call5153 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %inc.4152)
br label %for.inc17
land.rhs.preheader.i.4: ; preds = %if.then.4, %while.end.i.4
%indvars.iv = phi i64 [ %indvars.iv.next, %while.end.i.4 ], [ 0, %if.then.4 ]
%indvars.iv.i.4 = phi i64 [ %indvars.iv.next.i.4, %while.end.i.4 ], [ 1, %if.then.4 ]
%cnt.042.i.4 = phi i32 [ %cnt.1.lcssa.ph.i.4, %while.end.i.4 ], [ 0, %if.then.4 ]
%indvars68 = trunc i64 %indvars.iv.i.4 to i32
%arrayidx.i.4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i.4
%27 = load i32, ptr %arrayidx.i.4, align 4, !tbaa !5
%28 = add i32 %cnt.042.i.4, %indvars68
br label %land.rhs.i.4
land.rhs.i.4: ; preds = %while.body.i.4, %land.rhs.preheader.i.4
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %while.body.i.4 ], [ %indvars.iv.i.4, %land.rhs.preheader.i.4 ]
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %while.body.i.4 ], [ %indvars.iv, %land.rhs.preheader.i.4 ]
%cnt.135.i.4 = phi i32 [ %inc.i.4, %while.body.i.4 ], [ %cnt.042.i.4, %land.rhs.preheader.i.4 ]
%arrayidx3.i.4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv59
%29 = load i32, ptr %arrayidx3.i.4, align 4, !tbaa !5
%cmp4.i.4 = icmp sgt i32 %29, %27
br i1 %cmp4.i.4, label %while.body.i.4, label %while.end.i.4
while.body.i.4: ; preds = %land.rhs.i.4
%indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
%arrayidx8.i.4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv61
store i32 %29, ptr %arrayidx8.i.4, align 4, !tbaa !5
%inc.i.4 = add i32 %cnt.135.i.4, 1
%indvars.iv.next60 = add nsw i64 %indvars.iv59, -1
%exitcond.not = icmp eq i32 %inc.i.4, %28
br i1 %exitcond.not, label %while.end.i.4, label %land.rhs.i.4, !llvm.loop !9
while.end.i.4: ; preds = %while.body.i.4, %land.rhs.i.4
%i.0.pn.lcssa.ph.i.4 = phi i64 [ %indvars.iv61, %land.rhs.i.4 ], [ 0, %while.body.i.4 ]
%cnt.1.lcssa.ph.i.4 = phi i32 [ %cnt.135.i.4, %land.rhs.i.4 ], [ %28, %while.body.i.4 ]
%sext127 = shl i64 %i.0.pn.lcssa.ph.i.4, 32
%idxprom11.i.4 = ashr exact i64 %sext127, 32
%arrayidx12.i.4 = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i.4
store i32 %27, ptr %arrayidx12.i.4, align 4, !tbaa !5
%indvars.iv.next.i.4 = add nuw nsw i64 %indvars.iv.i.4, 1
%exitcond.not.i.4 = icmp eq i64 %indvars.iv.next.i.4, %wide.trip.count.i
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br i1 %exitcond.not.i.4, label %for.inc.4, label %land.rhs.preheader.i.4, !llvm.loop !11
for.inc.4: ; preds = %while.end.i.4
%add.4 = add nsw i32 %cnt.1.lcssa.ph.i.4, %cnt.1.3
%inc.4 = add nuw nsw i32 %m_cnt.1.3, 1
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %inc.4)
br i1 %cmp1.not, label %for.inc17, label %if.then12
if.then12: ; preds = %for.inc.4
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 1000)
br label %for.inc17
for.inc17: ; preds = %for.inc.4.thread149, %for.inc.4.thread, %for.inc.4, %if.then12
%cnt.1.4148 = phi i32 [ %cnt.1.3, %for.inc.4.thread ], [ %add.4, %for.inc.4 ], [ %add.4, %if.then12 ], [ %cnt.1.3, %for.inc.4.thread149 ]
br i1 %cmp1.not.1134, label %for.inc17.1, label %if.then12.1
if.then12.1: ; preds = %for.inc17
%call15.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 100)
br label %for.inc17.1
for.inc17.1: ; preds = %if.then12.1, %for.inc17
br i1 %cmp1.not.2, label %for.inc17.2, label %for.inc17.2.thread
for.inc17.2.thread: ; preds = %for.inc17.1
%call15.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 10)
br label %if.then12.3
for.inc17.2: ; preds = %for.inc17.1
br i1 %cmp1.not.3, label %for.inc17.3, label %if.then12.3
if.then12.3: ; preds = %for.inc17.2.thread, %for.inc17.2
%call15.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 4)
br label %for.inc17.3
for.inc17.3: ; preds = %if.then12.3, %for.inc17.2
%call22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 1)
%call23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cnt.1.4148)
%cmp2556 = icmp sgt i32 %n, 0
br i1 %cmp2556, label %for.body26.preheader, label %for.end32
for.body26.preheader: ; preds = %for.inc17.3
%wide.trip.count = zext i32 %n to i64
br label %for.body26
for.body26: ; preds = %for.body26.preheader, %for.body26
%indvars.iv121 = phi i64 [ 0, %for.body26.preheader ], [ %indvars.iv.next122, %for.body26 ]
%arrayidx28 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv121
%30 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %30)
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%exitcond124.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count
br i1 %exitcond124.not, label %for.end32, label %for.body26, !llvm.loop !12
for.end32: ; preds = %for.body26, %for.inc17.3
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%data = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %data) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, 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 %data, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @shellSort(ptr noundef nonnull %data, i32 noundef %.lcssa)
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %data) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
// AOJ ALDS1_2_D Shell Sort
// 2018.4.27 bal4u
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cnt;
void insertion_sort(int n, int *a, int g)
{
int i, j, key;
for (i = g; i < n; i++) {
key = a[i];
j = i-g;
while (j >= 0 && a[j] > key) {
a[j+g] = a[j];
j -= g;
cnt++;
}
a[j+g] = key;
}
}
int m;
int g[102];
void shell_sort(int n, int *a)
{
int i;
g[0] = 1;
for (m = 1; ; m++) {
g[m] = 3*g[m-1]+1;
if (g[m] >= n) break;
}
cnt = 0;
for (i = m-1; i >= 0; i--) insertion_sort(n, a, g[i]);
}
// バッファを経ずstdinから数値を得る
//#define getchar_unlocked() getchar()
int in()
{
int n = 0, c = getchar_unlocked();
do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
return n;
}
int a[1000002];
int main()
{
int N, i;
N = in();
for (i = 0; i < N; i++) a[i] = in();
shell_sort(N, a);
printf("%d\n", m);
printf("%d", g[m-1]);
for (i = m-2; i >= 0; i--) printf(" %d", g[i]);
printf("\n%d\n", cnt);
for (i = 0; i < N; i++) printf("%d\n", a[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119220/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119220/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@g = dso_local local_unnamed_addr global [102 x i32] zeroinitializer, align 16
@m = dso_local local_unnamed_addr global i32 0, align 4
@a = dso_local local_unnamed_addr global [1000002 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insertion_sort(i32 noundef %n, ptr nocapture noundef %a, i32 noundef %g) local_unnamed_addr #0 {
entry:
%cmp36 = icmp slt i32 %g, %n
br i1 %cmp36, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%j.034 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%i.0.pn33 = phi i32 [ %j.034, %while.body ], [ %2, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.034 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn33 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !5
%6 = load i32, ptr @cnt, align 4, !tbaa !5
%inc = add nsw i32 %6, 1
store i32 %inc, ptr @cnt, align 4, !tbaa !5
%j.0 = sub nsw i32 %j.034, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !9
while.end: ; preds = %land.rhs, %while.body
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn33, %land.rhs ], [ %j.034, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %a, i64 %idxprom11
store i32 %1, ptr %arrayidx12, 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.end, label %land.rhs.preheader, !llvm.loop !11
for.end: ; preds = %while.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @shell_sort(i32 noundef %n, ptr nocapture noundef %a) local_unnamed_addr #0 {
entry:
store i32 1, ptr @g, align 16, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%0 = phi i32 [ %add, %for.cond ], [ 1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 1, %entry ]
%mul = mul nsw i32 %0, 3
%add = add nsw i32 %mul, 1
%arrayidx2 = getelementptr inbounds [102 x i32], ptr @g, i64 0, i64 %indvars.iv
store i32 %add, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp slt i32 %add, %n
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %for.cond, label %for.end
for.end: ; preds = %for.cond
%1 = trunc i64 %indvars.iv to i32
store i32 %1, ptr @m, align 4, !tbaa !5
store i32 0, ptr @cnt, align 4, !tbaa !5
%wide.trip.count.i = sext i32 %n to i64
br label %for.body
for.body: ; preds = %for.end, %insertion_sort.exit
%indvars.iv19 = phi i64 [ %indvars.iv, %for.end ], [ %indvars.iv.next20, %insertion_sort.exit ]
%indvars.iv.next20 = add nsw i64 %indvars.iv19, -1
%idxprom8 = and i64 %indvars.iv.next20, 4294967295
%arrayidx9 = getelementptr inbounds [102 x i32], ptr @g, i64 0, i64 %idxprom8
%2 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp36.i = icmp slt i32 %2, %n
br i1 %cmp36.i, label %for.body.preheader.i, label %insertion_sort.exit
for.body.preheader.i: ; preds = %for.body
%3 = sext i32 %2 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %3, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%5 = trunc i64 %indvars.iv.i to i32
%6 = sub i32 %5, %2
br label %land.rhs.i
land.rhs.i: ; preds = %while.body.i, %land.rhs.preheader.i
%j.034.i = phi i32 [ %j.0.i, %while.body.i ], [ %6, %land.rhs.preheader.i ]
%i.0.pn33.i = phi i32 [ %j.034.i, %while.body.i ], [ %5, %land.rhs.preheader.i ]
%idxprom2.i = zext i32 %j.034.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %a, i64 %idxprom2.i
%7 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %7, %4
br i1 %cmp4.i, label %while.body.i, label %while.end.i
while.body.i: ; preds = %land.rhs.i
%idxprom7.i = sext i32 %i.0.pn33.i to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %a, i64 %idxprom7.i
store i32 %7, ptr %arrayidx8.i, align 4, !tbaa !5
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%inc.i = add nsw i32 %8, 1
store i32 %inc.i, ptr @cnt, align 4, !tbaa !5
%j.0.i = sub nsw i32 %j.034.i, %2
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i, !llvm.loop !9
while.end.i: ; preds = %while.body.i, %land.rhs.i
%i.0.pn.lcssa.ph.i = phi i32 [ %i.0.pn33.i, %land.rhs.i ], [ %j.034.i, %while.body.i ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %a, i64 %idxprom11.i
store i32 %4, ptr %arrayidx12.i, align 4, !tbaa !5
%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 %insertion_sort.exit, label %land.rhs.preheader.i, !llvm.loop !11
insertion_sort.exit: ; preds = %while.end.i, %for.body
%9 = icmp sgt i64 %indvars.iv19, 1
br i1 %9, label %for.body, label %for.end11, !llvm.loop !12
for.end11: ; preds = %insertion_sort.exit
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !13
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !15
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !19
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !20
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !13
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !15
%3 = load i8, ptr %1, align 1, !tbaa !21
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !15
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !19
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !20
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre = load ptr, ptr @stdin, align 8, !tbaa !13
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !15
%7 = load i8, ptr %5, align 1, !tbaa !21
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !22
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !13
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !15
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !19
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !20
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #4
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !13
br label %do.body.i.preheader
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !15
%3 = load i8, ptr %1, align 1, !tbaa !21
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph107 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%4 = phi ptr [ %8, %getchar_unlocked.exit13.i ], [ %.ph107, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul nsw i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !15
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !19
%cmp.not.i6.i = icmp ult ptr %5, %6
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !20
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !13
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !15
%7 = load i8, ptr %5, align 1, !tbaa !21
%conv3.i12.i = zext i8 %7 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%8 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i, label %do.body.i, label %for.cond.preheader, !llvm.loop !22
for.cond.preheader: ; preds = %getchar_unlocked.exit13.i
%cmp68 = icmp sgt i32 %add.i, 0
br i1 %cmp68, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %add.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %in.exit65
%9 = phi ptr [ %8, %for.body.preheader ], [ %18, %in.exit65 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %in.exit65 ]
%_IO_read_ptr.i.i35 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 1
%10 = load ptr, ptr %_IO_read_ptr.i.i35, align 8, !tbaa !15
%_IO_read_end.i.i36 = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 2
%11 = load ptr, ptr %_IO_read_end.i.i36, align 8, !tbaa !19
%cmp.not.i.i37 = icmp ult ptr %10, %11
br i1 %cmp.not.i.i37, label %cond.false.i.i62, label %cond.true.i.i38, !prof !20
cond.true.i.i38: ; preds = %for.body
%call.i.i39 = tail call i32 @__uflow(ptr noundef nonnull %9) #4
%.pre14.pre.i40 = load ptr, ptr @stdin, align 8, !tbaa !13
br label %do.body.i44.preheader
cond.false.i.i62: ; preds = %for.body
%incdec.ptr.i.i63 = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i.i63, ptr %_IO_read_ptr.i.i35, align 8, !tbaa !15
%12 = load i8, ptr %10, align 1, !tbaa !21
%conv3.i.i64 = zext i8 %12 to i32
br label %do.body.i44.preheader
do.body.i44.preheader: ; preds = %cond.false.i.i62, %cond.true.i.i38
%.ph106 = phi ptr [ %9, %cond.false.i.i62 ], [ %.pre14.pre.i40, %cond.true.i.i38 ]
%c.0.i46.ph = phi i32 [ %conv3.i.i64, %cond.false.i.i62 ], [ %call.i.i39, %cond.true.i.i38 ]
br label %do.body.i44
do.body.i44: ; preds = %do.body.i44.preheader, %getchar_unlocked.exit13.i56
%13 = phi ptr [ %18, %getchar_unlocked.exit13.i56 ], [ %.ph106, %do.body.i44.preheader ]
%14 = phi ptr [ %19, %getchar_unlocked.exit13.i56 ], [ %.ph106, %do.body.i44.preheader ]
%n.0.i45 = phi i32 [ %add.i49, %getchar_unlocked.exit13.i56 ], [ 0, %do.body.i44.preheader ]
%c.0.i46 = phi i32 [ %cond.i9.i57, %getchar_unlocked.exit13.i56 ], [ %c.0.i46.ph, %do.body.i44.preheader ]
%mul.i47 = mul nsw i32 %n.0.i45, 10
%and.i48 = and i32 %c.0.i46, 15
%add.i49 = add nsw i32 %and.i48, %mul.i47
%_IO_read_ptr.i4.i50 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 1
%15 = load ptr, ptr %_IO_read_ptr.i4.i50, align 8, !tbaa !15
%_IO_read_end.i5.i51 = getelementptr inbounds %struct._IO_FILE, ptr %14, i64 0, i32 2
%16 = load ptr, ptr %_IO_read_end.i5.i51, align 8, !tbaa !19
%cmp.not.i6.i52 = icmp ult ptr %15, %16
br i1 %cmp.not.i6.i52, label %cond.false.i10.i59, label %cond.true.i7.i53, !prof !20
cond.true.i7.i53: ; preds = %do.body.i44
%call.i8.i54 = tail call i32 @__uflow(ptr noundef nonnull %14) #4
%.pre.i55 = load ptr, ptr @stdin, align 8, !tbaa !13
br label %getchar_unlocked.exit13.i56
cond.false.i10.i59: ; preds = %do.body.i44
%incdec.ptr.i11.i60 = getelementptr inbounds i8, ptr %15, i64 1
store ptr %incdec.ptr.i11.i60, ptr %_IO_read_ptr.i4.i50, align 8, !tbaa !15
%17 = load i8, ptr %15, align 1, !tbaa !21
%conv3.i12.i61 = zext i8 %17 to i32
br label %getchar_unlocked.exit13.i56
getchar_unlocked.exit13.i56: ; preds = %cond.false.i10.i59, %cond.true.i7.i53
%18 = phi ptr [ %.pre.i55, %cond.true.i7.i53 ], [ %13, %cond.false.i10.i59 ]
%19 = phi ptr [ %.pre.i55, %cond.true.i7.i53 ], [ %14, %cond.false.i10.i59 ]
%cond.i9.i57 = phi i32 [ %call.i8.i54, %cond.true.i7.i53 ], [ %conv3.i12.i61, %cond.false.i10.i59 ]
%cmp.i58 = icmp sgt i32 %cond.i9.i57, 47
br i1 %cmp.i58, label %do.body.i44, label %in.exit65, !llvm.loop !22
in.exit65: ; preds = %getchar_unlocked.exit13.i56
%arrayidx = getelementptr inbounds [1000002 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %add.i49, ptr %arrayidx, 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 !23
for.end: ; preds = %in.exit65, %for.cond.preheader
store i32 1, ptr @g, align 16, !tbaa !5
br label %for.cond.i
for.cond.i: ; preds = %for.cond.i, %for.end
%20 = phi i32 [ %add.i67, %for.cond.i ], [ 1, %for.end ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond.i ], [ 1, %for.end ]
%mul.i66 = mul nsw i32 %20, 3
%add.i67 = add nsw i32 %mul.i66, 1
%arrayidx2.i = getelementptr inbounds [102 x i32], ptr @g, i64 0, i64 %indvars.iv.i
store i32 %add.i67, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp.not.i = icmp slt i32 %add.i67, %add.i
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %for.cond.i, label %for.end.i
for.end.i: ; preds = %for.cond.i
%21 = trunc i64 %indvars.iv.i to i32
store i32 %21, ptr @m, align 4, !tbaa !5
store i32 0, ptr @cnt, align 4, !tbaa !5
%wide.trip.count.i.i = sext i32 %add.i to i64
br label %for.body.i
for.body.i: ; preds = %insertion_sort.exit.i, %for.end.i
%cnt.promoted7179 = phi i32 [ 0, %for.end.i ], [ %cnt.promoted7175, %insertion_sort.exit.i ]
%indvars.iv19.i = phi i64 [ %indvars.iv.i, %for.end.i ], [ %indvars.iv.next20.i, %insertion_sort.exit.i ]
%indvars.iv.next20.i = add nsw i64 %indvars.iv19.i, -1
%idxprom8.i = and i64 %indvars.iv.next20.i, 4294967295
%arrayidx9.i = getelementptr inbounds [102 x i32], ptr @g, i64 0, i64 %idxprom8.i
%22 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%cmp36.i.i = icmp slt i32 %22, %add.i
br i1 %cmp36.i.i, label %for.body.preheader.i.i, label %insertion_sort.exit.i
for.body.preheader.i.i: ; preds = %for.body.i
%23 = sext i32 %22 to i64
br label %land.rhs.preheader.i.i
land.rhs.preheader.i.i: ; preds = %while.end.i.i, %for.body.preheader.i.i
%cnt.promoted7178 = phi i32 [ %cnt.promoted7179, %for.body.preheader.i.i ], [ %cnt.promoted7176, %while.end.i.i ]
%cnt.promoted74 = phi i32 [ %cnt.promoted7179, %for.body.preheader.i.i ], [ %cnt.promoted72, %while.end.i.i ]
%indvars.iv.i.i = phi i64 [ %23, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i, %while.end.i.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr @a, i64 %indvars.iv.i.i
%24 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%25 = trunc i64 %indvars.iv.i.i to i32
%26 = sub i32 %25, %22
%idxprom2.i.i95 = zext i32 %26 to i64
%arrayidx3.i.i96 = getelementptr inbounds i32, ptr @a, i64 %idxprom2.i.i95
%27 = load i32, ptr %arrayidx3.i.i96, align 4, !tbaa !5
%cmp4.i.i97 = icmp sgt i32 %27, %24
br i1 %cmp4.i.i97, label %while.body.i.i, label %while.end.i.i
land.rhs.i.i: ; preds = %while.body.i.i
%idxprom2.i.i = zext i32 %j.0.i.i to i64
%arrayidx3.i.i = getelementptr inbounds i32, ptr @a, i64 %idxprom2.i.i
%28 = load i32, ptr %arrayidx3.i.i, align 4, !tbaa !5
%cmp4.i.i = icmp sgt i32 %28, %24
br i1 %cmp4.i.i, label %while.body.i.i, label %while.end.i.i.loopexit, !llvm.loop !9
while.body.i.i: ; preds = %land.rhs.preheader.i.i, %land.rhs.i.i
%29 = phi i32 [ %28, %land.rhs.i.i ], [ %27, %land.rhs.preheader.i.i ]
%i.0.pn33.i.i100 = phi i32 [ %j.034.i.i99, %land.rhs.i.i ], [ %25, %land.rhs.preheader.i.i ]
%j.034.i.i99 = phi i32 [ %j.0.i.i, %land.rhs.i.i ], [ %26, %land.rhs.preheader.i.i ]
%cnt.promoted7398 = phi i32 [ %inc.i.i, %land.rhs.i.i ], [ %cnt.promoted74, %land.rhs.preheader.i.i ]
%idxprom7.i.i = sext i32 %i.0.pn33.i.i100 to i64
%arrayidx8.i.i = getelementptr inbounds i32, ptr @a, i64 %idxprom7.i.i
store i32 %29, ptr %arrayidx8.i.i, align 4, !tbaa !5
%inc.i.i = add nsw i32 %cnt.promoted7398, 1
%j.0.i.i = sub nsw i32 %j.034.i.i99, %22
%cmp1.i.i = icmp sgt i32 %j.0.i.i, -1
br i1 %cmp1.i.i, label %land.rhs.i.i, label %while.end.i.i.loopexit, !llvm.loop !9
while.end.i.i.loopexit: ; preds = %while.body.i.i, %land.rhs.i.i
store i32 %inc.i.i, ptr @cnt, align 4, !tbaa !5
br label %while.end.i.i
while.end.i.i: ; preds = %while.end.i.i.loopexit, %land.rhs.preheader.i.i
%cnt.promoted7176 = phi i32 [ %cnt.promoted7178, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.loopexit ]
%cnt.promoted72 = phi i32 [ %cnt.promoted74, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.loopexit ]
%i.0.pn.lcssa.ph.i.i = phi i32 [ %25, %land.rhs.preheader.i.i ], [ %j.034.i.i99, %while.end.i.i.loopexit ]
%idxprom11.i.i = sext i32 %i.0.pn.lcssa.ph.i.i to i64
%arrayidx12.i.i = getelementptr inbounds i32, ptr @a, i64 %idxprom11.i.i
store i32 %24, ptr %arrayidx12.i.i, align 4, !tbaa !5
%indvars.iv.next.i.i = add nsw i64 %indvars.iv.i.i, 1
%exitcond.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.i, label %insertion_sort.exit.i, label %land.rhs.preheader.i.i, !llvm.loop !11
insertion_sort.exit.i: ; preds = %while.end.i.i, %for.body.i
%cnt.promoted7175 = phi i32 [ %cnt.promoted7179, %for.body.i ], [ %cnt.promoted7176, %while.end.i.i ]
%30 = icmp sgt i64 %indvars.iv19.i, 1
br i1 %30, label %for.body.i, label %shell_sort.exit, !llvm.loop !12
shell_sort.exit: ; preds = %insertion_sort.exit.i
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %21)
%31 = load i32, ptr @m, align 4, !tbaa !5
%sub = add nsw i32 %31, -1
%idxprom3 = sext i32 %sub to i64
%arrayidx4 = getelementptr inbounds [102 x i32], ptr @g, i64 0, i64 %idxprom3
%32 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %32)
%33 = load i32, ptr @m, align 4, !tbaa !5
%cmp880 = icmp sgt i32 %33, 1
br i1 %cmp880, label %for.body9.preheader, label %for.end14
for.body9.preheader: ; preds = %shell_sort.exit
%sub6 = add nsw i32 %33, -2
%34 = zext i32 %sub6 to i64
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv85 = phi i64 [ %34, %for.body9.preheader ], [ %indvars.iv.next86, %for.body9 ]
%arrayidx11 = getelementptr inbounds [102 x i32], ptr @g, i64 0, i64 %indvars.iv85
%35 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %35)
%indvars.iv.next86 = add nsw i64 %indvars.iv85, -1
%cmp8.not = icmp eq i64 %indvars.iv85, 0
br i1 %cmp8.not, label %for.end14, label %for.body9, !llvm.loop !24
for.end14: ; preds = %for.body9, %shell_sort.exit
%36 = load i32, ptr @cnt, align 4, !tbaa !5
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %36)
br i1 %cmp68, label %for.body18.preheader, label %for.end24
for.body18.preheader: ; preds = %for.end14
%wide.trip.count91 = zext i32 %add.i to i64
br label %for.body18
for.body18: ; preds = %for.body18.preheader, %for.body18
%indvars.iv88 = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next89, %for.body18 ]
%arrayidx20 = getelementptr inbounds [1000002 x i32], ptr @a, i64 0, i64 %indvars.iv88
%37 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%call21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %37)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91
br i1 %exitcond92.not, label %for.end24, label %for.body18, !llvm.loop !25
for.end24: ; preds = %for.body18, %for.end14
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !14, i64 8}
!16 = !{!"_IO_FILE", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !6, i64 112, !6, i64 116, !17, i64 120, !18, i64 128, !7, i64 130, !7, i64 131, !14, i64 136, !17, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !14, i64 176, !17, i64 184, !6, i64 192, !7, i64 196}
!17 = !{!"long", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!16, !14, i64 16}
!20 = !{!"branch_weights", i32 2000, i32 1}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
|
#include<stdio.h>
int l,cnt,gcount;
int ary[1000000];
int n;
int G[100];
void insertsort(int ary[],int n,int g){
for(int i=g;i<n;i++){
int v=ary[i];
int j=i-g;
while(j>=0 && ary[j]>v){
ary[j+g]=ary[j];
j-=g;
cnt++;
}
ary[j+g]=v;
}
}
void shellsort(int ary[],int n){
int i,h=1;
gcount=0;
while(1){
if(h>n)break;
G[gcount]=h;
h=3*h+1;
gcount++;
}
for(i=gcount-1;i>=0;i--){
insertsort(ary,n,G[i]);
}
}
int main(){
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&ary[i]);
}
cnt=0;
shellsort(ary,n);
printf("%d\n",gcount);
for(i=gcount-1;i>=0;i--){
printf("%d",G[i]);
if(i>0)printf(" ");
}
printf("\n");
printf("%d\n",cnt);
for(i=0;i<n;i++)printf("%d\n",ary[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119264/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119264/source.c"
target datalayout = "e-m:e-p270: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
@gcount = dso_local local_unnamed_addr global i32 0, align 4
@G = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@ary = dso_local global [1000000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@l = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insertsort(ptr nocapture noundef %ary, i32 noundef %n, i32 noundef %g) local_unnamed_addr #0 {
entry:
%cmp36 = icmp slt i32 %g, %n
br i1 %cmp36, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
for.cond.cleanup: ; preds = %while.end, %entry
ret void
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %ary, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%j.034 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%i.0.pn33 = phi i32 [ %j.034, %while.body ], [ %2, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.034 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %ary, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn33 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %ary, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !5
%6 = load i32, ptr @cnt, align 4, !tbaa !5
%inc = add nsw i32 %6, 1
store i32 %inc, ptr @cnt, align 4, !tbaa !5
%j.0 = sub nsw i32 %j.034, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !9
while.end: ; preds = %land.rhs, %while.body
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn33, %land.rhs ], [ %j.034, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %ary, i64 %idxprom11
store i32 %1, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %land.rhs.preheader, !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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @shellsort(ptr nocapture noundef %ary, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp10 = icmp slt i32 %n, 1
br i1 %cmp10, label %for.cond.preheader.thread, label %if.end
for.cond.preheader.thread: ; preds = %entry
store i32 0, ptr @gcount, align 4, !tbaa !5
br label %for.end
for.cond.preheader: ; preds = %if.end
%0 = trunc i64 %indvars.iv.next to i32
store i32 %0, ptr @gcount, align 4, !tbaa !5
%cmp114 = icmp sgt i32 %0, 0
br i1 %cmp114, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %for.cond.preheader
%wide.trip.count.i = sext i32 %n to i64
%1 = and i64 %indvars.iv.next, 4294967295
br label %for.body
if.end: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%h.012 = phi i32 [ %add, %if.end ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr @G, i64 0, i64 %indvars.iv
store i32 %h.012, ptr %arrayidx, align 4, !tbaa !5
%mul = mul nsw i32 %h.012, 3
%add = add nsw i32 %mul, 1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp.not = icmp slt i32 %mul, %n
br i1 %cmp.not, label %if.end, label %for.cond.preheader
for.body: ; preds = %for.body.lr.ph, %insertsort.exit
%indvars.iv17 = phi i64 [ %1, %for.body.lr.ph ], [ %indvars.iv.next18, %insertsort.exit ]
%indvars.iv.next18 = add nsw i64 %indvars.iv17, -1
%idxprom2 = and i64 %indvars.iv.next18, 4294967295
%arrayidx3 = getelementptr inbounds [100 x i32], ptr @G, i64 0, i64 %idxprom2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp36.i = icmp slt i32 %2, %n
br i1 %cmp36.i, label %for.body.preheader.i, label %insertsort.exit
for.body.preheader.i: ; preds = %for.body
%3 = sext i32 %2 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %3, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %ary, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%5 = trunc i64 %indvars.iv.i to i32
%6 = sub i32 %5, %2
br label %land.rhs.i
land.rhs.i: ; preds = %while.body.i, %land.rhs.preheader.i
%j.034.i = phi i32 [ %j.0.i, %while.body.i ], [ %6, %land.rhs.preheader.i ]
%i.0.pn33.i = phi i32 [ %j.034.i, %while.body.i ], [ %5, %land.rhs.preheader.i ]
%idxprom2.i = zext i32 %j.034.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %ary, i64 %idxprom2.i
%7 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %7, %4
br i1 %cmp4.i, label %while.body.i, label %while.end.i
while.body.i: ; preds = %land.rhs.i
%idxprom7.i = sext i32 %i.0.pn33.i to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %ary, i64 %idxprom7.i
store i32 %7, ptr %arrayidx8.i, align 4, !tbaa !5
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%inc.i = add nsw i32 %8, 1
store i32 %inc.i, ptr @cnt, align 4, !tbaa !5
%j.0.i = sub nsw i32 %j.034.i, %2
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i, !llvm.loop !9
while.end.i: ; preds = %while.body.i, %land.rhs.i
%i.0.pn.lcssa.ph.i = phi i32 [ %i.0.pn33.i, %land.rhs.i ], [ %j.034.i, %while.body.i ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %ary, i64 %idxprom11.i
store i32 %4, ptr %arrayidx12.i, align 4, !tbaa !5
%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 %insertsort.exit, label %land.rhs.preheader.i, !llvm.loop !11
insertsort.exit: ; preds = %while.end.i, %for.body
%cmp1 = icmp sgt i64 %indvars.iv17, 1
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %insertsort.exit, %for.cond.preheader.thread, %for.cond.preheader
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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i32 0, ptr @cnt, align 4, !tbaa !5
br label %for.cond.preheader.thread.i
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @ary, 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 !13
for.end: ; preds = %for.body
store i32 0, ptr @cnt, align 4, !tbaa !5
%cmp10.i = icmp slt i32 %1, 1
br i1 %cmp10.i, label %for.cond.preheader.thread.i, label %if.end.i
for.cond.preheader.thread.i: ; preds = %for.end.thread, %for.end
store i32 0, ptr @gcount, align 4, !tbaa !5
br label %shellsort.exit
for.cond.preheader.i: ; preds = %if.end.i
%3 = trunc i64 %indvars.iv.next.i to i32
store i32 %3, ptr @gcount, align 4, !tbaa !5
%cmp114.i = icmp sgt i32 %3, 0
br i1 %cmp114.i, label %for.body.lr.ph.i, label %shellsort.exit
for.body.lr.ph.i: ; preds = %for.cond.preheader.i
%wide.trip.count.i.i = sext i32 %1 to i64
%4 = and i64 %indvars.iv.next.i, 4294967295
br label %for.body.i
if.end.i: ; preds = %for.end, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 0, %for.end ]
%h.012.i = phi i32 [ %add.i, %if.end.i ], [ 1, %for.end ]
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @G, i64 0, i64 %indvars.iv.i
store i32 %h.012.i, ptr %arrayidx.i, align 4, !tbaa !5
%mul.i = mul nsw i32 %h.012.i, 3
%add.i = add nsw i32 %mul.i, 1
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%cmp.not.i = icmp slt i32 %mul.i, %1
br i1 %cmp.not.i, label %if.end.i, label %for.cond.preheader.i
for.body.i: ; preds = %insertsort.exit.i, %for.body.lr.ph.i
%cnt.promoted3745 = phi i32 [ 0, %for.body.lr.ph.i ], [ %cnt.promoted3741, %insertsort.exit.i ]
%indvars.iv17.i = phi i64 [ %4, %for.body.lr.ph.i ], [ %indvars.iv.next18.i, %insertsort.exit.i ]
%indvars.iv.next18.i = add nsw i64 %indvars.iv17.i, -1
%idxprom2.i = and i64 %indvars.iv.next18.i, 4294967295
%arrayidx3.i = getelementptr inbounds [100 x i32], ptr @G, i64 0, i64 %idxprom2.i
%5 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp36.i.i = icmp slt i32 %5, %1
br i1 %cmp36.i.i, label %for.body.preheader.i.i, label %insertsort.exit.i
for.body.preheader.i.i: ; preds = %for.body.i
%6 = sext i32 %5 to i64
br label %land.rhs.preheader.i.i
land.rhs.preheader.i.i: ; preds = %while.end.i.i, %for.body.preheader.i.i
%cnt.promoted3744 = phi i32 [ %cnt.promoted3745, %for.body.preheader.i.i ], [ %cnt.promoted3742, %while.end.i.i ]
%cnt.promoted40 = phi i32 [ %cnt.promoted3745, %for.body.preheader.i.i ], [ %cnt.promoted38, %while.end.i.i ]
%indvars.iv.i.i = phi i64 [ %6, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i, %while.end.i.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr @ary, i64 %indvars.iv.i.i
%7 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !5
%8 = trunc i64 %indvars.iv.i.i to i32
%9 = sub i32 %8, %5
%idxprom2.i.i64 = zext i32 %9 to i64
%arrayidx3.i.i65 = getelementptr inbounds i32, ptr @ary, i64 %idxprom2.i.i64
%10 = load i32, ptr %arrayidx3.i.i65, align 4, !tbaa !5
%cmp4.i.i66 = icmp sgt i32 %10, %7
br i1 %cmp4.i.i66, label %while.body.i.i, label %while.end.i.i
land.rhs.i.i: ; preds = %while.body.i.i
%idxprom2.i.i = zext i32 %j.0.i.i to i64
%arrayidx3.i.i = getelementptr inbounds i32, ptr @ary, i64 %idxprom2.i.i
%11 = load i32, ptr %arrayidx3.i.i, align 4, !tbaa !5
%cmp4.i.i = icmp sgt i32 %11, %7
br i1 %cmp4.i.i, label %while.body.i.i, label %while.end.i.i.loopexit, !llvm.loop !9
while.body.i.i: ; preds = %land.rhs.preheader.i.i, %land.rhs.i.i
%12 = phi i32 [ %11, %land.rhs.i.i ], [ %10, %land.rhs.preheader.i.i ]
%i.0.pn33.i.i69 = phi i32 [ %j.034.i.i68, %land.rhs.i.i ], [ %8, %land.rhs.preheader.i.i ]
%j.034.i.i68 = phi i32 [ %j.0.i.i, %land.rhs.i.i ], [ %9, %land.rhs.preheader.i.i ]
%cnt.promoted3967 = phi i32 [ %inc.i.i, %land.rhs.i.i ], [ %cnt.promoted40, %land.rhs.preheader.i.i ]
%idxprom7.i.i = sext i32 %i.0.pn33.i.i69 to i64
%arrayidx8.i.i = getelementptr inbounds i32, ptr @ary, i64 %idxprom7.i.i
store i32 %12, ptr %arrayidx8.i.i, align 4, !tbaa !5
%inc.i.i = add nsw i32 %cnt.promoted3967, 1
%j.0.i.i = sub nsw i32 %j.034.i.i68, %5
%cmp1.i.i = icmp sgt i32 %j.0.i.i, -1
br i1 %cmp1.i.i, label %land.rhs.i.i, label %while.end.i.i.loopexit, !llvm.loop !9
while.end.i.i.loopexit: ; preds = %while.body.i.i, %land.rhs.i.i
store i32 %inc.i.i, ptr @cnt, align 4, !tbaa !5
br label %while.end.i.i
while.end.i.i: ; preds = %while.end.i.i.loopexit, %land.rhs.preheader.i.i
%cnt.promoted3742 = phi i32 [ %cnt.promoted3744, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.loopexit ]
%cnt.promoted38 = phi i32 [ %cnt.promoted40, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.loopexit ]
%i.0.pn.lcssa.ph.i.i = phi i32 [ %8, %land.rhs.preheader.i.i ], [ %j.034.i.i68, %while.end.i.i.loopexit ]
%idxprom11.i.i = sext i32 %i.0.pn.lcssa.ph.i.i to i64
%arrayidx12.i.i = getelementptr inbounds i32, ptr @ary, i64 %idxprom11.i.i
store i32 %7, ptr %arrayidx12.i.i, align 4, !tbaa !5
%indvars.iv.next.i.i = add nsw i64 %indvars.iv.i.i, 1
%exitcond.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.i, label %insertsort.exit.i, label %land.rhs.preheader.i.i, !llvm.loop !11
insertsort.exit.i: ; preds = %while.end.i.i, %for.body.i
%cnt.promoted3741 = phi i32 [ %cnt.promoted3745, %for.body.i ], [ %cnt.promoted3742, %while.end.i.i ]
%cmp1.i = icmp sgt i64 %indvars.iv17.i, 1
br i1 %cmp1.i, label %for.body.i, label %shellsort.exit, !llvm.loop !12
shellsort.exit: ; preds = %insertsort.exit.i, %for.cond.preheader.thread.i, %for.cond.preheader.i
%13 = phi i32 [ 0, %for.cond.preheader.thread.i ], [ %3, %for.cond.preheader.i ], [ %3, %insertsort.exit.i ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%14 = load i32, ptr @gcount, align 4, !tbaa !5
%cmp447 = icmp sgt i32 %14, 0
br i1 %cmp447, label %for.body5.preheader, label %for.end12
for.body5.preheader: ; preds = %shellsort.exit
%15 = zext i32 %14 to i64
%indvars.iv.next5575 = add nsw i64 %15, -1
%idxprom676 = and i64 %indvars.iv.next5575, 4294967295
%arrayidx777 = getelementptr inbounds [100 x i32], ptr @G, i64 0, i64 %idxprom676
%16 = load i32, ptr %arrayidx777, align 4, !tbaa !5
%call878 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16)
%cmp9.not79 = icmp eq i32 %14, 1
br i1 %cmp9.not79, label %for.end12, label %for.inc11
for.inc11: ; preds = %for.body5.preheader, %for.inc11
%indvars.iv.next5580 = phi i64 [ %indvars.iv.next55, %for.inc11 ], [ %indvars.iv.next5575, %for.body5.preheader ]
%putchar33 = call i32 @putchar(i32 32)
%indvars.iv.next55 = add nsw i64 %indvars.iv.next5580, -1
%idxprom6 = and i64 %indvars.iv.next55, 4294967295
%arrayidx7 = getelementptr inbounds [100 x i32], ptr @G, i64 0, i64 %idxprom6
%17 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17)
%cmp9.not = icmp eq i64 %indvars.iv.next5580, 1
br i1 %cmp9.not, label %for.end12, label %for.inc11, !llvm.loop !14
for.end12: ; preds = %for.inc11, %for.body5.preheader, %shellsort.exit
%putchar = call i32 @putchar(i32 10)
%18 = load i32, ptr @cnt, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp1650 = icmp sgt i32 %19, 0
br i1 %cmp1650, label %for.body17, label %for.end23
for.body17: ; preds = %for.end12, %for.body17
%indvars.iv57 = phi i64 [ %indvars.iv.next58, %for.body17 ], [ 0, %for.end12 ]
%arrayidx19 = getelementptr inbounds [1000000 x i32], ptr @ary, i64 0, i64 %indvars.iv57
%20 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %20)
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp16 = icmp slt i64 %indvars.iv.next58, %22
br i1 %cmp16, label %for.body17, label %for.end23, !llvm.loop !15
for.end23: ; preds = %for.body17, %for.end12
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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int insertionSort(int *,int,int);
int main (){
int n,x[1000000],i,j,cnt=0,m,g[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x[i]);
}
j=0;
for(i=1;i<=n;i=3*i+1){
g[j]=i;
j++;
cnt++;
}
m=cnt;
cnt=0;
for(i=1;i<=m;i++){
cnt=insertionSort(x,n,g[m-i]);
}
printf("%d\n",m);
for(i=1;i<=m;i++){
if(i-1){
printf(" ");
}
printf("%d",g[m-i]);
}
printf("\n");
printf("%d\n",cnt);
for(i=0;i<n;i++){
printf("%d\n",x[i]);
}
return 0;
}
int insertionSort(int *x,int n,int g){
int i,v,j;
static int cnt;
for(i=g;i<n;i++){
v=x[i];
j=i-g;
while((j>=0) && (x[j]>v)){
x[j+g]=x[j];
j=j-g;
cnt++;
}
x[j+g]=v;
}
return cnt;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119314/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119314/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@insertionSort.cnt = internal unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca [1000000 x i32], align 16
%g = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %g) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
br i1 %cmp68, label %for.body, label %for.end19.thread
for.cond2.preheader: ; preds = %for.body
%cmp3.not70 = icmp slt i32 %1, 1
br i1 %cmp3.not70, label %for.end19.thread, label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.body4
%indvars = trunc i64 %indvars.iv.next106 to i32
%cmp12.not92 = icmp eq i32 %indvars, 0
br i1 %cmp12.not92, label %for.end19.thread, label %for.body13.lr.ph
for.body13.lr.ph: ; preds = %for.cond11.preheader
%insertionSort.cnt.promoted = load i32, ptr @insertionSort.cnt, align 4, !tbaa !5
%wide.trip.count.i = sext i32 %1 to i64
%sext = shl i64 %indvars.iv.next106, 32
%3 = ashr exact i64 %sext, 32
%4 = add i64 %indvars.iv105, 2
%wide.trip.count = and i64 %4, 4294967295
br label %for.body13
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.body4 ], [ 0, %for.cond2.preheader ]
%i.173 = phi i32 [ %add, %for.body4 ], [ 1, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100 x i32], ptr %g, i64 0, i64 %indvars.iv105
store i32 %i.173, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next106 = add nuw i64 %indvars.iv105, 1
%mul = mul nsw i32 %i.173, 3
%add = add nsw i32 %mul, 1
%cmp3.not.not = icmp slt i32 %mul, %1
br i1 %cmp3.not.not, label %for.body4, label %for.cond11.preheader, !llvm.loop !11
for.body13: ; preds = %for.body13.lr.ph, %insertionSort.exit
%indvars.iv110 = phi i64 [ 1, %for.body13.lr.ph ], [ %indvars.iv.next111, %insertionSort.exit ]
%inc.i.lcssa879193 = phi i32 [ %insertionSort.cnt.promoted, %for.body13.lr.ph ], [ %inc.i.lcssa8788, %insertionSort.exit ]
%5 = sub nsw i64 %3, %indvars.iv110
%arrayidx15 = getelementptr inbounds [100 x i32], ptr %g, i64 0, i64 %5
%6 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp43.i = icmp slt i32 %6, %1
br i1 %cmp43.i, label %for.body.preheader.i, label %insertionSort.exit
for.body.preheader.i: ; preds = %for.body13
%7 = sext i32 %6 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%inc.i.lcssa8790 = phi i32 [ %inc.i.lcssa879193, %for.body.preheader.i ], [ %inc.i.lcssa8789, %while.end.i ]
%8 = phi i32 [ %inc.i.lcssa879193, %for.body.preheader.i ], [ %15, %while.end.i ]
%indvars.iv.i = phi i64 [ %7, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%insertionSort.cnt.promoted4144.i = phi i32 [ %inc.i.lcssa879193, %for.body.preheader.i ], [ %insertionSort.cnt.promoted39.ph.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%10 = trunc i64 %indvars.iv.i to i32
%11 = sub i32 %10, %6
%idxprom2.i75 = zext i32 %11 to i64
%arrayidx3.i76 = getelementptr inbounds i32, ptr %x, i64 %idxprom2.i75
%12 = load i32, ptr %arrayidx3.i76, align 4, !tbaa !5
%cmp4.i77 = icmp sgt i32 %12, %9
br i1 %cmp4.i77, label %while.body.i, label %while.end.i
land.rhs.i: ; preds = %while.body.i
%idxprom2.i = zext i32 %j.0.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %x, i64 %idxprom2.i
%13 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %13, %9
br i1 %cmp4.i, label %while.body.i, label %while.end.i.sink.split, !llvm.loop !12
while.body.i: ; preds = %land.rhs.preheader.i, %land.rhs.i
%14 = phi i32 [ %13, %land.rhs.i ], [ %12, %land.rhs.preheader.i ]
%i.0.pn35.i80 = phi i32 [ %j.036.i79, %land.rhs.i ], [ %10, %land.rhs.preheader.i ]
%j.036.i79 = phi i32 [ %j.0.i, %land.rhs.i ], [ %11, %land.rhs.preheader.i ]
%insertionSort.cnt.promoted40.i78 = phi i32 [ %inc.i, %land.rhs.i ], [ %insertionSort.cnt.promoted4144.i, %land.rhs.preheader.i ]
%idxprom7.i = sext i32 %i.0.pn35.i80 to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %x, i64 %idxprom7.i
store i32 %14, ptr %arrayidx8.i, align 4, !tbaa !5
%inc.i = add nsw i32 %insertionSort.cnt.promoted40.i78, 1
%j.0.i = sub nsw i32 %j.036.i79, %6
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i.sink.split, !llvm.loop !12
while.end.i.sink.split: ; preds = %land.rhs.i, %while.body.i
store i32 %inc.i, ptr @insertionSort.cnt, align 4, !tbaa !5
br label %while.end.i
while.end.i: ; preds = %while.end.i.sink.split, %land.rhs.preheader.i
%inc.i.lcssa8789 = phi i32 [ %inc.i.lcssa8790, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.sink.split ]
%15 = phi i32 [ %8, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.sink.split ]
%insertionSort.cnt.promoted39.ph.i = phi i32 [ %insertionSort.cnt.promoted4144.i, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.sink.split ]
%i.0.pn.lcssa.ph.i = phi i32 [ %10, %land.rhs.preheader.i ], [ %j.036.i79, %while.end.i.sink.split ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %x, i64 %idxprom11.i
store i32 %9, ptr %arrayidx12.i, align 4, !tbaa !5
%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 %insertionSort.exit, label %land.rhs.preheader.i, !llvm.loop !13
insertionSort.exit: ; preds = %while.end.i, %for.body13
%inc.i.lcssa8788 = phi i32 [ %inc.i.lcssa879193, %for.body13 ], [ %inc.i.lcssa8789, %while.end.i ]
%16 = phi i32 [ %inc.i.lcssa879193, %for.body13 ], [ %15, %while.end.i ]
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%exitcond.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count
br i1 %exitcond.not, label %for.end19, label %for.body13, !llvm.loop !14
for.end19.thread: ; preds = %for.cond11.preheader, %for.cond2.preheader, %entry
%call20138 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %for.end32
for.end19: ; preds = %insertionSort.exit
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %indvars)
br i1 %cmp12.not92, label %for.end32, label %if.end.peel
if.end.peel: ; preds = %for.end19
%sext144 = shl i64 %indvars.iv.next106, 32
%17 = ashr exact i64 %sext144, 32
%18 = add i32 %indvars, 1
%wide.trip.count120 = zext i32 %18 to i64
%19 = add nsw i64 %17, -1
%arrayidx28.peel = getelementptr inbounds [100 x i32], ptr %g, i64 0, i64 %19
%20 = load i32, ptr %arrayidx28.peel, align 4, !tbaa !5
%call29.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %20)
%exitcond121.peel.not = icmp eq i32 %18, 2
br i1 %exitcond121.peel.not, label %for.end32, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv115 = phi i64 [ %indvars.iv.next116, %if.end ], [ 2, %if.end.peel ]
%putchar66 = call i32 @putchar(i32 32)
%21 = sub nsw i64 %17, %indvars.iv115
%arrayidx28 = getelementptr inbounds [100 x i32], ptr %g, i64 0, i64 %21
%22 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %22)
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count120
br i1 %exitcond121.not, label %for.end32, label %if.end, !llvm.loop !15
for.end32: ; preds = %if.end, %if.end.peel, %for.end19.thread, %for.end19
%cnt.1.lcssa139 = phi i32 [ 0, %for.end19.thread ], [ %16, %for.end19 ], [ %16, %if.end.peel ], [ %16, %if.end ]
%putchar = call i32 @putchar(i32 10)
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.1.lcssa139)
%23 = load i32, ptr %n, align 4, !tbaa !5
%cmp3698 = icmp sgt i32 %23, 0
br i1 %cmp3698, label %for.body37, label %for.end43
for.body37: ; preds = %for.end32, %for.body37
%indvars.iv123 = phi i64 [ %indvars.iv.next124, %for.body37 ], [ 0, %for.end32 ]
%arrayidx39 = getelementptr inbounds [1000000 x i32], ptr %x, i64 0, i64 %indvars.iv123
%24 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24)
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp36 = icmp slt i64 %indvars.iv.next124, %26
br i1 %cmp36, label %for.body37, label %for.end43, !llvm.loop !17
for.end43: ; preds = %for.body37, %for.end32
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %g) #5
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @insertionSort(ptr nocapture noundef %x, i32 noundef %n, i32 noundef %g) local_unnamed_addr #3 {
entry:
%insertionSort.cnt.promoted38 = load i32, ptr @insertionSort.cnt, align 4, !tbaa !5
%cmp43 = icmp slt i32 %g, %n
br i1 %cmp43, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%1 = phi i32 [ %insertionSort.cnt.promoted38, %for.body.preheader ], [ %9, %while.end ]
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%insertionSort.cnt.promoted4144 = phi i32 [ %insertionSort.cnt.promoted38, %for.body.preheader ], [ %insertionSort.cnt.promoted39.ph, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %x, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%3 = trunc i64 %indvars.iv to i32
%4 = trunc i64 %indvars.iv to i32
%5 = sub i32 %4, %g
%idxprom248 = zext i32 %5 to i64
%arrayidx349 = getelementptr inbounds i32, ptr %x, i64 %idxprom248
%6 = load i32, ptr %arrayidx349, align 4, !tbaa !5
%cmp450 = icmp sgt i32 %6, %2
br i1 %cmp450, label %while.body, label %while.end
land.rhs: ; preds = %while.body
%idxprom2 = zext i32 %j.0 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %x, i64 %idxprom2
%7 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %7, %2
br i1 %cmp4, label %while.body, label %while.end.loopexit, !llvm.loop !12
while.body: ; preds = %land.rhs.preheader, %land.rhs
%8 = phi i32 [ %7, %land.rhs ], [ %6, %land.rhs.preheader ]
%i.0.pn3553 = phi i32 [ %j.03652, %land.rhs ], [ %3, %land.rhs.preheader ]
%j.03652 = phi i32 [ %j.0, %land.rhs ], [ %5, %land.rhs.preheader ]
%insertionSort.cnt.promoted4051 = phi i32 [ %inc, %land.rhs ], [ %insertionSort.cnt.promoted4144, %land.rhs.preheader ]
%idxprom7 = sext i32 %i.0.pn3553 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %x, i64 %idxprom7
store i32 %8, ptr %arrayidx8, align 4, !tbaa !5
%inc = add nsw i32 %insertionSort.cnt.promoted4051, 1
%j.0 = sub nsw i32 %j.03652, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end.loopexit, !llvm.loop !12
while.end.loopexit: ; preds = %land.rhs, %while.body
store i32 %inc, ptr @insertionSort.cnt, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.end.loopexit, %land.rhs.preheader
%9 = phi i32 [ %1, %land.rhs.preheader ], [ %inc, %while.end.loopexit ]
%insertionSort.cnt.promoted39.ph = phi i32 [ %insertionSort.cnt.promoted4144, %land.rhs.preheader ], [ %inc, %while.end.loopexit ]
%i.0.pn.lcssa.ph = phi i32 [ %3, %land.rhs.preheader ], [ %j.03652, %while.end.loopexit ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %x, i64 %idxprom11
store i32 %2, ptr %arrayidx12, 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.end, label %land.rhs.preheader, !llvm.loop !13
for.end: ; preds = %while.end, %entry
%10 = phi i32 [ %insertionSort.cnt.promoted38, %entry ], [ %9, %while.end ]
ret i32 %10
}
; 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 #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 norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
long long k;
int l=0;
int a[1000000];
int n;
int g[1000000];
void insertionsort(int a[], int n, int g)
{
int i, v, j;
for(i = g; i < n; i++){
v = a[i];
j = i - g;
while(j >= 0 && a[j] > v){
a[j+g] = a[j];
j-=g;
k++;
}
a[j+g] = v;
}
}
void shellsort(int a[], int n)
{
int h, j;
for(h = 1; ;){
if(h > n)break;
g[l] = h;
h = 3*h+1;
l++;
}
for(j = l-1; j >= 0; j--){
insertionsort(a, n, g[j]);
}
}
int main(void)
{
int i;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[i]);
}
k = 0;
shellsort(a, n);
printf("%d\n", l);
for(i = l-1; i >= 0; i--){
printf("%d", g[i]);
if(i!=0)printf(" ");
}
printf("\n");
printf("%d\n", k);
for(i = 0; i < n; i++){
printf("%d\n", a[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119358/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119358/source.c"
target datalayout = "e-m:e-p270: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 i32 0, align 4
@k = dso_local local_unnamed_addr global i64 0, align 8
@g = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@a = dso_local global [1000000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insertionsort(ptr nocapture noundef %a, i32 noundef %n, i32 noundef %g) local_unnamed_addr #0 {
entry:
%cmp43 = icmp slt i32 %g, %n
br i1 %cmp43, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%k.promoted38 = load i64, ptr @k, align 8, !tbaa !5
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%k.promoted4144 = phi i64 [ %k.promoted38, %for.body.preheader ], [ %k.promoted39.ph, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !9
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%k.promoted40 = phi i64 [ %inc, %while.body ], [ %k.promoted4144, %land.rhs.preheader ]
%j.036 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%i.0.pn35 = phi i32 [ %j.036, %while.body ], [ %2, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.036 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !9
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn35 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !9
%inc = add nsw i64 %k.promoted40, 1
store i64 %inc, ptr @k, align 8, !tbaa !5
%j.0 = sub nsw i32 %j.036, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body
%k.promoted39.ph = phi i64 [ %k.promoted40, %land.rhs ], [ %inc, %while.body ]
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn35, %land.rhs ], [ %j.036, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %a, i64 %idxprom11
store i32 %1, ptr %arrayidx12, align 4, !tbaa !9
%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.end, label %land.rhs.preheader, !llvm.loop !13
for.end: ; preds = %while.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @shellsort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%l.promoted = load i32, ptr @l, align 4, !tbaa !9
%cmp12 = icmp slt i32 %n, 1
br i1 %cmp12, label %for.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%0 = sext i32 %l.promoted to i64
br label %if.end
if.end: ; preds = %if.end.preheader, %if.end
%indvars.iv = phi i64 [ %0, %if.end.preheader ], [ %indvars.iv.next, %if.end ]
%h.014 = phi i32 [ 1, %if.end.preheader ], [ %add, %if.end ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @g, i64 0, i64 %indvars.iv
store i32 %h.014, ptr %arrayidx, align 4, !tbaa !9
%mul = mul nsw i32 %h.014, 3
%add = add nsw i32 %mul, 1
%indvars.iv.next = add i64 %indvars.iv, 1
%cmp.not = icmp slt i32 %mul, %n
br i1 %cmp.not, label %if.end, label %for.cond.for.end_crit_edge
for.cond.for.end_crit_edge: ; preds = %if.end
%1 = trunc i64 %indvars.iv.next to i32
store i32 %1, ptr @l, align 4, !tbaa !9
br label %for.end
for.end: ; preds = %for.cond.for.end_crit_edge, %entry
%2 = phi i32 [ %1, %for.cond.for.end_crit_edge ], [ %l.promoted, %entry ]
%cmp220 = icmp sgt i32 %2, 0
br i1 %cmp220, label %for.body.lr.ph, label %for.end5
for.body.lr.ph: ; preds = %for.end
%k.promoted = load i64, ptr @k, align 8, !tbaa !5
%wide.trip.count.i = sext i32 %n to i64
%3 = zext i32 %2 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %insertionsort.exit
%indvars.iv24 = phi i64 [ %3, %for.body.lr.ph ], [ %indvars.iv.next25, %insertionsort.exit ]
%inc.i1921 = phi i64 [ %k.promoted, %for.body.lr.ph ], [ %inc.i15, %insertionsort.exit ]
%indvars.iv.next25 = add nsw i64 %indvars.iv24, -1
%idxprom3 = and i64 %indvars.iv.next25, 4294967295
%arrayidx4 = getelementptr inbounds [1000000 x i32], ptr @g, i64 0, i64 %idxprom3
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !9
%cmp43.i = icmp slt i32 %4, %n
br i1 %cmp43.i, label %for.body.preheader.i, label %insertionsort.exit
for.body.preheader.i: ; preds = %for.body
%5 = sext i32 %4 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%inc.i18 = phi i64 [ %inc.i1921, %for.body.preheader.i ], [ %inc.i16, %while.end.i ]
%indvars.iv.i = phi i64 [ %5, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%k.promoted4144.i = phi i64 [ %inc.i1921, %for.body.preheader.i ], [ %k.promoted39.ph.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%7 = trunc i64 %indvars.iv.i to i32
%8 = sub i32 %7, %4
%idxprom2.i27 = zext i32 %8 to i64
%arrayidx3.i28 = getelementptr inbounds i32, ptr %a, i64 %idxprom2.i27
%9 = load i32, ptr %arrayidx3.i28, align 4, !tbaa !9
%cmp4.i29 = icmp sgt i32 %9, %6
br i1 %cmp4.i29, label %while.body.i, label %while.end.i
land.rhs.i: ; preds = %while.body.i
%idxprom2.i = zext i32 %j.0.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %a, i64 %idxprom2.i
%10 = load i32, ptr %arrayidx3.i, align 4, !tbaa !9
%cmp4.i = icmp sgt i32 %10, %6
br i1 %cmp4.i, label %while.body.i, label %while.end.i.loopexit, !llvm.loop !11
while.body.i: ; preds = %land.rhs.preheader.i, %land.rhs.i
%11 = phi i32 [ %10, %land.rhs.i ], [ %9, %land.rhs.preheader.i ]
%i.0.pn35.i32 = phi i32 [ %j.036.i31, %land.rhs.i ], [ %7, %land.rhs.preheader.i ]
%j.036.i31 = phi i32 [ %j.0.i, %land.rhs.i ], [ %8, %land.rhs.preheader.i ]
%k.promoted40.i30 = phi i64 [ %inc.i, %land.rhs.i ], [ %k.promoted4144.i, %land.rhs.preheader.i ]
%idxprom7.i = sext i32 %i.0.pn35.i32 to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %a, i64 %idxprom7.i
store i32 %11, ptr %arrayidx8.i, align 4, !tbaa !9
%inc.i = add nsw i64 %k.promoted40.i30, 1
%j.0.i = sub nsw i32 %j.036.i31, %4
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i.loopexit, !llvm.loop !11
while.end.i.loopexit: ; preds = %while.body.i, %land.rhs.i
store i64 %inc.i, ptr @k, align 8, !tbaa !5
br label %while.end.i
while.end.i: ; preds = %while.end.i.loopexit, %land.rhs.preheader.i
%inc.i16 = phi i64 [ %inc.i18, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.loopexit ]
%k.promoted39.ph.i = phi i64 [ %k.promoted4144.i, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.loopexit ]
%i.0.pn.lcssa.ph.i = phi i32 [ %7, %land.rhs.preheader.i ], [ %j.036.i31, %while.end.i.loopexit ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %a, i64 %idxprom11.i
store i32 %6, ptr %arrayidx12.i, align 4, !tbaa !9
%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 %insertionsort.exit, label %land.rhs.preheader.i, !llvm.loop !13
insertionsort.exit: ; preds = %while.end.i, %for.body
%inc.i15 = phi i64 [ %inc.i1921, %for.body ], [ %inc.i16, %while.end.i ]
%cmp2 = icmp sgt i64 %indvars.iv24, 1
br i1 %cmp2, label %for.body, label %for.end5, !llvm.loop !14
for.end5: ; preds = %insertionsort.exit, %for.end
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 !9
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i64 0, ptr @k, align 8, !tbaa !5
%l.promoted.i66 = load i32, ptr @l, align 4, !tbaa !9
br label %for.end.i
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 = 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 !9
%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 !15
for.end: ; preds = %for.body
store i64 0, ptr @k, align 8, !tbaa !5
%l.promoted.i = load i32, ptr @l, align 4, !tbaa !9
%cmp12.i = icmp slt i32 %1, 1
br i1 %cmp12.i, label %for.end.i, label %if.end.preheader.i
if.end.preheader.i: ; preds = %for.end
%3 = sext i32 %l.promoted.i to i64
br label %if.end.i
if.end.i: ; preds = %if.end.i, %if.end.preheader.i
%indvars.iv.i = phi i64 [ %3, %if.end.preheader.i ], [ %indvars.iv.next.i, %if.end.i ]
%h.014.i = phi i32 [ 1, %if.end.preheader.i ], [ %add.i, %if.end.i ]
%arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @g, i64 0, i64 %indvars.iv.i
store i32 %h.014.i, ptr %arrayidx.i, align 4, !tbaa !9
%mul.i = mul nsw i32 %h.014.i, 3
%add.i = add nsw i32 %mul.i, 1
%indvars.iv.next.i = add i64 %indvars.iv.i, 1
%cmp.not.i = icmp slt i32 %mul.i, %1
br i1 %cmp.not.i, label %if.end.i, label %for.cond.for.end_crit_edge.i
for.cond.for.end_crit_edge.i: ; preds = %if.end.i
%4 = trunc i64 %indvars.iv.next.i to i32
store i32 %4, ptr @l, align 4, !tbaa !9
br label %for.end.i
for.end.i: ; preds = %for.end.thread, %for.cond.for.end_crit_edge.i, %for.end
%.lcssa68 = phi i32 [ %1, %for.cond.for.end_crit_edge.i ], [ %1, %for.end ], [ %0, %for.end.thread ]
%5 = phi i32 [ %4, %for.cond.for.end_crit_edge.i ], [ %l.promoted.i, %for.end ], [ %l.promoted.i66, %for.end.thread ]
%cmp220.i = icmp sgt i32 %5, 0
br i1 %cmp220.i, label %for.body.lr.ph.i, label %shellsort.exit
for.body.lr.ph.i: ; preds = %for.end.i
%wide.trip.count.i.i = sext i32 %.lcssa68 to i64
%6 = zext i32 %5 to i64
br label %for.body.i
for.body.i: ; preds = %insertionsort.exit.i, %for.body.lr.ph.i
%indvars.iv24.i = phi i64 [ %6, %for.body.lr.ph.i ], [ %indvars.iv.next25.i, %insertionsort.exit.i ]
%inc.i1921.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %inc.i15.i, %insertionsort.exit.i ]
%indvars.iv.next25.i = add nsw i64 %indvars.iv24.i, -1
%idxprom3.i = and i64 %indvars.iv.next25.i, 4294967295
%arrayidx4.i = getelementptr inbounds [1000000 x i32], ptr @g, i64 0, i64 %idxprom3.i
%7 = load i32, ptr %arrayidx4.i, align 4, !tbaa !9
%cmp43.i.i = icmp slt i32 %7, %.lcssa68
br i1 %cmp43.i.i, label %for.body.preheader.i.i, label %insertionsort.exit.i
for.body.preheader.i.i: ; preds = %for.body.i
%8 = sext i32 %7 to i64
br label %land.rhs.preheader.i.i
land.rhs.preheader.i.i: ; preds = %while.end.i.i, %for.body.preheader.i.i
%inc.i18.i = phi i64 [ %inc.i1921.i, %for.body.preheader.i.i ], [ %inc.i16.i, %while.end.i.i ]
%indvars.iv.i.i = phi i64 [ %8, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i, %while.end.i.i ]
%k.promoted4144.i.i = phi i64 [ %inc.i1921.i, %for.body.preheader.i.i ], [ %k.promoted39.ph.i.i, %while.end.i.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr @a, i64 %indvars.iv.i.i
%9 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !9
%10 = trunc i64 %indvars.iv.i.i to i32
%11 = sub i32 %10, %7
%idxprom2.i.i36 = zext i32 %11 to i64
%arrayidx3.i.i37 = getelementptr inbounds i32, ptr @a, i64 %idxprom2.i.i36
%12 = load i32, ptr %arrayidx3.i.i37, align 4, !tbaa !9
%cmp4.i.i38 = icmp sgt i32 %12, %9
br i1 %cmp4.i.i38, label %while.body.i.i, label %while.end.i.i
land.rhs.i.i: ; preds = %while.body.i.i
%idxprom2.i.i = zext i32 %j.0.i.i to i64
%arrayidx3.i.i = getelementptr inbounds i32, ptr @a, i64 %idxprom2.i.i
%13 = load i32, ptr %arrayidx3.i.i, align 4, !tbaa !9
%cmp4.i.i = icmp sgt i32 %13, %9
br i1 %cmp4.i.i, label %while.body.i.i, label %while.end.i.i.sink.split, !llvm.loop !11
while.body.i.i: ; preds = %land.rhs.preheader.i.i, %land.rhs.i.i
%14 = phi i32 [ %13, %land.rhs.i.i ], [ %12, %land.rhs.preheader.i.i ]
%i.0.pn35.i.i41 = phi i32 [ %j.036.i.i40, %land.rhs.i.i ], [ %10, %land.rhs.preheader.i.i ]
%j.036.i.i40 = phi i32 [ %j.0.i.i, %land.rhs.i.i ], [ %11, %land.rhs.preheader.i.i ]
%k.promoted40.i.i39 = phi i64 [ %inc.i.i, %land.rhs.i.i ], [ %k.promoted4144.i.i, %land.rhs.preheader.i.i ]
%idxprom7.i.i = sext i32 %i.0.pn35.i.i41 to i64
%arrayidx8.i.i = getelementptr inbounds i32, ptr @a, i64 %idxprom7.i.i
store i32 %14, ptr %arrayidx8.i.i, align 4, !tbaa !9
%inc.i.i = add nsw i64 %k.promoted40.i.i39, 1
%j.0.i.i = sub nsw i32 %j.036.i.i40, %7
%cmp1.i.i = icmp sgt i32 %j.0.i.i, -1
br i1 %cmp1.i.i, label %land.rhs.i.i, label %while.end.i.i.sink.split, !llvm.loop !11
while.end.i.i.sink.split: ; preds = %land.rhs.i.i, %while.body.i.i
store i64 %inc.i.i, ptr @k, align 8, !tbaa !5
br label %while.end.i.i
while.end.i.i: ; preds = %while.end.i.i.sink.split, %land.rhs.preheader.i.i
%inc.i16.i = phi i64 [ %inc.i18.i, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.sink.split ]
%k.promoted39.ph.i.i = phi i64 [ %k.promoted4144.i.i, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.sink.split ]
%i.0.pn.lcssa.ph.i.i = phi i32 [ %10, %land.rhs.preheader.i.i ], [ %j.036.i.i40, %while.end.i.i.sink.split ]
%idxprom11.i.i = sext i32 %i.0.pn.lcssa.ph.i.i to i64
%arrayidx12.i.i = getelementptr inbounds i32, ptr @a, i64 %idxprom11.i.i
store i32 %9, ptr %arrayidx12.i.i, align 4, !tbaa !9
%indvars.iv.next.i.i = add nsw i64 %indvars.iv.i.i, 1
%exitcond.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.i, label %insertionsort.exit.i, label %land.rhs.preheader.i.i, !llvm.loop !13
insertionsort.exit.i: ; preds = %while.end.i.i, %for.body.i
%inc.i15.i = phi i64 [ %inc.i1921.i, %for.body.i ], [ %inc.i16.i, %while.end.i.i ]
%cmp2.i = icmp sgt i64 %indvars.iv24.i, 1
br i1 %cmp2.i, label %for.body.i, label %shellsort.exit, !llvm.loop !14
shellsort.exit: ; preds = %insertionsort.exit.i, %for.end.i
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%15 = load i32, ptr @l, align 4, !tbaa !9
%cmp450 = icmp sgt i32 %15, 0
br i1 %cmp450, label %for.body5.preheader, label %for.end12
for.body5.preheader: ; preds = %shellsort.exit
%16 = zext i32 %15 to i64
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.inc11
%indvars.iv58 = phi i64 [ %16, %for.body5.preheader ], [ %indvars.iv.next59, %for.inc11 ]
%indvars.iv.next59 = add nsw i64 %indvars.iv58, -1
%idxprom6 = and i64 %indvars.iv.next59, 4294967295
%arrayidx7 = getelementptr inbounds [1000000 x i32], ptr @g, i64 0, i64 %idxprom6
%17 = load i32, ptr %arrayidx7, align 4, !tbaa !9
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17)
%18 = and i64 %indvars.iv.next59, 4294967295
%cmp9.not = icmp eq i64 %18, 0
br i1 %cmp9.not, label %for.inc11, label %if.then
if.then: ; preds = %for.body5
%putchar33 = tail call i32 @putchar(i32 32)
br label %for.inc11
for.inc11: ; preds = %for.body5, %if.then
%cmp4 = icmp ugt i64 %indvars.iv58, 1
br i1 %cmp4, label %for.body5, label %for.end12, !llvm.loop !16
for.end12: ; preds = %for.inc11, %shellsort.exit
%putchar = tail call i32 @putchar(i32 10)
%19 = load i64, ptr @k, align 8, !tbaa !5
%call14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %19)
%20 = load i32, ptr @n, align 4, !tbaa !9
%cmp1652 = icmp sgt i32 %20, 0
br i1 %cmp1652, label %for.body17, label %for.end23
for.body17: ; preds = %for.end12, %for.body17
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.body17 ], [ 0, %for.end12 ]
%arrayidx19 = getelementptr inbounds [1000000 x i32], ptr @a, i64 0, i64 %indvars.iv61
%21 = load i32, ptr %arrayidx19, align 4, !tbaa !9
%call20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%22 = load i32, ptr @n, align 4, !tbaa !9
%23 = sext i32 %22 to i64
%cmp16 = icmp slt i64 %indvars.iv.next62, %23
br i1 %cmp16, label %for.body17, label %for.end23, !llvm.loop !17
for.end23: ; preds = %for.body17, %for.end12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include<stdio.h>
#include<stdlib.h>
long long cnt;
int l,A[1000000],n,G[1000000],j=0;
void insertionsort(int A[],int n,int g){
int i,v,j;
for(i=g;i<n;i++){
v=A[i];
j=i-g;
while(j>=0 && A[j]>v){
A[j+g]=A[j];
j-=g;
cnt++;
}
A[j+g]=v;
}
}
void shellsort(int A[],int n){
int h,i;
for(h=1;;){
if(h>n)break;
G[j++]=h;
h=3*h+1;
}
for(i=j;i>=0;i--)insertionsort(A,n,G[i]);
}
int main(){
int i;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&A[i]);
cnt=0;
shellsort(A,n);
printf("%d\n",j);
for(i=j-1;i>=0;i--){
printf("%d",G[i]);
if(i)printf(" ");
}
printf("\n");
printf("%d\n",cnt);
for(i=0;i<n;i++)printf("%d\n",A[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119400/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119400/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@j = dso_local local_unnamed_addr global i32 0, align 4
@cnt = dso_local local_unnamed_addr global i64 0, align 8
@G = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@A = dso_local global [1000000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@l = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @insertionsort(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %g) local_unnamed_addr #0 {
entry:
%cmp43 = icmp slt i32 %g, %n
br i1 %cmp43, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%cnt.promoted38 = load i64, ptr @cnt, align 8, !tbaa !5
%0 = sext i32 %g to i64
%wide.trip.count = sext i32 %n to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body.preheader
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %while.end ]
%cnt.promoted4144 = phi i64 [ %cnt.promoted38, %for.body.preheader ], [ %cnt.promoted39.ph, %while.end ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !9
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv to i32
%4 = sub i32 %3, %g
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%cnt.promoted40 = phi i64 [ %inc, %while.body ], [ %cnt.promoted4144, %land.rhs.preheader ]
%j.036 = phi i32 [ %j.0, %while.body ], [ %4, %land.rhs.preheader ]
%i.0.pn35 = phi i32 [ %j.036, %while.body ], [ %2, %land.rhs.preheader ]
%idxprom2 = zext i32 %j.036 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %idxprom2
%5 = load i32, ptr %arrayidx3, align 4, !tbaa !9
%cmp4 = icmp sgt i32 %5, %1
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom7 = sext i32 %i.0.pn35 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %idxprom7
store i32 %5, ptr %arrayidx8, align 4, !tbaa !9
%inc = add nsw i64 %cnt.promoted40, 1
store i64 %inc, ptr @cnt, align 8, !tbaa !5
%j.0 = sub nsw i32 %j.036, %g
%cmp1 = icmp sgt i32 %j.0, -1
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !11
while.end: ; preds = %land.rhs, %while.body
%cnt.promoted39.ph = phi i64 [ %cnt.promoted40, %land.rhs ], [ %inc, %while.body ]
%i.0.pn.lcssa.ph = phi i32 [ %i.0.pn35, %land.rhs ], [ %j.036, %while.body ]
%idxprom11 = sext i32 %i.0.pn.lcssa.ph to i64
%arrayidx12 = getelementptr inbounds i32, ptr %A, i64 %idxprom11
store i32 %1, ptr %arrayidx12, align 4, !tbaa !9
%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.end, label %land.rhs.preheader, !llvm.loop !13
for.end: ; preds = %while.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @shellsort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%j.promoted = load i32, ptr @j, align 4, !tbaa !9
%cmp12 = icmp slt i32 %n, 1
br i1 %cmp12, label %for.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%0 = sext i32 %j.promoted to i64
br label %if.end
if.end: ; preds = %if.end.preheader, %if.end
%indvars.iv = phi i64 [ %0, %if.end.preheader ], [ %indvars.iv.next, %if.end ]
%h.014 = phi i32 [ 1, %if.end.preheader ], [ %add, %if.end ]
%indvars.iv.next = add i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @G, i64 0, i64 %indvars.iv
store i32 %h.014, ptr %arrayidx, align 4, !tbaa !9
%mul = mul nsw i32 %h.014, 3
%add = add nsw i32 %mul, 1
%cmp.not = icmp slt i32 %mul, %n
br i1 %cmp.not, label %if.end, label %for.cond.for.end_crit_edge
for.cond.for.end_crit_edge: ; preds = %if.end
%1 = trunc i64 %indvars.iv.next to i32
store i32 %1, ptr @j, align 4, !tbaa !9
br label %for.end
for.end: ; preds = %for.cond.for.end_crit_edge, %entry
%2 = phi i32 [ %1, %for.cond.for.end_crit_edge ], [ %j.promoted, %entry ]
%cmp220 = icmp sgt i32 %2, -1
br i1 %cmp220, label %for.body.lr.ph, label %for.end5
for.body.lr.ph: ; preds = %for.end
%cnt.promoted = load i64, ptr @cnt, align 8, !tbaa !5
%wide.trip.count.i = sext i32 %n to i64
%3 = zext i32 %2 to i64
br label %for.body
for.body: ; preds = %for.body.lr.ph, %insertionsort.exit
%indvars.iv24 = phi i64 [ %3, %for.body.lr.ph ], [ %indvars.iv.next25, %insertionsort.exit ]
%inc.i1921 = phi i64 [ %cnt.promoted, %for.body.lr.ph ], [ %inc.i15, %insertionsort.exit ]
%arrayidx4 = getelementptr inbounds [1000000 x i32], ptr @G, i64 0, i64 %indvars.iv24
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !9
%cmp43.i = icmp slt i32 %4, %n
br i1 %cmp43.i, label %for.body.preheader.i, label %insertionsort.exit
for.body.preheader.i: ; preds = %for.body
%5 = sext i32 %4 to i64
br label %land.rhs.preheader.i
land.rhs.preheader.i: ; preds = %while.end.i, %for.body.preheader.i
%inc.i18 = phi i64 [ %inc.i1921, %for.body.preheader.i ], [ %inc.i16, %while.end.i ]
%indvars.iv.i = phi i64 [ %5, %for.body.preheader.i ], [ %indvars.iv.next.i, %while.end.i ]
%cnt.promoted4144.i = phi i64 [ %inc.i1921, %for.body.preheader.i ], [ %cnt.promoted39.ph.i, %while.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !9
%7 = trunc i64 %indvars.iv.i to i32
%8 = sub i32 %7, %4
%idxprom2.i27 = zext i32 %8 to i64
%arrayidx3.i28 = getelementptr inbounds i32, ptr %A, i64 %idxprom2.i27
%9 = load i32, ptr %arrayidx3.i28, align 4, !tbaa !9
%cmp4.i29 = icmp sgt i32 %9, %6
br i1 %cmp4.i29, label %while.body.i, label %while.end.i
land.rhs.i: ; preds = %while.body.i
%idxprom2.i = zext i32 %j.0.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %A, i64 %idxprom2.i
%10 = load i32, ptr %arrayidx3.i, align 4, !tbaa !9
%cmp4.i = icmp sgt i32 %10, %6
br i1 %cmp4.i, label %while.body.i, label %while.end.i.loopexit, !llvm.loop !11
while.body.i: ; preds = %land.rhs.preheader.i, %land.rhs.i
%11 = phi i32 [ %10, %land.rhs.i ], [ %9, %land.rhs.preheader.i ]
%i.0.pn35.i32 = phi i32 [ %j.036.i31, %land.rhs.i ], [ %7, %land.rhs.preheader.i ]
%j.036.i31 = phi i32 [ %j.0.i, %land.rhs.i ], [ %8, %land.rhs.preheader.i ]
%cnt.promoted40.i30 = phi i64 [ %inc.i, %land.rhs.i ], [ %cnt.promoted4144.i, %land.rhs.preheader.i ]
%idxprom7.i = sext i32 %i.0.pn35.i32 to i64
%arrayidx8.i = getelementptr inbounds i32, ptr %A, i64 %idxprom7.i
store i32 %11, ptr %arrayidx8.i, align 4, !tbaa !9
%inc.i = add nsw i64 %cnt.promoted40.i30, 1
%j.0.i = sub nsw i32 %j.036.i31, %4
%cmp1.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp1.i, label %land.rhs.i, label %while.end.i.loopexit, !llvm.loop !11
while.end.i.loopexit: ; preds = %while.body.i, %land.rhs.i
store i64 %inc.i, ptr @cnt, align 8, !tbaa !5
br label %while.end.i
while.end.i: ; preds = %while.end.i.loopexit, %land.rhs.preheader.i
%inc.i16 = phi i64 [ %inc.i18, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.loopexit ]
%cnt.promoted39.ph.i = phi i64 [ %cnt.promoted4144.i, %land.rhs.preheader.i ], [ %inc.i, %while.end.i.loopexit ]
%i.0.pn.lcssa.ph.i = phi i32 [ %7, %land.rhs.preheader.i ], [ %j.036.i31, %while.end.i.loopexit ]
%idxprom11.i = sext i32 %i.0.pn.lcssa.ph.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i
store i32 %6, ptr %arrayidx12.i, align 4, !tbaa !9
%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 %insertionsort.exit, label %land.rhs.preheader.i, !llvm.loop !13
insertionsort.exit: ; preds = %while.end.i, %for.body
%inc.i15 = phi i64 [ %inc.i1921, %for.body ], [ %inc.i16, %while.end.i ]
%indvars.iv.next25 = add nsw i64 %indvars.iv24, -1
%cmp2 = icmp sgt i64 %indvars.iv24, 0
br i1 %cmp2, label %for.body, label %for.end5, !llvm.loop !14
for.end5: ; preds = %insertionsort.exit, %for.end
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 !9
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i64 0, ptr @cnt, align 8, !tbaa !5
%j.promoted.i65 = load i32, ptr @j, align 4, !tbaa !9
br label %for.end.i
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 = 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 !9
%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 !15
for.end: ; preds = %for.body
store i64 0, ptr @cnt, align 8, !tbaa !5
%j.promoted.i = load i32, ptr @j, align 4, !tbaa !9
%cmp12.i = icmp slt i32 %1, 1
br i1 %cmp12.i, label %for.end.i, label %if.end.preheader.i
if.end.preheader.i: ; preds = %for.end
%3 = sext i32 %j.promoted.i to i64
br label %if.end.i
if.end.i: ; preds = %if.end.i, %if.end.preheader.i
%indvars.iv.i = phi i64 [ %3, %if.end.preheader.i ], [ %indvars.iv.next.i, %if.end.i ]
%h.014.i = phi i32 [ 1, %if.end.preheader.i ], [ %add.i, %if.end.i ]
%indvars.iv.next.i = add i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @G, i64 0, i64 %indvars.iv.i
store i32 %h.014.i, ptr %arrayidx.i, align 4, !tbaa !9
%mul.i = mul nsw i32 %h.014.i, 3
%add.i = add nsw i32 %mul.i, 1
%cmp.not.i = icmp slt i32 %mul.i, %1
br i1 %cmp.not.i, label %if.end.i, label %for.cond.for.end_crit_edge.i
for.cond.for.end_crit_edge.i: ; preds = %if.end.i
%4 = trunc i64 %indvars.iv.next.i to i32
store i32 %4, ptr @j, align 4, !tbaa !9
br label %for.end.i
for.end.i: ; preds = %for.end.thread, %for.cond.for.end_crit_edge.i, %for.end
%.lcssa67 = phi i32 [ %1, %for.cond.for.end_crit_edge.i ], [ %1, %for.end ], [ %0, %for.end.thread ]
%5 = phi i32 [ %4, %for.cond.for.end_crit_edge.i ], [ %j.promoted.i, %for.end ], [ %j.promoted.i65, %for.end.thread ]
%cmp220.i = icmp sgt i32 %5, -1
br i1 %cmp220.i, label %for.body.lr.ph.i, label %shellsort.exit
for.body.lr.ph.i: ; preds = %for.end.i
%wide.trip.count.i.i = sext i32 %.lcssa67 to i64
%6 = zext i32 %5 to i64
br label %for.body.i
for.body.i: ; preds = %insertionsort.exit.i, %for.body.lr.ph.i
%indvars.iv24.i = phi i64 [ %6, %for.body.lr.ph.i ], [ %indvars.iv.next25.i, %insertionsort.exit.i ]
%inc.i1921.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %inc.i15.i, %insertionsort.exit.i ]
%arrayidx4.i = getelementptr inbounds [1000000 x i32], ptr @G, i64 0, i64 %indvars.iv24.i
%7 = load i32, ptr %arrayidx4.i, align 4, !tbaa !9
%cmp43.i.i = icmp slt i32 %7, %.lcssa67
br i1 %cmp43.i.i, label %for.body.preheader.i.i, label %insertionsort.exit.i
for.body.preheader.i.i: ; preds = %for.body.i
%8 = sext i32 %7 to i64
br label %land.rhs.preheader.i.i
land.rhs.preheader.i.i: ; preds = %while.end.i.i, %for.body.preheader.i.i
%inc.i18.i = phi i64 [ %inc.i1921.i, %for.body.preheader.i.i ], [ %inc.i16.i, %while.end.i.i ]
%indvars.iv.i.i = phi i64 [ %8, %for.body.preheader.i.i ], [ %indvars.iv.next.i.i, %while.end.i.i ]
%cnt.promoted4144.i.i = phi i64 [ %inc.i1921.i, %for.body.preheader.i.i ], [ %cnt.promoted39.ph.i.i, %while.end.i.i ]
%arrayidx.i.i = getelementptr inbounds i32, ptr @A, i64 %indvars.iv.i.i
%9 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !9
%10 = trunc i64 %indvars.iv.i.i to i32
%11 = sub i32 %10, %7
%idxprom2.i.i35 = zext i32 %11 to i64
%arrayidx3.i.i36 = getelementptr inbounds i32, ptr @A, i64 %idxprom2.i.i35
%12 = load i32, ptr %arrayidx3.i.i36, align 4, !tbaa !9
%cmp4.i.i37 = icmp sgt i32 %12, %9
br i1 %cmp4.i.i37, label %while.body.i.i, label %while.end.i.i
land.rhs.i.i: ; preds = %while.body.i.i
%idxprom2.i.i = zext i32 %j.0.i.i to i64
%arrayidx3.i.i = getelementptr inbounds i32, ptr @A, i64 %idxprom2.i.i
%13 = load i32, ptr %arrayidx3.i.i, align 4, !tbaa !9
%cmp4.i.i = icmp sgt i32 %13, %9
br i1 %cmp4.i.i, label %while.body.i.i, label %while.end.i.i.sink.split, !llvm.loop !11
while.body.i.i: ; preds = %land.rhs.preheader.i.i, %land.rhs.i.i
%14 = phi i32 [ %13, %land.rhs.i.i ], [ %12, %land.rhs.preheader.i.i ]
%i.0.pn35.i.i40 = phi i32 [ %j.036.i.i39, %land.rhs.i.i ], [ %10, %land.rhs.preheader.i.i ]
%j.036.i.i39 = phi i32 [ %j.0.i.i, %land.rhs.i.i ], [ %11, %land.rhs.preheader.i.i ]
%cnt.promoted40.i.i38 = phi i64 [ %inc.i.i, %land.rhs.i.i ], [ %cnt.promoted4144.i.i, %land.rhs.preheader.i.i ]
%idxprom7.i.i = sext i32 %i.0.pn35.i.i40 to i64
%arrayidx8.i.i = getelementptr inbounds i32, ptr @A, i64 %idxprom7.i.i
store i32 %14, ptr %arrayidx8.i.i, align 4, !tbaa !9
%inc.i.i = add nsw i64 %cnt.promoted40.i.i38, 1
%j.0.i.i = sub nsw i32 %j.036.i.i39, %7
%cmp1.i.i = icmp sgt i32 %j.0.i.i, -1
br i1 %cmp1.i.i, label %land.rhs.i.i, label %while.end.i.i.sink.split, !llvm.loop !11
while.end.i.i.sink.split: ; preds = %land.rhs.i.i, %while.body.i.i
store i64 %inc.i.i, ptr @cnt, align 8, !tbaa !5
br label %while.end.i.i
while.end.i.i: ; preds = %while.end.i.i.sink.split, %land.rhs.preheader.i.i
%inc.i16.i = phi i64 [ %inc.i18.i, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.sink.split ]
%cnt.promoted39.ph.i.i = phi i64 [ %cnt.promoted4144.i.i, %land.rhs.preheader.i.i ], [ %inc.i.i, %while.end.i.i.sink.split ]
%i.0.pn.lcssa.ph.i.i = phi i32 [ %10, %land.rhs.preheader.i.i ], [ %j.036.i.i39, %while.end.i.i.sink.split ]
%idxprom11.i.i = sext i32 %i.0.pn.lcssa.ph.i.i to i64
%arrayidx12.i.i = getelementptr inbounds i32, ptr @A, i64 %idxprom11.i.i
store i32 %9, ptr %arrayidx12.i.i, align 4, !tbaa !9
%indvars.iv.next.i.i = add nsw i64 %indvars.iv.i.i, 1
%exitcond.not.i.i = icmp eq i64 %indvars.iv.next.i.i, %wide.trip.count.i.i
br i1 %exitcond.not.i.i, label %insertionsort.exit.i, label %land.rhs.preheader.i.i, !llvm.loop !13
insertionsort.exit.i: ; preds = %while.end.i.i, %for.body.i
%inc.i15.i = phi i64 [ %inc.i1921.i, %for.body.i ], [ %inc.i16.i, %while.end.i.i ]
%indvars.iv.next25.i = add nsw i64 %indvars.iv24.i, -1
%cmp2.i = icmp sgt i64 %indvars.iv24.i, 0
br i1 %cmp2.i, label %for.body.i, label %shellsort.exit, !llvm.loop !14
shellsort.exit: ; preds = %insertionsort.exit.i, %for.end.i
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%15 = load i32, ptr @j, align 4, !tbaa !9
%cmp449 = icmp sgt i32 %15, 0
br i1 %cmp449, label %for.body5.preheader, label %for.end11
for.body5.preheader: ; preds = %shellsort.exit
%16 = zext i32 %15 to i64
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.inc10
%indvars.iv57 = phi i64 [ %16, %for.body5.preheader ], [ %indvars.iv.next58, %for.inc10 ]
%indvars.iv.next58 = add nsw i64 %indvars.iv57, -1
%idxprom6 = and i64 %indvars.iv.next58, 4294967295
%arrayidx7 = getelementptr inbounds [1000000 x i32], ptr @G, i64 0, i64 %idxprom6
%17 = load i32, ptr %arrayidx7, align 4, !tbaa !9
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17)
%18 = and i64 %indvars.iv.next58, 4294967295
%tobool.not = icmp eq i64 %18, 0
br i1 %tobool.not, label %for.inc10, label %if.then
if.then: ; preds = %for.body5
%putchar32 = tail call i32 @putchar(i32 32)
br label %for.inc10
for.inc10: ; preds = %for.body5, %if.then
%cmp4 = icmp ugt i64 %indvars.iv57, 1
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !16
for.end11: ; preds = %for.inc10, %shellsort.exit
%putchar = tail call i32 @putchar(i32 10)
%19 = load i64, ptr @cnt, align 8, !tbaa !5
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %19)
%20 = load i32, ptr @n, align 4, !tbaa !9
%cmp1551 = icmp sgt i32 %20, 0
br i1 %cmp1551, label %for.body16, label %for.end22
for.body16: ; preds = %for.end11, %for.body16
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.body16 ], [ 0, %for.end11 ]
%arrayidx18 = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv60
%21 = load i32, ptr %arrayidx18, align 4, !tbaa !9
%call19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%22 = load i32, ptr @n, align 4, !tbaa !9
%23 = sext i32 %22 to i64
%cmp15 = icmp slt i64 %indvars.iv.next61, %23
br i1 %cmp15, label %for.body16, label %for.end22, !llvm.loop !17
for.end22: ; preds = %for.body16, %for.end11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include<stdio.h>
#define N 1000000
int main()
{
int n,i,j,k,v,cnt=0,m=0,A[N],G[N];
scanf("%d",&n);
for(i = 0;i < n;i++)
scanf("%d",&A[i]);
G[0]=1;
for(i = 1;G[i-1] <= n;i++)
{
m++;
G[i]=G[i-1]*3+1;
if(m>100)break;
}
for(i = m-1;i >= 0;i--)
{
for(j = G[i];j < n;j++)
{
v = A[j];
k = j - G[i];
while(k >= 0 && A[k] > v)
{
A[k+G[i]] = A[k];
k -= G[i];
cnt++;
}
A[k+G[i]] = v;
}
}
printf("%d\n",m);
for(i = m - 1;i > 0 ;i--)
printf("%d ",G[i]);
printf("%d\n%d\n",G[i],cnt);
for(i = 0;i < n;i++)
printf("%d\n",A[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119444/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119444/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = 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
%A = alloca [1000000 x i32], align 16
%G = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %G) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp115 = icmp sgt i32 %0, 0
br i1 %cmp115, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i32 1, ptr %G, align 16, !tbaa !5
br label %for.end56.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
store i32 1, ptr %G, align 16, !tbaa !5
%cmp6.not117 = icmp slt i32 %1, 1
br i1 %cmp6.not117, label %for.end56.thread, label %for.body7
for.cond3: ; preds = %for.body7
%cmp6.not.not = icmp slt i32 %mul, %1
br i1 %cmp6.not.not, label %for.body7.1, label %for.body21.preheader.split.loop.exit183, !llvm.loop !11
for.body7.1: ; preds = %for.cond3
%indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
%mul.1 = mul nsw i32 %add, 3
%add.1 = add nsw i32 %mul.1, 1
%arrayidx13.1 = getelementptr inbounds [1000000 x i32], ptr %G, i64 0, i64 %indvars.iv.next147
store i32 %add.1, ptr %arrayidx13.1, align 4, !tbaa !5
%inc8.1 = add nuw nsw i32 %m.0119, 2
%indvars.iv.next147.1 = add nuw nsw i64 %indvars.iv146, 2
%cmp6.not.not.1 = icmp slt i32 %mul.1, %1
br i1 %cmp6.not.not.1, label %for.body7, label %for.body21.preheader, !llvm.loop !11
for.body7: ; preds = %for.end, %for.body7.1
%indvars.iv146 = phi i64 [ %indvars.iv.next147.1, %for.body7.1 ], [ 1, %for.end ]
%3 = phi i32 [ %add.1, %for.body7.1 ], [ 1, %for.end ]
%m.0119 = phi i32 [ %inc8.1, %for.body7.1 ], [ 0, %for.end ]
%mul = mul nsw i32 %3, 3
%add = add nsw i32 %mul, 1
%arrayidx13 = getelementptr inbounds [1000000 x i32], ptr %G, i64 0, i64 %indvars.iv146
store i32 %add, ptr %arrayidx13, align 4, !tbaa !5
%exitcond = icmp eq i32 %m.0119, 100
br i1 %exitcond, label %for.body21.preheader, label %for.cond3
for.end56.thread: ; preds = %for.end, %for.end.thread
%call57178 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %for.end67
for.body21.preheader.split.loop.exit183: ; preds = %for.cond3
%inc8.le = or i32 %m.0119, 1
br label %for.body21.preheader
for.body21.preheader: ; preds = %for.body7, %for.body7.1, %for.body21.preheader.split.loop.exit183
%m.1.ph = phi i32 [ %inc8.le, %for.body21.preheader.split.loop.exit183 ], [ %inc8.1, %for.body7.1 ], [ 101, %for.body7 ]
%sub18168 = add i32 %m.1.ph, -1
%4 = zext i32 %sub18168 to i64
%wide.trip.count = sext i32 %1 to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.inc55
%indvars.iv154 = phi i64 [ %4, %for.body21.preheader ], [ %indvars.iv.next155, %for.inc55 ]
%cnt.0137 = phi i32 [ 0, %for.body21.preheader ], [ %cnt.1.lcssa, %for.inc55 ]
%arrayidx23 = getelementptr inbounds [1000000 x i32], ptr %G, i64 0, i64 %indvars.iv154
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp25131 = icmp slt i32 %5, %1
br i1 %cmp25131, label %for.body26.preheader, label %for.inc55
for.body26.preheader: ; preds = %for.body21
%6 = sext i32 %5 to i64
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %while.end, %for.body26.preheader
%indvars.iv149 = phi i64 [ %6, %for.body26.preheader ], [ %indvars.iv.next150, %while.end ]
%cnt.1133 = phi i32 [ %cnt.0137, %for.body26.preheader ], [ %cnt.2.lcssa.ph, %while.end ]
%arrayidx28 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %indvars.iv149
%7 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%8 = trunc i64 %indvars.iv149 to i32
%9 = trunc i64 %indvars.iv149 to i32
%10 = sub i32 %9, %5
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%k.0126 = phi i32 [ %k.0, %while.body ], [ %10, %land.rhs.preheader ]
%cnt.2125 = phi i32 [ %inc46, %while.body ], [ %cnt.1133, %land.rhs.preheader ]
%j.0.pn124 = phi i32 [ %k.0126, %while.body ], [ %8, %land.rhs.preheader ]
%idxprom33 = zext i32 %k.0126 to i64
%arrayidx34 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %idxprom33
%11 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%cmp35 = icmp sgt i32 %11, %7
br i1 %cmp35, label %while.body, label %while.end
while.body: ; preds = %land.rhs
%idxprom41 = sext i32 %j.0.pn124 to i64
%arrayidx42 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %idxprom41
store i32 %11, ptr %arrayidx42, align 4, !tbaa !5
%inc46 = add nsw i32 %cnt.2125, 1
%k.0 = sub nsw i32 %k.0126, %5
%cmp32 = icmp sgt i32 %k.0, -1
br i1 %cmp32, label %land.rhs, label %while.end, !llvm.loop !12
while.end: ; preds = %land.rhs, %while.body
%j.0.pn.lcssa.ph = phi i32 [ %j.0.pn124, %land.rhs ], [ %k.0126, %while.body ]
%cnt.2.lcssa.ph = phi i32 [ %cnt.2125, %land.rhs ], [ %inc46, %while.body ]
%idxprom50 = sext i32 %j.0.pn.lcssa.ph to i64
%arrayidx51 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %idxprom50
store i32 %7, ptr %arrayidx51, align 4, !tbaa !5
%indvars.iv.next150 = add nsw i64 %indvars.iv149, 1
%exitcond153.not = icmp eq i64 %indvars.iv.next150, %wide.trip.count
br i1 %exitcond153.not, label %for.inc55, label %land.rhs.preheader, !llvm.loop !13
for.inc55: ; preds = %while.end, %for.body21
%cnt.1.lcssa = phi i32 [ %cnt.0137, %for.body21 ], [ %cnt.2.lcssa.ph, %while.end ]
%indvars.iv.next155 = add nsw i64 %indvars.iv154, -1
%cmp20 = icmp sgt i64 %indvars.iv154, 0
br i1 %cmp20, label %for.body21, label %for.end56, !llvm.loop !14
for.end56: ; preds = %for.inc55
%call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.1.ph)
%cmp60139 = icmp sgt i32 %m.1.ph, 1
br i1 %cmp60139, label %for.body61.preheader, label %for.end67
for.body61.preheader: ; preds = %for.end56
%12 = zext i32 %sub18168 to i64
br label %for.body61
for.body61: ; preds = %for.body61.preheader, %for.body61
%indvars.iv157 = phi i64 [ %12, %for.body61.preheader ], [ %indvars.iv.next158, %for.body61 ]
%arrayidx63 = getelementptr inbounds [1000000 x i32], ptr %G, i64 0, i64 %indvars.iv157
%13 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
%indvars.iv.next158 = add nsw i64 %indvars.iv157, -1
%cmp60 = icmp ugt i64 %indvars.iv157, 1
br i1 %cmp60, label %for.body61, label %for.end67, !llvm.loop !15
for.end67: ; preds = %for.body61, %for.end56.thread, %for.end56
%cnt.0.lcssa180 = phi i32 [ %cnt.1.lcssa, %for.end56 ], [ 0, %for.end56.thread ], [ %cnt.1.lcssa, %for.body61 ]
%i.3.lcssa = phi i32 [ %sub18168, %for.end56 ], [ -1, %for.end56.thread ], [ 0, %for.body61 ]
%idxprom68 = sext i32 %i.3.lcssa to i64
%arrayidx69 = getelementptr inbounds [1000000 x i32], ptr %G, i64 0, i64 %idxprom68
%14 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %14, i32 noundef %cnt.0.lcssa180)
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp72142 = icmp sgt i32 %15, 0
br i1 %cmp72142, label %for.body73, label %for.end79
for.body73: ; preds = %for.end67, %for.body73
%indvars.iv160 = phi i64 [ %indvars.iv.next161, %for.body73 ], [ 0, %for.end67 ]
%arrayidx75 = getelementptr inbounds [1000000 x i32], ptr %A, i64 0, i64 %indvars.iv160
%16 = load i32, ptr %arrayidx75, align 4, !tbaa !5
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
%indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp72 = icmp slt i64 %indvars.iv.next161, %18
br i1 %cmp72, label %for.body73, label %for.end79, !llvm.loop !16
for.end79: ; preds = %for.body73, %for.end67
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %G) #3
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main(void){
/* 変数宣言,ちゃんと初期化しよう */
int A = 0;
int B = 0;
int ans = 0;
/* 変数宣言終わり */
/* 入力を受け付ける部分*/
// %dはdecimalの略.つまり,入力を10進数として扱うよという意味.
scanf("%d %d", &A, &B);
/* 入力を受け付ける部分終わり*/
/* 何か処理*/
ans = A*B;
if(A%B == 0){
/* 真の場合の処理 */
ans = 0;
}else{
/* 偽の場合の処理 */
ans = 1;
}
for(int i = 0; i < 10; i++){
// i = 0,1,2,3,4,5,6,7,8,9のとき処理される
}
/* 何か処理終わり*/
/* 出力する部分*/
printf("%d", ans); // %dの部分にansの値が表示される
/* 出力する部分*/
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119488/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119488/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
store i32 0, ptr %A, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
store i32 0, ptr %B, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp ne i32 %rem, 0
%. = zext i1 %cmp to i32
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.)
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"}
|
#include <stdio.h>
int main(void)
{
int N, K;
scanf("%d %d", &N, &K);
int max_c = N >= K ? N / K : 1;
int min_c = N >= K ? N / K : 0;
if (N > K && N % K)
max_c++;
int res = max_c - min_c;
printf("%d\n", res);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119530/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119530/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = load i32, ptr %K, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
br i1 %cmp.not, label %cond.end5, label %cond.true2
cond.true2: ; preds = %entry
%div = sdiv i32 %0, %1
br label %cond.end5
cond.end5: ; preds = %entry, %cond.true2
%cond16 = phi i32 [ %div, %cond.true2 ], [ 1, %entry ]
%cond6 = phi i32 [ %div, %cond.true2 ], [ 0, %entry ]
%cmp7 = icmp sgt i32 %0, %1
br i1 %cmp7, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %cond.end5
%rem = srem i32 %0, %1
%tobool.not = icmp ne i32 %rem, 0
%inc = zext i1 %tobool.not to i32
%spec.select = add nsw i32 %cond16, %inc
br label %if.end
if.end: ; preds = %land.lhs.true, %cond.end5
%max_c.0 = phi i32 [ %cond16, %cond.end5 ], [ %spec.select, %land.lhs.true ]
%sub = sub nsw i32 %max_c.0, %cond6
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int a,b;
scanf("%d%d", &a, &b);
if(a%b == 0){
printf("0\n");
}else{
printf("1\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119574/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119574/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local 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
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n,k;
scanf("%d%d",&n,&k);
if(n%k)printf("1\n");
else printf("0\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119617/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119617/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%rem = srem i32 %0, %1
%tobool.not = icmp eq i32 %rem, 0
%str.str.3 = select i1 %tobool.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int N,K;
scanf("%d",&N);
scanf("%d",&K);
if(N%K==0){
printf("0\n");
}
else{
printf("1\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119660/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119660/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"1\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = load i32, ptr %K, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp eq i32 %rem, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int n,k;
scanf("%d%d", &n, &k);
if (n%k) printf("1\n");
else printf("0\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119747/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119747/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.3 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%rem = srem i32 %0, %1
%tobool.not = icmp eq i32 %rem, 0
%str.str.3 = select i1 %tobool.not, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n, m;
scanf("%d %d", &n, &m);
int num[3]={-1, -1, -1};
for(int i=0; i<m; i++){
int s, c;
scanf("%d %d", &s, &c);
if(num[s-1]==-1)num[s-1]=c;
else if(num[s-1]!=c){
printf("-1\n");
return 0;
}
}
if(n!=1 && num[0]==0){
printf("-1\n");
return 0;
}
if(n!=1 && num[0]==-1)num[0]=1;
for(int i=0; i<n; i++){
if(num[i]==-1)printf("0");
else printf("%d", num[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%num = alloca [3 x i32], align 4
%s = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %num) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %num, i8 -1, i64 12, i1 false)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not60 = icmp sgt i32 %0, 0
br i1 %cmp.not60, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp1665 = icmp ne i32 %1, 1
br label %if.end21
for.body: ; preds = %entry, %cleanup
%i.061 = phi i32 [ %inc, %cleanup ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %c)
%2 = load i32, ptr %s, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [3 x i32], ptr %num, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2 = icmp eq i32 %3, -1
%4 = load i32, ptr %c, align 4, !tbaa !5
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
store i32 %4, ptr %arrayidx, align 4, !tbaa !5
br label %cleanup
if.else: ; preds = %for.body
%cmp9.not = icmp eq i32 %3, %4
br i1 %cmp9.not, label %cleanup, label %if.then10
if.then10: ; preds = %if.else
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
br label %cleanup48
cleanup: ; preds = %if.then, %if.else
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
%inc = add nuw nsw i32 %i.061, 1
%5 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not = icmp slt i32 %inc, %5
br i1 %cmp.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %cleanup
%.pre = load i32, ptr %num, align 4
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp ne i32 %6, 1
%cmp18 = icmp eq i32 %.pre, 0
%or.cond = select i1 %cmp16, i1 %cmp18, i1 false
br i1 %or.cond, label %if.then19, label %if.end21
if.then19: ; preds = %for.end
%puts59 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %cleanup48
if.end21: ; preds = %for.end.thread, %for.end
%cmp1668 = phi i1 [ %cmp1665, %for.end.thread ], [ %cmp16, %for.end ]
%7 = phi i32 [ %1, %for.end.thread ], [ %6, %for.end ]
%8 = phi i32 [ -1, %for.end.thread ], [ %.pre, %for.end ]
%cmp25 = icmp eq i32 %8, -1
%or.cond52 = select i1 %cmp1668, i1 %cmp25, i1 false
br i1 %or.cond52, label %if.then26, label %if.end28
if.then26: ; preds = %if.end21
store i32 1, ptr %num, align 4, !tbaa !5
br label %if.end28
if.end28: ; preds = %if.then26, %if.end21
%cmp3162 = icmp sgt i32 %7, 0
br i1 %cmp3162, label %for.body33, label %cleanup48
for.body33: ; preds = %if.end28, %for.inc44
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc44 ], [ 0, %if.end28 ]
%arrayidx35 = getelementptr inbounds [3 x i32], ptr %num, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36 = icmp eq i32 %9, -1
br i1 %cmp36, label %if.then37, label %if.else39
if.then37: ; preds = %for.body33
%putchar = call i32 @putchar(i32 48)
br label %for.inc44
if.else39: ; preds = %for.body33
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9)
br label %for.inc44
for.inc44: ; preds = %if.then37, %if.else39
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%10 = load i32, ptr %n, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp31 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp31, label %for.body33, label %cleanup48, !llvm.loop !11
cleanup48: ; preds = %for.inc44, %if.end28, %if.then10, %if.then19
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n, m, s[5], c[5], i, ans[4], con = 0, l;
for(i = 0; i < 4; i++){
ans[i] = 0;
}
scanf("%d %d", &n, &m);
for(i = 0; i < m; i++){
scanf("%d %d", &s[i], &c[i]);
}
for(i = 0; i < m; i++){
if(con == 1){
break;
}
if(s[i] == 1 && c[i] == 0 && n != 1){
printf("-1");
con = 1;
break;
}
for(l = 0; l < m; l++){
if(i != l && s[i] == s[l] && c[i] != c[l]){
printf("-1");
con = 1;
break;
}
}
}
if(con == 0){
for(i = 0; i < m; i++){
ans[s[i]] = c[i];
}
if(n != 1 && ans[1] == 0){
ans[1] = 1;
}
for(i = 1; i <= n; i++){
printf("%d", ans[i]);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119840/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%s = alloca [5 x i32], align 16
%c = alloca [5 x i32], align 16
%ans = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %ans) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %ans, i8 0, i64 16, i1 false), !tbaa !5
%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
%cmp2114 = icmp sgt i32 %0, 0
br i1 %cmp2114, label %for.body3, label %for.end65
for.cond12.preheader: ; preds = %for.body3
%cmp13118 = icmp slt i32 %3, 1
br i1 %cmp13118, label %for.end65, label %if.end.preheader
if.end.preheader: ; preds = %for.cond12.preheader
%1 = load i32, ptr %n, align 4
%cmp23 = icmp ne i32 %1, 1
%wide.trip.count = zext i32 %3 to i64
%2 = sext i32 %3 to i64
br label %if.end
for.body3: ; preds = %entry, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv
%arrayidx7 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %m, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp2, label %for.body3, label %for.cond12.preheader, !llvm.loop !9
if.end: ; preds = %if.end.preheader, %for.inc49
%indvars.iv130 = phi i64 [ 0, %if.end.preheader ], [ %indvars.iv.next131, %for.inc49 ]
%arrayidx17 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv130
%5 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18 = icmp eq i32 %5, 1
br i1 %cmp18, label %land.lhs.true, label %for.body29.lr.ph
land.lhs.true: ; preds = %if.end
%arrayidx20 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv130
%6 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %6, 0
%or.cond = select i1 %cmp21, i1 %cmp23, i1 false
br i1 %or.cond, label %if.end82.sink.split, label %for.body29.lr.ph
for.body29.lr.ph: ; preds = %if.end, %land.lhs.true
%arrayidx39 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv130
br label %for.body29
for.body29: ; preds = %for.body29.lr.ph, %for.inc46
%indvars.iv127 = phi i64 [ 0, %for.body29.lr.ph ], [ %indvars.iv.next128, %for.inc46 ]
%cmp30.not = icmp eq i64 %indvars.iv130, %indvars.iv127
br i1 %cmp30.not, label %for.inc46, label %land.lhs.true31
land.lhs.true31: ; preds = %for.body29
%arrayidx35 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv127
%7 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36 = icmp eq i32 %5, %7
br i1 %cmp36, label %land.lhs.true37, label %for.inc46
land.lhs.true37: ; preds = %land.lhs.true31
%8 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%arrayidx41 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv127
%9 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%cmp42.not = icmp eq i32 %8, %9
br i1 %cmp42.not, label %for.inc46, label %if.end82.sink.split
for.inc46: ; preds = %for.body29, %land.lhs.true31, %land.lhs.true37
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
%exitcond.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count
br i1 %exitcond.not, label %for.inc49, label %for.body29, !llvm.loop !11
for.inc49: ; preds = %for.inc46
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%cmp13.not = icmp slt i64 %indvars.iv.next131, %2
br i1 %cmp13.not, label %if.end, label %for.cond54.preheader, !llvm.loop !12
for.cond54.preheader: ; preds = %for.inc49
%cmp55121 = icmp sgt i32 %3, 0
br i1 %cmp55121, label %for.body56.preheader, label %for.end65
for.body56.preheader: ; preds = %for.cond54.preheader
%xtraiter = and i64 %wide.trip.count, 3
%10 = icmp ult i32 %3, 4
br i1 %10, label %for.end65.loopexit.unr-lcssa, label %for.body56.preheader.new
for.body56.preheader.new: ; preds = %for.body56.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body56
for.body56: ; preds = %for.body56, %for.body56.preheader.new
%indvars.iv133 = phi i64 [ 0, %for.body56.preheader.new ], [ %indvars.iv.next134.3, %for.body56 ]
%niter = phi i64 [ 0, %for.body56.preheader.new ], [ %niter.next.3, %for.body56 ]
%arrayidx58 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv133
%11 = load i32, ptr %arrayidx58, align 16, !tbaa !5
%arrayidx60 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv133
%12 = load i32, ptr %arrayidx60, align 16, !tbaa !5
%idxprom61 = sext i32 %12 to i64
%arrayidx62 = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 %idxprom61
store i32 %11, ptr %arrayidx62, align 4, !tbaa !5
%indvars.iv.next134 = or i64 %indvars.iv133, 1
%arrayidx58.1 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv.next134
%13 = load i32, ptr %arrayidx58.1, align 4, !tbaa !5
%arrayidx60.1 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv.next134
%14 = load i32, ptr %arrayidx60.1, align 4, !tbaa !5
%idxprom61.1 = sext i32 %14 to i64
%arrayidx62.1 = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 %idxprom61.1
store i32 %13, ptr %arrayidx62.1, align 4, !tbaa !5
%indvars.iv.next134.1 = or i64 %indvars.iv133, 2
%arrayidx58.2 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv.next134.1
%15 = load i32, ptr %arrayidx58.2, align 8, !tbaa !5
%arrayidx60.2 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv.next134.1
%16 = load i32, ptr %arrayidx60.2, align 8, !tbaa !5
%idxprom61.2 = sext i32 %16 to i64
%arrayidx62.2 = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 %idxprom61.2
store i32 %15, ptr %arrayidx62.2, align 4, !tbaa !5
%indvars.iv.next134.2 = or i64 %indvars.iv133, 3
%arrayidx58.3 = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv.next134.2
%17 = load i32, ptr %arrayidx58.3, align 4, !tbaa !5
%arrayidx60.3 = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv.next134.2
%18 = load i32, ptr %arrayidx60.3, align 4, !tbaa !5
%idxprom61.3 = sext i32 %18 to i64
%arrayidx62.3 = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 %idxprom61.3
store i32 %17, ptr %arrayidx62.3, align 4, !tbaa !5
%indvars.iv.next134.3 = add nuw nsw i64 %indvars.iv133, 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.end65.loopexit.unr-lcssa, label %for.body56, !llvm.loop !13
for.end65.loopexit.unr-lcssa: ; preds = %for.body56, %for.body56.preheader
%indvars.iv133.unr = phi i64 [ 0, %for.body56.preheader ], [ %indvars.iv.next134.3, %for.body56 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end65.loopexit, label %for.body56.epil
for.body56.epil: ; preds = %for.end65.loopexit.unr-lcssa, %for.body56.epil
%indvars.iv133.epil = phi i64 [ %indvars.iv.next134.epil, %for.body56.epil ], [ %indvars.iv133.unr, %for.end65.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body56.epil ], [ 0, %for.end65.loopexit.unr-lcssa ]
%arrayidx58.epil = getelementptr inbounds [5 x i32], ptr %c, i64 0, i64 %indvars.iv133.epil
%19 = load i32, ptr %arrayidx58.epil, align 4, !tbaa !5
%arrayidx60.epil = getelementptr inbounds [5 x i32], ptr %s, i64 0, i64 %indvars.iv133.epil
%20 = load i32, ptr %arrayidx60.epil, align 4, !tbaa !5
%idxprom61.epil = sext i32 %20 to i64
%arrayidx62.epil = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 %idxprom61.epil
store i32 %19, ptr %arrayidx62.epil, align 4, !tbaa !5
%indvars.iv.next134.epil = add nuw nsw i64 %indvars.iv133.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.end65.loopexit, label %for.body56.epil, !llvm.loop !14
for.end65.loopexit: ; preds = %for.body56.epil, %for.end65.loopexit.unr-lcssa
%arrayidx68.phi.trans.insert = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 1
%.pre141 = load i32, ptr %arrayidx68.phi.trans.insert, align 4
br label %for.end65
for.end65: ; preds = %entry, %for.cond12.preheader, %for.end65.loopexit, %for.cond54.preheader
%21 = phi i32 [ %.pre141, %for.end65.loopexit ], [ 0, %for.cond54.preheader ], [ 0, %for.cond12.preheader ], [ 0, %entry ]
%22 = load i32, ptr %n, align 4, !tbaa !5
%cmp66 = icmp ne i32 %22, 1
%arrayidx68 = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 1
%cmp69 = icmp eq i32 %21, 0
%or.cond83 = select i1 %cmp66, i1 %cmp69, i1 false
%spec.store.select = select i1 %or.cond83, i32 1, i32 %21
store i32 %spec.store.select, ptr %arrayidx68, align 4
%cmp74.not123 = icmp slt i32 %22, 1
br i1 %cmp74.not123, label %if.end82, label %for.body75
for.body75: ; preds = %for.end65, %for.body75
%indvars.iv138 = phi i64 [ %indvars.iv.next139, %for.body75 ], [ 1, %for.end65 ]
%arrayidx77 = getelementptr inbounds [4 x i32], ptr %ans, i64 0, i64 %indvars.iv138
%23 = load i32, ptr %arrayidx77, align 4, !tbaa !5
%call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%24 = load i32, ptr %n, align 4, !tbaa !5
%25 = sext i32 %24 to i64
%cmp74.not.not = icmp slt i64 %indvars.iv138, %25
br i1 %cmp74.not.not, label %for.body75, label %if.end82, !llvm.loop !16
if.end82.sink.split: ; preds = %land.lhs.true, %land.lhs.true37
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end82
if.end82: ; preds = %for.body75, %if.end82.sink.split, %for.end65
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %ans) #4
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main(void){
int n,m,a[4]={0,-1,-1,-1},s,c,i,j,f=0;
scanf("%d %d",&n,&m);
if(n==3){
for(i=0;i<m;i++){
scanf("%d %d",&s,&c);
if(a[s]==-1||a[s]==c){
a[s]=c;
}else{
f=-1;
}
}
for(i=2;i<=3;i++){
if(a[i]<0){
a[i]=0;
}
}
if(a[1]==0){
f=-1;
}else if(a[1]<0){
a[1]=1;
}
if(f==-1){
printf("-1\n");
}else{
printf("%d\n",a[1]*100+a[2]*10+a[3]);
}
}else if(n==2){
for(i=0;i<m;i++){
scanf("%d %d",&s,&c);
if(a[s]==-1||a[s]==c){
a[s]=c;
}else{
f=-1;
}
}
if(a[1]==0){
f=-1;
}else if(a[1]<0){
a[1]=1;
}
if(a[2]<0){
a[2]=0;
}
if(f==-1){
printf("-1\n");
}else{
printf("%d\n",a[1]*10+a[2]);
}
}else if(n==1){
for(i=0;i<m;i++){
scanf("%d %d",&s,&c);
if(a[s]==-1||a[s]==c){
a[s]=c;
}else{
f=-1;
}
}
if(a[1]<0){
a[1]=0;
}
if(f==-1){
printf("-1\n");
}else{
printf("%d\n",a[1]);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119891/source.c"
target datalayout = "e-m:e-p270: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.a = private unnamed_addr constant [4 x i32] [i32 0, i32 -1, i32 -1, i32 -1], align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca [4 x i32], align 16
%s = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #6
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %a, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.a, i64 16, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
switch i32 %0, label %if.end127 [
i32 3, label %for.cond.preheader
i32 2, label %for.cond47.preheader
i32 1, label %for.cond94.preheader
]
for.cond94.preheader: ; preds = %entry
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp95162 = icmp sgt i32 %1, 0
br i1 %cmp95162, label %for.body96, label %if.else121
for.cond47.preheader: ; preds = %entry
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp48165 = icmp sgt i32 %2, 0
br i1 %cmp48165, label %for.body49, label %if.then72.thread
if.then72.thread: ; preds = %for.cond47.preheader
%arrayidx66180 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
store i32 1, ptr %arrayidx66180, align 4, !tbaa !5
%arrayidx76191201 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%3 = load i32, ptr %arrayidx76191201, align 8, !tbaa !5
%spec.store.select147192202 = call i32 @llvm.smax.i32(i32 %3, i32 0)
br label %if.else84
for.cond.preheader: ; preds = %entry
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp1169 = icmp sgt i32 %4, 0
br i1 %cmp1169, label %for.body, label %for.cond10.preheader
for.cond10.preheader.loopexit: ; preds = %for.body
%arrayidx14.phi.trans.insert = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%.pre176 = load i32, ptr %arrayidx14.phi.trans.insert, align 8, !tbaa !5
%arrayidx14.1.phi.trans.insert = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3
%.pre177 = load i32, ptr %arrayidx14.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx23.phi.trans.insert = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%.pre178 = load i32, ptr %arrayidx23.phi.trans.insert, align 4, !tbaa !5
%5 = icmp eq i32 %spec.select, -1
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.cond10.preheader.loopexit, %for.cond.preheader
%6 = phi i32 [ -1, %for.cond.preheader ], [ %.pre178, %for.cond10.preheader.loopexit ]
%7 = phi i32 [ -1, %for.cond.preheader ], [ %.pre177, %for.cond10.preheader.loopexit ]
%8 = phi i32 [ -1, %for.cond.preheader ], [ %.pre176, %for.cond10.preheader.loopexit ]
%f.0.lcssa = phi i1 [ false, %for.cond.preheader ], [ %5, %for.cond10.preheader.loopexit ]
%spec.store.select = call i32 @llvm.smax.i32(i32 %8, i32 0)
%spec.store.select.1 = call i32 @llvm.smax.i32(i32 %7, i32 0)
%arrayidx23 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%cmp24 = icmp eq i32 %6, 0
br i1 %cmp24, label %if.then34, label %if.else26
for.body: ; preds = %for.cond.preheader, %for.body
%f.0171 = phi i32 [ %spec.select, %for.body ], [ 0, %for.cond.preheader ]
%i.0170 = phi i32 [ %inc, %for.body ], [ 0, %for.cond.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %c)
%9 = load i32, ptr %s, align 4, !tbaa !5
%idxprom = sext i32 %9 to i64
%arrayidx = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 %idxprom
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp3 = icmp eq i32 %10, -1
%11 = load i32, ptr %c, align 4
%cmp6 = icmp eq i32 %10, %11
%or.cond = select i1 %cmp3, i1 true, i1 %cmp6
%spec.store.select157 = select i1 %or.cond, i32 %11, i32 %10
store i32 %spec.store.select157, ptr %arrayidx, align 4
%spec.select = select i1 %or.cond, i32 %f.0171, i32 -1
%inc = add nuw nsw i32 %i.0170, 1
%12 = load i32, ptr %m, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %12
br i1 %cmp1, label %for.body, label %for.cond10.preheader.loopexit, !llvm.loop !9
if.else26: ; preds = %for.cond10.preheader
%cmp28 = icmp slt i32 %6, 0
br i1 %cmp28, label %if.then29, label %if.end32
if.then29: ; preds = %if.else26
store i32 1, ptr %arrayidx23, align 4, !tbaa !5
br label %if.end32
if.end32: ; preds = %if.else26, %if.then29
br i1 %f.0.lcssa, label %if.then34, label %if.else36
if.then34: ; preds = %for.cond10.preheader, %if.end32
%puts145 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end127
if.else36: ; preds = %if.end32
%13 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%mul = mul nsw i32 %13, 100
%mul39 = mul nsw i32 %spec.store.select, 10
%add = add nsw i32 %mul39, %mul
%add41 = add nsw i32 %add, %spec.store.select.1
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add41)
br label %if.end127
for.body49: ; preds = %for.cond47.preheader, %for.body49
%f.3167 = phi i32 [ %spec.select159, %for.body49 ], [ 0, %for.cond47.preheader ]
%i.2166 = phi i32 [ %inc64, %for.body49 ], [ 0, %for.cond47.preheader ]
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %c)
%14 = load i32, ptr %s, align 4, !tbaa !5
%idxprom51 = sext i32 %14 to i64
%arrayidx52 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 %idxprom51
%15 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%cmp53 = icmp eq i32 %15, -1
%16 = load i32, ptr %c, align 4
%cmp57 = icmp eq i32 %15, %16
%or.cond146 = select i1 %cmp53, i1 true, i1 %cmp57
%spec.store.select158 = select i1 %or.cond146, i32 %16, i32 %15
store i32 %spec.store.select158, ptr %arrayidx52, align 4
%spec.select159 = select i1 %or.cond146, i32 %f.3167, i32 -1
%inc64 = add nuw nsw i32 %i.2166, 1
%17 = load i32, ptr %m, align 4, !tbaa !5
%cmp48 = icmp slt i32 %inc64, %17
br i1 %cmp48, label %for.body49, label %for.end65, !llvm.loop !11
for.end65: ; preds = %for.body49
%arrayidx66.phi.trans.insert = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%.pre175 = load i32, ptr %arrayidx66.phi.trans.insert, align 4, !tbaa !5
%18 = icmp eq i32 %spec.select159, -1
%arrayidx66 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%cmp67 = icmp eq i32 %.pre175, 0
br i1 %cmp67, label %if.then82, label %if.else69
if.else69: ; preds = %for.end65
%cmp71 = icmp slt i32 %.pre175, 0
br i1 %cmp71, label %if.then72, label %if.end75
if.then72: ; preds = %if.else69
store i32 1, ptr %arrayidx66, align 4, !tbaa !5
%arrayidx76191 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%19 = load i32, ptr %arrayidx76191, align 8, !tbaa !5
%spec.store.select147192 = call i32 @llvm.smax.i32(i32 %19, i32 0)
br i1 %18, label %if.then82, label %if.else84
if.end75: ; preds = %if.else69
%arrayidx76 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%20 = load i32, ptr %arrayidx76, align 8, !tbaa !5
%spec.store.select147 = call i32 @llvm.smax.i32(i32 %20, i32 0)
br i1 %18, label %if.then82, label %if.else84
if.then82: ; preds = %for.end65, %if.then72, %if.end75
%puts144 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end127
if.else84: ; preds = %if.then72.thread, %if.then72, %if.end75
%spec.store.select147194 = phi i32 [ %spec.store.select147192, %if.then72 ], [ %spec.store.select147, %if.end75 ], [ %spec.store.select147192202, %if.then72.thread ]
%arrayidx66183187193 = phi ptr [ %arrayidx66, %if.then72 ], [ %arrayidx66, %if.end75 ], [ %arrayidx66180, %if.then72.thread ]
%21 = load i32, ptr %arrayidx66183187193, align 4, !tbaa !5
%mul86 = mul nsw i32 %21, 10
%add88 = add nsw i32 %mul86, %spec.store.select147194
%call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add88)
br label %if.end127
for.body96: ; preds = %for.cond94.preheader, %for.body96
%f.6164 = phi i32 [ %spec.select161, %for.body96 ], [ 0, %for.cond94.preheader ]
%i.3163 = phi i32 [ %inc111, %for.body96 ], [ 0, %for.cond94.preheader ]
%call97 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %c)
%22 = load i32, ptr %s, align 4, !tbaa !5
%idxprom98 = sext i32 %22 to i64
%arrayidx99 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 %idxprom98
%23 = load i32, ptr %arrayidx99, align 4, !tbaa !5
%cmp100 = icmp eq i32 %23, -1
%24 = load i32, ptr %c, align 4
%cmp104 = icmp eq i32 %23, %24
%or.cond148 = select i1 %cmp100, i1 true, i1 %cmp104
%spec.store.select160 = select i1 %or.cond148, i32 %24, i32 %23
store i32 %spec.store.select160, ptr %arrayidx99, align 4
%spec.select161 = select i1 %or.cond148, i32 %f.6164, i32 -1
%inc111 = add nuw nsw i32 %i.3163, 1
%25 = load i32, ptr %m, align 4, !tbaa !5
%cmp95 = icmp slt i32 %inc111, %25
br i1 %cmp95, label %for.body96, label %for.end112, !llvm.loop !12
for.end112: ; preds = %for.body96
%arrayidx113.phi.trans.insert = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%.pre = load i32, ptr %arrayidx113.phi.trans.insert, align 4, !tbaa !5
%26 = icmp eq i32 %spec.select161, -1
%spec.store.select149 = call i32 @llvm.smax.i32(i32 %.pre, i32 0)
br i1 %26, label %if.then119, label %if.else121
if.then119: ; preds = %for.end112
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end127
if.else121: ; preds = %for.cond94.preheader, %for.end112
%spec.store.select149198 = phi i32 [ %spec.store.select149, %for.end112 ], [ 0, %for.cond94.preheader ]
%call123 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.store.select149198)
br label %if.end127
if.end127: ; preds = %entry, %if.else84, %if.then82, %if.then119, %if.else121, %if.then34, %if.else36
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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: 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void) {
int N, M, s[10], c[15], X[10], i;
scanf("%d%d", &N, &M);
for (i=0; i<N; i++) X[i]=-1;
for (i=0; i<M; i++) {
// printf("[%d]\n", i);
scanf("%d%d", &s[i], &c[i]);
s[i]--;
if (X[s[i]]!=-1 && X[s[i]]!=c[i]) {
printf("-1");
return 0;
}
else X[s[i]]=c[i];
}
if (X[0]==0 && N!=1) {
printf("-1");
return 0;
}
if (X[0]==-1) {
if (N==1) X[0]=0;
else X[0]=1;
}
for (i=0; i<N; i++) {
if (X[i]==-1) X[i]=0;
printf("%d", X[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119934/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119934/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"-1\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%M = alloca i32, align 4
%s = alloca [10 x i32], align 16
%c = alloca [15 x i32], align 16
%X = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %X) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M)
%0 = load i32, ptr %N, align 4
%cmp88 = icmp sgt i32 %0, 0
br i1 %cmp88, label %for.body.preheader, label %for.cond1.preheader
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %X, i8 -1, i64 %2, i1 false), !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.body.preheader, %entry
%3 = load i32, ptr %M, align 4, !tbaa !5
%cmp290 = icmp sgt i32 %3, 0
br i1 %cmp290, label %for.body3, label %for.end32
for.body3: ; preds = %for.cond1.preheader, %if.else
%indvars.iv = phi i64 [ %indvars.iv.next, %if.else ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [10 x i32], ptr %s, i64 0, i64 %indvars.iv
%arrayidx7 = getelementptr inbounds [15 x i32], ptr %c, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %arrayidx5, align 4, !tbaa !5
%idxprom13 = sext i32 %dec to i64
%arrayidx14 = getelementptr inbounds [10 x i32], ptr %X, i64 0, i64 %idxprom13
%5 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15.not = icmp eq i32 %5, -1
%.pre = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp22.not = icmp eq i32 %5, %.pre
%or.cond101 = select i1 %cmp15.not, i1 true, i1 %cmp22.not
br i1 %or.cond101, label %if.else, label %cleanup.sink.split
if.else: ; preds = %for.body3
store i32 %.pre, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %M, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp2, label %for.body3, label %for.end32.loopexit, !llvm.loop !9
for.end32.loopexit: ; preds = %if.else
%.pre99 = load i32, ptr %N, align 4
br label %for.end32
for.end32: ; preds = %for.end32.loopexit, %for.cond1.preheader
%8 = phi i32 [ %.pre99, %for.end32.loopexit ], [ %0, %for.cond1.preheader ]
%9 = load i32, ptr %X, align 16, !tbaa !5
%cmp34 = icmp eq i32 %9, 0
%cmp36 = icmp ne i32 %8, 1
%or.cond = select i1 %cmp34, i1 %cmp36, i1 false
br i1 %or.cond, label %cleanup.sink.split, label %if.end39
if.end39: ; preds = %for.end32
%cmp41 = icmp eq i32 %9, -1
br i1 %cmp41, label %if.then42, label %if.end49
if.then42: ; preds = %if.end39
%cmp43 = icmp eq i32 %8, 1
br i1 %cmp43, label %if.end49.thread, label %if.else46
if.end49.thread: ; preds = %if.then42
store i32 0, ptr %X, align 16, !tbaa !5
br label %for.body52.preheader
if.else46: ; preds = %if.then42
store i32 1, ptr %X, align 16, !tbaa !5
br label %if.end49
if.end49: ; preds = %if.else46, %if.end39
%cmp5192 = icmp sgt i32 %8, 0
br i1 %cmp5192, label %for.body52.preheader, label %cleanup
for.body52.preheader: ; preds = %if.end49.thread, %if.end49
br label %for.body52
for.body52: ; preds = %for.body52.preheader, %for.body52
%indvars.iv96 = phi i64 [ %indvars.iv.next97, %for.body52 ], [ 0, %for.body52.preheader ]
%arrayidx54 = getelementptr inbounds [10 x i32], ptr %X, i64 0, i64 %indvars.iv96
%10 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%cmp55 = icmp eq i32 %10, -1
%spec.store.select = select i1 %cmp55, i32 0, i32 %10
store i32 %spec.store.select, ptr %arrayidx54, align 4
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.store.select)
%indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
%11 = load i32, ptr %N, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp51 = icmp slt i64 %indvars.iv.next97, %12
br i1 %cmp51, label %for.body52, label %cleanup, !llvm.loop !11
cleanup.sink.split: ; preds = %for.body3, %for.end32
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
cleanup: ; preds = %for.body52, %cleanup.sink.split, %if.end49
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %X) #4
call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
/* AtCoder Beginner Contest 133 D - Rain Flows into Dams
2019.07.28 by meyon */
#include <stdio.h>
#include <stdlib.h>
void err()
{
printf("Error!\n");
exit(1);
}
int main()
{
// input N
int N;
scanf("%d", &N);
if(3>N || 99999<N || 0==N%2) {
err();
}
// input A
int A[N];
for(int i=0; i<N; i++) {
scanf("%d", &A[i]);
if(0>A[i] || 1000000000<A[i]) {
err();
}
}
// rainfall X
int X[N];
for(int i=0; i<N; i++) {
X[i]=0;
}
int S=0;
for(int i=0; i<N; i++) {
S += A[i];
}
int P=0;
for(int i=1; i<N; i+=2) {
P += A[i];
}
X[0]=S-2*P; // X1=S-2(A2+A4+...+A[n-1])
for(int i=0; i<N-1; i++) {
X[i+1]=2*A[i]-X[i]; // X[i+1]=2Ai-Xi
}
// display answer
for(int i=0; i<N; i++) {
printf("%d ", X[i]);
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_119985/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_119985/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@str = private unnamed_addr constant [7 x i8] c"Error!\00", align 1
; Function Attrs: noreturn nounwind uwtable
define dso_local void @err() local_unnamed_addr #0 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
tail call void @exit(i32 noundef 1) #9
unreachable
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2
; Function Attrs: 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) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4
%1 = add i32 %0, -100000
%or.cond = icmp ult i32 %1, -99997
%rem = and i32 %0, 1
%cmp3 = icmp eq i32 %rem, 0
%or.cond98 = or i1 %or.cond, %cmp3
br i1 %or.cond98, label %if.then, label %if.end
if.then: ; preds = %entry
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
if.end: ; preds = %entry
%2 = zext i32 %0 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp4103 = icmp sgt i32 %4, 0
br i1 %cmp4103, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %if.end
%5 = zext i32 %4 to i64
%vla15138 = alloca i32, i64 %5, align 16
br label %for.cond67.preheader.thread
for.cond: ; preds = %for.body
%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
%cmp4 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp4, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond
%8 = zext i32 %6 to i64
%vla15 = alloca i32, i64 %8, align 16
%cmp18105 = icmp sgt i32 %6, 0
br i1 %cmp18105, label %for.body30.preheader, label %for.cond67.preheader.thread
for.body: ; preds = %if.end, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %if.end ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%9 = load i32, ptr %arrayidx, align 4, !tbaa !5
%or.cond99 = icmp ugt i32 %9, 1000000000
br i1 %or.cond99, label %if.then13, label %for.cond
if.then13: ; preds = %for.body
%puts.i100 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #9
unreachable
for.body30.preheader: ; preds = %for.cond.cleanup
%10 = shl nuw nsw i64 %8, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla15, i8 0, i64 %10, i1 false), !tbaa !5
%min.iters.check = icmp ult i32 %6, 8
br i1 %min.iters.check, label %for.body30.preheader190, label %vector.ph
vector.ph: ; preds = %for.body30.preheader
%n.vec = and i64 %8, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi170 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%11 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load171 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = add <4 x i32> %wide.load, %vec.phi
%14 = add <4 x i32> %wide.load171, %vec.phi170
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %8
br i1 %cmp.n, label %for.cond37.preheader, label %for.body30.preheader190
for.body30.preheader190: ; preds = %for.body30.preheader, %middle.block
%indvars.iv124.ph = phi i64 [ 0, %for.body30.preheader ], [ %n.vec, %middle.block ]
%S.0108.ph = phi i32 [ 0, %for.body30.preheader ], [ %16, %middle.block ]
br label %for.body30
for.cond37.preheader: ; preds = %for.body30, %middle.block
%add.lcssa = phi i32 [ %16, %middle.block ], [ %add, %for.body30 ]
%cmp38111 = icmp sgt i32 %6, 1
br i1 %cmp38111, label %for.body40.preheader, label %for.cond.cleanup39.thread
for.cond.cleanup39.thread: ; preds = %for.cond37.preheader
store i32 %add.lcssa, ptr %vla15, align 16, !tbaa !5
br i1 %cmp18105, label %for.body70.preheader, label %for.cond.cleanup69
for.body40.preheader: ; preds = %for.cond37.preheader
%17 = zext i32 %6 to i64
%18 = add nsw i64 %8, -2
%min.iters.check174 = icmp ult i64 %18, 16
br i1 %min.iters.check174, label %for.body40.preheader188, label %vector.ph175
vector.ph175: ; preds = %for.body40.preheader
%19 = lshr i64 %18, 1
%20 = add nuw i64 %19, 1
%n.mod.vf176 = and i64 %20, 7
%21 = icmp eq i64 %n.mod.vf176, 0
%22 = select i1 %21, i64 8, i64 %n.mod.vf176
%n.vec177 = sub i64 %20, %22
%23 = shl i64 %n.vec177, 1
%ind.end = or i64 %23, 1
br label %vector.body179
vector.body179: ; preds = %vector.body179, %vector.ph175
%index180 = phi i64 [ 0, %vector.ph175 ], [ %index.next185, %vector.body179 ]
%vec.phi181 = phi <4 x i32> [ zeroinitializer, %vector.ph175 ], [ %28, %vector.body179 ]
%vec.phi182 = phi <4 x i32> [ zeroinitializer, %vector.ph175 ], [ %29, %vector.body179 ]
%24 = shl i64 %index180, 1
%offset.idx = or i64 %24, 1
%25 = or i64 %24, 9
%26 = getelementptr inbounds i32, ptr %vla, i64 %offset.idx
%27 = getelementptr inbounds i32, ptr %vla, i64 %25
%wide.vec = load <8 x i32>, ptr %26, align 4, !tbaa !5
%wide.vec183 = load <8 x i32>, ptr %27, align 4, !tbaa !5
%strided.vec = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%strided.vec184 = shufflevector <8 x i32> %wide.vec183, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%28 = add <4 x i32> %strided.vec, %vec.phi181
%29 = add <4 x i32> %strided.vec184, %vec.phi182
%index.next185 = add nuw i64 %index180, 8
%30 = icmp eq i64 %index.next185, %n.vec177
br i1 %30, label %middle.block172, label %vector.body179, !llvm.loop !14
middle.block172: ; preds = %vector.body179
%bin.rdx186 = add <4 x i32> %29, %28
%31 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx186)
br label %for.body40.preheader188
for.body40.preheader188: ; preds = %for.body40.preheader, %middle.block172
%indvars.iv127.ph = phi i64 [ 1, %for.body40.preheader ], [ %ind.end, %middle.block172 ]
%P.0112.ph = phi i32 [ 0, %for.body40.preheader ], [ %31, %middle.block172 ]
br label %for.body40
for.body30: ; preds = %for.body30.preheader190, %for.body30
%indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.body30 ], [ %indvars.iv124.ph, %for.body30.preheader190 ]
%S.0108 = phi i32 [ %add, %for.body30 ], [ %S.0108.ph, %for.body30.preheader190 ]
%arrayidx32 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv124
%32 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%add = add nsw i32 %32, %S.0108
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%exitcond.not = icmp eq i64 %indvars.iv.next125, %8
br i1 %exitcond.not, label %for.cond37.preheader, label %for.body30, !llvm.loop !15
for.cond.cleanup39.loopexit: ; preds = %for.body40
%33 = shl nsw i32 %add43, 1
%sub163 = sub nsw i32 %add.lcssa, %33
store i32 %sub163, ptr %vla15, align 16, !tbaa !5
br i1 %cmp38111, label %for.body53.preheader, label %for.cond67.preheader
for.cond67.preheader.thread: ; preds = %for.cond.cleanup, %for.cond.cleanup.thread
%vla15140.ph = phi ptr [ %vla15, %for.cond.cleanup ], [ %vla15138, %for.cond.cleanup.thread ]
store i32 0, ptr %vla15140.ph, align 16, !tbaa !5
br label %for.cond.cleanup69
for.body53.preheader: ; preds = %for.cond.cleanup39.loopexit
%sub50 = add nsw i32 %6, -1
%wide.trip.count133 = zext i32 %sub50 to i64
%34 = add nsw i64 %wide.trip.count133, -1
%xtraiter = and i64 %wide.trip.count133, 3
%35 = icmp ult i64 %34, 3
br i1 %35, label %for.cond67.preheader.loopexit.unr-lcssa, label %for.body53.preheader.new
for.body53.preheader.new: ; preds = %for.body53.preheader
%unroll_iter = and i64 %wide.trip.count133, 4294967292
br label %for.body53
for.body40: ; preds = %for.body40.preheader188, %for.body40
%indvars.iv127 = phi i64 [ %indvars.iv.next128, %for.body40 ], [ %indvars.iv127.ph, %for.body40.preheader188 ]
%P.0112 = phi i32 [ %add43, %for.body40 ], [ %P.0112.ph, %for.body40.preheader188 ]
%arrayidx42 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv127
%36 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%add43 = add nsw i32 %36, %P.0112
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 2
%cmp38 = icmp ult i64 %indvars.iv.next128, %17
br i1 %cmp38, label %for.body40, label %for.cond.cleanup39.loopexit, !llvm.loop !16
for.cond67.preheader.loopexit.unr-lcssa: ; preds = %for.body53, %for.body53.preheader
%.unr = phi i32 [ %sub163, %for.body53.preheader ], [ %sub59.3, %for.body53 ]
%indvars.iv130.unr = phi i64 [ 0, %for.body53.preheader ], [ %indvars.iv.next131.3, %for.body53 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond67.preheader, label %for.body53.epil
for.body53.epil: ; preds = %for.cond67.preheader.loopexit.unr-lcssa, %for.body53.epil
%37 = phi i32 [ %sub59.epil, %for.body53.epil ], [ %.unr, %for.cond67.preheader.loopexit.unr-lcssa ]
%indvars.iv130.epil = phi i64 [ %indvars.iv.next131.epil, %for.body53.epil ], [ %indvars.iv130.unr, %for.cond67.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body53.epil ], [ 0, %for.cond67.preheader.loopexit.unr-lcssa ]
%arrayidx55.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv130.epil
%38 = load i32, ptr %arrayidx55.epil, align 4, !tbaa !5
%mul56.epil = shl nsw i32 %38, 1
%sub59.epil = sub nsw i32 %mul56.epil, %37
%indvars.iv.next131.epil = add nuw nsw i64 %indvars.iv130.epil, 1
%arrayidx62.epil = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv.next131.epil
store i32 %sub59.epil, ptr %arrayidx62.epil, align 4, !tbaa !5
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond67.preheader, label %for.body53.epil, !llvm.loop !17
for.cond67.preheader: ; preds = %for.cond67.preheader.loopexit.unr-lcssa, %for.body53.epil, %for.cond.cleanup39.loopexit
br i1 %cmp18105, label %for.body70.preheader, label %for.cond.cleanup69
for.body70.preheader: ; preds = %for.cond.cleanup39.thread, %for.cond67.preheader
br label %for.body70
for.body53: ; preds = %for.body53, %for.body53.preheader.new
%39 = phi i32 [ %sub163, %for.body53.preheader.new ], [ %sub59.3, %for.body53 ]
%indvars.iv130 = phi i64 [ 0, %for.body53.preheader.new ], [ %indvars.iv.next131.3, %for.body53 ]
%niter = phi i64 [ 0, %for.body53.preheader.new ], [ %niter.next.3, %for.body53 ]
%arrayidx55 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv130
%40 = load i32, ptr %arrayidx55, align 16, !tbaa !5
%mul56 = shl nsw i32 %40, 1
%sub59 = sub nsw i32 %mul56, %39
%indvars.iv.next131 = or i64 %indvars.iv130, 1
%arrayidx62 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv.next131
store i32 %sub59, ptr %arrayidx62, align 4, !tbaa !5
%arrayidx55.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next131
%41 = load i32, ptr %arrayidx55.1, align 4, !tbaa !5
%mul56.1 = shl nsw i32 %41, 1
%sub59.1 = sub nsw i32 %mul56.1, %sub59
%indvars.iv.next131.1 = or i64 %indvars.iv130, 2
%arrayidx62.1 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv.next131.1
store i32 %sub59.1, ptr %arrayidx62.1, align 8, !tbaa !5
%arrayidx55.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next131.1
%42 = load i32, ptr %arrayidx55.2, align 8, !tbaa !5
%mul56.2 = shl nsw i32 %42, 1
%sub59.2 = sub nsw i32 %mul56.2, %sub59.1
%indvars.iv.next131.2 = or i64 %indvars.iv130, 3
%arrayidx62.2 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv.next131.2
store i32 %sub59.2, ptr %arrayidx62.2, align 4, !tbaa !5
%arrayidx55.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next131.2
%43 = load i32, ptr %arrayidx55.3, align 4, !tbaa !5
%mul56.3 = shl nsw i32 %43, 1
%sub59.3 = sub nsw i32 %mul56.3, %sub59.2
%indvars.iv.next131.3 = add nuw nsw i64 %indvars.iv130, 4
%arrayidx62.3 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv.next131.3
store i32 %sub59.3, ptr %arrayidx62.3, align 16, !tbaa !5
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond67.preheader.loopexit.unr-lcssa, label %for.body53, !llvm.loop !19
for.cond.cleanup69: ; preds = %for.body70, %for.cond.cleanup39.thread, %for.cond67.preheader.thread, %for.cond67.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #10
ret i32 0
for.body70: ; preds = %for.body70.preheader, %for.body70
%indvars.iv135 = phi i64 [ %indvars.iv.next136, %for.body70 ], [ 0, %for.body70.preheader ]
%arrayidx72 = getelementptr inbounds i32, ptr %vla15, i64 %indvars.iv135
%44 = load i32, ptr %arrayidx72, align 4, !tbaa !5
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %44)
%indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
%45 = load i32, ptr %N, align 4, !tbaa !5
%46 = sext i32 %45 to i64
%cmp68 = icmp slt i64 %indvars.iv.next136, %46
br i1 %cmp68, label %for.body70, label %for.cond.cleanup69, !llvm.loop !20
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #8
attributes #0 = { 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 #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nofree nounwind }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = 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, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10, !13, !12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int main(void){
int i,j,k;
int N;
unsigned int A[100000],answer[100000] = {0};
unsigned int total = 0,temp;
scanf("%d",&N);
for(i = 0;i < N-1;i++){
scanf("%ud\n",&A[i]);
}
scanf("%ud",&A[i]);
total = A[0] * 2;
for(i = 1;i < N;i++){
if((i % 2) == 1){
total -= A[i] * 2;
}else{
total += A[i] * 2;
}
}
answer[0] = total / 2;
for(i = 1;i < N;i++){
answer[i] = A[i-1]*2 - answer[i-1];
}
for(i = 0;i < N-1;i++){
printf("%d ",answer[i]);
}
printf("%d\n",answer[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120026/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120026/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ud\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%ud\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d \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:
%N = alloca i32, align 4
%A = alloca [100000 x i32], align 16
%answer = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %answer) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %answer, i8 0, i64 400000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp71 = icmp sgt i32 %0, 1
br i1 %cmp71, 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 [100000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%2 = sext i32 %sub to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%3 = and i64 %indvars.iv.next, 4294967295
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i64 [ 0, %entry ], [ %3, %for.end.loopexit ]
%arrayidx3 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %i.0.lcssa
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx3)
%4 = load i32, ptr %A, align 16, !tbaa !5
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp773 = icmp sgt i32 %5, 1
br i1 %cmp773, label %for.body8.preheader, label %for.end19.thread
for.end19.thread: ; preds = %for.end
%div6999 = and i32 %4, 2147483647
br label %for.end46
for.body8.preheader: ; preds = %for.end
%mul = shl i32 %4, 1
%wide.trip.count = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %5, 9
br i1 %min.iters.check, label %for.body8.preheader106, label %vector.ph
vector.ph: ; preds = %for.body8.preheader
%n.vec = and i64 %6, -8
%ind.end = or i64 %n.vec, 1
%7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %mul, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 1, i64 2, i64 3, i64 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %7, %vector.ph ], [ %20, %vector.body ]
%vec.phi104 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%offset.idx = or i64 %index, 1
%8 = and <4 x i64> %vec.ind, <i64 1, i64 1, i64 1, i64 1>
%9 = and <4 x i64> %vec.ind, <i64 1, i64 1, i64 1, i64 1>
%10 = icmp eq <4 x i64> %8, zeroinitializer
%11 = icmp eq <4 x i64> %9, zeroinitializer
%12 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
%wide.load105 = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = shl <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%15 = shl <4 x i32> %wide.load105, <i32 1, i32 1, i32 1, i32 1>
%16 = sub <4 x i32> zeroinitializer, %14
%17 = sub <4 x i32> zeroinitializer, %15
%18 = select <4 x i1> %10, <4 x i32> %14, <4 x i32> %16
%19 = select <4 x i1> %11, <4 x i32> %15, <4 x i32> %17
%20 = add <4 x i32> %vec.phi, %18
%21 = add <4 x i32> %vec.phi104, %19
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%22 = icmp eq i64 %index.next, %n.vec
br i1 %22, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %21, %20
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.end19, label %for.body8.preheader106
for.body8.preheader106: ; preds = %for.body8.preheader, %middle.block
%indvars.iv85.ph = phi i64 [ 1, %for.body8.preheader ], [ %ind.end, %middle.block ]
%total.074.ph = phi i32 [ %mul, %for.body8.preheader ], [ %23, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader106, %for.body8
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body8 ], [ %indvars.iv85.ph, %for.body8.preheader106 ]
%total.074 = phi i32 [ %total.1, %for.body8 ], [ %total.074.ph, %for.body8.preheader106 ]
%rem97 = and i64 %indvars.iv85, 1
%cmp9.not = icmp eq i64 %rem97, 0
%arrayidx15 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %indvars.iv85
%24 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%mul16 = shl i32 %24, 1
%25 = sub i32 0, %mul16
%total.1.p = select i1 %cmp9.not, i32 %mul16, i32 %25
%total.1 = add i32 %total.074, %total.1.p
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%exitcond.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count
br i1 %exitcond.not, label %for.end19, label %for.body8, !llvm.loop !14
for.end19: ; preds = %for.body8, %middle.block
%total.1.lcssa = phi i32 [ %23, %middle.block ], [ %total.1, %for.body8 ]
%div69 = lshr exact i32 %total.1.lcssa, 1
store i32 %div69, ptr %answer, align 16, !tbaa !5
br i1 %cmp773, label %for.body23.preheader, label %for.end46
for.body23.preheader: ; preds = %for.end19
%xtraiter = and i64 %6, 1
%26 = icmp eq i32 %5, 2
br i1 %26, label %for.cond37.preheader.unr-lcssa, label %for.body23.preheader.new
for.body23.preheader.new: ; preds = %for.body23.preheader
%unroll_iter = and i64 %6, -2
br label %for.body23
for.cond37.preheader.unr-lcssa: ; preds = %for.body23, %for.body23.preheader
%.unr = phi i32 [ %div69, %for.body23.preheader ], [ %sub31.1, %for.body23 ]
%indvars.iv88.unr = phi i64 [ 1, %for.body23.preheader ], [ %indvars.iv.next89.1, %for.body23 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond37.preheader, label %for.body23.epil
for.body23.epil: ; preds = %for.cond37.preheader.unr-lcssa
%27 = add nsw i64 %indvars.iv88.unr, -1
%arrayidx26.epil = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %27
%28 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !5
%mul27.epil = shl i32 %28, 1
%sub31.epil = sub i32 %mul27.epil, %.unr
%arrayidx33.epil = getelementptr inbounds [100000 x i32], ptr %answer, i64 0, i64 %indvars.iv88.unr
store i32 %sub31.epil, ptr %arrayidx33.epil, align 4, !tbaa !5
br label %for.cond37.preheader
for.cond37.preheader: ; preds = %for.cond37.preheader.unr-lcssa, %for.body23.epil
br i1 %cmp773, label %for.body40, label %for.end46
for.body23: ; preds = %for.body23, %for.body23.preheader.new
%29 = phi i32 [ %div69, %for.body23.preheader.new ], [ %sub31.1, %for.body23 ]
%indvars.iv88 = phi i64 [ 1, %for.body23.preheader.new ], [ %indvars.iv.next89.1, %for.body23 ]
%niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.1, %for.body23 ]
%30 = add nsw i64 %indvars.iv88, -1
%arrayidx26 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %30
%31 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%mul27 = shl i32 %31, 1
%sub31 = sub i32 %mul27, %29
%arrayidx33 = getelementptr inbounds [100000 x i32], ptr %answer, i64 0, i64 %indvars.iv88
store i32 %sub31, ptr %arrayidx33, align 4, !tbaa !5
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%arrayidx26.1 = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %indvars.iv88
%32 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%mul27.1 = shl i32 %32, 1
%sub31.1 = sub i32 %mul27.1, %sub31
%arrayidx33.1 = getelementptr inbounds [100000 x i32], ptr %answer, i64 0, i64 %indvars.iv.next89
store i32 %sub31.1, ptr %arrayidx33.1, align 4, !tbaa !5
%indvars.iv.next89.1 = add nuw nsw i64 %indvars.iv88, 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.cond37.preheader.unr-lcssa, label %for.body23, !llvm.loop !15
for.body40: ; preds = %for.cond37.preheader, %for.body40
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.body40 ], [ 0, %for.cond37.preheader ]
%arrayidx42 = getelementptr inbounds [100000 x i32], ptr %answer, i64 0, i64 %indvars.iv94
%33 = load i32, ptr %arrayidx42, align 4, !tbaa !5
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %33)
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%34 = load i32, ptr %N, align 4, !tbaa !5
%sub38 = add nsw i32 %34, -1
%35 = sext i32 %sub38 to i64
%cmp39 = icmp slt i64 %indvars.iv.next95, %35
br i1 %cmp39, label %for.body40, label %for.end46.loopexit, !llvm.loop !16
for.end46.loopexit: ; preds = %for.body40
%idxprom47.phi.trans.insert = and i64 %indvars.iv.next95, 4294967295
%arrayidx48.phi.trans.insert = getelementptr inbounds [100000 x i32], ptr %answer, i64 0, i64 %idxprom47.phi.trans.insert
%.pre = load i32, ptr %arrayidx48.phi.trans.insert, align 4, !tbaa !5
br label %for.end46
for.end46: ; preds = %for.end19, %for.end19.thread, %for.cond37.preheader, %for.end46.loopexit
%36 = phi i32 [ %.pre, %for.end46.loopexit ], [ %div69, %for.cond37.preheader ], [ %div69, %for.end19 ], [ %div6999, %for.end19.thread ]
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %36)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %answer) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main() {
int a, b, year;
scanf("%d%d",&a,&b);
for(year = 1; ;year++) {
a = a*3;
b = b*2;
if(a > b) {
printf("%d",year);
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12007/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12007/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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)
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%mul15 = phi i32 [ %b.promoted, %entry ], [ %mul1, %for.cond ]
%mul4 = phi i32 [ %a.promoted, %entry ], [ %mul, %for.cond ]
%year.0 = phi i32 [ 1, %entry ], [ %inc, %for.cond ]
%mul = mul nsw i32 %mul4, 3
%mul1 = shl nsw i32 %mul15, 1
%cmp = icmp sgt i32 %mul, %mul1
%inc = add nuw nsw i32 %year.0, 1
br i1 %cmp, label %if.then, label %for.cond
if.then: ; preds = %for.cond
store i32 %mul, ptr %a, align 4, !tbaa !5
store i32 %mul1, ptr %b, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %year.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <math.h>
int main(int argc, char *argv[])
{
int n, k;
char s[100001];
int cnt[200001];
int ptr;
char last = ' '; // not '0' and not '1'
int lastpos;
int sum;
int i;
int max;
scanf("%d %d", &n, &k);
scanf("%s", s);
for (i = 0; i < 200001; i++) {
cnt[i] = 0;
}
lastpos = 0;
last = s[lastpos];
ptr = 0;
i = 0;
do {
i++;
if (last != s[i]) {
int len = i - lastpos;
int dest = ptr + (last - '0');
cnt[dest] = len;
if (last == '1') {ptr += 2;}
lastpos = i;
last = s[lastpos];
}
} while(s[i] != '\0');
sum = 0;
for (i = 0; i < k * 2; i++) {
sum += cnt[i];
}
max = sum;
for (i = k * 2; cnt[i] != 0; i++) {
if (i % 2 == 0) {
sum += cnt[i];
sum -= cnt[i - (k * 2)];
if (i > (k * 2 + 1)) {
sum -= cnt[i - (k * 2 + 1)];
}
} else {
sum += cnt[i];
}
if (sum > max) {max = sum;}
}
printf("%d\n", max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120112/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120112/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [100001 x i8], align 16
%cnt = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %cnt) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800004) %cnt, i8 0, i64 800004, i1 false), !tbaa !5
%0 = load i8, ptr %s, align 16, !tbaa !9
br label %do.body
do.body: ; preds = %do.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %do.cond ], [ 0, %entry ]
%lastpos.0 = phi i32 [ %lastpos.1, %do.cond ], [ 0, %entry ]
%last.0 = phi i8 [ %last.1, %do.cond ], [ %0, %entry ]
%ptr.0 = phi i32 [ %ptr.2, %do.cond ], [ 0, %entry ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx6 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%1 = load i8, ptr %arrayidx6, align 1, !tbaa !9
%cmp8.not = icmp eq i8 %last.0, %1
br i1 %cmp8.not, label %do.cond, label %if.then
if.then: ; preds = %do.body
%conv = sext i8 %last.0 to i32
%2 = trunc i64 %indvars.iv.next to i32
%sub = sub nsw i32 %2, %lastpos.0
%sub11 = add nsw i32 %conv, -48
%add = add nsw i32 %sub11, %ptr.0
%idxprom12 = sext i32 %add to i64
%arrayidx13 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %idxprom12
store i32 %sub, ptr %arrayidx13, align 4, !tbaa !5
%cmp15 = icmp eq i8 %last.0, 49
%add18 = add nsw i32 %ptr.0, 2
%spec.select = select i1 %cmp15, i32 %add18, i32 %ptr.0
br label %do.cond
do.cond: ; preds = %do.body, %if.then
%lastpos.1 = phi i32 [ %2, %if.then ], [ %lastpos.0, %do.body ]
%last.1 = phi i8 [ %1, %if.then ], [ %last.0, %do.body ]
%ptr.2 = phi i32 [ %spec.select, %if.then ], [ %ptr.0, %do.body ]
%cmp25.not = icmp eq i8 %1, 0
br i1 %cmp25.not, label %for.cond27.preheader, label %do.body, !llvm.loop !10
for.cond27.preheader: ; preds = %do.cond
%3 = load i32, ptr %k, align 4, !tbaa !5
%mul = shl i32 %3, 1
%cmp28112 = icmp sgt i32 %3, 0
br i1 %cmp28112, label %for.body30.preheader, label %for.cond38.preheader
for.body30.preheader: ; preds = %for.cond27.preheader
%smax = call i32 @llvm.smax.i32(i32 %mul, i32 1)
%wide.trip.count = zext i32 %smax to i64
%min.iters.check = icmp ult i32 %smax, 8
br i1 %min.iters.check, label %for.body30.preheader154, label %vector.ph
vector.ph: ; preds = %for.body30.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 ], [ %6, %vector.body ]
%vec.phi152 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%4 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load153 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = add <4 x i32> %wide.load, %vec.phi
%7 = add <4 x i32> %wide.load153, %vec.phi152
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond38.preheader, label %for.body30.preheader154
for.body30.preheader154: ; preds = %for.body30.preheader, %middle.block
%indvars.iv124.ph = phi i64 [ 0, %for.body30.preheader ], [ %n.vec, %middle.block ]
%sum.0113.ph = phi i32 [ 0, %for.body30.preheader ], [ %9, %middle.block ]
br label %for.body30
for.cond38.preheader: ; preds = %for.body30, %middle.block, %for.cond27.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond27.preheader ], [ %9, %middle.block ], [ %add33, %for.body30 ]
%idxprom39116 = sext i32 %mul to i64
%arrayidx40117 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %idxprom39116
%10 = load i32, ptr %arrayidx40117, align 8, !tbaa !5
%cmp41.not118 = icmp eq i32 %10, 0
br i1 %cmp41.not118, label %for.end77, label %if.end70.peel
if.end70.peel: ; preds = %for.cond38.preheader
%add56 = or i32 %mul, 1
%11 = sext i32 %add56 to i64
%add49.peel = add nsw i32 %10, %sum.0.lcssa
%12 = load i32, ptr %cnt, align 16, !tbaa !5
%sub54.peel = sub i32 %add49.peel, %12
%spec.select110.peel = call i32 @llvm.smax.i32(i32 %sub54.peel, i32 %sum.0.lcssa)
%indvars.iv.next128.peel = or i64 %idxprom39116, 1
%arrayidx40.peel = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %indvars.iv.next128.peel
%13 = load i32, ptr %arrayidx40.peel, align 4, !tbaa !5
%cmp41.not.peel = icmp eq i32 %13, 0
br i1 %cmp41.not.peel, label %for.end77, label %if.end70.peel145
if.end70.peel145: ; preds = %if.end70.peel
%add69.peel136 = add nsw i32 %13, %sub54.peel
%spec.select110.peel147 = call i32 @llvm.smax.i32(i32 %add69.peel136, i32 %spec.select110.peel)
%indvars.iv.next128.peel148 = add nsw i64 %idxprom39116, 2
%arrayidx40.peel149 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %indvars.iv.next128.peel148
%14 = load i32, ptr %arrayidx40.peel149, align 8, !tbaa !5
%cmp41.not.peel150 = icmp eq i32 %14, 0
br i1 %cmp41.not.peel150, label %for.end77, label %for.body43
for.body30: ; preds = %for.body30.preheader154, %for.body30
%indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.body30 ], [ %indvars.iv124.ph, %for.body30.preheader154 ]
%sum.0113 = phi i32 [ %add33, %for.body30 ], [ %sum.0113.ph, %for.body30.preheader154 ]
%arrayidx32 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %indvars.iv124
%15 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%add33 = add nsw i32 %15, %sum.0113
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%exitcond.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count
br i1 %exitcond.not, label %for.cond38.preheader, label %for.body30, !llvm.loop !15
for.body43: ; preds = %if.end70.peel145, %if.end70
%indvars.iv127 = phi i64 [ %indvars.iv.next128, %if.end70 ], [ %indvars.iv.next128.peel148, %if.end70.peel145 ]
%16 = phi i32 [ %22, %if.end70 ], [ %14, %if.end70.peel145 ]
%max.0121 = phi i32 [ %spec.select110, %if.end70 ], [ %spec.select110.peel147, %if.end70.peel145 ]
%sum.1119 = phi i32 [ %sum.2, %if.end70 ], [ %add69.peel136, %if.end70.peel145 ]
%17 = and i64 %indvars.iv127, 1
%cmp44 = icmp eq i64 %17, 0
%add49 = add nsw i32 %16, %sum.1119
br i1 %cmp44, label %if.then46, label %if.end70
if.then46: ; preds = %for.body43
%18 = sub nsw i64 %indvars.iv127, %idxprom39116
%arrayidx53 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %18
%19 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%sub54 = sub i32 %add49, %19
%cmp57 = icmp sgt i64 %indvars.iv127, %11
br i1 %cmp57, label %if.then59, label %if.end70
if.then59: ; preds = %if.then46
%20 = sub nsw i64 %indvars.iv127, %11
%arrayidx64 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %20
%21 = load i32, ptr %arrayidx64, align 4, !tbaa !5
%sub65 = sub nsw i32 %sub54, %21
br label %if.end70
if.end70: ; preds = %for.body43, %if.then46, %if.then59
%sum.2 = phi i32 [ %sub65, %if.then59 ], [ %sub54, %if.then46 ], [ %add49, %for.body43 ]
%spec.select110 = call i32 @llvm.smax.i32(i32 %sum.2, i32 %max.0121)
%indvars.iv.next128 = add nsw i64 %indvars.iv127, 1
%arrayidx40 = getelementptr inbounds [200001 x i32], ptr %cnt, i64 0, i64 %indvars.iv.next128
%22 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cmp41.not = icmp eq i32 %22, 0
br i1 %cmp41.not, label %for.end77, label %for.body43, !llvm.loop !16
for.end77: ; preds = %if.end70, %if.end70.peel, %if.end70.peel145, %for.cond38.preheader
%max.0.lcssa = phi i32 [ %sum.0.lcssa, %for.cond38.preheader ], [ %spec.select110.peel, %if.end70.peel ], [ %spec.select110.peel147, %if.end70.peel145 ], [ %spec.select110, %if.end70 ]
%call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %cnt) #5
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !11, !14, !13}
!16 = distinct !{!16, !11, !17}
!17 = !{!"llvm.loop.peeled.count", i32 2}
|
#include <stdio.h>
#include <string.h>
#define ONE_WEEK 7
int main(void)
{
char day[7][4] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
char s[4];
int i;
scanf("%s", s);
for (i = 0; i < ONE_WEEK; i++)
{
if (strcmp(s, day[i]) == 0)
{
printf("%d\n", ONE_WEEK - i);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120156/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120156/source.c"
target datalayout = "e-m:e-p270: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.day = private unnamed_addr constant [7 x [4 x i8]] [[4 x i8] c"SUN\00", [4 x i8] c"MON\00", [4 x i8] c"TUE\00", [4 x i8] c"WED\00", [4 x i8] c"THU\00", [4 x i8] c"FRI\00", [4 x i8] c"SAT\00"], align 16
@.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 [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @__const.main.day, i64 4)
%cmp4 = icmp eq i32 %bcmp, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %entry
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 7)
br label %for.inc
for.inc: ; preds = %entry, %if.then
%bcmp12 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) getelementptr inbounds ([7 x [4 x i8]], ptr @__const.main.day, i64 0, i64 1), i64 4)
%cmp4.1 = icmp eq i32 %bcmp12, 0
br i1 %cmp4.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
%call5.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 6)
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%bcmp13 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) getelementptr inbounds ([7 x [4 x i8]], ptr @__const.main.day, i64 0, i64 2), i64 4)
%cmp4.2 = icmp eq i32 %bcmp13, 0
br i1 %cmp4.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
%call5.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 5)
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%bcmp14 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) getelementptr inbounds ([7 x [4 x i8]], ptr @__const.main.day, i64 0, i64 3), i64 4)
%cmp4.3 = icmp eq i32 %bcmp14, 0
br i1 %cmp4.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
%call5.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 4)
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%bcmp15 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) getelementptr inbounds ([7 x [4 x i8]], ptr @__const.main.day, i64 0, i64 4), i64 4)
%cmp4.4 = icmp eq i32 %bcmp15, 0
br i1 %cmp4.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
%call5.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 3)
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3
%bcmp16 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) getelementptr inbounds ([7 x [4 x i8]], ptr @__const.main.day, i64 0, i64 5), i64 4)
%cmp4.5 = icmp eq i32 %bcmp16, 0
br i1 %cmp4.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
%call5.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 2)
br label %for.inc.5
for.inc.5: ; preds = %if.then.5, %for.inc.4
%bcmp17 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) getelementptr inbounds ([7 x [4 x i8]], ptr @__const.main.day, i64 0, i64 6), i64 4)
%cmp4.6 = icmp eq i32 %bcmp17, 0
br i1 %cmp4.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
%call5.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 1)
br label %for.inc.6
for.inc.6: ; preds = %if.then.6, %for.inc.5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(){
char s[4];
int d = 0;
scanf("%s", s);
switch(s[0]){
case 'S':
if(s[1] == 'A') d = 1;
else d = 7;
break;
case 'F':
d = 2;
break;
case 'T':
if(s[1] == 'H') d = 3;
else d = 5;
break;
case 'W':
d = 4;
break;
case 'M':
d = 6;
break;
}
printf("%d\n", d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120242/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120242/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%conv = sext i8 %0 to i32
switch i32 %conv, label %sw.epilog [
i32 83, label %sw.bb
i32 70, label %sw.bb4
i32 84, label %sw.bb5
i32 87, label %sw.bb13
i32 77, label %sw.bb14
]
sw.bb: ; preds = %entry
%arrayidx1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %1, 65
%. = select i1 %cmp, i32 1, i32 7
br label %sw.epilog
sw.bb4: ; preds = %entry
br label %sw.epilog
sw.bb5: ; preds = %entry
%arrayidx6 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8 = icmp eq i8 %2, 72
%.16 = select i1 %cmp8, i32 3, i32 5
br label %sw.epilog
sw.bb13: ; preds = %entry
br label %sw.epilog
sw.bb14: ; preds = %entry
br label %sw.epilog
sw.epilog: ; preds = %sw.bb5, %sw.bb, %entry, %sw.bb14, %sw.bb13, %sw.bb4
%d.0 = phi i32 [ 0, %entry ], [ 6, %sw.bb14 ], [ 4, %sw.bb13 ], [ 2, %sw.bb4 ], [ %., %sw.bb ], [ %.16, %sw.bb5 ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int main()
{
int a,b,countyear=0;
scanf(" %d %d",&a,&b);
while(a<=b){
a=a*3;
b=b*2;
countyear++;
}
printf("%d\n",countyear);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12030/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12030/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\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)
%a.promoted = load i32, ptr %a, align 4, !tbaa !5
%b.promoted = load i32, ptr %b, align 4, !tbaa !5
%cmp.not6 = icmp sgt i32 %a.promoted, %b.promoted
br i1 %cmp.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%countyear.09 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
%mul48 = phi i32 [ %mul, %while.body ], [ %a.promoted, %entry ]
%mul157 = phi i32 [ %mul1, %while.body ], [ %b.promoted, %entry ]
%mul = mul nsw i32 %mul48, 3
%mul1 = shl nsw i32 %mul157, 1
%inc = add nuw nsw i32 %countyear.09, 1
%cmp.not = icmp sgt i32 %mul, %mul1
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %mul, ptr %a, align 4, !tbaa !5
store i32 %mul1, ptr %b, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%countyear.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %countyear.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>
#include<string.h>
int main(void){
char s[4];
scanf("%s",s);
if(strcmp(s,"SUN")==0){
printf("7\n");
}
if(strcmp(s,"MON")==0){
printf("6\n");
}
if(strcmp(s,"TUE")==0){
printf("5\n");
}
if(strcmp(s,"WED")==0){
printf("4\n");
}
if(strcmp(s,"THU")==0){
printf("3\n");
}
if(strcmp(s,"FRI")==0){
printf("2\n");
}
if(strcmp(s,"SAT")==0){
printf("1\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120350/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120350/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"SUN\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"MON\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"TUE\00", align 1
@.str.7 = private unnamed_addr constant [4 x i8] c"WED\00", align 1
@.str.9 = private unnamed_addr constant [4 x i8] c"THU\00", align 1
@.str.11 = private unnamed_addr constant [4 x i8] c"FRI\00", align 1
@.str.13 = private unnamed_addr constant [4 x i8] c"SAT\00", align 1
@str = private unnamed_addr constant [2 x i8] c"7\00", align 1
@str.15 = private unnamed_addr constant [2 x i8] c"6\00", align 1
@str.16 = private unnamed_addr constant [2 x i8] c"5\00", align 1
@str.17 = private unnamed_addr constant [2 x i8] c"4\00", align 1
@str.18 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@str.19 = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.20 = 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 [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.1, i64 4)
%cmp = icmp eq i32 %bcmp, 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 %if.end
if.end: ; preds = %if.then, %entry
%bcmp40 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.3, i64 4)
%cmp6 = icmp eq i32 %bcmp40, 0
br i1 %cmp6, label %if.then7, label %if.end9
if.then7: ; preds = %if.end
%puts41 = call i32 @puts(ptr nonnull dereferenceable(1) @str.15)
br label %if.end9
if.end9: ; preds = %if.then7, %if.end
%bcmp42 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.5, i64 4)
%cmp12 = icmp eq i32 %bcmp42, 0
br i1 %cmp12, label %if.then13, label %if.end15
if.then13: ; preds = %if.end9
%puts43 = call i32 @puts(ptr nonnull dereferenceable(1) @str.16)
br label %if.end15
if.end15: ; preds = %if.then13, %if.end9
%bcmp44 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.7, i64 4)
%cmp18 = icmp eq i32 %bcmp44, 0
br i1 %cmp18, label %if.then19, label %if.end21
if.then19: ; preds = %if.end15
%puts45 = call i32 @puts(ptr nonnull dereferenceable(1) @str.17)
br label %if.end21
if.end21: ; preds = %if.then19, %if.end15
%bcmp46 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.9, i64 4)
%cmp24 = icmp eq i32 %bcmp46, 0
br i1 %cmp24, label %if.then25, label %if.end27
if.then25: ; preds = %if.end21
%puts47 = call i32 @puts(ptr nonnull dereferenceable(1) @str.18)
br label %if.end27
if.end27: ; preds = %if.then25, %if.end21
%bcmp48 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.11, i64 4)
%cmp30 = icmp eq i32 %bcmp48, 0
br i1 %cmp30, label %if.then31, label %if.end33
if.then31: ; preds = %if.end27
%puts49 = call i32 @puts(ptr nonnull dereferenceable(1) @str.19)
br label %if.end33
if.end33: ; preds = %if.then31, %if.end27
%bcmp50 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.13, i64 4)
%cmp36 = icmp eq i32 %bcmp50, 0
br i1 %cmp36, label %if.then37, label %if.end39
if.then37: ; preds = %if.end33
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.20)
br label %if.end39
if.end39: ; preds = %if.then37, %if.end33
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(){
char s[10];
scanf("%s",s);
if(strcmp(s,"SUN") ==0 ){
printf("7\n");
}
else if(strcmp(s,"MON") ==0){
printf("6\n");
}
else if(strcmp(s,"TUE") ==0){
printf("5\n");
}
else if(strcmp(s,"WED") ==0){
printf("4\n");
}
else if(strcmp(s,"THU") ==0){
printf("3\n");
}
else if(strcmp(s,"FRI") ==0){
printf("2\n");
}
else if(strcmp(s,"SAT") ==0){
printf("1\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120394/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120394/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"SUN\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"MON\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"TUE\00", align 1
@.str.7 = private unnamed_addr constant [4 x i8] c"WED\00", align 1
@.str.9 = private unnamed_addr constant [4 x i8] c"THU\00", align 1
@.str.11 = private unnamed_addr constant [4 x i8] c"FRI\00", align 1
@.str.13 = private unnamed_addr constant [4 x i8] c"SAT\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
@str.15 = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.16 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@str.17 = private unnamed_addr constant [2 x i8] c"4\00", align 1
@str.18 = private unnamed_addr constant [2 x i8] c"5\00", align 1
@str.19 = private unnamed_addr constant [2 x i8] c"6\00", align 1
@str.20 = private unnamed_addr constant [2 x i8] c"7\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.1, i64 4)
%cmp = icmp eq i32 %bcmp, 0
br i1 %cmp, label %if.end44.sink.split, label %if.else
if.else: ; preds = %entry
%bcmp45 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.3, i64 4)
%cmp6 = icmp eq i32 %bcmp45, 0
br i1 %cmp6, label %if.end44.sink.split, label %if.else9
if.else9: ; preds = %if.else
%bcmp46 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.5, i64 4)
%cmp12 = icmp eq i32 %bcmp46, 0
br i1 %cmp12, label %if.end44.sink.split, label %if.else15
if.else15: ; preds = %if.else9
%bcmp47 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.7, i64 4)
%cmp18 = icmp eq i32 %bcmp47, 0
br i1 %cmp18, label %if.end44.sink.split, label %if.else21
if.else21: ; preds = %if.else15
%bcmp48 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.9, i64 4)
%cmp24 = icmp eq i32 %bcmp48, 0
br i1 %cmp24, label %if.end44.sink.split, label %if.else27
if.else27: ; preds = %if.else21
%bcmp49 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.11, i64 4)
%cmp30 = icmp eq i32 %bcmp49, 0
br i1 %cmp30, label %if.end44.sink.split, label %if.else33
if.else33: ; preds = %if.else27
%bcmp50 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %s, ptr noundef nonnull dereferenceable(4) @.str.13, i64 4)
%cmp36 = icmp eq i32 %bcmp50, 0
br i1 %cmp36, label %if.end44.sink.split, label %if.end44
if.end44.sink.split: ; preds = %if.else33, %if.else27, %if.else21, %if.else15, %if.else9, %if.else, %entry
%str.19.sink = phi ptr [ @str.20, %entry ], [ @str.19, %if.else ], [ @str.18, %if.else9 ], [ @str.17, %if.else15 ], [ @str.16, %if.else21 ], [ @str.15, %if.else27 ], [ @str, %if.else33 ]
%puts55 = call i32 @puts(ptr nonnull dereferenceable(1) %str.19.sink)
br label %if.end44
if.end44: ; preds = %if.end44.sink.split, %if.else33
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; } /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define MAX 100001
#define MOD 1000000007
typedef struct list
{
int node;
struct list *next;
} list;
list *graph[MAX]; // 木のグラフ
int painted[MAX] = {0}; // 頂点が塗られていれば1,塗られてなければ0
int colors; // 色の数
void AddEdge(int node1, int node2)
{
list *new1 = (list *)malloc(sizeof(list *));
list *new2 = (list *)malloc(sizeof(list *));
new1->node = node2;
new2->node = node1;
new1->next = graph[node1];
new2->next = graph[node2];
graph[node1] = new1;
graph[node2] = new2;
}
long long int Dfs(int node, int parent)
{
painted[node] = 1;
int n = colors - 1 - painted[parent];
list *child = graph[node];
int num = 0;
long long int ans = 1;
while (child != NULL)
{
if (child->node != parent) {
ans = (ans * (n - num++)) % MOD;
ans = (ans * Dfs(child->node, node)) % MOD;
}
child = child->next;
}
return ans;
}
int main(void)
{
int n, a, b;
scanf("%d %d", &n, &colors);
int ni;
for (ni = 0; ni <= n; ni++)
graph[ni] = NULL;
for (ni = 1; ni < n; ni++)
{
scanf("%d %d", &a, &b);
AddEdge(a, b);
}
AddEdge(0, 1);
long long int ans;
ans = (colors * Dfs(1, 0)) % MOD;
printf("%lld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.list = type { i32, ptr }
@painted = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@graph = dso_local local_unnamed_addr global [100001 x ptr] zeroinitializer, align 16
@colors = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @acs(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 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%conv = sext i8 %0 to i32
%1 = load i8, ptr %b, align 1, !tbaa !9
%conv1 = sext i8 %1 to i32
%sub = sub nsw i32 %conv, %conv1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @cmp_str(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 {
entry:
%0 = load ptr, ptr %a, align 8, !tbaa !10
%1 = load ptr, ptr %b, align 8, !tbaa !10
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #10
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local void @AddEdge(i32 noundef %node1, i32 noundef %node2) local_unnamed_addr #3 {
entry:
%call = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
%call1 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
%idxprom = sext i32 %node1 to i64
%arrayidx = getelementptr inbounds [100001 x ptr], ptr @graph, i64 0, i64 %idxprom
%0 = load ptr, ptr %arrayidx, align 8, !tbaa !10
%next = getelementptr inbounds %struct.list, ptr %call, i64 0, i32 1
store ptr %0, ptr %next, align 8, !tbaa !12
%idxprom4 = sext i32 %node2 to i64
%arrayidx5 = getelementptr inbounds [100001 x ptr], ptr @graph, i64 0, i64 %idxprom4
%1 = load ptr, ptr %arrayidx5, align 8, !tbaa !10
%next6 = getelementptr inbounds %struct.list, ptr %call1, i64 0, i32 1
store ptr %1, ptr %next6, align 8, !tbaa !12
store ptr %call, ptr %arrayidx, align 8, !tbaa !10
store ptr %call1, ptr %arrayidx5, align 8, !tbaa !10
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i64 @Dfs(i32 noundef %node, i32 noundef %parent) local_unnamed_addr #6 {
entry:
%idxprom = sext i32 %node to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr @painted, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @colors, align 4, !tbaa !5
%idxprom1 = sext i32 %parent to i64
%arrayidx2 = getelementptr inbounds [100001 x i32], ptr @painted, i64 0, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%2 = xor i32 %1, -1
%sub3 = add i32 %0, %2
%arrayidx5 = getelementptr inbounds [100001 x ptr], ptr @graph, i64 0, i64 %idxprom
%child.020 = load ptr, ptr %arrayidx5, align 8, !tbaa !10
%cmp.not21 = icmp eq ptr %child.020, null
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%child.024 = phi ptr [ %child.0, %if.end ], [ %child.020, %entry ]
%ans.023 = phi i64 [ %ans.1, %if.end ], [ 1, %entry ]
%num.022 = phi i32 [ %num.1, %if.end ], [ 0, %entry ]
%3 = load i32, ptr %child.024, align 8, !tbaa !14
%cmp7.not = icmp eq i32 %3, %parent
br i1 %cmp7.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%inc = add nsw i32 %num.022, 1
%sub8 = sub i32 %sub3, %num.022
%conv = sext i32 %sub8 to i64
%mul = mul nsw i64 %ans.023, %conv
%rem = srem i64 %mul, 1000000007
%call = tail call i64 @Dfs(i32 noundef %3, i32 noundef %node), !range !15
%mul10 = mul nsw i64 %call, %rem
%rem11 = srem i64 %mul10, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%num.1 = phi i32 [ %inc, %if.then ], [ %num.022, %while.body ]
%ans.1 = phi i64 [ %rem11, %if.then ], [ %ans.023, %while.body ]
%next = getelementptr inbounds %struct.list, ptr %child.024, i64 0, i32 1
%child.0 = load ptr, ptr %next, align 8, !tbaa !10
%cmp.not = icmp eq ptr %child.0, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %ans.1, %if.end ]
ret i64 %ans.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #12
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #12
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull @colors)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not18 = icmp slt i32 %0, 0
br i1 %cmp.not18, label %for.end7, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%2 = zext i32 %1 to i64
%3 = shl nuw nsw i64 %2, 3
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @graph, i8 0, i64 %3, i1 false), !tbaa !10
%cmp220 = icmp ugt i32 %0, 1
br i1 %cmp220, label %for.body3, label %for.end7
for.body3: ; preds = %for.cond1.preheader, %for.body3
%ni.121 = phi i32 [ %inc6, %for.body3 ], [ 1, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%call.i = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
%call1.i = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100001 x ptr], ptr @graph, i64 0, i64 %idxprom.i
%6 = load ptr, ptr %arrayidx.i, align 8, !tbaa !10
%next.i = getelementptr inbounds %struct.list, ptr %call.i, i64 0, i32 1
store ptr %6, ptr %next.i, align 8, !tbaa !12
%idxprom4.i = sext i32 %5 to i64
%arrayidx5.i = getelementptr inbounds [100001 x ptr], ptr @graph, i64 0, i64 %idxprom4.i
%7 = load ptr, ptr %arrayidx5.i, align 8, !tbaa !10
%next6.i = getelementptr inbounds %struct.list, ptr %call1.i, i64 0, i32 1
store ptr %7, ptr %next6.i, align 8, !tbaa !12
store ptr %call.i, ptr %arrayidx.i, align 8, !tbaa !10
store ptr %call1.i, ptr %arrayidx5.i, align 8, !tbaa !10
%inc6 = add nuw nsw i32 %ni.121, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc6, %8
br i1 %cmp2, label %for.body3, label %for.end7, !llvm.loop !18
for.end7: ; preds = %for.body3, %entry, %for.cond1.preheader
%call.i14 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
%call1.i15 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #11
%9 = load ptr, ptr @graph, align 16, !tbaa !10
%next.i16 = getelementptr inbounds %struct.list, ptr %call.i14, i64 0, i32 1
store ptr %9, ptr %next.i16, align 8, !tbaa !12
%10 = load ptr, ptr getelementptr inbounds ([100001 x ptr], ptr @graph, i64 0, i64 1), align 8, !tbaa !10
%next6.i17 = getelementptr inbounds %struct.list, ptr %call1.i15, i64 0, i32 1
store ptr %10, ptr %next6.i17, align 8, !tbaa !12
store ptr %call.i14, ptr @graph, align 16, !tbaa !10
store ptr %call1.i15, ptr getelementptr inbounds ([100001 x ptr], ptr @graph, i64 0, i64 1), align 8, !tbaa !10
%11 = load i32, ptr @colors, align 4, !tbaa !5
%conv = sext i32 %11 to i64
%call8 = call i64 @Dfs(i32 noundef 1, i32 noundef 0), !range !15
%mul = mul nsw i64 %call8, %conv
%rem = srem i64 %mul, 1000000007
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #9
attributes #0 = { 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 nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"list", !6, i64 0, !11, i64 8}
!14 = !{!13, !6, i64 0}
!15 = !{i64 -1000000006, i64 1000000007}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int input_n;
int input_score_a[1000];
int min_sa = 1000000, score_a_sa = 0;
int counter_i, counter_j;
for( ; ; )
{
scanf("%d", &input_n);
if(input_n == 0)
break;
for(counter_i = 0 ; counter_i < input_n ; counter_i++)
scanf("%d", &input_score_a[counter_i]);
for(counter_i = 0 ; counter_i < input_n ; counter_i++)
{
for(counter_j = counter_i + 1 ; counter_j < input_n ; counter_j++)
{
score_a_sa = abs(input_score_a[counter_i] - input_score_a[counter_j]);
if(min_sa > score_a_sa)
min_sa = score_a_sa;
}
}
printf("%d\n", min_sa);
min_sa = 1000000;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120495/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120495/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%input_n = alloca i32, align 4
%input_score_a = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input_n) #5
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %input_score_a) #5
%call45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input_n)
%0 = load i32, ptr %input_n, align 4, !tbaa !5
%cmp46 = icmp eq i32 %0, 0
br i1 %cmp46, label %for.end24, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.end22
%1 = phi i32 [ %20, %for.end22 ], [ %0, %entry ]
%cmp235 = icmp sgt i32 %1, 0
br i1 %cmp235, label %for.body, label %for.end22
for.cond4.preheader: ; preds = %for.body
%cmp541 = icmp sgt i32 %3, 0
br i1 %cmp541, label %for.body6.preheader, label %for.end22
for.body6.preheader: ; preds = %for.cond4.preheader
%2 = zext i32 %3 to i64
%wide.trip.count57 = zext i32 %3 to i64
br label %for.body6
for.body: ; preds = %for.cond1.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond1.preheader ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %input_score_a, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %input_n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp2, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond4.loopexit: ; preds = %for.body9, %middle.block, %for.body6
%min_sa.2.lcssa = phi i32 [ %min_sa.142, %for.body6 ], [ %17, %middle.block ], [ %spec.select, %for.body9 ]
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
br i1 %exitcond58.not, label %for.end22, label %for.body6, !llvm.loop !11
for.body6: ; preds = %for.body6.preheader, %for.cond4.loopexit
%indvars.iv54 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next55, %for.cond4.loopexit ]
%indvars.iv49 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next50, %for.cond4.loopexit ]
%min_sa.142 = phi i32 [ 1000000, %for.body6.preheader ], [ %min_sa.2.lcssa, %for.cond4.loopexit ]
%5 = xor i64 %indvars.iv54, -1
%6 = add nsw i64 %5, %wide.trip.count57
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%cmp837 = icmp ult i64 %indvars.iv.next55, %2
br i1 %cmp837, label %for.body9.lr.ph, label %for.cond4.loopexit
for.body9.lr.ph: ; preds = %for.body6
%arrayidx11 = getelementptr inbounds [1000 x i32], ptr %input_score_a, i64 0, i64 %indvars.iv54
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%min.iters.check = icmp ult i64 %6, 8
br i1 %min.iters.check, label %for.body9.preheader, label %vector.ph
vector.ph: ; preds = %for.body9.lr.ph
%n.vec = and i64 %6, -8
%ind.end = add i64 %indvars.iv49, %n.vec
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %min_sa.142, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %7, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %14, %vector.body ]
%vec.phi61 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %15, %vector.body ]
%offset.idx = add i64 %indvars.iv49, %index
%8 = getelementptr inbounds [1000 x i32], ptr %input_score_a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load62 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = sub nsw <4 x i32> %broadcast.splat, %wide.load
%11 = sub nsw <4 x i32> %broadcast.splat, %wide.load62
%12 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %10, i1 true)
%13 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %11, i1 true)
%14 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %12)
%15 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi61, <4 x i32> %13)
%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 !12
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %14, <4 x i32> %15)
%17 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.cond4.loopexit, label %for.body9.preheader
for.body9.preheader: ; preds = %for.body9.lr.ph, %middle.block
%indvars.iv51.ph = phi i64 [ %indvars.iv49, %for.body9.lr.ph ], [ %ind.end, %middle.block ]
%min_sa.238.ph = phi i32 [ %min_sa.142, %for.body9.lr.ph ], [ %17, %middle.block ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.body9 ], [ %indvars.iv51.ph, %for.body9.preheader ]
%min_sa.238 = phi i32 [ %spec.select, %for.body9 ], [ %min_sa.238.ph, %for.body9.preheader ]
%arrayidx13 = getelementptr inbounds [1000 x i32], ptr %input_score_a, i64 0, i64 %indvars.iv51
%18 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%sub = sub nsw i32 %7, %18
%19 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%spec.select = call i32 @llvm.smin.i32(i32 %min_sa.238, i32 %19)
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count57
br i1 %exitcond.not, label %for.cond4.loopexit, label %for.body9, !llvm.loop !15
for.end22: ; preds = %for.cond4.loopexit, %for.cond1.preheader, %for.cond4.preheader
%min_sa.1.lcssa = phi i32 [ 1000000, %for.cond4.preheader ], [ 1000000, %for.cond1.preheader ], [ %min_sa.2.lcssa, %for.cond4.loopexit ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min_sa.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input_n)
%20 = load i32, ptr %input_n, align 4, !tbaa !5
%cmp = icmp eq i32 %20, 0
br i1 %cmp, label %for.end24, label %for.cond1.preheader
for.end24: ; preds = %for.end22, %entry
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %input_score_a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input_n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, !14, !13}
|
#include <stdio.h>
int S(int n);
int main(){
int n;
scanf("%d", &n);
printf(n % S(n) == 0 ? "Yes\n" : "No\n");
return 0;
}
int S(int n){
int sum = 0;
for(int i = n; i > 0; i /= 10){
sum += (i % 10);
}
return sum;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120538/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120538/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"Yes\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"No\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %0, 0
br i1 %cmp4.i, label %for.body.i, label %S.exit
for.body.i: ; preds = %entry, %for.body.i
%i.06.i = phi i32 [ %div.i, %for.body.i ], [ %0, %entry ]
%sum.05.i = phi i32 [ %add.i, %for.body.i ], [ 0, %entry ]
%rem.i = urem i32 %i.06.i, 10
%add.i = add nuw nsw i32 %rem.i, %sum.05.i
%div.i = udiv i32 %i.06.i, 10
%cmp.not.i = icmp ult i32 %i.06.i, 10
br i1 %cmp.not.i, label %S.exit, label %for.body.i, !llvm.loop !9
S.exit: ; preds = %for.body.i, %entry
%sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %for.body.i ]
%rem = srem i32 %0, %sum.0.lcssa.i
%cmp = icmp eq i32 %rem, 0
%cond = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @S(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
ret i32 %sum.0.lcssa
for.body: ; preds = %entry, %for.body
%i.06 = phi i32 [ %div, %for.body ], [ %n, %entry ]
%sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%rem = urem i32 %i.06, 10
%add = add nuw nsw i32 %rem, %sum.05
%div = udiv i32 %i.06, 10
%cmp.not = icmp ult i32 %i.06, 10
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int N;
scanf("%d", &N);
int sum =0;
int tmp = N;
while (tmp > 0){
sum += tmp % 10;
tmp = tmp / 10;
}
if (N % sum == 0){
printf("%s\n", "Yes");
}
else {
printf("%s\n", "No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120581/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120581/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%tmp.011 = phi i32 [ %div, %while.body ], [ %0, %entry ]
%sum.010 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%rem = urem i32 %tmp.011, 10
%add = add nuw nsw i32 %rem, %sum.010
%div = udiv i32 %tmp.011, 10
%cmp.not = icmp ult i32 %tmp.011, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%rem1 = srem i32 %0, %sum.0.lcssa
%cmp2 = icmp eq i32 %rem1, 0
%.str.2..str.3 = select i1 %cmp2, ptr @.str.2, ptr @.str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdbool.h>
int calculate_digit_sum (int target)
{
// return value of this function
int digit_sum;
// STEP.01
// initialize the variable to store the digit sum
digit_sum = (int)0;
// STEP.02
// calculate the digit sum
while (target > (int)0)
{
digit_sum += target % (int)10;
target /= (int)10;
}
// STEP.END
// declare the return value of this function
return digit_sum;
}
bool is_multiple (int target, int base)
{
if (target % base == (int)0) { return true; }
else { return false; }
}
int main (void)
{
// variables for `main`
int int_given;
int rtvl_scanf;
// STEP.01
// read out the given string
rtvl_scanf = scanf("%d", &int_given);
// STEP.02
// output whether the digit sum of given integer is the multiple of the given integer or not
if ( is_multiple( int_given, calculate_digit_sum(int_given) ) )
{ printf("%s\n", "Yes"); }
else
{ printf("%s\n", "No"); }
// STEP.END
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120624/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120624/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @calculate_digit_sum(i32 noundef %target) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %target, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%digit_sum.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%target.addr.05 = phi i32 [ %div, %while.body ], [ %target, %entry ]
%rem = urem i32 %target.addr.05, 10
%add = add nuw nsw i32 %digit_sum.06, %rem
%div = udiv i32 %target.addr.05, 10
%cmp.not = icmp ult i32 %target.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%digit_sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %digit_sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @is_multiple(i32 noundef %target, i32 noundef %base) local_unnamed_addr #2 {
entry:
%rem = srem i32 %target, %base
%cmp = icmp eq i32 %rem, 0
ret i1 %cmp
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%int_given = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %int_given) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %int_given)
%0 = load i32, ptr %int_given, align 4, !tbaa !7
%cmp4.i = icmp sgt i32 %0, 0
br i1 %cmp4.i, label %while.body.i, label %calculate_digit_sum.exit
while.body.i: ; preds = %entry, %while.body.i
%digit_sum.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %entry ]
%target.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %0, %entry ]
%rem.i = urem i32 %target.addr.05.i, 10
%add.i = add nuw nsw i32 %rem.i, %digit_sum.06.i
%div.i = udiv i32 %target.addr.05.i, 10
%cmp.not.i = icmp ult i32 %target.addr.05.i, 10
br i1 %cmp.not.i, label %calculate_digit_sum.exit, label %while.body.i, !llvm.loop !5
calculate_digit_sum.exit: ; preds = %while.body.i, %entry
%digit_sum.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %while.body.i ]
%rem.i6 = srem i32 %0, %digit_sum.0.lcssa.i
%cmp.i = icmp eq i32 %rem.i6, 0
%.str.2..str.3 = select i1 %cmp.i, ptr @.str.2, ptr @.str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %int_given) #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 #5
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int N;
int buf;
int S = 0;
int i, j, k;
scanf("%d", &N);
buf = N;
for(i = 0; i < 10; i++){
S += N%10;
N /= 10;
}
N = buf;
if(N%S == 0){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120668/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%rem.1 = srem i32 %div, 10
%add.1 = add nsw i32 %rem.1, %rem
%div.1 = sdiv i32 %0, 100
%rem.2 = srem i32 %div.1, 10
%add.2 = add nsw i32 %rem.2, %add.1
%div.2 = sdiv i32 %0, 1000
%rem.3 = srem i32 %div.2, 10
%add.3 = add nsw i32 %rem.3, %add.2
%div.3 = sdiv i32 %0, 10000
%rem.4 = srem i32 %div.3, 10
%add.4 = add nsw i32 %rem.4, %add.3
%div.4 = sdiv i32 %0, 100000
%rem.5.lhs.trunc = trunc i32 %div.4 to i16
%rem.512 = srem i16 %rem.5.lhs.trunc, 10
%rem.5.sext = sext i16 %rem.512 to i32
%add.5 = add nsw i32 %add.4, %rem.5.sext
%div.5 = sdiv i32 %0, 1000000
%rem.6.lhs.trunc = trunc i32 %div.5 to i16
%rem.613 = srem i16 %rem.6.lhs.trunc, 10
%rem.6.sext = sext i16 %rem.613 to i32
%add.6 = add nsw i32 %add.5, %rem.6.sext
%div.6 = sdiv i32 %0, 10000000
%rem.7.lhs.trunc = trunc i32 %div.6 to i16
%rem.714 = srem i16 %rem.7.lhs.trunc, 10
%rem.7.sext = sext i16 %rem.714 to i32
%add.7 = add nsw i32 %add.6, %rem.7.sext
%div.7 = sdiv i32 %0, 100000000
%rem.8.lhs.trunc = trunc i32 %div.7 to i8
%rem.815 = srem i8 %rem.8.lhs.trunc, 10
%rem.8.sext = sext i8 %rem.815 to i32
%add.8 = add nsw i32 %add.7, %rem.8.sext
%div.8 = sdiv i32 %0, 1000000000
%add.9 = add nsw i32 %div.8, %add.8
%rem1 = srem i32 %0, %add.9
%cmp2 = icmp eq i32 %rem1, 0
%str.3.str = select i1 %cmp2, 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
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
long long int n,a,s=0,b;
scanf("%lld",&n);
b=n;
while(b>0){
a=b%10;
s+=a;
b=b/10;
}
//printf("%lld\n",s);
if(n%s==0)printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
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
%cmp9 = icmp sgt i64 %0, 0
br i1 %cmp9, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%b.011 = phi i64 [ %div, %while.body ], [ %0, %entry ]
%s.010 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%rem = urem i64 %b.011, 10
%add = add nuw nsw i64 %rem, %s.010
%div = udiv i64 %b.011, 10
%cmp.not = icmp ult i64 %b.011, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%s.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
%rem1 = srem i64 %0, %s.0.lcssa
%cmp2 = icmp eq i64 %rem1, 0
%str.3.str = select i1 %cmp2, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
void shuffledget(int x[],int n){
srand(time(0));
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int main(void){
int i,j,n,m,k,a[524288],b,c,w,r=0,l,t;
double d;
char s[524288];
scanf("%d",&n);
//l=strlen(s);
//for(i=0;i<n;i++){scanf("%d",&a[i]);}
//shuffledget(a,n);
//qsort(a,n,sizeof(int),sortfncsj);
if(n%dsum(n)==0){printf("Yes\n");}else{printf("No\n");}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120754/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120754/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !16
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !17
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !17
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !22
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #13
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #13
ret i32 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #14
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #14
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #14
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !34
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #14
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !35
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !36
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #14
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #14
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !25
%tobool.not4.i = icmp eq i32 %0, 0
br i1 %tobool.not4.i, label %dsum.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%r.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %entry ]
%x.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %0, %entry ]
%rem.i = srem i32 %x.addr.05.i, 10
%add.i = add nsw i32 %rem.i, %r.06.i
%div.i = sdiv i32 %x.addr.05.i, 10
%x.addr.05.off.i = add i32 %x.addr.05.i, 9
%tobool.not.i = icmp ult i32 %x.addr.05.off.i, 19
br i1 %tobool.not.i, label %dsum.exit, label %while.body.i, !llvm.loop !14
dsum.exit: ; preds = %while.body.i, %entry
%r.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %while.body.i ]
%rem = srem i32 %0, %r.0.lcssa.i
%cmp = icmp eq i32 %rem, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #14
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #12
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind }
attributes #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = distinct !{!33, !6, !9, !10}
!34 = distinct !{!34, !6, !10, !9}
!35 = distinct !{!35, !6}
!36 = distinct !{!36, !6}
|
#include <stdio.h>
#include <math.h>
int main(){
long n;
scanf("%ld",&n);
long cpy=n;
int sum=0,i;
for(i=0;i<10;i++){
sum+=cpy%10;
cpy=cpy/10;
}
if(n%sum==0)
printf("Yes");
else
printf("No");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%rem = srem i64 %0, 10
%div = sdiv i64 %0, 10
%rem.1 = srem i64 %div, 10
%conv1.1 = add nsw i64 %rem, %rem.1
%div.1 = sdiv i64 %0, 100
%rem.2 = srem i64 %div.1, 10
%conv1.2 = add nsw i64 %conv1.1, %rem.2
%div.2 = sdiv i64 %0, 1000
%rem.3 = srem i64 %div.2, 10
%conv1.3 = add nsw i64 %conv1.2, %rem.3
%div.3 = sdiv i64 %0, 10000
%rem.4 = srem i64 %div.3, 10
%conv1.4 = add nsw i64 %conv1.3, %rem.4
%div.4 = sdiv i64 %0, 100000
%rem.5 = srem i64 %div.4, 10
%conv1.5 = add nsw i64 %conv1.4, %rem.5
%div.5 = sdiv i64 %0, 1000000
%rem.6 = srem i64 %div.5, 10
%conv1.6 = add nsw i64 %conv1.5, %rem.6
%div.6 = sdiv i64 %0, 10000000
%rem.7 = srem i64 %div.6, 10
%conv1.7 = add nsw i64 %conv1.6, %rem.7
%div.7 = sdiv i64 %0, 100000000
%rem.8 = srem i64 %div.7, 10
%conv1.8 = add nsw i64 %conv1.7, %rem.8
%div.8 = sdiv i64 %0, 1000000000
%rem.9 = srem i64 %div.8, 10
%conv1.9 = add nsw i64 %conv1.8, %rem.9
%rem3 = srem i64 %0, %conv1.9
%cmp4 = icmp eq i64 %rem3, 0
%.str.1..str.2 = select i1 %cmp4, ptr @.str.1, ptr @.str.2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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(void){
int a,b=0,c;
scanf("%d",&a);
int i=a;
while(i){
c =i % 10;
b =b + c;
i =i / 10;
}
if(a%b==0) printf("Yes\n");
else printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120855/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120855/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
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 i32, ptr %a, align 4, !tbaa !5
%tobool.not8 = icmp eq i32 %0, 0
br i1 %tobool.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%i.010 = phi i32 [ %div, %while.body ], [ %0, %entry ]
%b.09 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%rem = srem i32 %i.010, 10
%add = add nsw i32 %rem, %b.09
%div = sdiv i32 %i.010, 10
%i.010.off = add i32 %i.010, 9
%tobool.not = icmp ult i32 %i.010.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%b.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%rem1 = srem i32 %0, %b.0.lcssa
%cmp = icmp eq i32 %rem1, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define MAX 200000
typedef unsigned long long ULL;
int main(){
ULL a_sum[MAX+1],b_sum[MAX+1];
int a,b;
int read_time;
int *readed;
int N,M,K;
ULL time = 0;
int max;
int i,j;
scanf("%d%d%d",&N,&M,&K);
a_sum[0] = b_sum[0] = 0;
for(i=0;i<N;i++){
scanf("%d",&a);
a_sum[i+1] = a_sum[i] + a;
}
for(i=0;i<M;i++){
scanf("%d",&b);
b_sum[i+1] = b_sum[i] + b;
}
max = 0;
for(i=0;i<=N;i++){
if( a_sum[i] > K){
break;
}
for(j = max - i ;j<=M; j++){
time = a_sum[i] + b_sum[j];
if(time > K){
break;
}
if( time <= K){
if( max < i + j){
max = i + j;
}
}
}
}
printf("%d\n",max);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120912/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120912/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@.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:
%a_sum = alloca [200001 x i64], align 16
%b_sum = alloca [200001 x i64], align 16
%a = alloca i32, align 4
%b = alloca i32, align 4
%N = alloca i32, align 4
%M = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1600008, ptr nonnull %a_sum) #4
call void @llvm.lifetime.start.p0(i64 1600008, ptr nonnull %b_sum) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M, ptr noundef nonnull %K)
store i64 0, ptr %b_sum, align 16, !tbaa !5
store i64 0, ptr %a_sum, align 16, !tbaa !5
%0 = load i32, ptr %N, align 4, !tbaa !9
%cmp84 = icmp sgt i32 %0, 0
br i1 %cmp84, label %for.body, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%2 = load i32, ptr %M, align 4, !tbaa !9
%cmp886 = icmp sgt i32 %2, 0
br i1 %cmp886, label %for.body10, label %for.cond22.preheader
for.body: ; preds = %entry, %for.body
%3 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !9
%conv = sext i32 %4 to i64
%add = add i64 %3, %conv
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx6 = getelementptr inbounds [200001 x i64], ptr %a_sum, i64 0, i64 %indvars.iv.next
store i64 %add, ptr %arrayidx6, align 8, !tbaa !5
%5 = load i32, ptr %N, align 4, !tbaa !9
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !11
for.cond22.preheader.loopexit: ; preds = %for.body10
%.pre = load i32, ptr %N, align 4, !tbaa !9
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.cond22.preheader.loopexit, %for.cond7.preheader
%7 = phi i32 [ %1, %for.cond7.preheader ], [ %.pre, %for.cond22.preheader.loopexit ]
%.lcssa = phi i32 [ %2, %for.cond7.preheader ], [ %13, %for.cond22.preheader.loopexit ]
%cmp23.not93 = icmp slt i32 %7, 0
br i1 %cmp23.not93, label %for.end61, label %for.body25.lr.ph
for.body25.lr.ph: ; preds = %for.cond22.preheader
%8 = load i32, ptr %K, align 4, !tbaa !9
%conv28 = sext i32 %8 to i64
%9 = add i32 %.lcssa, 1
%10 = add nuw i32 %7, 1
%wide.trip.count = zext i32 %10 to i64
br label %for.body25
for.body10: ; preds = %for.cond7.preheader, %for.body10
%11 = phi i64 [ %add15, %for.body10 ], [ 0, %for.cond7.preheader ]
%indvars.iv100 = phi i64 [ %indvars.iv.next101, %for.body10 ], [ 0, %for.cond7.preheader ]
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%12 = load i32, ptr %b, align 4, !tbaa !9
%conv14 = sext i32 %12 to i64
%add15 = add i64 %11, %conv14
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%arrayidx18 = getelementptr inbounds [200001 x i64], ptr %b_sum, i64 0, i64 %indvars.iv.next101
store i64 %add15, ptr %arrayidx18, align 8, !tbaa !5
%13 = load i32, ptr %M, align 4, !tbaa !9
%14 = sext i32 %13 to i64
%cmp8 = icmp slt i64 %indvars.iv.next101, %14
br i1 %cmp8, label %for.body10, label %for.cond22.preheader.loopexit, !llvm.loop !13
for.body25: ; preds = %for.body25.lr.ph, %for.inc59
%indvars.iv109 = phi i64 [ 0, %for.body25.lr.ph ], [ %indvars.iv.next110, %for.inc59 ]
%indvars.iv103 = phi i32 [ 0, %for.body25.lr.ph ], [ %indvars.iv.next104, %for.inc59 ]
%max.094 = phi i32 [ 0, %for.body25.lr.ph ], [ %max.1.lcssa, %for.inc59 ]
%arrayidx27 = getelementptr inbounds [200001 x i64], ptr %a_sum, i64 0, i64 %indvars.iv109
%15 = load i64, ptr %arrayidx27, align 8, !tbaa !5
%cmp29 = icmp ugt i64 %15, %conv28
br i1 %cmp29, label %for.end61, label %if.end
if.end: ; preds = %for.body25
%indvars111 = trunc i64 %indvars.iv109 to i32
%sub = sub nsw i32 %max.094, %indvars111
%cmp32.not88 = icmp sgt i32 %sub, %.lcssa
br i1 %cmp32.not88, label %for.inc59, label %for.body34.preheader
for.body34.preheader: ; preds = %if.end
%16 = add i32 %max.094, %indvars.iv103
%17 = sext i32 %16 to i64
br label %for.body34
for.body34: ; preds = %for.body34.preheader, %if.then48
%indvars.iv105 = phi i64 [ %17, %for.body34.preheader ], [ %indvars.iv.next106, %if.then48 ]
%max.189 = phi i32 [ %max.094, %for.body34.preheader ], [ %spec.select, %if.then48 ]
%arrayidx38 = getelementptr inbounds [200001 x i64], ptr %b_sum, i64 0, i64 %indvars.iv105
%18 = load i64, ptr %arrayidx38, align 8, !tbaa !5
%add39 = add i64 %18, %15
%cmp41 = icmp ugt i64 %add39, %conv28
br i1 %cmp41, label %for.inc59, label %if.then48
if.then48: ; preds = %for.body34
%19 = add nsw i64 %indvars.iv105, %indvars.iv109
%20 = trunc i64 %19 to i32
%spec.select = call i32 @llvm.smax.i32(i32 %max.189, i32 %20)
%indvars.iv.next106 = add nsw i64 %indvars.iv105, 1
%lftr.wideiv = trunc i64 %indvars.iv.next106 to i32
%exitcond.not = icmp eq i32 %9, %lftr.wideiv
br i1 %exitcond.not, label %for.inc59, label %for.body34, !llvm.loop !14
for.inc59: ; preds = %for.body34, %if.then48, %if.end
%max.1.lcssa = phi i32 [ %max.094, %if.end ], [ %spec.select, %if.then48 ], [ %max.189, %for.body34 ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%indvars.iv.next104 = add nsw i32 %indvars.iv103, -1
%exitcond112.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count
br i1 %exitcond112.not, label %for.end61, label %for.body25, !llvm.loop !15
for.end61: ; preds = %for.inc59, %for.body25, %for.cond22.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ %max.094, %for.body25 ], [ %max.1.lcssa, %for.inc59 ]
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 1600008, ptr nonnull %b_sum) #4
call void @llvm.lifetime.end.p0(i64 1600008, ptr nonnull %a_sum) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
int main(void){
// Your code here!
long long int a[200001];
long long int b[200001];
int n,m,k;
a[0]=0;
b[0]=0;
scanf("%d %d %d",&n,&m,&k);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
a[i]+=a[i-1];
}
for(int i=1;i<=m;i++){
scanf("%lld",&b[i]);
b[i]+=b[i-1];
}
int max=0;
int jbest=m;
for(int i=0;i<=n;i++){
for(int j=jbest;m>=0;j--){
if(a[i]+b[j]<=k){
if(i+j>max){
max=i+j;
}
jbest=j;
break;
}
}
}
/*
for(int i=0;i<n;i++){
printf("%lld ",a[i]);
}
for(int i=0;i<m;i++){
printf("%lld ",b[i]);
}*/
printf("%d",max);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_120956/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_120956/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [200001 x i64], align 16
%b = alloca [200001 x i64], align 16
%n = alloca i32, align 4
%m = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1600008, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 1600008, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
store i64 0, ptr %a, align 16, !tbaa !5
store i64 0, ptr %b, align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp.not72 = icmp slt i32 %0, 1
br i1 %cmp.not72, label %for.cond9.preheader, label %for.body
for.cond9.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %6, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !9
%cmp10.not74 = icmp slt i32 %2, 1
br i1 %cmp10.not74, label %for.cond26.preheader, label %for.body12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx2 = getelementptr inbounds [200001 x i64], ptr %a, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx2)
%3 = add nsw i64 %indvars.iv, -1
%arrayidx5 = getelementptr inbounds [200001 x i64], ptr %a, i64 0, i64 %3
%4 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%5 = load i64, ptr %arrayidx2, align 8, !tbaa !5
%add = add nsw i64 %5, %4
store i64 %add, ptr %arrayidx2, align 8, !tbaa !5
%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.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond9.preheader, !llvm.loop !11
for.cond26.preheader.loopexit: ; preds = %for.body12
%.pre = load i32, ptr %n, align 4, !tbaa !9
br label %for.cond26.preheader
for.cond26.preheader: ; preds = %for.cond26.preheader.loopexit, %for.cond9.preheader
%8 = phi i32 [ %1, %for.cond9.preheader ], [ %.pre, %for.cond26.preheader.loopexit ]
%.lcssa = phi i32 [ %2, %for.cond9.preheader ], [ %25, %for.cond26.preheader.loopexit ]
%cmp27.not77 = icmp slt i32 %8, 0
br i1 %cmp27.not77, label %for.cond.cleanup28, label %for.cond30.preheader.lr.ph
for.cond30.preheader.lr.ph: ; preds = %for.cond26.preheader
%cmp31 = icmp sgt i32 %.lcssa, -1
%9 = load i32, ptr %k, align 4
%conv = sext i32 %9 to i64
br i1 %cmp31, label %for.cond30.preheader.us.preheader, label %for.cond.cleanup28
for.cond30.preheader.us.preheader: ; preds = %for.cond30.preheader.lr.ph
%10 = add i32 %8, 1
%wide.trip.count = zext i32 %10 to i64
%xtraiter = and i64 %wide.trip.count, 1
%11 = icmp eq i32 %8, 0
br i1 %11, label %for.cond.cleanup28.loopexit.unr-lcssa, label %for.cond30.preheader.us.preheader.new
for.cond30.preheader.us.preheader.new: ; preds = %for.cond30.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.cond30.preheader.us
for.cond30.preheader.us: ; preds = %if.then.split.us.us.1, %for.cond30.preheader.us.preheader.new
%indvars.iv101 = phi i64 [ 0, %for.cond30.preheader.us.preheader.new ], [ %indvars.iv.next102.1, %if.then.split.us.us.1 ]
%jbest.079.us = phi i32 [ %.lcssa, %for.cond30.preheader.us.preheader.new ], [ %20, %if.then.split.us.us.1 ]
%max.078.us = phi i32 [ 0, %for.cond30.preheader.us.preheader.new ], [ %spec.select.us.1, %if.then.split.us.us.1 ]
%niter = phi i64 [ 0, %for.cond30.preheader.us.preheader.new ], [ %niter.next.1, %if.then.split.us.us.1 ]
%arrayidx35.us = getelementptr inbounds [200001 x i64], ptr %a, i64 0, i64 %indvars.iv101
%12 = load i64, ptr %arrayidx35.us, align 16, !tbaa !5
%13 = sext i32 %jbest.079.us to i64
br label %for.body33.us.us
for.body33.us.us: ; preds = %for.body33.us.us, %for.cond30.preheader.us
%indvars.iv98 = phi i64 [ %indvars.iv.next99, %for.body33.us.us ], [ %13, %for.cond30.preheader.us ]
%arrayidx37.us.us = getelementptr inbounds [200001 x i64], ptr %b, i64 0, i64 %indvars.iv98
%14 = load i64, ptr %arrayidx37.us.us, align 8, !tbaa !5
%add38.us.us = add nsw i64 %14, %12
%cmp39.not.us.us = icmp sgt i64 %add38.us.us, %conv
%indvars.iv.next99 = add i64 %indvars.iv98, -1
br i1 %cmp39.not.us.us, label %for.body33.us.us, label %if.then.split.us.us
if.then.split.us.us: ; preds = %for.body33.us.us
%15 = trunc i64 %indvars.iv98 to i32
%16 = trunc i64 %indvars.iv101 to i32
%add41.us = add nsw i32 %15, %16
%spec.select.us = call i32 @llvm.smax.i32(i32 %add41.us, i32 %max.078.us)
%indvars.iv.next102 = or i64 %indvars.iv101, 1
%arrayidx35.us.1 = getelementptr inbounds [200001 x i64], ptr %a, i64 0, i64 %indvars.iv.next102
%17 = load i64, ptr %arrayidx35.us.1, align 8, !tbaa !5
%sext = shl i64 %indvars.iv98, 32
%18 = ashr exact i64 %sext, 32
br label %for.body33.us.us.1
for.body33.us.us.1: ; preds = %for.body33.us.us.1, %if.then.split.us.us
%indvars.iv98.1 = phi i64 [ %indvars.iv.next99.1, %for.body33.us.us.1 ], [ %18, %if.then.split.us.us ]
%arrayidx37.us.us.1 = getelementptr inbounds [200001 x i64], ptr %b, i64 0, i64 %indvars.iv98.1
%19 = load i64, ptr %arrayidx37.us.us.1, align 8, !tbaa !5
%add38.us.us.1 = add nsw i64 %19, %17
%cmp39.not.us.us.1 = icmp sgt i64 %add38.us.us.1, %conv
%indvars.iv.next99.1 = add i64 %indvars.iv98.1, -1
br i1 %cmp39.not.us.us.1, label %for.body33.us.us.1, label %if.then.split.us.us.1
if.then.split.us.us.1: ; preds = %for.body33.us.us.1
%20 = trunc i64 %indvars.iv98.1 to i32
%21 = trunc i64 %indvars.iv.next102 to i32
%add41.us.1 = add nsw i32 %20, %21
%spec.select.us.1 = call i32 @llvm.smax.i32(i32 %add41.us.1, i32 %spec.select.us)
%indvars.iv.next102.1 = add nuw nsw i64 %indvars.iv101, 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.cleanup28.loopexit.unr-lcssa, label %for.cond30.preheader.us, !llvm.loop !13
for.body12: ; preds = %for.cond9.preheader, %for.body12
%indvars.iv94 = phi i64 [ %indvars.iv.next95, %for.body12 ], [ 1, %for.cond9.preheader ]
%arrayidx14 = getelementptr inbounds [200001 x i64], ptr %b, i64 0, i64 %indvars.iv94
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx14)
%22 = add nsw i64 %indvars.iv94, -1
%arrayidx18 = getelementptr inbounds [200001 x i64], ptr %b, i64 0, i64 %22
%23 = load i64, ptr %arrayidx18, align 8, !tbaa !5
%24 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%add21 = add nsw i64 %24, %23
store i64 %add21, ptr %arrayidx14, align 8, !tbaa !5
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%25 = load i32, ptr %m, align 4, !tbaa !9
%26 = sext i32 %25 to i64
%cmp10.not.not = icmp slt i64 %indvars.iv94, %26
br i1 %cmp10.not.not, label %for.body12, label %for.cond26.preheader.loopexit, !llvm.loop !14
for.cond.cleanup28.loopexit.unr-lcssa: ; preds = %if.then.split.us.us.1, %for.cond30.preheader.us.preheader
%spec.select.us.lcssa.ph = phi i32 [ undef, %for.cond30.preheader.us.preheader ], [ %spec.select.us.1, %if.then.split.us.us.1 ]
%indvars.iv101.unr = phi i64 [ 0, %for.cond30.preheader.us.preheader ], [ %indvars.iv.next102.1, %if.then.split.us.us.1 ]
%jbest.079.us.unr = phi i32 [ %.lcssa, %for.cond30.preheader.us.preheader ], [ %20, %if.then.split.us.us.1 ]
%max.078.us.unr = phi i32 [ 0, %for.cond30.preheader.us.preheader ], [ %spec.select.us.1, %if.then.split.us.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup28, label %for.cond30.preheader.us.epil
for.cond30.preheader.us.epil: ; preds = %for.cond.cleanup28.loopexit.unr-lcssa
%arrayidx35.us.epil = getelementptr inbounds [200001 x i64], ptr %a, i64 0, i64 %indvars.iv101.unr
%27 = load i64, ptr %arrayidx35.us.epil, align 8, !tbaa !5
%28 = sext i32 %jbest.079.us.unr to i64
br label %for.body33.us.us.epil
for.body33.us.us.epil: ; preds = %for.body33.us.us.epil, %for.cond30.preheader.us.epil
%indvars.iv98.epil = phi i64 [ %indvars.iv.next99.epil, %for.body33.us.us.epil ], [ %28, %for.cond30.preheader.us.epil ]
%arrayidx37.us.us.epil = getelementptr inbounds [200001 x i64], ptr %b, i64 0, i64 %indvars.iv98.epil
%29 = load i64, ptr %arrayidx37.us.us.epil, align 8, !tbaa !5
%add38.us.us.epil = add nsw i64 %29, %27
%cmp39.not.us.us.epil = icmp sgt i64 %add38.us.us.epil, %conv
%indvars.iv.next99.epil = add i64 %indvars.iv98.epil, -1
br i1 %cmp39.not.us.us.epil, label %for.body33.us.us.epil, label %if.then.split.us.us.epil
if.then.split.us.us.epil: ; preds = %for.body33.us.us.epil
%30 = trunc i64 %indvars.iv98.epil to i32
%31 = trunc i64 %indvars.iv101.unr to i32
%add41.us.epil = add nsw i32 %30, %31
%spec.select.us.epil = call i32 @llvm.smax.i32(i32 %add41.us.epil, i32 %max.078.us.unr)
br label %for.cond.cleanup28
for.cond.cleanup28: ; preds = %if.then.split.us.us.epil, %for.cond.cleanup28.loopexit.unr-lcssa, %for.cond30.preheader.lr.ph, %for.cond26.preheader
%max.0.lcssa = phi i32 [ 0, %for.cond26.preheader ], [ 0, %for.cond30.preheader.lr.ph ], [ %spec.select.us.lcssa.ph, %for.cond.cleanup28.loopexit.unr-lcssa ], [ %spec.select.us.epil, %if.then.split.us.us.epil ]
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %max.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 1600008, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 1600008, 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.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 = !{!"long 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>
int main()
{int i,j,k,max;
scanf("%d%d%d",&i,&j,&k);
max=i*j+k;
if(max<i*(j+k))
max=i*(j+k);
if(max<i+j*k)
max=i+j*k;
if(max<(i+j)*k)
max=(i+j)*k;
if(max<i*j*k)
max=i*j*k;
if(max<i+j+k)
max=i+j+k;
printf("%d\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%i = alloca i32, align 4
%j = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i, ptr noundef nonnull %j, ptr noundef nonnull %k)
%0 = load i32, ptr %i, align 4, !tbaa !5
%1 = load i32, ptr %j, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %k, align 4, !tbaa !5
%add = add nsw i32 %mul, %2
%add1 = add nsw i32 %2, %1
%mul2 = mul nsw i32 %add1, %0
%spec.select = call i32 @llvm.smax.i32(i32 %add, i32 %mul2)
%mul5 = mul nsw i32 %2, %1
%add6 = add nsw i32 %mul5, %0
%max.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %add6)
%add12 = add nsw i32 %1, %0
%mul13 = mul nsw i32 %add12, %2
%max.2 = call i32 @llvm.smax.i32(i32 %max.1, i32 %mul13)
%mul20 = mul nsw i32 %mul, %2
%max.3 = call i32 @llvm.smax.i32(i32 %max.2, i32 %mul20)
%add27 = add nsw i32 %add12, %2
%max.4 = call i32 @llvm.smax.i32(i32 %max.3, i32 %add27)
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int N,count=0;
char S[300001];
scanf("%d",&N);
scanf("%s",S);
int min;
for(int i=1;i<N;i++){
if(S[i]=='E')count++;
}
min=count;
for(int i=1;i<N;i++){
if(S[i]=='E')count--;
if(S[i-1]=='W')count++;
if(min>count)min=count;
}
printf("%d\n",min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121041/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121041/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [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 [300001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 300001, ptr nonnull %S) #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.1, ptr noundef nonnull %S)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %0, 1
br i1 %cmp46, label %for.body.preheader, label %for.cond.cleanup9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%1 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %0, 9
br i1 %min.iters.check, label %for.body.preheader65, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -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.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi63 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = getelementptr inbounds [300001 x i8], ptr %S, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %2, align 1, !tbaa !9
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load64 = load <4 x i8>, ptr %3, align 1, !tbaa !9
%4 = icmp eq <4 x i8> %wide.load, <i8 69, i8 69, i8 69, i8 69>
%5 = icmp eq <4 x i8> %wide.load64, <i8 69, i8 69, i8 69, i8 69>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = add <4 x i32> %vec.phi, %6
%9 = add <4 x i32> %vec.phi63, %7
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.cond6.preheader, label %for.body.preheader65
for.body.preheader65: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%count.047.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ]
br label %for.body
for.cond6.preheader: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %11, %middle.block ], [ %spec.select, %for.body ]
br i1 %cmp46, label %for.body10.preheader, label %for.cond.cleanup9
for.body10.preheader: ; preds = %for.cond6.preheader
%.pre = load i8, ptr %S, align 16, !tbaa !9
%xtraiter = and i64 %1, 1
%12 = icmp eq i32 %0, 2
br i1 %12, label %for.cond.cleanup9.loopexit.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter = and i64 %1, -2
br label %for.body10
for.body: ; preds = %for.body.preheader65, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader65 ]
%count.047 = phi i32 [ %spec.select, %for.body ], [ %count.047.ph, %for.body.preheader65 ]
%arrayidx = getelementptr inbounds [300001 x i8], ptr %S, i64 0, i64 %indvars.iv
%13 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %13, 69
%inc = zext i1 %cmp2 to i32
%spec.select = add nuw nsw i32 %count.047, %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.cond6.preheader, label %for.body, !llvm.loop !14
for.cond.cleanup9.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%min.1.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %min.1.1, %for.body10 ]
%.unr = phi i8 [ %.pre, %for.body10.preheader ], [ %17, %for.body10 ]
%indvars.iv56.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next57.1, %for.body10 ]
%min.052.unr = phi i32 [ %spec.select.lcssa, %for.body10.preheader ], [ %min.1.1, %for.body10 ]
%count.251.unr = phi i32 [ %spec.select.lcssa, %for.body10.preheader ], [ %count.4.1, %for.body10 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup9, label %for.body10.epil
for.body10.epil: ; preds = %for.cond.cleanup9.loopexit.unr-lcssa
%arrayidx12.epil = getelementptr inbounds [300001 x i8], ptr %S, i64 0, i64 %indvars.iv56.unr
%14 = load i8, ptr %arrayidx12.epil, align 1, !tbaa !9
%cmp14.epil = icmp eq i8 %14, 69
%dec.epil = sext i1 %cmp14.epil to i32
%spec.select45.epil = add nsw i32 %count.251.unr, %dec.epil
%cmp21.epil = icmp eq i8 %.unr, 87
%inc24.epil = zext i1 %cmp21.epil to i32
%count.4.epil = add nsw i32 %spec.select45.epil, %inc24.epil
%min.1.epil = call i32 @llvm.smin.i32(i32 %min.052.unr, i32 %count.4.epil)
br label %for.cond.cleanup9
for.cond.cleanup9: ; preds = %for.body10.epil, %for.cond.cleanup9.loopexit.unr-lcssa, %entry, %for.cond6.preheader
%min.0.lcssa = phi i32 [ %spec.select.lcssa, %for.cond6.preheader ], [ 0, %entry ], [ %min.1.lcssa.ph, %for.cond.cleanup9.loopexit.unr-lcssa ], [ %min.1.epil, %for.body10.epil ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 300001, ptr nonnull %S) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%15 = phi i8 [ %.pre, %for.body10.preheader.new ], [ %17, %for.body10 ]
%indvars.iv56 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next57.1, %for.body10 ]
%min.052 = phi i32 [ %spec.select.lcssa, %for.body10.preheader.new ], [ %min.1.1, %for.body10 ]
%count.251 = phi i32 [ %spec.select.lcssa, %for.body10.preheader.new ], [ %count.4.1, %for.body10 ]
%niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ]
%arrayidx12 = getelementptr inbounds [300001 x i8], ptr %S, i64 0, i64 %indvars.iv56
%16 = load i8, ptr %arrayidx12, align 1, !tbaa !9
%cmp14 = icmp eq i8 %16, 69
%dec = sext i1 %cmp14 to i32
%spec.select45 = add nsw i32 %count.251, %dec
%cmp21 = icmp eq i8 %15, 87
%inc24 = zext i1 %cmp21 to i32
%count.4 = add nsw i32 %spec.select45, %inc24
%min.1 = call i32 @llvm.smin.i32(i32 %min.052, i32 %count.4)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%arrayidx12.1 = getelementptr inbounds [300001 x i8], ptr %S, i64 0, i64 %indvars.iv.next57
%17 = load i8, ptr %arrayidx12.1, align 1, !tbaa !9
%cmp14.1 = icmp eq i8 %17, 69
%dec.1 = sext i1 %cmp14.1 to i32
%spec.select45.1 = add nsw i32 %count.4, %dec.1
%cmp21.1 = icmp eq i8 %16, 87
%inc24.1 = zext i1 %cmp21.1 to i32
%count.4.1 = add nsw i32 %spec.select45.1, %inc24.1
%min.1.1 = call i32 @llvm.smin.i32(i32 %min.1, i32 %count.4.1)
%indvars.iv.next57.1 = add nuw nsw i64 %indvars.iv56, 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.cleanup9.loopexit.unr-lcssa, label %for.body10, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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.smin.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
!15 = distinct !{!15, !11}
|
#include<stdio.h>
#include<stdlib.h>
#include<memory.h>
#define MAXN 10000000
char a[MAXN];
int b[MAXN] = { 0 };
int main(void)
{
int n;
while (scanf("%d", &n) != EOF)
{
int i = 0, j = 0;
scanf("%s", a);
int num = 0;
int min = 100000000;
for (int m = 0; m < n; m++)
{
if (a[m] == 'E')
{
b[m] = 1;
}
}
for (int m = 0; m < n - 1; m++)
{
b[m + 1] += b[m];
}
for (int m = 0; m < n; m++)
{
if (a[m] == 'E')
num = (m - b[m] + (b[n - 1] - b[m]) + 1);
else
num = (m - b[m] + (b[n - 1] - b[m]));
if (min > num)
min = num;
}
printf("%d\n", min);
memset(b, 0, sizeof(b));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121085/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121085/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@b = dso_local local_unnamed_addr global [10000000 x i32] zeroinitializer, align 16
@.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
@a = dso_local global [10000000 x i8] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not90 = icmp eq i32 %call89, -1
br i1 %cmp.not90, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup25
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @a)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp280 = icmp sgt i32 %0, 0
br i1 %cmp280, label %for.body.preheader, label %for.cond.cleanup25
for.body.preheader: ; preds = %while.body
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader123, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %pred.store.continue122, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue122 ]
%1 = or i64 %index, 4
%2 = getelementptr inbounds [10000000 x i8], ptr @a, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %2, align 8, !tbaa !9
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load108 = load <4 x i8>, ptr %3, align 4, !tbaa !9
%4 = icmp eq <4 x i8> %wide.load, <i8 69, i8 69, i8 69, i8 69>
%5 = icmp eq <4 x i8> %wide.load108, <i8 69, i8 69, i8 69, i8 69>
%6 = extractelement <4 x i1> %4, i64 0
br i1 %6, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%7 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %index
store i32 1, ptr %7, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%8 = extractelement <4 x i1> %4, i64 1
br i1 %8, label %pred.store.if109, label %pred.store.continue110
pred.store.if109: ; preds = %pred.store.continue
%9 = or i64 %index, 1
%10 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %9
store i32 1, ptr %10, align 4, !tbaa !5
br label %pred.store.continue110
pred.store.continue110: ; preds = %pred.store.if109, %pred.store.continue
%11 = extractelement <4 x i1> %4, i64 2
br i1 %11, label %pred.store.if111, label %pred.store.continue112
pred.store.if111: ; preds = %pred.store.continue110
%12 = or i64 %index, 2
%13 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %12
store i32 1, ptr %13, align 8, !tbaa !5
br label %pred.store.continue112
pred.store.continue112: ; preds = %pred.store.if111, %pred.store.continue110
%14 = extractelement <4 x i1> %4, i64 3
br i1 %14, label %pred.store.if113, label %pred.store.continue114
pred.store.if113: ; preds = %pred.store.continue112
%15 = or i64 %index, 3
%16 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %15
store i32 1, ptr %16, align 4, !tbaa !5
br label %pred.store.continue114
pred.store.continue114: ; preds = %pred.store.if113, %pred.store.continue112
%17 = extractelement <4 x i1> %5, i64 0
br i1 %17, label %pred.store.if115, label %pred.store.continue116
pred.store.if115: ; preds = %pred.store.continue114
%18 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %1
store i32 1, ptr %18, align 16, !tbaa !5
br label %pred.store.continue116
pred.store.continue116: ; preds = %pred.store.if115, %pred.store.continue114
%19 = extractelement <4 x i1> %5, i64 1
br i1 %19, label %pred.store.if117, label %pred.store.continue118
pred.store.if117: ; preds = %pred.store.continue116
%20 = or i64 %index, 5
%21 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %20
store i32 1, ptr %21, align 4, !tbaa !5
br label %pred.store.continue118
pred.store.continue118: ; preds = %pred.store.if117, %pred.store.continue116
%22 = extractelement <4 x i1> %5, i64 2
br i1 %22, label %pred.store.if119, label %pred.store.continue120
pred.store.if119: ; preds = %pred.store.continue118
%23 = or i64 %index, 6
%24 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %23
store i32 1, ptr %24, align 8, !tbaa !5
br label %pred.store.continue120
pred.store.continue120: ; preds = %pred.store.if119, %pred.store.continue118
%25 = extractelement <4 x i1> %5, i64 3
br i1 %25, label %pred.store.if121, label %pred.store.continue122
pred.store.if121: ; preds = %pred.store.continue120
%26 = or i64 %index, 7
%27 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %26
store i32 1, ptr %27, align 4, !tbaa !5
br label %pred.store.continue122
pred.store.continue122: ; preds = %pred.store.if121, %pred.store.continue120
%index.next = add nuw i64 %index, 8
%28 = icmp eq i64 %index.next, %n.vec
br i1 %28, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %pred.store.continue122
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond8.preheader, label %for.body.preheader123
for.body.preheader123: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond8.preheader: ; preds = %for.inc, %middle.block
%sub = add i32 %0, -1
%cmp982 = icmp sgt i32 %0, 1
br i1 %cmp982, label %for.body12.preheader, label %for.cond22.preheader
for.body12.preheader: ; preds = %for.cond8.preheader
%wide.trip.count95 = zext i32 %sub to i64
%.pre = load i32, ptr @b, align 16, !tbaa !5
%29 = add nsw i64 %wide.trip.count95, -1
%xtraiter = and i64 %wide.trip.count95, 3
%30 = icmp ult i64 %29, 3
br i1 %30, label %for.cond22.preheader.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i64 %wide.trip.count95, 4294967292
br label %for.body12
for.body: ; preds = %for.body.preheader123, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.body.preheader123 ]
%arrayidx = getelementptr inbounds [10000000 x i8], ptr @a, i64 0, i64 %indvars.iv
%31 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp3 = icmp eq i8 %31, 69
br i1 %cmp3, label %if.then, label %for.inc
if.then: ; preds = %for.body
%arrayidx6 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx6, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%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.cond8.preheader, label %for.body, !llvm.loop !14
for.cond22.preheader.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %add17.3, %for.body12 ]
%indvars.iv92.unr = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next93.3, %for.body12 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond22.preheader, label %for.body12.epil
for.body12.epil: ; preds = %for.cond22.preheader.loopexit.unr-lcssa, %for.body12.epil
%32 = phi i32 [ %add17.epil, %for.body12.epil ], [ %.unr, %for.cond22.preheader.loopexit.unr-lcssa ]
%indvars.iv92.epil = phi i64 [ %indvars.iv.next93.epil, %for.body12.epil ], [ %indvars.iv92.unr, %for.cond22.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body12.epil ], [ 0, %for.cond22.preheader.loopexit.unr-lcssa ]
%indvars.iv.next93.epil = add nuw nsw i64 %indvars.iv92.epil, 1
%arrayidx16.epil = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv.next93.epil
%33 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%add17.epil = add nsw i32 %33, %32
store i32 %add17.epil, ptr %arrayidx16.epil, align 4, !tbaa !5
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond22.preheader, label %for.body12.epil, !llvm.loop !15
for.cond22.preheader: ; preds = %for.cond22.preheader.loopexit.unr-lcssa, %for.body12.epil, %for.cond8.preheader
br i1 %cmp280, label %for.body26.lr.ph, label %for.cond.cleanup25
for.body26.lr.ph: ; preds = %for.cond22.preheader
%idxprom48 = zext i32 %sub to i64
%arrayidx49 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %idxprom48
%wide.trip.count101 = zext i32 %0 to i64
%34 = load i32, ptr %arrayidx49, align 4, !tbaa !5
br label %for.body26
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%35 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %add17.3, %for.body12 ]
%indvars.iv92 = phi i64 [ 0, %for.body12.preheader.new ], [ %indvars.iv.next93.3, %for.body12 ]
%niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.3, %for.body12 ]
%indvars.iv.next93 = or i64 %indvars.iv92, 1
%arrayidx16 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv.next93
%36 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%add17 = add nsw i32 %36, %35
store i32 %add17, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next93.1 = or i64 %indvars.iv92, 2
%arrayidx16.1 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv.next93.1
%37 = load i32, ptr %arrayidx16.1, align 8, !tbaa !5
%add17.1 = add nsw i32 %37, %add17
store i32 %add17.1, ptr %arrayidx16.1, align 8, !tbaa !5
%indvars.iv.next93.2 = or i64 %indvars.iv92, 3
%arrayidx16.2 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv.next93.2
%38 = load i32, ptr %arrayidx16.2, align 4, !tbaa !5
%add17.2 = add nsw i32 %38, %add17.1
store i32 %add17.2, ptr %arrayidx16.2, align 4, !tbaa !5
%indvars.iv.next93.3 = add nuw nsw i64 %indvars.iv92, 4
%arrayidx16.3 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv.next93.3
%39 = load i32, ptr %arrayidx16.3, align 16, !tbaa !5
%add17.3 = add nsw i32 %39, %add17.2
store i32 %add17.3, ptr %arrayidx16.3, align 16, !tbaa !5
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond22.preheader.loopexit.unr-lcssa, label %for.body12, !llvm.loop !17
for.cond.cleanup25: ; preds = %if.end54, %while.body, %for.cond22.preheader
%min.0.lcssa = phi i32 [ 100000000, %for.cond22.preheader ], [ 100000000, %while.body ], [ %spec.select, %if.end54 ]
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.0.lcssa)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000000) @b, i8 0, i64 40000000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18
for.body26: ; preds = %for.body26.lr.ph, %if.end54
%indvars.iv97 = phi i64 [ 0, %for.body26.lr.ph ], [ %indvars.iv.next98.pre-phi, %if.end54 ]
%min.086 = phi i32 [ 100000000, %for.body26.lr.ph ], [ %spec.select, %if.end54 ]
%arrayidx28 = getelementptr inbounds [10000000 x i8], ptr @a, i64 0, i64 %indvars.iv97
%40 = load i8, ptr %arrayidx28, align 1, !tbaa !9
%cmp30 = icmp eq i8 %40, 69
%arrayidx34 = getelementptr inbounds [10000000 x i32], ptr @b, i64 0, i64 %indvars.iv97
%41 = load i32, ptr %arrayidx34, align 4, !tbaa !5
br i1 %cmp30, label %if.then32, label %if.else
if.then32: ; preds = %for.body26
%42 = add nuw nsw i64 %indvars.iv97, 1
%43 = trunc i64 %42 to i32
%add42 = add i32 %34, %43
%44 = shl i32 %41, 1
%add43 = sub i32 %add42, %44
br label %if.end54
if.else: ; preds = %for.body26
%45 = trunc i64 %indvars.iv97 to i32
%sub46 = add i32 %34, %45
%46 = shl i32 %41, 1
%add53 = sub i32 %sub46, %46
%.pre103 = add nuw nsw i64 %indvars.iv97, 1
br label %if.end54
if.end54: ; preds = %if.else, %if.then32
%indvars.iv.next98.pre-phi = phi i64 [ %.pre103, %if.else ], [ %42, %if.then32 ]
%num.0 = phi i32 [ %add53, %if.else ], [ %add43, %if.then32 ]
%spec.select = call i32 @llvm.smin.i32(i32 %min.086, i32 %num.0)
%exitcond102.not = icmp eq i64 %indvars.iv.next98.pre-phi, %wide.trip.count101
br i1 %exitcond102.not, label %for.cond.cleanup25, label %for.body26, !llvm.loop !19
while.end: ; preds = %for.cond.cleanup25, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
|
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;
int dsc(const void *a, const void *b)
{
return *(int *)b - *(int *)a;
}
int
main(int argc, char *argv[])
{
int n, a[100000];
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", &a[i]);
qsort(a, n, sizeof(int), dsc);
int i = 0;
while(i < n){
if(a[i] == a[i + 1]) break;
i++;
}
int x = 0;
if(i <= n - 4){
x = a[i];
}
i += 2;
while(i < n){
if(a[i] == a[i + 1]) break;
i++;
}
int y = 0;
if(i <= n - 2){
y = a[i];
}
printf("%lld\n", (ll)x * (ll)y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dsc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%a = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %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
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @dsc) #6
%1 = load i32, ptr %n, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %1, i32 0)
%wide.trip.count = zext i32 %smax to i64
br label %while.cond
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
while.cond: ; preds = %while.body, %for.cond.cleanup
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %while.body ], [ 0, %for.cond.cleanup ]
%exitcond.not = icmp eq i64 %indvars.iv62, %wide.trip.count
br i1 %exitcond.not, label %while.end, label %while.body
while.body: ; preds = %while.cond
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv62
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next63
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp eq i32 %4, %5
br i1 %cmp9, label %while.end.split.loop.exit, label %while.cond, !llvm.loop !11
while.end.split.loop.exit: ; preds = %while.body
%6 = trunc i64 %indvars.iv62 to i32
br label %while.end
while.end: ; preds = %while.cond, %while.end.split.loop.exit
%i2.0.lcssa = phi i32 [ %6, %while.end.split.loop.exit ], [ %smax, %while.cond ]
%sub = add nsw i32 %1, -4
%cmp12.not = icmp sgt i32 %i2.0.lcssa, %sub
%.pre69 = zext i32 %i2.0.lcssa to i64
br i1 %cmp12.not, label %if.end17, label %if.then14
if.then14: ; preds = %while.end
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %.pre69
%7 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%8 = sext i32 %7 to i64
br label %if.end17
if.end17: ; preds = %while.end, %if.then14
%x.0 = phi i64 [ %8, %if.then14 ], [ 0, %while.end ]
%add18 = add i32 %i2.0.lcssa, 2
%9 = add nuw nsw i64 %.pre69, 2
%smax67 = call i32 @llvm.smax.i32(i32 %1, i32 %add18)
br label %while.cond19
while.cond19: ; preds = %while.body22, %if.end17
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %while.body22 ], [ %9, %if.end17 ]
%10 = trunc i64 %indvars.iv65 to i32
%cmp20 = icmp sgt i32 %1, %10
br i1 %cmp20, label %while.body22, label %while.end33
while.body22: ; preds = %while.cond19
%arrayidx24 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv65
%11 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%arrayidx27 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next66
%12 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28 = icmp eq i32 %11, %12
br i1 %cmp28, label %while.end33, label %while.cond19, !llvm.loop !12
while.end33: ; preds = %while.body22, %while.cond19
%i2.1.lcssa = phi i32 [ %10, %while.body22 ], [ %smax67, %while.cond19 ]
%sub34 = add nsw i32 %1, -2
%cmp35.not = icmp sgt i32 %i2.1.lcssa, %sub34
br i1 %cmp35.not, label %if.end40, label %if.then37
if.then37: ; preds = %while.end33
%idxprom38 = zext i32 %i2.1.lcssa to i64
%arrayidx39 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom38
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%14 = sext i32 %13 to i64
br label %if.end40
if.end40: ; preds = %if.then37, %while.end33
%y.0 = phi i64 [ %14, %if.then37 ], [ 0, %while.end33 ]
%mul = mul nsw i64 %y.0, %x.0
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul)
call void @llvm.lifetime.end.p0(i64 400000, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !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 <inttypes.h>
char S[128];
int K;
int nyan = 0;
int kugyu[128];
char mimorin[128];
int main(void) {
int i, horieyui;
int64_t mareitaso = 0;
if (scanf("%127s", S) != 1) return 1;
if (scanf("%d", &K) != 1) return 1;
horieyui = 1;
for (i = 1; S[i - 1] != '\0'; i++) {
if (S[i - 1] != S[i]) {
kugyu[nyan] = horieyui;
mimorin[nyan] = S[i - 1];
nyan++;
horieyui = 1;
} else {
horieyui++;
}
}
if (nyan < 1) {
puts("ERROR!");
return 2;
} else if (nyan == 1) {
int64_t yukati = (int64_t)kugyu[0] * K;
mareitaso += yukati / 2;
} else if (mimorin[0] == mimorin[nyan - 1]) {
for (i = 1; i < nyan - 1; i++) {
mareitaso += kugyu[i] / 2;
}
mareitaso *= K;
mareitaso += ((int64_t)(kugyu[0] + kugyu[nyan - 1]) / 2) * (K - 1);
mareitaso += kugyu[0] / 2;
mareitaso += kugyu[nyan - 1] / 2;
} else {
for (i = 0; i < nyan; i++) {
mareitaso += kugyu[i] / 2;
}
mareitaso *= K;
}
printf("%" PRId64 "\n", mareitaso);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@nyan = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%127s\00", align 1
@S = dso_local global [128 x i8] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@K = dso_local global i32 0, align 4
@kugyu = dso_local local_unnamed_addr global [128 x i32] zeroinitializer, align 16
@mimorin = dso_local local_unnamed_addr global [128 x i8] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [7 x i8] c"ERROR!\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @S)
%cmp.not = icmp eq i32 %call, 1
br i1 %cmp.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @K)
%cmp2.not = icmp eq i32 %call1, 1
br i1 %cmp2.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %if.end
%nyan.promoted = load i32, ptr @nyan, align 4, !tbaa !5
%0 = load i8, ptr @S, align 16, !tbaa !9
%cmp5.not122 = icmp eq i8 %0, 0
br i1 %cmp5.not122, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.cond.preheader ]
%1 = phi i8 [ %2, %for.inc ], [ %0, %for.cond.preheader ]
%horieyui.0125 = phi i32 [ %horieyui.1, %for.inc ], [ 1, %for.cond.preheader ]
%inc121123 = phi i32 [ %inc120, %for.inc ], [ %nyan.promoted, %for.cond.preheader ]
%arrayidx12 = getelementptr inbounds [128 x i8], ptr @S, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx12, align 1, !tbaa !9
%cmp14.not = icmp eq i8 %1, %2
br i1 %cmp14.not, label %if.else, label %if.then16
if.then16: ; preds = %for.body
%idxprom17 = sext i32 %inc121123 to i64
%arrayidx18 = getelementptr inbounds [128 x i32], ptr @kugyu, i64 0, i64 %idxprom17
store i32 %horieyui.0125, ptr %arrayidx18, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds [128 x i8], ptr @mimorin, i64 0, i64 %idxprom17
store i8 %1, ptr %arrayidx23, align 1, !tbaa !9
%inc = add nsw i32 %inc121123, 1
store i32 %inc, ptr @nyan, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%inc24 = add nsw i32 %horieyui.0125, 1
br label %for.inc
for.inc: ; preds = %if.then16, %if.else
%inc120 = phi i32 [ %inc, %if.then16 ], [ %inc121123, %if.else ]
%horieyui.1 = phi i32 [ 1, %if.then16 ], [ %inc24, %if.else ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp5.not = icmp eq i8 %2, 0
br i1 %cmp5.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.inc, %for.cond.preheader
%3 = phi i32 [ %nyan.promoted, %for.cond.preheader ], [ %inc120, %for.inc ]
%cmp27 = icmp slt i32 %3, 1
br i1 %cmp27, label %if.then29, label %if.else31
if.then29: ; preds = %for.end
%call30 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
if.else31: ; preds = %for.end
%cmp32 = icmp eq i32 %3, 1
br i1 %cmp32, label %if.then34, label %if.else37
if.then34: ; preds = %if.else31
%4 = load i32, ptr @kugyu, align 16, !tbaa !5
%conv35 = sext i32 %4 to i64
%5 = load i32, ptr @K, align 4, !tbaa !5
%conv36 = sext i32 %5 to i64
%mul = mul nsw i64 %conv36, %conv35
%div = sdiv i64 %mul, 2
br label %if.end97
if.else37: ; preds = %if.else31
%6 = load i8, ptr @mimorin, align 16, !tbaa !9
%sub39 = add nsw i32 %3, -1
%idxprom40 = zext i32 %sub39 to i64
%arrayidx41 = getelementptr inbounds [128 x i8], ptr @mimorin, i64 0, i64 %idxprom40
%7 = load i8, ptr %arrayidx41, align 1, !tbaa !9
%cmp43 = icmp eq i8 %6, %7
br i1 %cmp43, label %for.cond46.preheader, label %for.body84.preheader
for.body84.preheader: ; preds = %if.else37
%wide.trip.count = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 4
br i1 %min.iters.check, label %for.body84.preheader162, label %vector.ph
vector.ph: ; preds = %for.body84.preheader
%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 ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi141 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%8 = getelementptr inbounds [128 x i32], ptr @kugyu, i64 0, i64 %index
%wide.load = load <2 x i32>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 2
%wide.load142 = load <2 x i32>, ptr %9, align 8, !tbaa !5
%10 = sdiv <2 x i32> %wide.load, <i32 2, i32 2>
%11 = sdiv <2 x i32> %wide.load142, <i32 2, i32 2>
%12 = sext <2 x i32> %10 to <2 x i64>
%13 = sext <2 x i32> %11 to <2 x i64>
%14 = add <2 x i64> %vec.phi, %12
%15 = add <2 x i64> %vec.phi141, %13
%index.next = add nuw i64 %index, 4
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %15, %14
%17 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end92, label %for.body84.preheader162
for.body84.preheader162: ; preds = %for.body84.preheader, %middle.block
%indvars.iv133.ph = phi i64 [ 0, %for.body84.preheader ], [ %n.vec, %middle.block ]
%mareitaso.1128.ph = phi i64 [ 0, %for.body84.preheader ], [ %17, %middle.block ]
br label %for.body84
for.cond46.preheader: ; preds = %if.else37
%cmp48129 = icmp ugt i32 %3, 2
br i1 %cmp48129, label %for.body50.preheader, label %for.end58
for.body50.preheader: ; preds = %for.cond46.preheader
%18 = add nsw i64 %idxprom40, -1
%min.iters.check145 = icmp ult i64 %18, 4
br i1 %min.iters.check145, label %for.body50.preheader160, label %vector.ph146
vector.ph146: ; preds = %for.body50.preheader
%n.vec148 = and i64 %18, -4
%ind.end = or i64 %n.vec148, 1
br label %vector.body151
vector.body151: ; preds = %vector.body151, %vector.ph146
%index152 = phi i64 [ 0, %vector.ph146 ], [ %index.next157, %vector.body151 ]
%vec.phi153 = phi <2 x i64> [ zeroinitializer, %vector.ph146 ], [ %25, %vector.body151 ]
%vec.phi154 = phi <2 x i64> [ zeroinitializer, %vector.ph146 ], [ %26, %vector.body151 ]
%offset.idx = or i64 %index152, 1
%19 = getelementptr inbounds [128 x i32], ptr @kugyu, i64 0, i64 %offset.idx
%wide.load155 = load <2 x i32>, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 2
%wide.load156 = load <2 x i32>, ptr %20, align 4, !tbaa !5
%21 = sdiv <2 x i32> %wide.load155, <i32 2, i32 2>
%22 = sdiv <2 x i32> %wide.load156, <i32 2, i32 2>
%23 = sext <2 x i32> %21 to <2 x i64>
%24 = sext <2 x i32> %22 to <2 x i64>
%25 = add <2 x i64> %vec.phi153, %23
%26 = add <2 x i64> %vec.phi154, %24
%index.next157 = add nuw i64 %index152, 4
%27 = icmp eq i64 %index.next157, %n.vec148
br i1 %27, label %middle.block143, label %vector.body151, !llvm.loop !15
middle.block143: ; preds = %vector.body151
%bin.rdx158 = add <2 x i64> %26, %25
%28 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx158)
%cmp.n150 = icmp eq i64 %18, %n.vec148
br i1 %cmp.n150, label %for.end58, label %for.body50.preheader160
for.body50.preheader160: ; preds = %for.body50.preheader, %middle.block143
%indvars.iv136.ph = phi i64 [ 1, %for.body50.preheader ], [ %ind.end, %middle.block143 ]
%mareitaso.0131.ph = phi i64 [ 0, %for.body50.preheader ], [ %28, %middle.block143 ]
br label %for.body50
for.body50: ; preds = %for.body50.preheader160, %for.body50
%indvars.iv136 = phi i64 [ %indvars.iv.next137, %for.body50 ], [ %indvars.iv136.ph, %for.body50.preheader160 ]
%mareitaso.0131 = phi i64 [ %add55, %for.body50 ], [ %mareitaso.0131.ph, %for.body50.preheader160 ]
%arrayidx52 = getelementptr inbounds [128 x i32], ptr @kugyu, i64 0, i64 %indvars.iv136
%29 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%div53 = sdiv i32 %29, 2
%conv54 = sext i32 %div53 to i64
%add55 = add nsw i64 %mareitaso.0131, %conv54
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%exitcond140.not = icmp eq i64 %indvars.iv.next137, %idxprom40
br i1 %exitcond140.not, label %for.end58, label %for.body50, !llvm.loop !16
for.end58: ; preds = %for.body50, %middle.block143, %for.cond46.preheader
%mareitaso.0.lcssa = phi i64 [ 0, %for.cond46.preheader ], [ %28, %middle.block143 ], [ %add55, %for.body50 ]
%30 = load i32, ptr @K, align 4, !tbaa !5
%conv59 = sext i32 %30 to i64
%mul60 = mul nsw i64 %mareitaso.0.lcssa, %conv59
%31 = load i32, ptr @kugyu, align 16, !tbaa !5
%idxprom62 = sext i32 %sub39 to i64
%arrayidx63 = getelementptr inbounds [128 x i32], ptr @kugyu, i64 0, i64 %idxprom62
%32 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%add64 = add nsw i32 %32, %31
%33 = sdiv i32 %add64, 2
%div66 = sext i32 %33 to i64
%sub67 = add nsw i32 %30, -1
%conv68 = sext i32 %sub67 to i64
%mul69 = mul nsw i64 %div66, %conv68
%div71 = sdiv i32 %31, 2
%conv72 = sext i32 %div71 to i64
%div77 = sdiv i32 %32, 2
%conv78 = sext i32 %div77 to i64
%add70 = add i64 %mul60, %conv72
%add73 = add i64 %add70, %conv78
%add79 = add i64 %add73, %mul69
br label %if.end97
for.body84: ; preds = %for.body84.preheader162, %for.body84
%indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.body84 ], [ %indvars.iv133.ph, %for.body84.preheader162 ]
%mareitaso.1128 = phi i64 [ %add89, %for.body84 ], [ %mareitaso.1128.ph, %for.body84.preheader162 ]
%arrayidx86 = getelementptr inbounds [128 x i32], ptr @kugyu, i64 0, i64 %indvars.iv133
%34 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%div87 = sdiv i32 %34, 2
%conv88 = sext i32 %div87 to i64
%add89 = add nsw i64 %mareitaso.1128, %conv88
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count
br i1 %exitcond.not, label %for.end92, label %for.body84, !llvm.loop !17
for.end92: ; preds = %for.body84, %middle.block
%add89.lcssa = phi i64 [ %17, %middle.block ], [ %add89, %for.body84 ]
%35 = load i32, ptr @K, align 4, !tbaa !5
%conv93 = sext i32 %35 to i64
%mul94 = mul nsw i64 %add89.lcssa, %conv93
br label %if.end97
if.end97: ; preds = %if.then34, %for.end92, %for.end58
%mareitaso.2 = phi i64 [ %div, %if.then34 ], [ %add79, %for.end58 ], [ %mul94, %for.end92 ]
%call98 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %mareitaso.2)
br label %cleanup
cleanup: ; preds = %if.end, %entry, %if.end97, %if.then29
%retval.0 = phi i32 [ 2, %if.then29 ], [ 0, %if.end97 ], [ 1, %entry ], [ 1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !11, !13, !14}
!16 = distinct !{!16, !11, !14, !13}
!17 = distinct !{!17, !11, !14, !13}
|
#include<stdio.h>
typedef long long int ll;
ll n,ans=0;
int dfs(ll a,ll n3,ll n5,ll n7){
if(a>n)return ans;
if(n3+n5+n7==3)ans++;
dfs(a*10+7,1,n5,n7);
dfs(a*10+5,n3,1,n7);
dfs(a*10+3,n3,n5,1);
}
int main(){
scanf("%lld",&n);
printf("%lld\n",dfs(0,0,0,0));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121265/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121265/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@ans = dso_local local_unnamed_addr global i64 0, align 8
@n = dso_local global i64 0, align 8
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i64 noundef %a, i64 noundef %n3, i64 noundef %n5, i64 noundef %n7) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp23.not = icmp slt i64 %0, %a
br i1 %cmp23.not, label %if.then, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%add = add nsw i64 %n5, %n3
%add1.peel = add nsw i64 %add, %n7
%cmp2.peel = icmp eq i64 %add1.peel, 3
br i1 %cmp2.peel, label %if.then4.peel, label %if.end5.peel
if.then4.peel: ; preds = %if.end.lr.ph
%1 = load i64, ptr @ans, align 8, !tbaa !5
%inc.peel = add nsw i64 %1, 1
store i64 %inc.peel, ptr @ans, align 8, !tbaa !5
br label %if.end5.peel
if.end5.peel: ; preds = %if.then4.peel, %if.end.lr.ph
%mul.peel = mul nsw i64 %a, 10
%add6.peel = add nsw i64 %mul.peel, 7
%call.peel = tail call i32 @dfs(i64 noundef %add6.peel, i64 noundef 1, i64 noundef %n5, i64 noundef %n7)
%add8.peel = add nsw i64 %mul.peel, 5
%call9.peel = tail call i32 @dfs(i64 noundef %add8.peel, i64 noundef %n3, i64 noundef 1, i64 noundef %n7)
%add11.peel = add nsw i64 %mul.peel, 3
%2 = load i64, ptr @n, align 8, !tbaa !5
%cmp.peel = icmp slt i64 %2, %add11.peel
br i1 %cmp.peel, label %if.then, label %if.end.peel.next
if.end.peel.next: ; preds = %if.end5.peel
%cmp2 = icmp eq i64 %add, 2
br label %if.end
if.then: ; preds = %if.end5, %if.end5.peel, %entry
%3 = load i64, ptr @ans, align 8, !tbaa !5
%conv = trunc i64 %3 to i32
%current.ret.tr22 = select i1 %cmp23.not, i32 %conv, i32 undef
ret i32 %current.ret.tr22
if.end: ; preds = %if.end.peel.next, %if.end5
%a.tr24 = phi i64 [ %add11.peel, %if.end.peel.next ], [ %add11, %if.end5 ]
br i1 %cmp2, label %if.then4, label %if.end5
if.then4: ; preds = %if.end
%4 = load i64, ptr @ans, align 8, !tbaa !5
%inc = add nsw i64 %4, 1
store i64 %inc, ptr @ans, align 8, !tbaa !5
br label %if.end5
if.end5: ; preds = %if.then4, %if.end
%mul = mul nsw i64 %a.tr24, 10
%add6 = add nsw i64 %mul, 7
%call = tail call i32 @dfs(i64 noundef %add6, i64 noundef 1, i64 noundef %n5, i64 noundef 1)
%add8 = add nsw i64 %mul, 5
%call9 = tail call i32 @dfs(i64 noundef %add8, i64 noundef %n3, i64 noundef 1, i64 noundef 1)
%add11 = add nsw i64 %mul, 3
%5 = load i64, ptr @n, align 8, !tbaa !5
%cmp = icmp slt i64 %5, %add11
br i1 %cmp, label %if.then, label %if.end, !llvm.loop !9
}
; 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)
%call1 = tail call i32 @dfs(i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0)
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1)
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
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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.peeled.count", i32 1}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int check(long p){
int c = 0;
int s[3] = {};
while(p > 0){
c = p % 10;
p = (p - c)/10;
if(c == 3){
s[0]++;
} else if(c == 5){
s[1]++;
} else if(c == 7){
s[2]++;
}
}
if(s[0] > 0 && s[1] > 0 && s[2] > 0){
return 0;
} else {
return 1;
}
}
int dfs(long k, int p, int s[3]){
int i, ret;
if(k <= p){
if(check(k) == 0){;
ret = 1;
//printf("%ld\n", k);
} else {
ret = 0;
}
for(i = 0; i < 3; i++){
ret += dfs(10*k + s[i], p, s);
}
return ret;
} else {
return 0;
}
}
int main(){
int c;
long p;
int s[3] = {3, 5, 7};
scanf("%ld", &p);
c = dfs(0, p, s);
printf("%d\n", c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121315/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121315/source.c"
target datalayout = "e-m:e-p270: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.s = private unnamed_addr constant [3 x i32] [i32 3, i32 5, i32 7], align 4
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @check(i64 noundef %p) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i64 %p, 0
br i1 %cmp41, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end16
%s.sroa.9.045 = phi i32 [ %s.sroa.9.1, %if.end16 ], [ 0, %entry ]
%s.sroa.6.044 = phi i32 [ %s.sroa.6.1, %if.end16 ], [ 0, %entry ]
%s.sroa.0.043 = phi i32 [ %s.sroa.0.1, %if.end16 ], [ 0, %entry ]
%p.addr.042 = phi i64 [ %div48, %if.end16 ], [ %p, %entry ]
%rem = urem i64 %p.addr.042, 10
%conv = trunc i64 %rem to i32
%sub = sub nuw nsw i64 %p.addr.042, %rem
%div48 = udiv i64 %p.addr.042, 10
switch i32 %conv, label %if.end16 [
i32 3, label %if.then
i32 5, label %if.then6
i32 7, label %if.then12
]
if.then: ; preds = %while.body
%inc = add nsw i32 %s.sroa.0.043, 1
br label %if.end16
if.then6: ; preds = %while.body
%inc8 = add nsw i32 %s.sroa.6.044, 1
br label %if.end16
if.then12: ; preds = %while.body
%inc14 = add nsw i32 %s.sroa.9.045, 1
br label %if.end16
if.end16: ; preds = %while.body, %if.then6, %if.then12, %if.then
%s.sroa.0.1 = phi i32 [ %inc, %if.then ], [ %s.sroa.0.043, %if.then6 ], [ %s.sroa.0.043, %if.then12 ], [ %s.sroa.0.043, %while.body ]
%s.sroa.6.1 = phi i32 [ %s.sroa.6.044, %if.then ], [ %inc8, %if.then6 ], [ %s.sroa.6.044, %if.then12 ], [ %s.sroa.6.044, %while.body ]
%s.sroa.9.1 = phi i32 [ %s.sroa.9.045, %if.then ], [ %s.sroa.9.045, %if.then6 ], [ %inc14, %if.then12 ], [ %s.sroa.9.045, %while.body ]
%cmp = icmp sgt i64 %sub, 9
br i1 %cmp, label %while.body, label %while.end.loopexit, !llvm.loop !5
while.end.loopexit: ; preds = %if.end16
%0 = icmp slt i32 %s.sroa.0.1, 1
%1 = icmp slt i32 %s.sroa.6.1, 1
%2 = select i1 %0, i1 true, i1 %1
%3 = icmp slt i32 %s.sroa.9.1, 1
%4 = select i1 %2, i1 true, i1 %3
%5 = zext i1 %4 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%s.sroa.0.0.lcssa = phi i32 [ 1, %entry ], [ %5, %while.end.loopexit ]
ret i32 %s.sroa.0.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @dfs(i64 noundef %k, i32 noundef %p, ptr nocapture noundef readonly %s) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %check.exit.thread, %entry
%accumulator.tr = phi i32 [ 0, %entry ], [ %add9.2, %check.exit.thread ]
%k.tr = phi i64 [ %k, %entry ], [ %add.2, %check.exit.thread ]
%conv = sext i32 %p to i64
%cmp.not = icmp slt i64 %conv, %k.tr
br i1 %cmp.not, label %cleanup, label %if.then
if.then: ; preds = %tailrecurse
%cmp41.i = icmp sgt i64 %k.tr, 0
br i1 %cmp41.i, label %while.body.i, label %check.exit.thread
while.body.i: ; preds = %if.then, %if.end16.i
%s.sroa.9.045.i = phi i32 [ %s.sroa.9.1.i, %if.end16.i ], [ 0, %if.then ]
%s.sroa.6.044.i = phi i32 [ %s.sroa.6.1.i, %if.end16.i ], [ 0, %if.then ]
%s.sroa.0.043.i = phi i32 [ %s.sroa.0.1.i, %if.end16.i ], [ 0, %if.then ]
%p.addr.042.i = phi i64 [ %div48.i, %if.end16.i ], [ %k.tr, %if.then ]
%rem.i = urem i64 %p.addr.042.i, 10
%conv.i = trunc i64 %rem.i to i32
%sub.i = sub nuw nsw i64 %p.addr.042.i, %rem.i
%div48.i = udiv i64 %p.addr.042.i, 10
switch i32 %conv.i, label %if.end16.i [
i32 3, label %if.then.i
i32 5, label %if.then6.i
i32 7, label %if.then12.i
]
if.then.i: ; preds = %while.body.i
%inc.i = add nsw i32 %s.sroa.0.043.i, 1
br label %if.end16.i
if.then6.i: ; preds = %while.body.i
%inc8.i = add nsw i32 %s.sroa.6.044.i, 1
br label %if.end16.i
if.then12.i: ; preds = %while.body.i
%inc14.i = add nsw i32 %s.sroa.9.045.i, 1
br label %if.end16.i
if.end16.i: ; preds = %if.then12.i, %if.then6.i, %if.then.i, %while.body.i
%s.sroa.0.1.i = phi i32 [ %inc.i, %if.then.i ], [ %s.sroa.0.043.i, %if.then6.i ], [ %s.sroa.0.043.i, %if.then12.i ], [ %s.sroa.0.043.i, %while.body.i ]
%s.sroa.6.1.i = phi i32 [ %s.sroa.6.044.i, %if.then.i ], [ %inc8.i, %if.then6.i ], [ %s.sroa.6.044.i, %if.then12.i ], [ %s.sroa.6.044.i, %while.body.i ]
%s.sroa.9.1.i = phi i32 [ %s.sroa.9.045.i, %if.then.i ], [ %s.sroa.9.045.i, %if.then6.i ], [ %inc14.i, %if.then12.i ], [ %s.sroa.9.045.i, %while.body.i ]
%cmp.i = icmp ugt i64 %sub.i, 9
br i1 %cmp.i, label %while.body.i, label %check.exit, !llvm.loop !5
check.exit: ; preds = %if.end16.i
%0 = icmp sgt i32 %s.sroa.0.1.i, 0
%1 = icmp sgt i32 %s.sroa.6.1.i, 0
%.not23 = select i1 %0, i1 %1, i1 false
%2 = icmp sgt i32 %s.sroa.9.1.i, 0
%3 = select i1 %.not23, i1 %2, i1 false
%cond.fr = freeze i1 %3
%spec.select = zext i1 %cond.fr to i32
br label %check.exit.thread
check.exit.thread: ; preds = %check.exit, %if.then
%4 = phi i32 [ 0, %if.then ], [ %spec.select, %check.exit ]
%mul = mul nsw i64 %k.tr, 10
%5 = load i32, ptr %s, align 4, !tbaa !7
%conv7 = sext i32 %5 to i64
%add = add nsw i64 %mul, %conv7
%call8 = tail call i32 @dfs(i64 noundef %add, i32 noundef %p, ptr noundef nonnull %s)
%add9 = add nsw i32 %call8, %4
%arrayidx.1 = getelementptr inbounds i32, ptr %s, i64 1
%6 = load i32, ptr %arrayidx.1, align 4, !tbaa !7
%conv7.1 = sext i32 %6 to i64
%add.1 = add nsw i64 %mul, %conv7.1
%call8.1 = tail call i32 @dfs(i64 noundef %add.1, i32 noundef %p, ptr noundef nonnull %s)
%add9.1 = add nsw i32 %call8.1, %add9
%arrayidx.2 = getelementptr inbounds i32, ptr %s, i64 2
%7 = load i32, ptr %arrayidx.2, align 4, !tbaa !7
%conv7.2 = sext i32 %7 to i64
%add.2 = add nsw i64 %mul, %conv7.2
%add9.2 = add nsw i32 %accumulator.tr, %add9.1
br label %tailrecurse
cleanup: ; preds = %tailrecurse
%accumulator.ret.tr = add nsw i32 %accumulator.tr, 0
ret i32 %accumulator.ret.tr
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%p = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p)
%0 = load i64, ptr %p, align 8, !tbaa !11
%conv = trunc i64 %0 to i32
%call1 = call i32 @dfs(i64 noundef 0, i32 noundef %conv, ptr noundef nonnull @__const.main.s)
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !9, i64 0}
|
#include <stdio.h>
int main(void){
char s[5];
scanf("%s",s);
if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]) printf("Yes");
else if(s[0]==s[2] && s[1]!=s[2] && s[1]==s[3]) printf("Yes");
else if(s[0]==s[3] && s[3]!=s[1] && s[1]==s[2]) printf("Yes");
else printf("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121359/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121359/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
%arrayidx6 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx6, align 1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%cmp8.not = icmp ne i8 %0, %2
%arrayidx13 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx13, align 1
%cmp15 = icmp eq i8 %2, %3
%or.cond = select i1 %cmp8.not, i1 %cmp15, i1 false
br i1 %or.cond, label %if.end66, label %if.else
if.else: ; preds = %entry, %land.lhs.true
%cmp22 = icmp eq i8 %0, %2
br i1 %cmp22, label %land.lhs.true24, label %if.else.if.else40_crit_edge
if.else.if.else40_crit_edge: ; preds = %if.else
%arrayidx43.phi.trans.insert = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%.pre69 = load i8, ptr %arrayidx43.phi.trans.insert, align 1, !tbaa !5
br label %if.else40
land.lhs.true24: ; preds = %if.else
%cmp29.not = icmp ne i8 %1, %0
%arrayidx34 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%4 = load i8, ptr %arrayidx34, align 1
%cmp36 = icmp eq i8 %1, %4
%or.cond67 = select i1 %cmp29.not, i1 %cmp36, i1 false
br i1 %or.cond67, label %if.end66, label %if.else40
if.else40: ; preds = %if.else.if.else40_crit_edge, %land.lhs.true24
%5 = phi i8 [ %.pre69, %if.else.if.else40_crit_edge ], [ %4, %land.lhs.true24 ]
%cmp45 = icmp eq i8 %0, %5
br i1 %cmp45, label %land.lhs.true47, label %if.else63
land.lhs.true47: ; preds = %if.else40
%cmp52.not = icmp ne i8 %0, %1
%cmp59 = icmp eq i8 %1, %2
%or.cond68 = and i1 %cmp59, %cmp52.not
br i1 %or.cond68, label %if.end66, label %if.else63
if.else63: ; preds = %land.lhs.true47, %if.else40
br label %if.end66
if.end66: ; preds = %land.lhs.true47, %land.lhs.true24, %land.lhs.true, %if.else63
%.str.1.sink = phi ptr [ @.str.2, %if.else63 ], [ @.str.1, %land.lhs.true ], [ @.str.1, %land.lhs.true24 ], [ @.str.1, %land.lhs.true47 ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink)
call void @llvm.lifetime.end.p0(i64 5, 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>
#include<stdlib.h>
#include <string.h>
int main()
{
char a,b,c,d;
scanf("%c%c%c%c",&a,&b,&c,&d);
if(a==b && b==c && c==d && a==d)
printf("No");
else if(a==c && b==d)
printf("Yes");
else if(a==d && b==c)
printf("Yes");
else if(a==b && c==d)
printf("Yes");
else
printf("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121409/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121409/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%c%c%c%c\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
%b = alloca i8, align 1
%c = alloca i8, align 1
%d = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i8, ptr %a, align 1, !tbaa !5
%1 = load i8, ptr %b, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
%.pre = load i8, ptr %c, align 1, !tbaa !5
br i1 %cmp, label %land.lhs.true, label %entry.if.else_crit_edge
entry.if.else_crit_edge: ; preds = %entry
%.pre61 = load i8, ptr %d, align 1
br label %if.else
land.lhs.true: ; preds = %entry
%cmp5 = icmp eq i8 %0, %.pre
%.pre62 = load i8, ptr %d, align 1
%cmp10 = icmp eq i8 %0, %.pre62
%or.cond = select i1 %cmp5, i1 %cmp10, i1 false
br i1 %or.cond, label %if.end57, label %if.else
if.else: ; preds = %entry.if.else_crit_edge, %land.lhs.true
%2 = phi i8 [ %.pre61, %entry.if.else_crit_edge ], [ %.pre62, %land.lhs.true ]
%cmp20 = icmp eq i8 %0, %.pre
%cmp25 = icmp eq i8 %1, %2
%or.cond58 = select i1 %cmp20, i1 %cmp25, i1 false
br i1 %or.cond58, label %if.end57, label %if.else29
if.else29: ; preds = %if.else
%cmp32 = icmp eq i8 %0, %2
%cmp37 = icmp eq i8 %1, %.pre
%or.cond59 = and i1 %cmp37, %cmp32
br i1 %or.cond59, label %if.end57, label %if.else41
if.else41: ; preds = %if.else29
%cmp49 = icmp eq i8 %.pre, %2
%or.cond60 = and i1 %cmp, %cmp49
%.str.2..str.1 = select i1 %or.cond60, ptr @.str.2, ptr @.str.1
br label %if.end57
if.end57: ; preds = %if.else41, %if.else29, %if.else, %land.lhs.true
%.str.2.sink = phi ptr [ @.str.1, %land.lhs.true ], [ @.str.2, %if.else ], [ @.str.2, %if.else29 ], [ %.str.2..str.1, %if.else41 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void) {
char s[5];
scanf("%s",s);
int t = 0;
if(s[0] == s[1]) {
if(s[0] != s[2] && s[2] == s[3]) {
t = 1;
}
}
if(s[0] == s[2]) {
if(s[0] != s[1] && s[1] == s[3]) {
t = 1;
}
}
if(s[0] == s[3]) {
if(s[0] != s[1] && s[1] == s[2]) {
t = 1;
}
}
if(t == 0) {
printf("No\n");
} else {
printf("Yes\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121452/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121452/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [5 x i8], align 1
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 i8, ptr %s, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
%arrayidx6 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx6, align 1
br i1 %cmp, label %if.then, label %if.end17
if.then: ; preds = %entry
%cmp8.not = icmp ne i8 %0, %2
%arrayidx12 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx12, align 1
%cmp14 = icmp eq i8 %2, %3
%or.cond = select i1 %cmp8.not, i1 %cmp14, i1 false
%spec.select = zext i1 %or.cond to i32
br label %if.end17
if.end17: ; preds = %entry, %if.then
%t.0 = phi i32 [ %spec.select, %if.then ], [ 0, %entry ]
%cmp22 = icmp eq i8 %0, %2
br i1 %cmp22, label %if.then24, label %if.end17.if.end40_crit_edge
if.end17.if.end40_crit_edge: ; preds = %if.end17
%arrayidx43.phi.trans.insert = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%.pre79 = load i8, ptr %arrayidx43.phi.trans.insert, align 1, !tbaa !5
br label %if.end40
if.then24: ; preds = %if.end17
%cmp29.not = icmp ne i8 %0, %1
%arrayidx34 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%4 = load i8, ptr %arrayidx34, align 1
%cmp36 = icmp eq i8 %1, %4
%or.cond71 = select i1 %cmp29.not, i1 %cmp36, i1 false
%spec.select73 = select i1 %or.cond71, i32 1, i32 %t.0
br label %if.end40
if.end40: ; preds = %if.end17.if.end40_crit_edge, %if.then24
%5 = phi i8 [ %.pre79, %if.end17.if.end40_crit_edge ], [ %4, %if.then24 ]
%t.1 = phi i32 [ %t.0, %if.end17.if.end40_crit_edge ], [ %spec.select73, %if.then24 ]
%cmp45 = icmp eq i8 %0, %5
br i1 %cmp45, label %if.then47, label %if.end63
if.then47: ; preds = %if.end40
%cmp59 = icmp ne i8 %1, %2
%or.cond72.not78 = or i1 %cmp, %cmp59
%cmp64 = icmp eq i32 %t.1, 0
%or.cond77 = select i1 %or.cond72.not78, i1 %cmp64, i1 false
br i1 %or.cond77, label %if.end69, label %if.else
if.end63: ; preds = %if.end40
%cmp64.old = icmp eq i32 %t.1, 0
br i1 %cmp64.old, label %if.end69, label %if.else
if.else: ; preds = %if.then47, %if.end63
br label %if.end69
if.end69: ; preds = %if.end63, %if.then47, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %if.then47 ], [ @str.3, %if.end63 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int n;
int x;
int k;
int q, r;
int ans=1;
int i;
scanf ("%d", &n);
scanf ("%d", &x);
k=7-x;
for(i=0; i<n; i++){
scanf ("%d%d", &q, &r);
if (q==x || q==k) ans=0;
if (r==x || r==k) ans=0;
}
if (!ans) printf ("NO\n");
else printf ("YES\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12151/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12151/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i32, align 4
%q = alloca i32, align 4
%r = 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 %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 7, %0
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %1, 0
br i1 %cmp19, label %for.body, label %if.else
for.body: ; preds = %entry, %for.body
%i.021 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%ans.020 = phi i32 [ %ans.2, %for.body ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %q, ptr noundef nonnull %r)
%2 = load i32, ptr %q, align 4, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !5
%cmp3 = icmp eq i32 %2, %3
%cmp4 = icmp eq i32 %2, %sub
%4 = load i32, ptr %r, align 4, !tbaa !5
%cmp5 = icmp eq i32 %4, %3
%cmp7 = icmp eq i32 %4, %sub
%or.cond18 = select i1 %cmp5, i1 true, i1 %cmp7
%5 = select i1 %or.cond18, i1 true, i1 %cmp3
%6 = select i1 %5, i1 true, i1 %cmp4
%ans.2 = select i1 %6, i32 0, i32 %ans.020
%inc = add nuw nsw i32 %i.021, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%8 = icmp eq i32 %ans.2, 0
br i1 %8, label %if.end13, label %if.else
if.else: ; preds = %entry, %for.end
br label %if.end13
if.end13: ; preds = %for.end, %if.else
%str.4.sink = phi ptr [ @str.4, %if.else ], [ @str, %for.end ]
%puts17 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
//#include<string.h>
int main()
{
char s[4];
int i,j,check[4],dem=0;
scanf("%s", &s);
check[0]=0;
check[1]=0;
check[2]=0;
check[3]=0;
for (i=0; i<=3; i++)
{
if (check[i]==0)
{
dem++;
check[i]=1;
}
for (j=i+1; j<4; j++)
{
if (s[j]==s[i] && check[j]==0) check[j]=1;
}
}
//printf("%d\n", dem);
if (dem!=2) printf("No");
else
{
int f1=1;
for (i=1; i<4; i++)
{
if (s[i]==s[0]) f1++;
}
//printf("%d", f1);
if (f1==2) printf("Yes");
else printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121553/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121553/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.body10.lr.ph:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx12 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx12, align 1, !tbaa !5
%cmp16.not = icmp eq i8 %1, %0
%arrayidx12.186 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx12.186, align 1, !tbaa !5
%cmp16.187 = icmp ne i8 %2, %0
%arrayidx12.293 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx12.293, align 1, !tbaa !5
%cmp16.294 = icmp ne i8 %3, %0
%dem.1.1 = select i1 %cmp16.not, i32 1, i32 2
%arrayidx14.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%4 = load i8, ptr %arrayidx14.1, align 1, !tbaa !5
%arrayidx12.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%5 = load i8, ptr %arrayidx12.1, align 1, !tbaa !5
%cmp16.1 = icmp ne i8 %5, %4
%narrow.not = select i1 %cmp16.1, i1 %cmp16.187, i1 false
%arrayidx12.1.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 3
%6 = load i8, ptr %arrayidx12.1.1, align 1, !tbaa !5
%cmp16.1.1 = icmp ne i8 %6, %4
%inc.2 = zext i1 %narrow.not to i32
%dem.1.2 = add nuw nsw i32 %dem.1.1, %inc.2
%arrayidx14.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%7 = load i8, ptr %arrayidx14.2, align 1, !tbaa !5
%arrayidx12.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 3
%8 = load i8, ptr %arrayidx12.2, align 1, !tbaa !5
%cmp16.2 = icmp ne i8 %8, %7
%9 = select i1 %cmp16.2, i1 %cmp16.1.1, i1 false
%or.cond = select i1 %9, i1 %cmp16.294, i1 false
%inc.3 = zext i1 %or.cond to i32
%dem.1.3 = add nuw nsw i32 %dem.1.2, %inc.3
%cmp30.not = icmp eq i32 %dem.1.3, 2
br i1 %cmp30.not, label %for.cond34.preheader, label %if.end58
for.cond34.preheader: ; preds = %for.body10.lr.ph
%10 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx39 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%11 = load i8, ptr %arrayidx39, align 1, !tbaa !5
%cmp43 = icmp eq i8 %11, %10
%spec.select = select i1 %cmp43, i32 2, i32 1
%arrayidx39.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%12 = load i8, ptr %arrayidx39.1, align 1, !tbaa !5
%cmp43.1 = icmp eq i8 %12, %10
%inc46.1 = zext i1 %cmp43.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc46.1
%arrayidx39.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 3
%13 = load i8, ptr %arrayidx39.2, align 1, !tbaa !5
%cmp43.2 = icmp eq i8 %13, %10
%inc46.2 = zext i1 %cmp43.2 to i32
%spec.select.2 = add nuw nsw i32 %spec.select.1, %inc46.2
%cmp51 = icmp eq i32 %spec.select.2, 2
%.str.2..str.1 = select i1 %cmp51, ptr @.str.2, ptr @.str.1
br label %if.end58
if.end58: ; preds = %for.body10.lr.ph, %for.cond34.preheader
%.str.2.sink = phi ptr [ %.str.2..str.1, %for.cond34.preheader ], [ @.str.1, %for.body10.lr.ph ]
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char s[128];
int a;
if(scanf("%s",s) == 1){};
if(s[0] == 0 || s[1] == 0 || s[2] == 0|| s[3] ==0){puts("No");return 0;}
if(s[0] == s[1] && s[0] == s[1] && s[0] == s[2]) {puts("No");return 0;}
if( (s[0] == s[1] && s[2] == s[3]) || (s[0] == s[2] && s[1] == s[3]) || (s[0] == s[3] && s[2] == s[1])){
puts("Yes");
}else{
puts("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121597/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [128 x i8], align 16
call void @llvm.lifetime.start.p0(i64 128, 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
%cmp1 = icmp eq i8 %0, 0
%arrayidx3 = getelementptr inbounds [128 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx3, align 1
%cmp5 = icmp eq i8 %1, 0
%or.cond = select i1 %cmp1, i1 true, i1 %cmp5
%arrayidx8 = getelementptr inbounds [128 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx8, align 2
%cmp10 = icmp eq i8 %2, 0
%or.cond88 = select i1 %or.cond, i1 true, i1 %cmp10
%arrayidx13 = getelementptr inbounds [128 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx13, align 1
%cmp15 = icmp eq i8 %3, 0
%or.cond89 = select i1 %or.cond88, i1 true, i1 %cmp15
br i1 %or.cond89, label %cleanup, label %if.end19
if.end19: ; preds = %entry
%cmp24 = icmp eq i8 %0, %1
%cmp37 = icmp eq i8 %0, %2
%or.cond90 = select i1 %cmp24, i1 %cmp37, i1 false
br i1 %or.cond90, label %cleanup, label %if.end41
if.end41: ; preds = %if.end19
%cmp53 = icmp eq i8 %2, %3
%or.cond91 = select i1 %cmp24, i1 %cmp53, i1 false
%cmp67 = icmp eq i8 %1, %3
%or.cond92 = select i1 %cmp37, i1 %cmp67, i1 false
%or.cond94 = select i1 %or.cond91, i1 true, i1 %or.cond92
br i1 %or.cond94, label %cleanup, label %lor.lhs.false69
lor.lhs.false69: ; preds = %if.end41
%cmp74 = icmp eq i8 %0, %3
%cmp81 = icmp eq i8 %2, %1
%or.cond93 = select i1 %cmp74, i1 %cmp81, i1 false
%spec.select = select i1 %or.cond93, ptr @.str.2, ptr @.str.1
br label %cleanup
cleanup: ; preds = %lor.lhs.false69, %if.end41, %if.end19, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %if.end19 ], [ @.str.2, %if.end41 ], [ %spec.select, %lor.lhs.false69 ]
%call84 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
char input[5];
memset(input, '\0', sizeof(input));
int counter[4];
memset(counter, 0, sizeof(counter));
int full_counter = 0;
scanf("%s", &input);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (input[i] == input[j]) {
counter[i] += 1;
}
}
}
full_counter = counter[3] + counter[2] + counter[1] + counter[0];
if (full_counter == 8) {
printf("Yes");
} else{ printf("No"); }
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121647/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121647/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.inc:
%input = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %input) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %input, i8 0, i64 5, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i8, ptr %input, align 1, !tbaa !5
%arrayidx7.1 = getelementptr inbounds [5 x i8], ptr %input, i64 0, i64 1
%1 = load i8, ptr %arrayidx7.1, align 1, !tbaa !5
%cmp9.1 = icmp eq i8 %0, %1
%spec.select = select i1 %cmp9.1, i32 2, i32 1
%arrayidx7.2 = getelementptr inbounds [5 x i8], ptr %input, i64 0, i64 2
%2 = load i8, ptr %arrayidx7.2, align 1, !tbaa !5
%cmp9.2 = icmp eq i8 %0, %2
%add.2 = zext i1 %cmp9.2 to i32
%counter.sroa.0.2 = add nuw nsw i32 %spec.select, %add.2
%arrayidx7.3 = getelementptr inbounds [5 x i8], ptr %input, i64 0, i64 3
%3 = load i8, ptr %arrayidx7.3, align 1, !tbaa !5
%cmp9.3 = icmp eq i8 %0, %3
%add.3 = zext i1 %cmp9.3 to i32
%counter.sroa.0.3 = add nuw nsw i32 %counter.sroa.0.2, %add.3
%counter.sroa.12.0 = select i1 %cmp9.1, i32 2, i32 1
%cmp9.2.1 = icmp eq i8 %1, %2
%add.2.1 = zext i1 %cmp9.2.1 to i32
%counter.sroa.12.2 = add nuw nsw i32 %counter.sroa.12.0, %add.2.1
%cmp9.3.1 = icmp eq i8 %1, %3
%add.3.1 = zext i1 %cmp9.3.1 to i32
%counter.sroa.12.3 = add nuw nsw i32 %counter.sroa.12.2, %add.3.1
%counter.sroa.21.0 = zext i1 %cmp9.2 to i32
%add.1.2 = select i1 %cmp9.2, i32 2, i32 1
%counter.sroa.21.1 = select i1 %cmp9.2.1, i32 %add.1.2, i32 %counter.sroa.21.0
%cmp9.3.2 = icmp eq i8 %2, %3
%counter.sroa.21.3.v = select i1 %cmp9.3.2, i32 2, i32 1
%counter.sroa.21.3 = add nuw nsw i32 %counter.sroa.21.1, %counter.sroa.21.3.v
%counter.sroa.30.0 = zext i1 %cmp9.3 to i32
%add.1.3 = select i1 %cmp9.3, i32 2, i32 1
%counter.sroa.30.1 = select i1 %cmp9.3.1, i32 %add.1.3, i32 %counter.sroa.30.0
%add.2.3 = zext i1 %cmp9.3.2 to i32
%counter.sroa.30.2 = add nuw nsw i32 %counter.sroa.30.1, %add.2.3
%add.3.3 = add nuw nsw i32 %counter.sroa.30.2, 1
%add18 = add nuw nsw i32 %counter.sroa.21.3, %add.3.3
%add20 = add nuw nsw i32 %add18, %counter.sroa.12.3
%add22 = add nuw nsw i32 %add20, %counter.sroa.0.3
%cmp23 = icmp eq i32 %add22, 8
%.str.2.sink = select i1 %cmp23, ptr @.str.1, ptr @.str.2
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %input) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
//AtCoder用
//プリプロセッサ系
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
#define INFTY 2147483646
#define DEBUG 1
#define END printf("\n");return 0;
#define QS09(how_data,data) qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_09);
#define QS90(how_data,data) qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_90);
//↓この2つはCE対策のために適当にdefineしてるだけだから使う際は「構造体クイックソート設定」をコピペ
#define ST_NAME _GD
#define KEY_NAME how_vertex
#define ST09(how_data,data) qsort(data,how_data,sizeof(ST_NAME),(int (*)(const void *,const void *))qsort_st09);
#define ST90(how_data,data) qsort(data,how_data,sizeof(ST_NAME),(int (*)(const void *,const void *))qsort_st90);
#define In(a) long a;scanf("%ld",&a);
#define Out(a) printf("%ld\n",a);
#define dprintf if(DEBUG)printf
#define ifdebug if(DEBUG)
#define MAKE_ARRAY_DATA In(how_data);long data[how_data];input_array(how_data,data);
#define update_max(a,b) a=(a>b?a:b);
#define update_min(a,b) a=(a<b?a:b);
#define input_long(A) int A;scanf("%d",&A)
//構造体クイックソート設定 使用時はmainに以下をコピペ、ST_NAMEとKEY_NAMEを書き換え
/*
#undef ST_NAME
#undef KEY_NAME
#define ST_NAME _GD
#define KEY_NAME how_vertex
ST09(how_data,data);
*/
//関数
void input_array(long how_data,long *data); //配列の入力
void output_array(long how_data,long *data); //配列の出力
void input_array2(long first , long second , long data[][3]); //2次元配列の入力
void format_array(long how_data ,long *data,long what); //配列初期化
long get_random(long min, long max); //min~max範囲の乱数生成
long factorial(long n); //n!
long fibonacci(long n); //n番目のフィボナッチ
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);
int qsort_st09(const void *c1, const void *c2);
int qsort_st90(const void *c1, const void *c2);
long sel_max(long a , long b);
long sel_min(long a , long b);
long array_max(long how_data,long *data);
long array_min(long how_data,long *data);
long array_search(long how_data,long *data,long what);
long can_DP(long how_data,long *data,long how_can,bool *can);
long array_sum(long how_data,long *data);
long Leven_dist(char *now , char *target);
long get_digit(long target);
long rounding(double target);
long roundingdown(double target);
long roundingup(double target);
long ncr(long n , long r);
long npr(long n , long r);
long nhr(long n , long r);
int fifw(long add,long *data);
long fifr(long *data);
void GRAPH_input(void);
void GRAPH_dfs(long now);
bool check_prime(long target);
long get_lcm(long a,long b);
long get_gcd(long a,long b);
void digit_cut(int how_data,char *s,int *i); //文字列として与えられた数列を1桁ずつ分割
//グローバル変数一覧
long fifo[1000]={0};//fifo[0]はデータ件数
long loop1,loop2,loop3,loop4,loop5;
long g_ans=0; //answerグローバル変数用
typedef struct{
long how_vertex;
long how_edge;
long edge_data[1000][2];
bool aleady_searched_vertex[500];
bool all_searched;
} _GD;//GraphData
_GD GRAPH={0,0,{{0}},{0},0};
char c_temp;
//loop5 loop4 loop3 loop2 loop1 input_long
//--------------ここから
int main(void){
char s[5];
scanf("%s",s);
//AABB ABBA ABABのパターンのみ
if(((s[0]==s[1])&&(s[2]==s[3])&&(s[1]!=s[2])) || ((s[0]==s[3])&&(s[1]==s[2])&&(s[0]!=s[1]))|| ((s[0]==s[2])&&(s[1]==s[3])&&(s[0]!=s[1]))){
printf("Yes");
}else{
printf("No");
}
END;
}
//--------------ここまで
void input_array(long how_data,long *data){
long loop;
for(loop=0;loop<how_data;loop++){
scanf("%ld",&data[loop]);
}
return ;
}
void output_array(long how_data,long *data){
long loop;
for(loop=0;loop<how_data;loop++){
printf("%ld ",data[loop]);
}
printf("\n");
return ;
}
void input_array2(long first,long second,long data[][3]){
long loopA,loopB;
for(loopA=0;loopA<first;loopA++){
for(loopB=0;loopB<second;loopB++){
scanf("%ld",&data[loopA][loopB]);
}
}
return ;
}
void format_array(long how_data ,long *data,long what){
long loopA;
for(loopA=0;loopA<how_data;loopA++){
data[loopA]=what;
}
return ;
}
long get_random(long min, long max){ //指定の範囲から乱数を1つ返すやつ
//srand((unsigned int)time(0)); //現在時刻で疑似乱数初期化
rand();rand();rand();rand(); //乱数を空打ち
return (rand()%(max+1-min))+min;
}
long factorial(long n){//n!のMOD10^9+7を返すやつ
unsigned long long int ret=1;
for(long i=1;i<=n;i++)ret=(ret*i)%1000000007;
return (long)ret;
}
int qsort_09(const int *sys1 , const int *sys2){ //小さいのが上にくるやつ
//qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_09);
if(*sys1<*sys2){
return -1;
}else if(*sys1==*sys2){
return 0;
}else{
return 1;
}
}
int qsort_90(const int *sys1, const int *sys2){ //大きいのが上にくるやつ
//qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_90);
if(*sys1<*sys2){
return 1;
}else if(*sys1==*sys2){
return 0;
}else{
return -1;
}
}
int qsort_st09(const void *c1, const void *c2){
ST_NAME hikaku1= *(ST_NAME *)c1;
ST_NAME hikaku2= *(ST_NAME *)c2;
return hikaku1.KEY_NAME - hikaku2.KEY_NAME;
}
int qsort_st90(const void *c1, const void *c2){
ST_NAME hikaku1= *(ST_NAME *)c1;
ST_NAME hikaku2= *(ST_NAME *)c2;
return hikaku2.KEY_NAME - hikaku1.KEY_NAME;
}
long fibonacci(long n){
switch(n){
case 0:return 0;
case 1:return 1;
default :return fibonacci(n-1)+fibonacci(n-2);
}
}
long sel_max(long a,long b){
if(a>b)return a;
return b;
}
long sel_min(long a,long b){
if(a>b)return b;
return a;
}
long can_DP(long how_data,long *data,long how_can,bool *can){//Typical DP Contest A
//data内で組み合わせられる和をcanに0 or 1で入れる
//返り値はパターン数
long loopA,loopB;
long ret=0;
for(loopA=0;loopA<how_can;loopA++){//初期化
can[loopA]=0;
}
can[0]=1;//絶対にありえる
for(loopA=0;loopA<how_data;loopA++){
for(loopB=how_can-1;loopB>=0;loopB--){
if(can[loopB]==1 && loopB+data[loopA]<how_can){
can[loopB+data[loopA]]=1;
}
}
}
for(loopA=0;loopA<how_can;loopA++){
if(can[loopA]==1){
ret++;
}
}
return ret;
}
long array_max(long how_data,long *data){
long loop;
long ret=data[0];
for(loop=0;loop<how_data;loop++){
if(ret<data[loop])ret=data[loop];
}
return ret;
}
long array_min(long how_data,long *data){
long loop;
long ret=data[0];
for(loop=0;loop<how_data;loop++){
if(ret>data[loop])ret=data[loop];
}
return ret;
}
long array_sum(long how_data,long *data){
long ret=0;
long loop;
for(loop=0;loop<how_data;loop++){
ret+=data[loop];
}
return ret;
}
long array_search(long how_data,long *data,long what){
long loop;
for(loop=0;loop<how_data;loop++){
if(data[loop]==what){
return loop;
}
}
return -1;
}
long Leven_dist(char *now , char *target){
long loopA,loopB;
//レーベンシュタイン距離を求める
// 参考文献
// http://nw.tsuda.ac.jp/class/algoB/c13.html (アルゴリズム理解)
// http://d.hatena.ne.jp/ohnishiakira/20090809/1249845529 (実装)
long len_now=strlen(now)+1;
long len_target=strlen(target)+1;
long d[len_now][len_target]; //計算用
for(loopA=0;loopA<len_now;loopA++) d[loopA][0]=loopA;
for(loopA=0;loopA<len_target;loopA++) d[0][loopA]=loopA;
for(loopA=1;loopA<len_now;loopA++){
for(loopB=1;loopB<len_target;loopB++){
long cost=(now[loopA-1]==target[loopB-1] ? 0:1);
d[loopA][loopB]=sel_min(sel_min(d[loopA-1][loopB]+1,d[loopA][loopB-1]+1),d[loopA-1][loopB-1]+cost);
}
}
return d[len_now-1][len_target-1];
}
long get_digit(long target){
return (long)(log10(target)+1);
}
long ncr(long n , long r){
//パスカルの三角形
long loopA,loopB;
long pascal[100][102]={{0}};
pascal[1][0]=1;
pascal[1][1]=1;
for(loopA=2;loopA<100;loopA++){
pascal[loopA][0]=1;
for(loopB=1;loopB<loopA;loopB++){
pascal[loopA][loopB]=pascal[loopA-1][loopB-1]+pascal[loopA-1][loopB];
}
pascal[loopA][loopA]=1;
}
return pascal[n][r];
}
long npr(long n, long r){
return ncr(n,r)*factorial(r);
}
long nhr(long n , long r){
return ncr(n+r-1,r);
}
long rounding(double target){
return (long)target+0.50;
}
long roundingup(double target){
return (long)ceil(target);
}
long roundingdown(double target){
return (long)floor(target);
}
int fifw(long add,long *data){
data[data[0]+1]=add;
data[0]++;
return data[0]; //現在のデータ件数を返す
}
long fifr(long *data){
long ret=data[1];
data[0]--;
for(int i=1;i<999;i++){
data[i]=data[i+1];
}
return ret;
}
void GRAPH_input(void){
scanf("%ld %ld\n",&GRAPH.how_vertex,&GRAPH.how_edge);
for(long loopA=0;loopA<GRAPH.how_edge;loopA++){
scanf("%ld %ld\n",&GRAPH.edge_data[loopA][0],&GRAPH.edge_data[loopA][1]);
}
return;
}
void GRAPH_dfs(long now){
GRAPH.aleady_searched_vertex[now]=1;
for(int loopA=0;loopA<GRAPH.how_edge;loopA++){
if(GRAPH.edge_data[loopA][0]==now && GRAPH.aleady_searched_vertex[GRAPH.edge_data[loopA][1]]==0){
GRAPH_dfs(GRAPH.edge_data[loopA][1]);
}
if(GRAPH.edge_data[loopA][1]==now && GRAPH.aleady_searched_vertex[GRAPH.edge_data[loopA][0]]==0){
GRAPH_dfs(GRAPH.edge_data[loopA][0]);
}
}
return ;
}
bool check_prime(long target){//素数判定、素数なら1
if(target==2)return 1;
if(target<=1 || target%2==0)return 0;
for(int loopA=3;loopA<=sqrt(target)+1;loopA+=2)if(target%loopA==0)return 0;
return 1;
}
long get_lcm(long a,long b){//最小公倍数
return (a*b)/get_gcd(a,b);
}
long get_gcd(long a,long b){//最大公約数 参考:https://webkaru.net/clang/find-gcd-of-two-number/
// a>b
if(a<b){
int tem=a;
a=b;
b=tem;
}
long r=a%b;
while(r!=0){
a=b;
b=r;
r=a%b;
}
return b;
}
void digit_cut(int how_data,char *s,int *i){
for(int loopA=0;loopA<how_data;loopA++){
i[loopA]=atoi(&s[loopA]);
}
return ;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121698/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121698/source.c"
target datalayout = "e-m:e-p270: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._GD = type { i64, i64, [1000 x [2 x i64]], [500 x i8], i8 }
@fifo = dso_local local_unnamed_addr global [1000 x i64] zeroinitializer, align 16
@g_ans = dso_local local_unnamed_addr global i64 0, align 8
@GRAPH = dso_local global %struct._GD zeroinitializer, align 8
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%ld \00", align 1
@.str.6 = private unnamed_addr constant [9 x i8] c"%ld %ld\0A\00", align 1
@loop1 = dso_local local_unnamed_addr global i64 0, align 8
@loop2 = dso_local local_unnamed_addr global i64 0, align 8
@loop3 = dso_local local_unnamed_addr global i64 0, align 8
@loop4 = dso_local local_unnamed_addr global i64 0, align 8
@loop5 = dso_local local_unnamed_addr global i64 0, align 8
@c_temp = dso_local local_unnamed_addr global i8 0, align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #28
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %entry.lor.lhs.false_crit_edge
entry.lor.lhs.false_crit_edge: ; preds = %entry
%arrayidx19.phi.trans.insert = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%.pre = load i8, ptr %arrayidx19.phi.trans.insert, align 1, !tbaa !5
br label %lor.lhs.false
land.lhs.true: ; preds = %entry
%arrayidx4 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%arrayidx6 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8 = icmp ne i8 %2, %3
%cmp15.not = icmp eq i8 %0, %2
%or.cond = or i1 %cmp15.not, %cmp8
br i1 %or.cond, label %lor.lhs.false, label %if.end
lor.lhs.false: ; preds = %entry.lor.lhs.false_crit_edge, %land.lhs.true
%4 = phi i8 [ %.pre, %entry.lor.lhs.false_crit_edge ], [ %3, %land.lhs.true ]
%cmp21 = icmp ne i8 %0, %4
%arrayidx26 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%5 = load i8, ptr %arrayidx26, align 1, !tbaa !5
%cmp28 = icmp ne i8 %1, %5
%or.cond61 = or i1 %cmp, %cmp28
%or.cond65 = select i1 %cmp21, i1 true, i1 %or.cond61
br i1 %or.cond65, label %lor.lhs.false37, label %if.end
lor.lhs.false37: ; preds = %lor.lhs.false
%cmp42 = icmp ne i8 %0, %5
%cmp49 = icmp ne i8 %1, %4
%6 = or i1 %cmp49, %cmp42
%or.cond63 = or i1 %cmp, %6
%spec.select = select i1 %or.cond63, ptr @.str.2, ptr @.str.1
br label %if.end
if.end: ; preds = %lor.lhs.false37, %land.lhs.true, %lor.lhs.false
%.str.2.sink = phi ptr [ @.str.1, %lor.lhs.false ], [ @.str.1, %land.lhs.true ], [ %spec.select, %lor.lhs.false37 ]
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #28
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 uwtable
define dso_local void @input_array(i64 noundef %how_data, ptr noundef %data) local_unnamed_addr #0 {
entry:
%cmp3 = icmp sgt i64 %how_data, 0
br i1 %cmp3, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%loop.04 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.04
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %arrayidx)
%inc = add nuw nsw i64 %loop.04, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @output_array(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i64 %how_data, 0
br i1 %cmp4, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%loop.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.05
%0 = load i64, ptr %arrayidx, align 8, !tbaa !10
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %0)
%inc = add nuw nsw i64 %loop.05, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @input_array2(i64 noundef %first, i64 noundef %second, ptr noundef %data) local_unnamed_addr #0 {
entry:
%cmp14 = icmp sgt i64 %first, 0
%cmp212 = icmp sgt i64 %second, 0
%or.cond = and i1 %cmp14, %cmp212
br i1 %or.cond, label %for.cond1.preheader.us, label %for.end7
for.cond1.preheader.us: ; preds = %entry, %for.cond1.for.inc5_crit_edge.us
%loopA.015.us = phi i64 [ %inc6.us, %for.cond1.for.inc5_crit_edge.us ], [ 0, %entry ]
br label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.body3.us
%loopB.013.us = phi i64 [ 0, %for.cond1.preheader.us ], [ %inc.us, %for.body3.us ]
%arrayidx4.us = getelementptr inbounds [3 x i64], ptr %data, i64 %loopA.015.us, i64 %loopB.013.us
%call.us = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %arrayidx4.us)
%inc.us = add nuw nsw i64 %loopB.013.us, 1
%exitcond.not = icmp eq i64 %inc.us, %second
br i1 %exitcond.not, label %for.cond1.for.inc5_crit_edge.us, label %for.body3.us, !llvm.loop !13
for.cond1.for.inc5_crit_edge.us: ; preds = %for.body3.us
%inc6.us = add nuw nsw i64 %loopA.015.us, 1
%exitcond17.not = icmp eq i64 %inc6.us, %first
br i1 %exitcond17.not, label %for.end7, label %for.cond1.preheader.us, !llvm.loop !14
for.end7: ; preds = %for.cond1.for.inc5_crit_edge.us, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @format_array(i64 noundef %how_data, ptr nocapture noundef writeonly %data, i64 noundef %what) local_unnamed_addr #3 {
entry:
%cmp3 = icmp sgt i64 %how_data, 0
br i1 %cmp3, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader5, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %what, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%0 = getelementptr inbounds i64, ptr %data, i64 %index
store <2 x i64> %broadcast.splat, ptr %0, align 8, !tbaa !10
%1 = getelementptr inbounds i64, ptr %0, i64 2
store <2 x i64> %broadcast.splat, ptr %1, align 8, !tbaa !10
%index.next = add nuw i64 %index, 4
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader5
for.body.preheader5: ; preds = %for.body.preheader, %middle.block
%loopA.04.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader5, %for.body
%loopA.04 = phi i64 [ %inc, %for.body ], [ %loopA.04.ph, %for.body.preheader5 ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loopA.04
store i64 %what, ptr %arrayidx, align 8, !tbaa !10
%inc = add nuw nsw i64 %loopA.04, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !18
for.end: ; preds = %for.body, %middle.block, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i64 @get_random(i64 noundef %min, i64 noundef %max) local_unnamed_addr #4 {
entry:
%call = tail call i32 @rand() #28
%call1 = tail call i32 @rand() #28
%call2 = tail call i32 @rand() #28
%call3 = tail call i32 @rand() #28
%call4 = tail call i32 @rand() #28
%conv = sext i32 %call4 to i64
%reass.sub = sub i64 %max, %min
%sub = add i64 %reass.sub, 1
%rem = srem i64 %conv, %sub
%add5 = add nsw i64 %rem, %min
ret i64 %add5
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #5
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @factorial(i64 noundef %n) local_unnamed_addr #6 {
entry:
%cmp.not4 = icmp slt i64 %n, 1
br i1 %cmp.not4, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %n, 3
%0 = icmp ult i64 %n, 4
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 %n, -4
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%rem.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %rem.3, %for.body ]
%i.06.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.3, %for.body ]
%ret.05.unr = phi i64 [ 1, %for.body.preheader ], [ %rem.3, %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
%i.06.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.06.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%ret.05.epil = phi i64 [ %rem.epil, %for.body.epil ], [ %ret.05.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 i64 %i.06.epil, %ret.05.epil
%rem.epil = urem i64 %mul.epil, 1000000007
%inc.epil = add nuw i64 %i.06.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !19
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%ret.0.lcssa = phi i64 [ 1, %entry ], [ %rem.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %rem.epil, %for.body.epil ]
ret i64 %ret.0.lcssa
for.body: ; preds = %for.body, %for.body.preheader.new
%i.06 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.3, %for.body ]
%ret.05 = phi i64 [ 1, %for.body.preheader.new ], [ %rem.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%mul = mul i64 %i.06, %ret.05
%rem = urem i64 %mul, 1000000007
%inc = add nuw nsw i64 %i.06, 1
%mul.1 = mul i64 %inc, %rem
%rem.1 = urem i64 %mul.1, 1000000007
%inc.1 = add nuw nsw i64 %i.06, 2
%mul.2 = mul i64 %inc.1, %rem.1
%rem.2 = urem i64 %mul.2, 1000000007
%inc.2 = add nuw i64 %i.06, 3
%mul.3 = mul i64 %inc.2, %rem.2
%rem.3 = urem i64 %mul.3, 1000000007
%inc.3 = add nuw i64 %i.06, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qsort_09(ptr nocapture noundef readonly %sys1, ptr nocapture noundef readonly %sys2) local_unnamed_addr #7 {
entry:
%0 = load i32, ptr %sys1, align 4, !tbaa !22
%1 = load i32, ptr %sys2, align 4, !tbaa !22
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qsort_90(ptr nocapture noundef readonly %sys1, ptr nocapture noundef readonly %sys2) local_unnamed_addr #7 {
entry:
%0 = load i32, ptr %sys1, align 4, !tbaa !22
%1 = load i32, ptr %sys2, align 4, !tbaa !22
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qsort_st09(ptr nocapture noundef readonly %c1, ptr nocapture noundef readonly %c2) local_unnamed_addr #7 {
entry:
%hikaku1.sroa.0.0.copyload = load i64, ptr %c1, align 8, !tbaa.struct !24
%hikaku2.sroa.0.0.copyload = load i64, ptr %c2, align 8, !tbaa.struct !24
%sub = sub nsw i64 %hikaku1.sroa.0.0.copyload, %hikaku2.sroa.0.0.copyload
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qsort_st90(ptr nocapture noundef readonly %c1, ptr nocapture noundef readonly %c2) local_unnamed_addr #7 {
entry:
%hikaku1.sroa.0.0.copyload = load i64, ptr %c1, align 8, !tbaa.struct !24
%hikaku2.sroa.0.0.copyload = load i64, ptr %c2, align 8, !tbaa.struct !24
%sub = sub nsw i64 %hikaku2.sroa.0.0.copyload, %hikaku1.sroa.0.0.copyload
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @fibonacci(i64 noundef %n) local_unnamed_addr #8 {
entry:
%switch13 = icmp ult i64 %n, 2
br i1 %switch13, label %return, label %sw.default
sw.default: ; preds = %entry, %sw.default
%n.tr15 = phi i64 [ %sub2, %sw.default ], [ %n, %entry ]
%accumulator.tr14 = phi i64 [ %add, %sw.default ], [ 0, %entry ]
%sub = add nsw i64 %n.tr15, -1
%call = tail call i64 @fibonacci(i64 noundef %sub)
%sub2 = add nsw i64 %n.tr15, -2
%add = add nsw i64 %call, %accumulator.tr14
%switch = icmp ult i64 %sub2, 2
br i1 %switch, label %return, label %sw.default
return: ; preds = %sw.default, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %sw.default ]
%n.tr.lcssa = phi i64 [ %n, %entry ], [ %sub2, %sw.default ]
%accumulator.ret.tr = add nsw i64 %n.tr.lcssa, %accumulator.tr.lcssa
ret i64 %accumulator.ret.tr
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sel_max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #9 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sel_min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #9 {
entry:
%b.a = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %b.a
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i64 @can_DP(i64 noundef %how_data, ptr nocapture noundef readonly %data, i64 noundef %how_can, ptr nocapture noundef %can) local_unnamed_addr #10 {
entry:
%cmp59 = icmp sgt i64 %how_can, 0
br i1 %cmp59, label %for.end, label %for.end.thread
for.end: ; preds = %entry
tail call void @llvm.memset.p0.i64(ptr align 1 %can, i8 0, i64 %how_can, i1 false), !tbaa !25
store i8 1, ptr %can, align 1, !tbaa !25
%cmp364 = icmp sgt i64 %how_data, 0
br i1 %cmp364, label %for.cond5.preheader.us.preheader, label %for.cond22.preheader
for.cond5.preheader.us.preheader: ; preds = %for.end
%xtraiter = and i64 %how_can, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%loopB.063.us.prol = add nsw i64 %how_can, -1
%arrayidx8.us.prol = getelementptr inbounds i8, ptr %can, i64 %loopB.063.us.prol
%0 = icmp eq i64 %how_can, 1
br label %for.cond5.preheader.us
for.end.thread: ; preds = %entry
store i8 1, ptr %can, align 1, !tbaa !25
br label %for.end36
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.inc19_crit_edge.us
%loopA.165.us = phi i64 [ %inc20.us, %for.cond5.for.inc19_crit_edge.us ], [ 0, %for.cond5.preheader.us.preheader ]
%arrayidx11.us = getelementptr inbounds i64, ptr %data, i64 %loopA.165.us
br i1 %lcmp.mod.not, label %for.body7.us.prol.loopexit, label %for.body7.us.prol
for.body7.us.prol: ; preds = %for.cond5.preheader.us
%1 = load i8, ptr %arrayidx8.us.prol, align 1, !tbaa !25, !range !27, !noundef !28
%tobool.not.us.prol = icmp eq i8 %1, 0
br i1 %tobool.not.us.prol, label %for.body7.us.prol.loopexit, label %land.lhs.true.us.prol
land.lhs.true.us.prol: ; preds = %for.body7.us.prol
%2 = load i64, ptr %arrayidx11.us, align 8, !tbaa !10
%add.us.prol = add nsw i64 %2, %loopB.063.us.prol
%cmp12.us.prol = icmp slt i64 %add.us.prol, %how_can
br i1 %cmp12.us.prol, label %if.then.us.prol, label %for.body7.us.prol.loopexit
if.then.us.prol: ; preds = %land.lhs.true.us.prol
%arrayidx16.us.prol = getelementptr inbounds i8, ptr %can, i64 %add.us.prol
store i8 1, ptr %arrayidx16.us.prol, align 1, !tbaa !25
br label %for.body7.us.prol.loopexit
for.body7.us.prol.loopexit: ; preds = %for.body7.us.prol, %land.lhs.true.us.prol, %if.then.us.prol, %for.cond5.preheader.us
%loopB.063.us.in.unr = phi i64 [ %how_can, %for.cond5.preheader.us ], [ %loopB.063.us.prol, %if.then.us.prol ], [ %loopB.063.us.prol, %land.lhs.true.us.prol ], [ %loopB.063.us.prol, %for.body7.us.prol ]
br i1 %0, label %for.cond5.for.inc19_crit_edge.us, label %for.body7.us
for.body7.us: ; preds = %for.body7.us.prol.loopexit, %for.inc17.us.1
%loopB.063.us.in = phi i64 [ %loopB.063.us.1, %for.inc17.us.1 ], [ %loopB.063.us.in.unr, %for.body7.us.prol.loopexit ]
%loopB.063.us = add nsw i64 %loopB.063.us.in, -1
%arrayidx8.us = getelementptr inbounds i8, ptr %can, i64 %loopB.063.us
%3 = load i8, ptr %arrayidx8.us, align 1, !tbaa !25, !range !27, !noundef !28
%tobool.not.us = icmp eq i8 %3, 0
br i1 %tobool.not.us, label %for.inc17.us, label %land.lhs.true.us
land.lhs.true.us: ; preds = %for.body7.us
%4 = load i64, ptr %arrayidx11.us, align 8, !tbaa !10
%add.us = add nsw i64 %4, %loopB.063.us
%cmp12.us = icmp slt i64 %add.us, %how_can
br i1 %cmp12.us, label %if.then.us, label %for.inc17.us
if.then.us: ; preds = %land.lhs.true.us
%arrayidx16.us = getelementptr inbounds i8, ptr %can, i64 %add.us
store i8 1, ptr %arrayidx16.us, align 1, !tbaa !25
br label %for.inc17.us
for.inc17.us: ; preds = %if.then.us, %land.lhs.true.us, %for.body7.us
%loopB.063.us.1 = add nsw i64 %loopB.063.us.in, -2
%arrayidx8.us.1 = getelementptr inbounds i8, ptr %can, i64 %loopB.063.us.1
%5 = load i8, ptr %arrayidx8.us.1, align 1, !tbaa !25, !range !27, !noundef !28
%tobool.not.us.1 = icmp eq i8 %5, 0
br i1 %tobool.not.us.1, label %for.inc17.us.1, label %land.lhs.true.us.1
land.lhs.true.us.1: ; preds = %for.inc17.us
%6 = load i64, ptr %arrayidx11.us, align 8, !tbaa !10
%add.us.1 = add nsw i64 %6, %loopB.063.us.1
%cmp12.us.1 = icmp slt i64 %add.us.1, %how_can
br i1 %cmp12.us.1, label %if.then.us.1, label %for.inc17.us.1
if.then.us.1: ; preds = %land.lhs.true.us.1
%arrayidx16.us.1 = getelementptr inbounds i8, ptr %can, i64 %add.us.1
store i8 1, ptr %arrayidx16.us.1, align 1, !tbaa !25
br label %for.inc17.us.1
for.inc17.us.1: ; preds = %if.then.us.1, %land.lhs.true.us.1, %for.inc17.us
%cmp6.us.1 = icmp sgt i64 %loopB.063.us.in, 2
br i1 %cmp6.us.1, label %for.body7.us, label %for.cond5.for.inc19_crit_edge.us, !llvm.loop !29
for.cond5.for.inc19_crit_edge.us: ; preds = %for.inc17.us.1, %for.body7.us.prol.loopexit
%inc20.us = add nuw nsw i64 %loopA.165.us, 1
%exitcond.not = icmp eq i64 %inc20.us, %how_data
br i1 %exitcond.not, label %for.cond22.preheader, label %for.cond5.preheader.us, !llvm.loop !30
for.cond22.preheader: ; preds = %for.cond5.for.inc19_crit_edge.us, %for.end
br i1 %cmp59, label %for.body25.preheader, label %for.end36
for.body25.preheader: ; preds = %for.cond22.preheader
%xtraiter72 = and i64 %how_can, 7
%7 = icmp ult i64 %how_can, 8
br i1 %7, label %for.end36.loopexit.unr-lcssa, label %for.body25.preheader.new
for.body25.preheader.new: ; preds = %for.body25.preheader
%unroll_iter = and i64 %how_can, -8
br label %for.body25
for.body25: ; preds = %for.body25, %for.body25.preheader.new
%ret.068 = phi i64 [ 0, %for.body25.preheader.new ], [ %spec.select.7, %for.body25 ]
%loopA.267 = phi i64 [ 0, %for.body25.preheader.new ], [ %inc35.7, %for.body25 ]
%niter = phi i64 [ 0, %for.body25.preheader.new ], [ %niter.next.7, %for.body25 ]
%arrayidx26 = getelementptr inbounds i8, ptr %can, i64 %loopA.267
%8 = load i8, ptr %arrayidx26, align 1, !tbaa !25, !range !27, !noundef !28
%inc32 = zext i8 %8 to i64
%spec.select = add nuw nsw i64 %ret.068, %inc32
%inc35 = or i64 %loopA.267, 1
%arrayidx26.1 = getelementptr inbounds i8, ptr %can, i64 %inc35
%9 = load i8, ptr %arrayidx26.1, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.1 = zext i8 %9 to i64
%spec.select.1 = add nuw nsw i64 %spec.select, %inc32.1
%inc35.1 = or i64 %loopA.267, 2
%arrayidx26.2 = getelementptr inbounds i8, ptr %can, i64 %inc35.1
%10 = load i8, ptr %arrayidx26.2, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.2 = zext i8 %10 to i64
%spec.select.2 = add nuw nsw i64 %spec.select.1, %inc32.2
%inc35.2 = or i64 %loopA.267, 3
%arrayidx26.3 = getelementptr inbounds i8, ptr %can, i64 %inc35.2
%11 = load i8, ptr %arrayidx26.3, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.3 = zext i8 %11 to i64
%spec.select.3 = add nuw nsw i64 %spec.select.2, %inc32.3
%inc35.3 = or i64 %loopA.267, 4
%arrayidx26.4 = getelementptr inbounds i8, ptr %can, i64 %inc35.3
%12 = load i8, ptr %arrayidx26.4, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.4 = zext i8 %12 to i64
%spec.select.4 = add nuw nsw i64 %spec.select.3, %inc32.4
%inc35.4 = or i64 %loopA.267, 5
%arrayidx26.5 = getelementptr inbounds i8, ptr %can, i64 %inc35.4
%13 = load i8, ptr %arrayidx26.5, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.5 = zext i8 %13 to i64
%spec.select.5 = add nuw nsw i64 %spec.select.4, %inc32.5
%inc35.5 = or i64 %loopA.267, 6
%arrayidx26.6 = getelementptr inbounds i8, ptr %can, i64 %inc35.5
%14 = load i8, ptr %arrayidx26.6, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.6 = zext i8 %14 to i64
%spec.select.6 = add nuw nsw i64 %spec.select.5, %inc32.6
%inc35.6 = or i64 %loopA.267, 7
%arrayidx26.7 = getelementptr inbounds i8, ptr %can, i64 %inc35.6
%15 = load i8, ptr %arrayidx26.7, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.7 = zext i8 %15 to i64
%spec.select.7 = add nuw nsw i64 %spec.select.6, %inc32.7
%inc35.7 = add nuw nsw i64 %loopA.267, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end36.loopexit.unr-lcssa, label %for.body25, !llvm.loop !31
for.end36.loopexit.unr-lcssa: ; preds = %for.body25, %for.body25.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body25.preheader ], [ %spec.select.7, %for.body25 ]
%ret.068.unr = phi i64 [ 0, %for.body25.preheader ], [ %spec.select.7, %for.body25 ]
%loopA.267.unr = phi i64 [ 0, %for.body25.preheader ], [ %inc35.7, %for.body25 ]
%lcmp.mod73.not = icmp eq i64 %xtraiter72, 0
br i1 %lcmp.mod73.not, label %for.end36, label %for.body25.epil
for.body25.epil: ; preds = %for.end36.loopexit.unr-lcssa, %for.body25.epil
%ret.068.epil = phi i64 [ %spec.select.epil, %for.body25.epil ], [ %ret.068.unr, %for.end36.loopexit.unr-lcssa ]
%loopA.267.epil = phi i64 [ %inc35.epil, %for.body25.epil ], [ %loopA.267.unr, %for.end36.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body25.epil ], [ 0, %for.end36.loopexit.unr-lcssa ]
%arrayidx26.epil = getelementptr inbounds i8, ptr %can, i64 %loopA.267.epil
%16 = load i8, ptr %arrayidx26.epil, align 1, !tbaa !25, !range !27, !noundef !28
%inc32.epil = zext i8 %16 to i64
%spec.select.epil = add nuw nsw i64 %ret.068.epil, %inc32.epil
%inc35.epil = add nuw nsw i64 %loopA.267.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter72
br i1 %epil.iter.cmp.not, label %for.end36, label %for.body25.epil, !llvm.loop !32
for.end36: ; preds = %for.end36.loopexit.unr-lcssa, %for.body25.epil, %for.end.thread, %for.cond22.preheader
%ret.0.lcssa = phi i64 [ 0, %for.cond22.preheader ], [ 0, %for.end.thread ], [ %spec.select.lcssa.ph, %for.end36.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body25.epil ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_max(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #11 {
entry:
%0 = load i64, ptr %data, align 8, !tbaa !10
%cmp10 = icmp sgt i64 %how_data, 0
br i1 %cmp10, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
%minmax.ident.splatinsert = insertelement <2 x i64> poison, i64 %0, i64 0
%minmax.ident.splat = shufflevector <2 x i64> %minmax.ident.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %3, %vector.body ]
%vec.phi13 = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %4, %vector.body ]
%1 = getelementptr inbounds i64, ptr %data, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !10
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load14 = load <2 x i64>, ptr %2, align 8, !tbaa !10
%3 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%4 = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %vec.phi13, <2 x i64> %wide.load14)
%index.next = add nuw i64 %index, 4
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smax.v2i64(<2 x i64> %3, <2 x i64> %4)
%6 = tail call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%ret.012.ph = phi i64 [ %0, %for.body.preheader ], [ %6, %middle.block ]
%loop.011.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%ret.012 = phi i64 [ %spec.select, %for.body ], [ %ret.012.ph, %for.body.preheader15 ]
%loop.011 = phi i64 [ %inc, %for.body ], [ %loop.011.ph, %for.body.preheader15 ]
%arrayidx1 = getelementptr inbounds i64, ptr %data, i64 %loop.011
%7 = load i64, ptr %arrayidx1, align 8, !tbaa !10
%spec.select = tail call i64 @llvm.smax.i64(i64 %ret.012, i64 %7)
%inc = add nuw nsw i64 %loop.011, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !34
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i64 [ %0, %entry ], [ %6, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_min(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #11 {
entry:
%0 = load i64, ptr %data, align 8, !tbaa !10
%cmp10 = icmp sgt i64 %how_data, 0
br i1 %cmp10, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader15, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -4
%minmax.ident.splatinsert = insertelement <2 x i64> poison, i64 %0, i64 0
%minmax.ident.splat = shufflevector <2 x i64> %minmax.ident.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %3, %vector.body ]
%vec.phi13 = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %4, %vector.body ]
%1 = getelementptr inbounds i64, ptr %data, i64 %index
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !10
%2 = getelementptr inbounds i64, ptr %1, i64 2
%wide.load14 = load <2 x i64>, ptr %2, align 8, !tbaa !10
%3 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi, <2 x i64> %wide.load)
%4 = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %vec.phi13, <2 x i64> %wide.load14)
%index.next = add nuw i64 %index, 4
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !35
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <2 x i64> @llvm.smin.v2i64(<2 x i64> %3, <2 x i64> %4)
%6 = tail call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader15
for.body.preheader15: ; preds = %for.body.preheader, %middle.block
%ret.012.ph = phi i64 [ %0, %for.body.preheader ], [ %6, %middle.block ]
%loop.011.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader15, %for.body
%ret.012 = phi i64 [ %spec.select, %for.body ], [ %ret.012.ph, %for.body.preheader15 ]
%loop.011 = phi i64 [ %inc, %for.body ], [ %loop.011.ph, %for.body.preheader15 ]
%arrayidx1 = getelementptr inbounds i64, ptr %data, i64 %loop.011
%7 = load i64, ptr %arrayidx1, align 8, !tbaa !10
%spec.select = tail call i64 @llvm.smin.i64(i64 %ret.012, i64 %7)
%inc = add nuw nsw i64 %loop.011, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !36
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i64 [ %0, %entry ], [ %6, %middle.block ], [ %spec.select, %for.body ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_sum(i64 noundef %how_data, ptr nocapture noundef readonly %data) local_unnamed_addr #12 {
entry:
%cmp4 = icmp sgt i64 %how_data, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %how_data, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %how_data, -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 ], [ %2, %vector.body ]
%vec.phi7 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i64, ptr %data, i64 %index
%wide.load = load <2 x i64>, ptr %0, align 8, !tbaa !10
%1 = getelementptr inbounds i64, ptr %0, i64 2
%wide.load8 = load <2 x i64>, ptr %1, align 8, !tbaa !10
%2 = add <2 x i64> %wide.load, %vec.phi
%3 = add <2 x i64> %wide.load8, %vec.phi7
%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 !37
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %3, %2
%5 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %how_data
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%loop.06.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%ret.05.ph = phi i64 [ 0, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%loop.06 = phi i64 [ %inc, %for.body ], [ %loop.06.ph, %for.body.preheader9 ]
%ret.05 = phi i64 [ %add, %for.body ], [ %ret.05.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.06
%6 = load i64, ptr %arrayidx, align 8, !tbaa !10
%add = add nsw i64 %6, %ret.05
%inc = add nuw nsw i64 %loop.06, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !38
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i64 [ 0, %entry ], [ %5, %middle.block ], [ %add, %for.body ]
ret i64 %ret.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i64 @array_search(i64 noundef %how_data, ptr nocapture noundef readonly %data, i64 noundef %what) local_unnamed_addr #12 {
entry:
%cmp5 = icmp sgt i64 %how_data, 0
br i1 %cmp5, label %for.body, label %cleanup
for.body: ; preds = %entry, %for.inc
%loop.06 = phi i64 [ %inc, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %data, i64 %loop.06
%0 = load i64, ptr %arrayidx, align 8, !tbaa !10
%cmp1 = icmp eq i64 %0, %what
br i1 %cmp1, label %cleanup, label %for.inc
for.inc: ; preds = %for.body
%inc = add nuw nsw i64 %loop.06, 1
%exitcond.not = icmp eq i64 %inc, %how_data
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !39
cleanup: ; preds = %for.body, %for.inc, %entry
%retval.0 = phi i64 [ -1, %entry ], [ -1, %for.inc ], [ %loop.06, %for.body ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i64 @Leven_dist(ptr nocapture noundef readonly %now, ptr nocapture noundef readonly %target) local_unnamed_addr #13 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %now) #29
%add = add i64 %call, 1
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %target) #29
%add2 = add i64 %call1, 1
%0 = mul nuw i64 %add2, %add
%vla = alloca i64, i64 %0, align 16
%cmp81 = icmp ult i64 %call, 9223372036854775807
br i1 %cmp81, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %add, 3
%1 = icmp ult i64 %call, 3
br i1 %1, label %for.cond4.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %add, -4
br label %for.body
for.cond4.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%loopA.082.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond4.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond4.preheader.loopexit.unr-lcssa, %for.body.epil
%loopA.082.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %loopA.082.unr, %for.cond4.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond4.preheader.loopexit.unr-lcssa ]
%2 = mul nsw i64 %loopA.082.epil, %add2
%arrayidx.epil = getelementptr inbounds i64, ptr %vla, i64 %2
store i64 %loopA.082.epil, ptr %arrayidx.epil, align 8, !tbaa !10
%inc.epil = add nuw nsw i64 %loopA.082.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.cond4.preheader, label %for.body.epil, !llvm.loop !40
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit.unr-lcssa, %for.body.epil, %entry
%cmp583 = icmp ult i64 %call1, 9223372036854775807
br i1 %cmp583, label %for.body6.preheader, label %for.cond12.preheader
for.body6.preheader: ; preds = %for.cond4.preheader
%min.iters.check = icmp ult i64 %add2, 4
br i1 %min.iters.check, label %for.body6.preheader95, label %vector.ph
vector.ph: ; preds = %for.body6.preheader
%n.vec = and i64 %add2, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%3 = getelementptr inbounds i64, ptr %vla, i64 %index
store <2 x i64> %vec.ind, ptr %3, align 16, !tbaa !10
%4 = getelementptr inbounds i64, ptr %3, i64 2
store <2 x i64> %step.add, ptr %4, align 16, !tbaa !10
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !41
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %add2, %n.vec
br i1 %cmp.n, label %for.cond12.preheader, label %for.body6.preheader95
for.body6.preheader95: ; preds = %for.body6.preheader, %middle.block
%loopA.184.ph = phi i64 [ 0, %for.body6.preheader ], [ %n.vec, %middle.block ]
br label %for.body6
for.body: ; preds = %for.body, %for.body.preheader.new
%loopA.082 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%6 = mul nsw i64 %loopA.082, %add2
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %6
store i64 %loopA.082, ptr %arrayidx, align 16, !tbaa !10
%inc = or i64 %loopA.082, 1
%7 = mul nsw i64 %inc, %add2
%arrayidx.1 = getelementptr inbounds i64, ptr %vla, i64 %7
store i64 %inc, ptr %arrayidx.1, align 8, !tbaa !10
%inc.1 = or i64 %loopA.082, 2
%8 = mul nsw i64 %inc.1, %add2
%arrayidx.2 = getelementptr inbounds i64, ptr %vla, i64 %8
store i64 %inc.1, ptr %arrayidx.2, align 16, !tbaa !10
%inc.2 = or i64 %loopA.082, 3
%9 = mul nsw i64 %inc.2, %add2
%arrayidx.3 = getelementptr inbounds i64, ptr %vla, i64 %9
store i64 %inc.2, ptr %arrayidx.3, align 8, !tbaa !10
%inc.3 = add nuw nsw i64 %loopA.082, 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.cond4.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !42
for.cond12.preheader: ; preds = %for.body6, %middle.block, %for.cond4.preheader
%cmp1387 = icmp sgt i64 %add, 1
%cmp1685 = icmp sgt i64 %add2, 1
%or.cond = select i1 %cmp1387, i1 %cmp1685, i1 false
br i1 %or.cond, label %for.cond15.preheader.us, label %for.end47
for.cond15.preheader.us: ; preds = %for.cond12.preheader, %for.cond15.for.inc45_crit_edge.us
%loopA.288.us = phi i64 [ %inc46.us, %for.cond15.for.inc45_crit_edge.us ], [ 1, %for.cond12.preheader ]
%sub.us = add nsw i64 %loopA.288.us, -1
%arrayidx18.us = getelementptr inbounds i8, ptr %now, i64 %sub.us
%10 = load i8, ptr %arrayidx18.us, align 1, !tbaa !5
%11 = mul nsw i64 %sub.us, %add2
%arrayidx26.us = getelementptr inbounds i64, ptr %vla, i64 %11
%12 = mul nsw i64 %loopA.288.us, %add2
%arrayidx29.us = getelementptr inbounds i64, ptr %vla, i64 %12
%.pre = load i64, ptr %arrayidx29.us, align 8, !tbaa !10
br label %for.body17.us
for.body17.us: ; preds = %for.cond15.preheader.us, %for.body17.us
%13 = phi i64 [ %.pre, %for.cond15.preheader.us ], [ %b.a.i80.us, %for.body17.us ]
%loopB.086.us = phi i64 [ 1, %for.cond15.preheader.us ], [ %inc43.us, %for.body17.us ]
%sub19.us = add nsw i64 %loopB.086.us, -1
%arrayidx20.us = getelementptr inbounds i8, ptr %target, i64 %sub19.us
%14 = load i8, ptr %arrayidx20.us, align 1, !tbaa !5
%cmp22.us = icmp ne i8 %10, %14
%conv24.us = zext i1 %cmp22.us to i64
%arrayidx27.us = getelementptr inbounds i64, ptr %arrayidx26.us, i64 %loopB.086.us
%15 = load i64, ptr %arrayidx27.us, align 8, !tbaa !10
%add28.us = add nsw i64 %15, 1
%add32.us = add nsw i64 %13, 1
%b.a.i.us = tail call i64 @llvm.smin.i64(i64 %add28.us, i64 %add32.us)
%arrayidx37.us = getelementptr inbounds i64, ptr %arrayidx26.us, i64 %sub19.us
%16 = load i64, ptr %arrayidx37.us, align 8, !tbaa !10
%add38.us = add nsw i64 %16, %conv24.us
%b.a.i80.us = tail call i64 @llvm.smin.i64(i64 %b.a.i.us, i64 %add38.us)
%arrayidx41.us = getelementptr inbounds i64, ptr %arrayidx29.us, i64 %loopB.086.us
store i64 %b.a.i80.us, ptr %arrayidx41.us, align 8, !tbaa !10
%inc43.us = add nuw nsw i64 %loopB.086.us, 1
%exitcond92.not = icmp eq i64 %loopB.086.us, %call1
br i1 %exitcond92.not, label %for.cond15.for.inc45_crit_edge.us, label %for.body17.us, !llvm.loop !43
for.cond15.for.inc45_crit_edge.us: ; preds = %for.body17.us
%inc46.us = add nuw nsw i64 %loopA.288.us, 1
%exitcond93.not = icmp eq i64 %loopA.288.us, %call
br i1 %exitcond93.not, label %for.end47, label %for.cond15.preheader.us, !llvm.loop !44
for.body6: ; preds = %for.body6.preheader95, %for.body6
%loopA.184 = phi i64 [ %inc10, %for.body6 ], [ %loopA.184.ph, %for.body6.preheader95 ]
%arrayidx8 = getelementptr inbounds i64, ptr %vla, i64 %loopA.184
store i64 %loopA.184, ptr %arrayidx8, align 8, !tbaa !10
%inc10 = add nuw nsw i64 %loopA.184, 1
%exitcond91.not = icmp eq i64 %loopA.184, %call1
br i1 %exitcond91.not, label %for.cond12.preheader, label %for.body6, !llvm.loop !45
for.end47: ; preds = %for.cond15.for.inc45_crit_edge.us, %for.cond12.preheader
%17 = mul nsw i64 %add2, %call
%arrayidx49 = getelementptr inbounds i64, ptr %vla, i64 %17
%arrayidx51 = getelementptr inbounds i64, ptr %arrayidx49, i64 %call1
%18 = load i64, ptr %arrayidx51, align 8, !tbaa !10
ret i64 %18
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #14
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local i64 @get_digit(i64 noundef %target) local_unnamed_addr #15 {
entry:
%conv = sitofp i64 %target to double
%call = tail call double @log10(double noundef %conv) #28
%add = fadd double %call, 1.000000e+00
%conv1 = fptosi double %add to i64
ret i64 %conv1
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log10(double noundef) local_unnamed_addr #16
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @ncr(i64 noundef %n, i64 noundef %r) local_unnamed_addr #8 {
entry:
%pascal = alloca [100 x [102 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 81600, ptr nonnull %pascal) #28
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81600) %pascal, i8 0, i64 81600, i1 false)
%arrayidx = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 1
store i64 1, ptr %arrayidx, align 16, !tbaa !10
%arrayidx3 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 1, i64 1
store i64 1, ptr %arrayidx3, align 8, !tbaa !10
br label %for.body
for.body: ; preds = %entry, %for.end
%indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.end ]
%loopA.037 = phi i64 [ 2, %entry ], [ %inc20, %for.end ]
%0 = add i64 %indvar, 1
%arrayidx4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037
store i64 1, ptr %arrayidx4, align 16, !tbaa !10
%sub = add nsw i64 %loopA.037, -1
%arrayidx11.phi.trans.insert = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %sub, i64 0
%.pre = load i64, ptr %arrayidx11.phi.trans.insert, align 16, !tbaa !10
%min.iters.check = icmp ult i64 %0, 2
br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph
vector.ph: ; preds = %for.body
%n.vec = and i64 %0, -2
%ind.end = or i64 %0, 1
%vector.recur.init = insertelement <2 x i64> poison, i64 %.pre, i64 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %sub, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !10
%2 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2>
%3 = add nsw <2 x i64> %wide.load, %2
%4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037, i64 %offset.idx
store <2 x i64> %3, ptr %4, align 8, !tbaa !10
%index.next = add nuw i64 %index, 2
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <2 x i64> %wide.load, i64 1
br i1 %cmp.n, label %for.end, label %for.body8.preheader
for.body8.preheader: ; preds = %for.body, %middle.block
%scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body ]
%loopB.036.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader, %for.body8
%scalar.recur = phi i64 [ %6, %for.body8 ], [ %scalar.recur.ph, %for.body8.preheader ]
%loopB.036 = phi i64 [ %inc, %for.body8 ], [ %loopB.036.ph, %for.body8.preheader ]
%arrayidx14 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %sub, i64 %loopB.036
%6 = load i64, ptr %arrayidx14, align 8, !tbaa !10
%add = add nsw i64 %6, %scalar.recur
%arrayidx16 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037, i64 %loopB.036
store i64 %add, ptr %arrayidx16, align 8, !tbaa !10
%inc = add nuw nsw i64 %loopB.036, 1
%exitcond.not = icmp eq i64 %inc, %loopA.037
br i1 %exitcond.not, label %for.end, label %for.body8, !llvm.loop !47
for.end: ; preds = %for.body8, %middle.block
%arrayidx18 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %loopA.037, i64 %loopA.037
store i64 1, ptr %arrayidx18, align 8, !tbaa !10
%inc20 = add nuw nsw i64 %loopA.037, 1
%exitcond38.not = icmp eq i64 %inc20, 100
%indvar.next = add i64 %indvar, 1
br i1 %exitcond38.not, label %for.end21, label %for.body, !llvm.loop !48
for.end21: ; preds = %for.end
%arrayidx23 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal, i64 0, i64 %n, i64 %r
%7 = load i64, ptr %arrayidx23, align 8, !tbaa !10
call void @llvm.lifetime.end.p0(i64 81600, ptr nonnull %pascal) #28
ret i64 %7
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #17
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @npr(i64 noundef %n, i64 noundef %r) local_unnamed_addr #8 {
entry:
%pascal.i = alloca [100 x [102 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 81600, ptr nonnull %pascal.i) #28
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81600) %pascal.i, i8 0, i64 81600, i1 false)
%arrayidx.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1
store i64 1, ptr %arrayidx.i, align 16, !tbaa !10
%arrayidx3.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1, i64 1
store i64 1, ptr %arrayidx3.i, align 8, !tbaa !10
br label %for.body.i
for.body.i: ; preds = %for.end.i, %entry
%indvar = phi i64 [ %indvar.next, %for.end.i ], [ 0, %entry ]
%loopA.037.i = phi i64 [ %inc20.i, %for.end.i ], [ 2, %entry ]
%0 = add i64 %indvar, 1
%arrayidx4.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i
store i64 1, ptr %arrayidx4.i, align 16, !tbaa !10
%sub.i = add nsw i64 %loopA.037.i, -1
%arrayidx11.phi.trans.insert.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 0
%.pre.i = load i64, ptr %arrayidx11.phi.trans.insert.i, align 16, !tbaa !10
%min.iters.check = icmp ult i64 %0, 2
br i1 %min.iters.check, label %for.body8.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.i
%n.vec = and i64 %0, -2
%ind.end = or i64 %0, 1
%vector.recur.init = insertelement <2 x i64> poison, i64 %.pre.i, i64 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !10
%2 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2>
%3 = add nsw <2 x i64> %wide.load, %2
%4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %offset.idx
store <2 x i64> %3, ptr %4, align 8, !tbaa !10
%index.next = add nuw i64 %index, 2
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !49
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <2 x i64> %wide.load, i64 1
br i1 %cmp.n, label %for.end.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %for.body.i, %middle.block
%scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre.i, %for.body.i ]
%loopB.036.i.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.i ]
br label %for.body8.i
for.body8.i: ; preds = %for.body8.i.preheader, %for.body8.i
%scalar.recur = phi i64 [ %6, %for.body8.i ], [ %scalar.recur.ph, %for.body8.i.preheader ]
%loopB.036.i = phi i64 [ %inc.i, %for.body8.i ], [ %loopB.036.i.ph, %for.body8.i.preheader ]
%arrayidx14.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %loopB.036.i
%6 = load i64, ptr %arrayidx14.i, align 8, !tbaa !10
%add.i = add nsw i64 %6, %scalar.recur
%arrayidx16.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopB.036.i
store i64 %add.i, ptr %arrayidx16.i, align 8, !tbaa !10
%inc.i = add nuw nsw i64 %loopB.036.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %loopA.037.i
br i1 %exitcond.not.i, label %for.end.i, label %for.body8.i, !llvm.loop !50
for.end.i: ; preds = %for.body8.i, %middle.block
%arrayidx18.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopA.037.i
store i64 1, ptr %arrayidx18.i, align 8, !tbaa !10
%inc20.i = add nuw nsw i64 %loopA.037.i, 1
%exitcond38.not.i = icmp eq i64 %inc20.i, 100
%indvar.next = add i64 %indvar, 1
br i1 %exitcond38.not.i, label %ncr.exit, label %for.body.i, !llvm.loop !48
ncr.exit: ; preds = %for.end.i
%arrayidx23.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %n, i64 %r
%7 = load i64, ptr %arrayidx23.i, align 8, !tbaa !10
call void @llvm.lifetime.end.p0(i64 81600, ptr nonnull %pascal.i) #28
%cmp.not4.i = icmp slt i64 %r, 1
br i1 %cmp.not4.i, label %factorial.exit, label %for.body.i3.preheader
for.body.i3.preheader: ; preds = %ncr.exit
%xtraiter = and i64 %r, 3
%8 = icmp ult i64 %r, 4
br i1 %8, label %factorial.exit.loopexit.unr-lcssa, label %for.body.i3.preheader.new
for.body.i3.preheader.new: ; preds = %for.body.i3.preheader
%unroll_iter = and i64 %r, -4
br label %for.body.i3
for.body.i3: ; preds = %for.body.i3, %for.body.i3.preheader.new
%i.06.i = phi i64 [ 1, %for.body.i3.preheader.new ], [ %inc.i4.3, %for.body.i3 ]
%ret.05.i = phi i64 [ 1, %for.body.i3.preheader.new ], [ %rem.i.3, %for.body.i3 ]
%niter = phi i64 [ 0, %for.body.i3.preheader.new ], [ %niter.next.3, %for.body.i3 ]
%mul.i = mul i64 %ret.05.i, %i.06.i
%rem.i = urem i64 %mul.i, 1000000007
%inc.i4 = add nuw nsw i64 %i.06.i, 1
%mul.i.1 = mul i64 %rem.i, %inc.i4
%rem.i.1 = urem i64 %mul.i.1, 1000000007
%inc.i4.1 = add nuw nsw i64 %i.06.i, 2
%mul.i.2 = mul i64 %rem.i.1, %inc.i4.1
%rem.i.2 = urem i64 %mul.i.2, 1000000007
%inc.i4.2 = add nuw i64 %i.06.i, 3
%mul.i.3 = mul i64 %rem.i.2, %inc.i4.2
%rem.i.3 = urem i64 %mul.i.3, 1000000007
%inc.i4.3 = add nuw i64 %i.06.i, 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 %factorial.exit.loopexit.unr-lcssa, label %for.body.i3, !llvm.loop !21
factorial.exit.loopexit.unr-lcssa: ; preds = %for.body.i3, %for.body.i3.preheader
%rem.i.lcssa.ph = phi i64 [ undef, %for.body.i3.preheader ], [ %rem.i.3, %for.body.i3 ]
%i.06.i.unr = phi i64 [ 1, %for.body.i3.preheader ], [ %inc.i4.3, %for.body.i3 ]
%ret.05.i.unr = phi i64 [ 1, %for.body.i3.preheader ], [ %rem.i.3, %for.body.i3 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %factorial.exit, label %for.body.i3.epil
for.body.i3.epil: ; preds = %factorial.exit.loopexit.unr-lcssa, %for.body.i3.epil
%i.06.i.epil = phi i64 [ %inc.i4.epil, %for.body.i3.epil ], [ %i.06.i.unr, %factorial.exit.loopexit.unr-lcssa ]
%ret.05.i.epil = phi i64 [ %rem.i.epil, %for.body.i3.epil ], [ %ret.05.i.unr, %factorial.exit.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i3.epil ], [ 0, %factorial.exit.loopexit.unr-lcssa ]
%mul.i.epil = mul i64 %ret.05.i.epil, %i.06.i.epil
%rem.i.epil = urem i64 %mul.i.epil, 1000000007
%inc.i4.epil = add nuw i64 %i.06.i.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 %factorial.exit, label %for.body.i3.epil, !llvm.loop !51
factorial.exit: ; preds = %factorial.exit.loopexit.unr-lcssa, %for.body.i3.epil, %ncr.exit
%ret.0.lcssa.i = phi i64 [ 1, %ncr.exit ], [ %rem.i.lcssa.ph, %factorial.exit.loopexit.unr-lcssa ], [ %rem.i.epil, %for.body.i3.epil ]
%mul = mul nsw i64 %ret.0.lcssa.i, %7
ret i64 %mul
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @nhr(i64 noundef %n, i64 noundef %r) local_unnamed_addr #8 {
entry:
%pascal.i = alloca [100 x [102 x i64]], align 16
call void @llvm.lifetime.start.p0(i64 81600, ptr nonnull %pascal.i) #28
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(81600) %pascal.i, i8 0, i64 81600, i1 false)
%arrayidx.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1
store i64 1, ptr %arrayidx.i, align 16, !tbaa !10
%arrayidx3.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 1, i64 1
store i64 1, ptr %arrayidx3.i, align 8, !tbaa !10
br label %for.body.i
for.body.i: ; preds = %for.end.i, %entry
%indvar = phi i64 [ %indvar.next, %for.end.i ], [ 0, %entry ]
%loopA.037.i = phi i64 [ %inc20.i, %for.end.i ], [ 2, %entry ]
%0 = add i64 %indvar, 1
%arrayidx4.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i
store i64 1, ptr %arrayidx4.i, align 16, !tbaa !10
%sub.i = add nsw i64 %loopA.037.i, -1
%arrayidx11.phi.trans.insert.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 0
%.pre.i = load i64, ptr %arrayidx11.phi.trans.insert.i, align 16, !tbaa !10
%min.iters.check = icmp ult i64 %0, 2
br i1 %min.iters.check, label %for.body8.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.i
%n.vec = and i64 %0, -2
%ind.end = or i64 %0, 1
%vector.recur.init = insertelement <2 x i64> poison, i64 %.pre.i, i64 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <2 x i64> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %1, align 8, !tbaa !10
%2 = shufflevector <2 x i64> %vector.recur, <2 x i64> %wide.load, <2 x i32> <i32 1, i32 2>
%3 = add nsw <2 x i64> %wide.load, %2
%4 = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %offset.idx
store <2 x i64> %3, ptr %4, align 8, !tbaa !10
%index.next = add nuw i64 %index, 2
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !52
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <2 x i64> %wide.load, i64 1
br i1 %cmp.n, label %for.end.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %for.body.i, %middle.block
%scalar.recur.ph = phi i64 [ %vector.recur.extract, %middle.block ], [ %.pre.i, %for.body.i ]
%loopB.036.i.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.i ]
br label %for.body8.i
for.body8.i: ; preds = %for.body8.i.preheader, %for.body8.i
%scalar.recur = phi i64 [ %6, %for.body8.i ], [ %scalar.recur.ph, %for.body8.i.preheader ]
%loopB.036.i = phi i64 [ %inc.i, %for.body8.i ], [ %loopB.036.i.ph, %for.body8.i.preheader ]
%arrayidx14.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub.i, i64 %loopB.036.i
%6 = load i64, ptr %arrayidx14.i, align 8, !tbaa !10
%add.i = add nsw i64 %6, %scalar.recur
%arrayidx16.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopB.036.i
store i64 %add.i, ptr %arrayidx16.i, align 8, !tbaa !10
%inc.i = add nuw nsw i64 %loopB.036.i, 1
%exitcond.not.i = icmp eq i64 %inc.i, %loopA.037.i
br i1 %exitcond.not.i, label %for.end.i, label %for.body8.i, !llvm.loop !53
for.end.i: ; preds = %for.body8.i, %middle.block
%arrayidx18.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %loopA.037.i, i64 %loopA.037.i
store i64 1, ptr %arrayidx18.i, align 8, !tbaa !10
%inc20.i = add nuw nsw i64 %loopA.037.i, 1
%exitcond38.not.i = icmp eq i64 %inc20.i, 100
%indvar.next = add i64 %indvar, 1
br i1 %exitcond38.not.i, label %ncr.exit, label %for.body.i, !llvm.loop !48
ncr.exit: ; preds = %for.end.i
%add = add i64 %n, -1
%sub = add i64 %add, %r
%arrayidx23.i = getelementptr inbounds [100 x [102 x i64]], ptr %pascal.i, i64 0, i64 %sub, i64 %r
%7 = load i64, ptr %arrayidx23.i, align 8, !tbaa !10
call void @llvm.lifetime.end.p0(i64 81600, ptr nonnull %pascal.i) #28
ret i64 %7
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @rounding(double noundef %target) local_unnamed_addr #18 {
entry:
%conv = fptosi double %target to i64
%conv1 = sitofp i64 %conv to double
%add = fadd double %conv1, 5.000000e-01
%conv2 = fptosi double %add to i64
ret i64 %conv2
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @roundingup(double noundef %target) local_unnamed_addr #9 {
entry:
%0 = tail call double @llvm.ceil.f64(double %target)
%conv = fptosi double %0 to i64
ret i64 %conv
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #19
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @roundingdown(double noundef %target) local_unnamed_addr #9 {
entry:
%0 = tail call double @llvm.floor.f64(double %target)
%conv = fptosi double %0 to i64
ret i64 %conv
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #19
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @fifw(i64 noundef %add, ptr nocapture noundef %data) local_unnamed_addr #20 {
entry:
%0 = load i64, ptr %data, align 8, !tbaa !10
%1 = getelementptr i64, ptr %data, i64 %0
%arrayidx2 = getelementptr i64, ptr %1, i64 1
store i64 %add, ptr %arrayidx2, align 8, !tbaa !10
%2 = load i64, ptr %data, align 8, !tbaa !10
%inc = add nsw i64 %2, 1
store i64 %inc, ptr %data, align 8, !tbaa !10
%conv = trunc i64 %inc to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i64 @fifr(ptr nocapture noundef %data) local_unnamed_addr #21 {
entry:
%arrayidx = getelementptr i64, ptr %data, i64 1
%0 = load i64, ptr %arrayidx, align 8, !tbaa !10
%1 = load i64, ptr %data, align 8, !tbaa !10
%dec = add nsw i64 %1, -1
store i64 %dec, ptr %data, align 8, !tbaa !10
%scevgep12 = getelementptr i8, ptr %data, i64 16
tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(7984) %arrayidx, ptr noundef nonnull align 8 dereferenceable(7984) %scevgep12, i64 7984, i1 false), !tbaa !10
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @GRAPH_input() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @GRAPH, ptr noundef nonnull getelementptr inbounds (%struct._GD, ptr @GRAPH, i64 0, i32 1))
%0 = load i64, ptr getelementptr inbounds (%struct._GD, ptr @GRAPH, i64 0, i32 1), align 8, !tbaa !54
%cmp8 = icmp sgt i64 %0, 0
br i1 %cmp8, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %entry, %for.body
%loopA.09 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 2, i64 %loopA.09
%arrayidx3 = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 2, i64 %loopA.09, i64 1
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%inc = add nuw nsw i64 %loopA.09, 1
%1 = load i64, ptr getelementptr inbounds (%struct._GD, ptr @GRAPH, i64 0, i32 1), align 8, !tbaa !54
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !56
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @GRAPH_dfs(i64 noundef %now) local_unnamed_addr #22 {
entry:
%arrayidx = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 3, i64 %now
store i8 1, ptr %arrayidx, align 1, !tbaa !25
%0 = load i64, ptr getelementptr inbounds (%struct._GD, ptr @GRAPH, i64 0, i32 1), align 8, !tbaa !54
%cmp44 = icmp sgt i64 %0, 0
br i1 %cmp44, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
ret void
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx2 = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 2, i64 %indvars.iv
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !10
%cmp4 = icmp eq i64 %1, %now
br i1 %cmp4, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %for.body
%arrayidx8 = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 2, i64 %indvars.iv, i64 1
%2 = load i64, ptr %arrayidx8, align 8, !tbaa !10
%arrayidx9 = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 3, i64 %2
%3 = load i8, ptr %arrayidx9, align 1, !tbaa !25, !range !27, !noundef !28
%cmp11 = icmp eq i8 %3, 0
br i1 %cmp11, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true
tail call void @GRAPH_dfs(i64 noundef %2)
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true, %for.body
%arrayidx18 = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 2, i64 %indvars.iv, i64 1
%4 = load i64, ptr %arrayidx18, align 8, !tbaa !10
%cmp19 = icmp eq i64 %4, %now
br i1 %cmp19, label %land.lhs.true21, label %for.inc
land.lhs.true21: ; preds = %if.end
%5 = load i64, ptr %arrayidx2, align 8, !tbaa !10
%arrayidx25 = getelementptr inbounds %struct._GD, ptr @GRAPH, i64 0, i32 3, i64 %5
%6 = load i8, ptr %arrayidx25, align 1, !tbaa !25, !range !27, !noundef !28
%cmp28 = icmp eq i8 %6, 0
br i1 %cmp28, label %if.then30, label %for.inc
if.then30: ; preds = %land.lhs.true21
tail call void @GRAPH_dfs(i64 noundef %5)
br label %for.inc
for.inc: ; preds = %if.end, %land.lhs.true21, %if.then30
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i64, ptr getelementptr inbounds (%struct._GD, ptr @GRAPH, i64 0, i32 1), align 8, !tbaa !54
%cmp = icmp sgt i64 %7, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !57
}
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local zeroext i1 @check_prime(i64 noundef %target) local_unnamed_addr #23 {
entry:
%cmp = icmp eq i64 %target, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i64 %target, 2
%rem = and i64 %target, 1
%cmp2 = icmp eq i64 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %return, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%conv5 = sitofp i64 %target to double
%call21 = tail call double @sqrt(double noundef %conv5) #28
%add22 = fadd double %call21, 1.000000e+00
%cmp623 = fcmp ult double %add22, 3.000000e+00
br i1 %cmp623, label %return, label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%0 = trunc i64 %indvars.iv.next to i32
%conv = sitofp i32 %0 to double
%call = tail call double @sqrt(double noundef %conv5) #28
%add = fadd double %call, 1.000000e+00
%cmp6 = fcmp ult double %add, %conv
br i1 %cmp6, label %return, label %for.body, !llvm.loop !58
for.body: ; preds = %for.cond.preheader, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 3, %for.cond.preheader ]
%rem9 = srem i64 %target, %indvars.iv
%cmp10.not = icmp ne i64 %rem9, 0
br i1 %cmp10.not, label %for.cond, label %return
return: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end, %entry
%retval.1 = phi i1 [ true, %entry ], [ false, %if.end ], [ true, %for.cond.preheader ], [ %cmp10.not, %for.cond ], [ %cmp10.not, %for.body ]
ret i1 %retval.1
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #16
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @get_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #8 {
entry:
%cmp.i = icmp slt i64 %a, %b
%sext.i = shl i64 %a, 32
%conv1.i = ashr exact i64 %sext.i, 32
%b.addr.0.i = select i1 %cmp.i, i64 %conv1.i, i64 %b
%a.addr.0.i = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
%rem.i = srem i64 %a.addr.0.i, %b.addr.0.i
%cmp2.not14.i = icmp eq i64 %rem.i, 0
br i1 %cmp2.not14.i, label %get_gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%r.016.i = phi i64 [ %rem4.i, %while.body.i ], [ %rem.i, %entry ]
%b.addr.115.i = phi i64 [ %r.016.i, %while.body.i ], [ %b.addr.0.i, %entry ]
%rem4.i = srem i64 %b.addr.115.i, %r.016.i
%cmp2.not.i = icmp eq i64 %rem4.i, 0
br i1 %cmp2.not.i, label %get_gcd.exit, label %while.body.i, !llvm.loop !59
get_gcd.exit: ; preds = %while.body.i, %entry
%b.addr.1.lcssa.i = phi i64 [ %b.addr.0.i, %entry ], [ %r.016.i, %while.body.i ]
%mul = mul nsw i64 %b, %a
%div = sdiv i64 %mul, %b.addr.1.lcssa.i
ret i64 %div
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @get_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #8 {
entry:
%cmp = icmp slt i64 %a, %b
%sext = shl i64 %a, 32
%conv1 = ashr exact i64 %sext, 32
%b.addr.0 = select i1 %cmp, i64 %conv1, i64 %b
%a.addr.0 = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
%rem = srem i64 %a.addr.0, %b.addr.0
%cmp2.not14 = icmp eq i64 %rem, 0
br i1 %cmp2.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.016 = phi i64 [ %rem4, %while.body ], [ %rem, %entry ]
%b.addr.115 = phi i64 [ %r.016, %while.body ], [ %b.addr.0, %entry ]
%rem4 = srem i64 %b.addr.115, %r.016
%cmp2.not = icmp eq i64 %rem4, 0
br i1 %cmp2.not, label %while.end, label %while.body, !llvm.loop !59
while.end: ; preds = %while.body, %entry
%b.addr.1.lcssa = phi i64 [ %b.addr.0, %entry ], [ %r.016, %while.body ]
ret i64 %b.addr.1.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @digit_cut(i32 noundef %how_data, ptr nocapture noundef readonly %s, ptr nocapture noundef writeonly %i) local_unnamed_addr #0 {
entry:
%cmp6 = icmp sgt i32 %how_data, 0
br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %how_data to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%call.i = tail call i64 @strtol(ptr nocapture noundef nonnull %arrayidx, ptr noundef null, i32 noundef 10) #28
%conv.i = trunc i64 %call.i to i32
%arrayidx2 = getelementptr inbounds i32, ptr %i, i64 %indvars.iv
store i32 %conv.i, ptr %arrayidx2, align 4, !tbaa !22
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !60
}
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #24
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #25
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #26
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #26
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #27
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smax.v2i64(<2 x i64>, <2 x i64>) #26
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>) #26
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #26
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #26
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #26
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-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(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nosync nounwind memory(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 = { 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 #10 = { 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 #11 = { 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 #12 = { 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 #13 = { 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 #14 = { 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 #15 = { mustprogress nofree nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #16 = { 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 #17 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #18 = { 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 #19 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #20 = { 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 #21 = { mustprogress nofree 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 #22 = { 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 #23 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #24 = { 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 #25 = { nofree nounwind }
attributes #26 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #27 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #28 = { nounwind }
attributes #29 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !6, i64 0}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !9, !17, !16}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !9}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !6, i64 0}
!24 = !{i64 0, i64 8, !10, i64 8, i64 8, !10, i64 16, i64 16000, !5, i64 16016, i64 500, !5, i64 16516, i64 1, !25}
!25 = !{!26, !26, i64 0}
!26 = !{!"_Bool", !6, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = distinct !{!29, !9}
!30 = distinct !{!30, !9}
!31 = distinct !{!31, !9}
!32 = distinct !{!32, !20}
!33 = distinct !{!33, !9, !16, !17}
!34 = distinct !{!34, !9, !17, !16}
!35 = distinct !{!35, !9, !16, !17}
!36 = distinct !{!36, !9, !17, !16}
!37 = distinct !{!37, !9, !16, !17}
!38 = distinct !{!38, !9, !17, !16}
!39 = distinct !{!39, !9}
!40 = distinct !{!40, !20}
!41 = distinct !{!41, !9, !16, !17}
!42 = distinct !{!42, !9}
!43 = distinct !{!43, !9}
!44 = distinct !{!44, !9}
!45 = distinct !{!45, !9, !17, !16}
!46 = distinct !{!46, !9, !16, !17}
!47 = distinct !{!47, !9, !17, !16}
!48 = distinct !{!48, !9}
!49 = distinct !{!49, !9, !16, !17}
!50 = distinct !{!50, !9, !17, !16}
!51 = distinct !{!51, !20}
!52 = distinct !{!52, !9, !16, !17}
!53 = distinct !{!53, !9, !17, !16}
!54 = !{!55, !11, i64 8}
!55 = !{!"", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 16016, !26, i64 16516}
!56 = distinct !{!56, !9}
!57 = distinct !{!57, !9}
!58 = distinct !{!58, !9}
!59 = distinct !{!59, !9}
!60 = distinct !{!60, !9}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
int n,i,j,z=0,o=0,c,k,f,f1,d,c2=0;
char a[101],b[101][101];
scanf("%d",&n);
scanf("%s",a);
z=strlen(a);
for(i=0;i<n;i++){
scanf("%s",b[i]);
}
for(i=0;i<n;i++){
f=0;
o=strlen(b[i]);
for(j=0;j<o;j++){
for(k=1;k<o;k++){
f1=1; c=0;
for(d=j;c<z;d+=k){
if(d>o){
f1=0;
break;
}
if(a[c]!=b[i][d]){
f1=0;
break;
}
c++;
}
if(f1==1){
f=1;
j=1000;
k=1000;
break;
}
}
}
if(f==1){
c2++;
}
}
printf("%d\n",c2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121740/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [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
%a = alloca [101 x i8], align 16
%b = alloca [101 x [101 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 10201, ptr nonnull %b) #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.1, ptr noundef nonnull %a)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #5
%call3.fr = freeze i64 %call3
%conv = trunc i64 %call3.fr to i32
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp82 = icmp sgt i32 %0, 0
br i1 %cmp82, label %for.body, label %for.end62
for.cond7.preheader: ; preds = %for.body
%cmp894 = icmp sgt i32 %5, 0
br i1 %cmp894, label %for.body10.lr.ph, label %for.end62
for.body10.lr.ph: ; preds = %for.cond7.preheader
%cmp25.not84 = icmp sgt i32 %conv, 0
%wide.trip.count128 = zext i32 %5 to i64
br i1 %cmp25.not84, label %for.body10.us.preheader, label %for.body10
for.body10.us.preheader: ; preds = %for.body10.lr.ph
%wide.trip.count120 = and i64 %call3.fr, 4294967295
br label %for.body10.us
for.body10.us: ; preds = %for.body10.us.preheader, %for.end54.us
%indvars.iv125 = phi i64 [ 0, %for.body10.us.preheader ], [ %indvars.iv.next126, %for.end54.us ]
%c2.096.us = phi i32 [ 0, %for.body10.us.preheader ], [ %spec.select.us, %for.end54.us ]
%arrayidx12.us = getelementptr inbounds [101 x [101 x i8]], ptr %b, i64 0, i64 %indvars.iv125
%call14.us = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx12.us) #5
%conv15.us = trunc i64 %call14.us to i32
%or.cond = icmp slt i32 %conv15.us, 2
br i1 %or.cond, label %for.end54.us, label %for.cond20.preheader.us.us.us.preheader
for.end54.us: ; preds = %for.inc52.us.us.us, %for.body10.us
%f.0.lcssa.us = phi i32 [ 0, %for.body10.us ], [ %f.1.us.us.us, %for.inc52.us.us.us ]
%cmp55.us = icmp eq i32 %f.0.lcssa.us, 1
%inc58.us = zext i1 %cmp55.us to i32
%spec.select.us = add nuw nsw i32 %c2.096.us, %inc58.us
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%exitcond129.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count128
br i1 %exitcond129.not, label %for.end62, label %for.body10.us, !llvm.loop !9
for.cond20.preheader.us.us.us.preheader: ; preds = %for.body10.us
%sext = shl i64 %call14.us, 32
%1 = ashr exact i64 %sext, 32
%wide.trip.count123 = and i64 %call14.us, 4294967295
br label %for.cond20.preheader.us.us.us
for.cond20.preheader.us.us.us: ; preds = %for.cond20.preheader.us.us.us.preheader, %for.inc52.us.us.us
%f.091.us.us.us = phi i32 [ %f.1.us.us.us, %for.inc52.us.us.us ], [ 0, %for.cond20.preheader.us.us.us.preheader ]
%j.090.us.us.us = phi i32 [ %inc53.us.us.us, %for.inc52.us.us.us ], [ 0, %for.cond20.preheader.us.us.us.preheader ]
%2 = sext i32 %j.090.us.us.us to i64
br label %for.cond24.preheader.us.us.us
for.inc52.us.us.us: ; preds = %for.inc49.us.us.us, %if.end41.us.us.us
%j.1.us.us.us = phi i32 [ 1000, %if.end41.us.us.us ], [ %j.090.us.us.us, %for.inc49.us.us.us ]
%f.1.us.us.us = phi i32 [ 1, %if.end41.us.us.us ], [ %f.091.us.us.us, %for.inc49.us.us.us ]
%inc53.us.us.us = add nsw i32 %j.1.us.us.us, 1
%cmp17.us.us.us = icmp slt i32 %inc53.us.us.us, %conv15.us
br i1 %cmp17.us.us.us, label %for.cond20.preheader.us.us.us, label %for.end54.us, !llvm.loop !11
for.body27.us.us.us: ; preds = %for.cond24.preheader.us.us.us, %if.end41.us.us.us
%indvars.iv115 = phi i64 [ 0, %for.cond24.preheader.us.us.us ], [ %indvars.iv.next116, %if.end41.us.us.us ]
%indvars.iv113 = phi i64 [ %2, %for.cond24.preheader.us.us.us ], [ %indvars.iv.next114, %if.end41.us.us.us ]
%cmp28.us.us.us = icmp sgt i64 %indvars.iv113, %1
br i1 %cmp28.us.us.us, label %for.inc49.us.us.us, label %if.end.us.us.us
if.end.us.us.us: ; preds = %for.body27.us.us.us
%arrayidx31.us.us.us = getelementptr inbounds [101 x i8], ptr %a, i64 0, i64 %indvars.iv115
%3 = load i8, ptr %arrayidx31.us.us.us, align 1, !tbaa !12
%arrayidx36.us.us.us = getelementptr inbounds [101 x [101 x i8]], ptr %b, i64 0, i64 %indvars.iv125, i64 %indvars.iv113
%4 = load i8, ptr %arrayidx36.us.us.us, align 1, !tbaa !12
%cmp38.not.us.us.us = icmp eq i8 %3, %4
br i1 %cmp38.not.us.us.us, label %if.end41.us.us.us, label %for.inc49.us.us.us
if.end41.us.us.us: ; preds = %if.end.us.us.us
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%indvars.iv.next114 = add nsw i64 %indvars.iv113, %indvars.iv111
%exitcond121.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count120
br i1 %exitcond121.not, label %for.inc52.us.us.us, label %for.body27.us.us.us, !llvm.loop !13
for.inc49.us.us.us: ; preds = %if.end.us.us.us, %for.body27.us.us.us
%indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
%exitcond124.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count123
br i1 %exitcond124.not, label %for.inc52.us.us.us, label %for.cond24.preheader.us.us.us, !llvm.loop !14
for.cond24.preheader.us.us.us: ; preds = %for.inc49.us.us.us, %for.cond20.preheader.us.us.us
%indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.inc49.us.us.us ], [ 1, %for.cond20.preheader.us.us.us ]
br label %for.body27.us.us.us
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x [101 x i8]], ptr %b, i64 0, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !15
for.body10: ; preds = %for.body10.lr.ph, %for.end54
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.end54 ], [ 0, %for.body10.lr.ph ]
%c2.096 = phi i32 [ %spec.select, %for.end54 ], [ 0, %for.body10.lr.ph ]
%arrayidx12 = getelementptr inbounds [101 x [101 x i8]], ptr %b, i64 0, i64 %indvars.iv108
%call14 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx12) #5
%conv15 = trunc i64 %call14 to i32
%or.cond134 = icmp slt i32 %conv15, 2
br i1 %or.cond134, label %for.end54, label %for.cond20.preheader.lr.ph.split.us
for.cond20.preheader.lr.ph.split.us: ; preds = %for.body10
%cmp17.us = icmp ugt i32 %conv15, 1001
br i1 %cmp17.us, label %for.cond20.preheader.us, label %for.end54, !llvm.loop !11
for.cond20.preheader.us: ; preds = %for.cond20.preheader.lr.ph.split.us, %for.cond20.preheader.us
br label %for.cond20.preheader.us
for.end54: ; preds = %for.cond20.preheader.lr.ph.split.us, %for.body10
%cmp55 = phi i32 [ 0, %for.body10 ], [ 1, %for.cond20.preheader.lr.ph.split.us ]
%spec.select = add nuw nsw i32 %cmp55, %c2.096
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%exitcond.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count128
br i1 %exitcond.not, label %for.end62, label %for.body10, !llvm.loop !9
for.end62: ; preds = %for.end54, %for.end54.us, %entry, %for.cond7.preheader
%c2.0.lcssa = phi i32 [ 0, %for.cond7.preheader ], [ 0, %entry ], [ %spec.select.us, %for.end54.us ], [ %spec.select, %for.end54 ]
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c2.0.lcssa)
call void @llvm.lifetime.end.p0(i64 10201, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 101, 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(void)
{
int a=0,b=0,mod=0,print1=0,print2=0,i=0,gcd=0,lcm=0;
while(scanf("%d %d",&a,&b)!=EOF){
print1 = (a>b) ? a : b;
print2 = (a>b) ? b : a;
for(i=0;i<=print1;i++)
{
print1=print1%print2;
if(print1==0)
{
gcd=print2;
printf("%d ",gcd);
break;
}
print2=print2%print1;
if(print2==0)
{
gcd=print1;
printf("%d ",gcd);
break;
}
}
lcm=a/gcd;
lcm*=b;
printf("%d\n",lcm);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121791/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
store i32 0, ptr %b, align 4, !tbaa !5
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not35 = icmp eq i32 %call34, -1
br i1 %cmp.not35, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%gcd.036 = phi i32 [ %gcd.1, %for.end ], [ 0, %entry ]
%0 = load i32, ptr %a, align 4
%1 = load i32, ptr %b, align 4
%cond = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%cmp7.not30 = icmp slt i32 %cond, 0
br i1 %cmp7.not30, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %while.body
%cond6 = call i32 @llvm.smin.i32(i32 %0, i32 %1)
br label %for.body
for.cond: ; preds = %if.end
%inc = add nuw nsw i32 %i.033, 1
%cmp7.not.not = icmp slt i32 %i.033, %rem
br i1 %cmp7.not.not, label %for.body, label %for.end, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%i.033 = phi i32 [ %inc, %for.cond ], [ 0, %for.body.preheader ]
%print2.032 = phi i32 [ %rem10, %for.cond ], [ %cond6, %for.body.preheader ]
%print1.031 = phi i32 [ %rem, %for.cond ], [ %cond, %for.body.preheader ]
%rem = srem i32 %print1.031, %print2.032
%cmp8 = icmp eq i32 %rem, 0
br i1 %cmp8, label %for.end.sink.split, label %if.end
if.end: ; preds = %for.body
%rem10 = srem i32 %print2.032, %rem
%cmp11 = icmp eq i32 %rem10, 0
br i1 %cmp11, label %for.end.sink.split, label %for.cond
for.end.sink.split: ; preds = %if.end, %for.body
%rem.lcssa41.sink = phi i32 [ %print2.032, %for.body ], [ %rem, %if.end ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %rem.lcssa41.sink)
br label %for.end
for.end: ; preds = %for.cond, %for.end.sink.split, %while.body
%gcd.1 = phi i32 [ %gcd.036, %while.body ], [ %rem.lcssa41.sink, %for.end.sink.split ], [ %gcd.036, %for.cond ]
%2 = load i32, ptr %a, align 4, !tbaa !5
%div = sdiv i32 %2, %gcd.1
%3 = load i32, ptr %b, align 4, !tbaa !5
%mul = mul nsw i32 %3, %div
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; 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 a, b, r, g, l;
int a1, b1;
while(scanf("%d %d", &a, &b) != EOF){
a1 = a;
b1 = b;
do{
r = a % b;
if(r == 0){
g = b;
}else {
a = b;
b = r;
}
}while(r != 0);
l = g * (a1 / g) * (b1 / g);
printf("%d %d\n", g, l);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121834/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121834/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%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
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not19 = icmp eq i32 %call18, -1
br i1 %cmp.not19, label %while.end, label %while.body
while.body: ; preds = %entry, %do.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%.fr = freeze i32 %0
%1 = load i32, ptr %b, align 4, !tbaa !5
%rem14 = srem i32 %.fr, %1
%cmp115 = icmp eq i32 %rem14, 0
br i1 %cmp115, label %do.end, label %do.cond
do.cond: ; preds = %while.body, %do.cond
%rem17 = phi i32 [ %rem, %do.cond ], [ %rem14, %while.body ]
%rem1316 = phi i32 [ %rem17, %do.cond ], [ %1, %while.body ]
%rem = srem i32 %rem1316, %rem17
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %do.body.do.end_crit_edge, label %do.cond
do.body.do.end_crit_edge: ; preds = %do.cond
store i32 %rem1316, ptr %a, align 4, !tbaa !5
store i32 %rem17, ptr %b, align 4, !tbaa !5
%.pre = srem i32 %.fr, %rem17
br label %do.end
do.end: ; preds = %do.body.do.end_crit_edge, %while.body
%.pre-phi = phi i32 [ %.pre, %do.body.do.end_crit_edge ], [ 0, %while.body ]
%.lcssa = phi i32 [ %rem17, %do.body.do.end_crit_edge ], [ %1, %while.body ]
%mul = sub nsw i32 %.fr, %.pre-phi
%div3 = sdiv i32 %1, %.lcssa
%mul4 = mul nsw i32 %mul, %div3
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa, i32 noundef %mul4)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %do.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main(){
int a,b,x,y;
int temp,tempa,tempb;
while(scanf("%d %d",&a,&b)!=EOF){
tempa=fmax(a,b);
tempb=fmin(a,b);
while(tempb!=0){
temp=tempa%tempb;
tempa=tempb;
tempb=temp;
}
x=tempa;
y=a/x*b;
printf("%d %d\n",x,y);
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121878/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121878/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%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
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not20 = icmp eq i32 %call19, -1
br i1 %cmp.not20, label %while.end11, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %b, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%2 = call double @llvm.maxnum.f64(double %conv, double %conv1)
%conv2 = fptosi double %2 to i32
%3 = call double @llvm.minnum.f64(double %conv, double %conv1)
%conv5 = fptosi double %3 to i32
%cmp7.not16 = icmp eq i32 %conv5, 0
br i1 %cmp7.not16, label %while.end, label %while.body9
while.body9: ; preds = %while.body, %while.body9
%tempb.018 = phi i32 [ %rem, %while.body9 ], [ %conv5, %while.body ]
%tempa.017 = phi i32 [ %tempb.018, %while.body9 ], [ %conv2, %while.body ]
%rem = srem i32 %tempa.017, %tempb.018
%cmp7.not = icmp eq i32 %rem, 0
br i1 %cmp7.not, label %while.end, label %while.body9, !llvm.loop !9
while.end: ; preds = %while.body9, %while.body
%tempa.0.lcssa = phi i32 [ %conv2, %while.body ], [ %tempb.018, %while.body9 ]
%div = sdiv i32 %0, %tempa.0.lcssa
%mul = mul nsw i32 %div, %1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %tempa.0.lcssa, i32 noundef %mul)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end11, label %while.body, !llvm.loop !11
while.end11: ; preds = %while.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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.maxnum.f64(double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.minnum.f64(double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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 gcd(int a, int b);
int lcm(int a, int b);
int main(void)
{
int a, b;
while (scanf("%d %d", &a, &b) == 2) {
printf("%d %d\n", gcd(a, b), lcm(a, b));
}
return (0);
}
int gcd(int a, int b)
{
if (b == 0) {
return (a);
}
return (gcd(b, a % b));
}
int lcm(int a, int b)
{
return (a / gcd(a, b) * b);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121920/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121920/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%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
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp7 = icmp eq i32 %call6, 2
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %lcm.exit
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp4.i = icmp eq i32 %1, 0
br i1 %cmp4.i, label %lcm.exit, label %if.end.i
if.end.i: ; preds = %while.body, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %1, %while.body ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %0, %while.body ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %if.end.i.i, label %if.end.i
if.end.i.i: ; preds = %if.end.i, %if.end.i.i
%b.tr6.i.i = phi i32 [ %rem.i.i, %if.end.i.i ], [ %1, %if.end.i ]
%a.tr5.i.i = phi i32 [ %b.tr6.i.i, %if.end.i.i ], [ %0, %if.end.i ]
%rem.i.i = srem i32 %a.tr5.i.i, %b.tr6.i.i
%cmp.i.i = icmp eq i32 %rem.i.i, 0
br i1 %cmp.i.i, label %lcm.exit, label %if.end.i.i
lcm.exit: ; preds = %if.end.i.i, %while.body
%a.tr.lcssa.i5 = phi i32 [ %0, %while.body ], [ %b.tr6.i, %if.end.i.i ]
%a.tr.lcssa.i.i = phi i32 [ %0, %while.body ], [ %b.tr6.i.i, %if.end.i.i ]
%div.i = sdiv i32 %0, %a.tr.lcssa.i.i
%mul.i = mul nsw i32 %div.i, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.tr.lcssa.i5, i32 noundef %mul.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp eq i32 %call, 2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %lcm.exit, %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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq i32 %b, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cmp4.i = icmp eq i32 %b, 0
br i1 %cmp4.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%div = sdiv i32 %a, %a.tr.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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 gcd(int a, int b);
int main(void)
{
int a, b, c, GCD, lcm;
while (scanf("%d %d",&a ,&b)!= EOF){
GCD = gcd(a, b);
lcm = a / GCD * b;
printf("%d %d\n", GCD, lcm);
}
return (0);
}
int gcd(int a, int b)
{
if (b == 0) return (a);
return (gcd(b, a % b));
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_121964/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_121964/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%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
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not5 = icmp eq i32 %call4, -1
br i1 %cmp.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %gcd.exit
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp4.i = icmp eq i32 %1, 0
br i1 %cmp4.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %while.body, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %1, %while.body ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %0, %while.body ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %while.body
%a.tr.lcssa.i = phi i32 [ %0, %while.body ], [ %b.tr6.i, %if.end.i ]
%div = sdiv i32 %0, %a.tr.lcssa.i
%mul = mul nsw i32 %div, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.tr.lcssa.i, i32 noundef %mul)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %gcd.exit, %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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq i32 %b, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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"}
|
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
GCD and LCM
*/
#include <stdio.h>
int main(void)
{
int a,b,temp,a_orig,b_orig;
long int gcd = 0, lcm = 0;
while(scanf("%ld %ld", &a_orig, &b_orig)!=EOF)
{
if (a_orig < b_orig)
{
long x;
x = b_orig;
b_orig = a_orig;
a_orig = x;
}
a = a_orig;
b = b_orig;
while (b != 0){
long temp;
temp = b;
b = a % b;
a = temp;
}
gcd = a;
/* lcm = a * b_orig / gcd ???????????§????????¨????????????
20???*20?????¨???????????¨long??§??????????????????????????§???????????????
*/
lcm = (a_orig / gcd) * b_orig;
printf("%d %ld\n", gcd, lcm);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122006/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122006/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [8 x i8] c"%d %ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a_orig = alloca i32, align 4
%b_orig = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a_orig) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b_orig) #3
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a_orig, ptr noundef nonnull %b_orig)
%cmp.not24 = icmp eq i32 %call23, -1
br i1 %cmp.not24, label %while.end14, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %a_orig, align 4, !tbaa !5
%1 = load i32, ptr %b_orig, align 4, !tbaa !5
%cmp1 = icmp slt i32 %0, %1
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %while.body
store i32 %0, ptr %b_orig, align 4, !tbaa !5
store i32 %1, ptr %a_orig, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%2 = phi i32 [ %0, %if.then ], [ %1, %while.body ]
%3 = phi i32 [ %1, %if.then ], [ %0, %while.body ]
%cmp4.not20 = icmp eq i32 %2, 0
br i1 %cmp4.not20, label %while.end, label %while.body6
while.body6: ; preds = %if.end, %while.body6
%a.022 = phi i32 [ %b.021, %while.body6 ], [ %3, %if.end ]
%b.021 = phi i32 [ %rem, %while.body6 ], [ %2, %if.end ]
%rem = srem i32 %a.022, %b.021
%cmp4.not = icmp eq i32 %rem, 0
br i1 %cmp4.not, label %while.end, label %while.body6, !llvm.loop !9
while.end: ; preds = %while.body6, %if.end
%a.0.lcssa = phi i32 [ %3, %if.end ], [ %b.021, %while.body6 ]
%conv10 = sext i32 %a.0.lcssa to i64
%conv11 = sext i32 %3 to i64
%div = sdiv i64 %conv11, %conv10
%conv12 = sext i32 %2 to i64
%mul = mul nsw i64 %div, %conv12
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %conv10, i64 noundef %mul)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a_orig, ptr noundef nonnull %b_orig)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end14, label %while.body, !llvm.loop !11
while.end14: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b_orig) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a_orig) #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"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
long long n,i,j,t,sum1,sum2;
long long b[100005],a[100005];
scanf("%I64d",&n);
for (i=0;i<n;i++)
scanf ("%I64d",&a[i]);
for (i=0;i<n;i++)
scanf ("%I64d",&b[i]);
sum1=0;
for (i=0;i<n;i++)
sum1=sum1+a[i];
sum2=0;
j=0;
for (i=1;i<n;i++)
if (b[j]<b[i])
j=i;
sum2=sum2+b[j];
t=0;
if (j==0)
t=1;
for (i=0;i<n;i++)
if (b[t]<b[i]&&i!=j)
t=i;
sum2+=b[t];
if (sum1<=sum2)
printf("YES");
else printf("NO");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12205/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12205/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%I64d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%b = alloca [100005 x i64], align 16
%a = alloca [100005 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp74 = icmp sgt i64 %0, 0
br i1 %cmp74, label %for.body, label %for.cond17.preheader.thread
for.cond2.preheader: ; preds = %for.body
%cmp376 = icmp sgt i64 %1, 0
br i1 %cmp376, label %for.body4, label %for.cond17.preheader.thread
for.body: ; preds = %entry, %for.body
%i.075 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %i.075
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.075, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond10.preheader: ; preds = %for.body4
%cmp1178 = icmp sgt i64 %9, 0
br i1 %cmp1178, label %for.body12.preheader, label %for.cond17.preheader.thread.thread
for.body12.preheader: ; preds = %for.cond10.preheader
%min.iters.check = icmp ult i64 %9, 4
br i1 %min.iters.check, label %for.body12.preheader116, label %vector.ph
vector.ph: ; preds = %for.body12.preheader
%n.vec = and i64 %9, -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.phi114 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%2 = getelementptr inbounds [100005 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.load115 = 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.load115, %vec.phi114
%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 !11
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 %9, %n.vec
br i1 %cmp.n, label %for.cond17.preheader, label %for.body12.preheader116
for.body12.preheader116: ; preds = %for.body12.preheader, %middle.block
%sum1.080.ph = phi i64 [ 0, %for.body12.preheader ], [ %7, %middle.block ]
%i.279.ph = phi i64 [ 0, %for.body12.preheader ], [ %n.vec, %middle.block ]
br label %for.body12
for.cond17.preheader.thread.thread: ; preds = %for.cond10.preheader
%8 = load i64, ptr %b, align 16, !tbaa !5
br label %for.end42
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.177 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond2.preheader ]
%arrayidx5 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %i.177
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%inc8 = add nuw nsw i64 %i.177, 1
%9 = load i64, ptr %n, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc8, %9
br i1 %cmp3, label %for.body4, label %for.cond10.preheader, !llvm.loop !14
for.cond17.preheader.thread: ; preds = %entry, %for.cond2.preheader
%10 = load i64, ptr %b, align 16, !tbaa !5
br label %for.end42
for.cond17.preheader: ; preds = %for.body12, %middle.block
%add.lcssa = phi i64 [ %7, %middle.block ], [ %add, %for.body12 ]
%cmp1882 = icmp sgt i64 %9, 1
br i1 %cmp1882, label %for.body19.preheader, label %for.end25
for.body19.preheader: ; preds = %for.cond17.preheader
%11 = add i64 %9, -1
%12 = add i64 %9, -2
%xtraiter = and i64 %11, 3
%13 = icmp ult i64 %12, 3
br i1 %13, label %for.end25.loopexit.unr-lcssa, label %for.body19.preheader.new
for.body19.preheader.new: ; preds = %for.body19.preheader
%unroll_iter = and i64 %11, -4
br label %for.body19
for.body12: ; preds = %for.body12.preheader116, %for.body12
%sum1.080 = phi i64 [ %add, %for.body12 ], [ %sum1.080.ph, %for.body12.preheader116 ]
%i.279 = phi i64 [ %inc15, %for.body12 ], [ %i.279.ph, %for.body12.preheader116 ]
%arrayidx13 = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %i.279
%14 = load i64, ptr %arrayidx13, align 8, !tbaa !5
%add = add nsw i64 %14, %sum1.080
%inc15 = add nuw nsw i64 %i.279, 1
%exitcond.not = icmp eq i64 %inc15, %9
br i1 %exitcond.not, label %for.cond17.preheader, label %for.body12, !llvm.loop !15
for.body19: ; preds = %for.body19, %for.body19.preheader.new
%j.084 = phi i64 [ 0, %for.body19.preheader.new ], [ %spec.select.3, %for.body19 ]
%i.383 = phi i64 [ 1, %for.body19.preheader.new ], [ %inc24.3, %for.body19 ]
%niter = phi i64 [ 0, %for.body19.preheader.new ], [ %niter.next.3, %for.body19 ]
%arrayidx20 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %j.084
%15 = load i64, ptr %arrayidx20, align 8, !tbaa !5
%arrayidx21 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %i.383
%16 = load i64, ptr %arrayidx21, align 8, !tbaa !5
%cmp22 = icmp slt i64 %15, %16
%spec.select = select i1 %cmp22, i64 %i.383, i64 %j.084
%inc24 = add nuw nsw i64 %i.383, 1
%arrayidx20.1 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %spec.select
%17 = load i64, ptr %arrayidx20.1, align 8, !tbaa !5
%arrayidx21.1 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %inc24
%18 = load i64, ptr %arrayidx21.1, align 8, !tbaa !5
%cmp22.1 = icmp slt i64 %17, %18
%spec.select.1 = select i1 %cmp22.1, i64 %inc24, i64 %spec.select
%inc24.1 = add nuw nsw i64 %i.383, 2
%arrayidx20.2 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %spec.select.1
%19 = load i64, ptr %arrayidx20.2, align 8, !tbaa !5
%arrayidx21.2 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %inc24.1
%20 = load i64, ptr %arrayidx21.2, align 8, !tbaa !5
%cmp22.2 = icmp slt i64 %19, %20
%spec.select.2 = select i1 %cmp22.2, i64 %inc24.1, i64 %spec.select.1
%inc24.2 = add nuw nsw i64 %i.383, 3
%arrayidx20.3 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %spec.select.2
%21 = load i64, ptr %arrayidx20.3, align 8, !tbaa !5
%arrayidx21.3 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %inc24.2
%22 = load i64, ptr %arrayidx21.3, align 8, !tbaa !5
%cmp22.3 = icmp slt i64 %21, %22
%spec.select.3 = select i1 %cmp22.3, i64 %inc24.2, i64 %spec.select.2
%inc24.3 = add nuw nsw i64 %i.383, 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.end25.loopexit.unr-lcssa, label %for.body19, !llvm.loop !16
for.end25.loopexit.unr-lcssa: ; preds = %for.body19, %for.body19.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body19.preheader ], [ %spec.select.3, %for.body19 ]
%j.084.unr = phi i64 [ 0, %for.body19.preheader ], [ %spec.select.3, %for.body19 ]
%i.383.unr = phi i64 [ 1, %for.body19.preheader ], [ %inc24.3, %for.body19 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end25, label %for.body19.epil
for.body19.epil: ; preds = %for.end25.loopexit.unr-lcssa, %for.body19.epil
%j.084.epil = phi i64 [ %spec.select.epil, %for.body19.epil ], [ %j.084.unr, %for.end25.loopexit.unr-lcssa ]
%i.383.epil = phi i64 [ %inc24.epil, %for.body19.epil ], [ %i.383.unr, %for.end25.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body19.epil ], [ 0, %for.end25.loopexit.unr-lcssa ]
%arrayidx20.epil = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %j.084.epil
%23 = load i64, ptr %arrayidx20.epil, align 8, !tbaa !5
%arrayidx21.epil = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %i.383.epil
%24 = load i64, ptr %arrayidx21.epil, align 8, !tbaa !5
%cmp22.epil = icmp slt i64 %23, %24
%spec.select.epil = select i1 %cmp22.epil, i64 %i.383.epil, i64 %j.084.epil
%inc24.epil = add nuw nsw i64 %i.383.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.end25, label %for.body19.epil, !llvm.loop !17
for.end25: ; preds = %for.end25.loopexit.unr-lcssa, %for.body19.epil, %for.cond17.preheader
%j.0.lcssa = phi i64 [ 0, %for.cond17.preheader ], [ %spec.select.lcssa.ph, %for.end25.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body19.epil ]
%arrayidx26 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %j.0.lcssa
%25 = load i64, ptr %arrayidx26, align 8, !tbaa !5
%cmp28 = icmp eq i64 %j.0.lcssa, 0
%spec.store.select = zext i1 %cmp28 to i64
br i1 %cmp1178, label %for.body33.preheader, label %for.end42
for.body33.preheader: ; preds = %for.end25
%xtraiter122 = and i64 %9, 1
%26 = icmp eq i64 %9, 1
br i1 %26, label %for.end42.loopexit.unr-lcssa, label %for.body33.preheader.new
for.body33.preheader.new: ; preds = %for.body33.preheader
%unroll_iter126 = and i64 %9, -2
br label %for.body33
for.body33: ; preds = %for.body33, %for.body33.preheader.new
%t.088 = phi i64 [ %spec.store.select, %for.body33.preheader.new ], [ %t.1.1, %for.body33 ]
%i.487 = phi i64 [ 0, %for.body33.preheader.new ], [ %inc41.1, %for.body33 ]
%niter127 = phi i64 [ 0, %for.body33.preheader.new ], [ %niter127.next.1, %for.body33 ]
%arrayidx34 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %t.088
%27 = load i64, ptr %arrayidx34, align 8, !tbaa !5
%arrayidx35 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %i.487
%28 = load i64, ptr %arrayidx35, align 16, !tbaa !5
%cmp36 = icmp sge i64 %27, %28
%cmp37.not = icmp eq i64 %i.487, %j.0.lcssa
%or.cond = or i1 %cmp36, %cmp37.not
%t.1 = select i1 %or.cond, i64 %t.088, i64 %i.487
%inc41 = or i64 %i.487, 1
%arrayidx34.1 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %t.1
%29 = load i64, ptr %arrayidx34.1, align 8, !tbaa !5
%arrayidx35.1 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %inc41
%30 = load i64, ptr %arrayidx35.1, align 8, !tbaa !5
%cmp36.1 = icmp sge i64 %29, %30
%cmp37.not.1 = icmp eq i64 %inc41, %j.0.lcssa
%or.cond.1 = or i1 %cmp36.1, %cmp37.not.1
%t.1.1 = select i1 %or.cond.1, i64 %t.1, i64 %inc41
%inc41.1 = add nuw nsw i64 %i.487, 2
%niter127.next.1 = add i64 %niter127, 2
%niter127.ncmp.1 = icmp eq i64 %niter127.next.1, %unroll_iter126
br i1 %niter127.ncmp.1, label %for.end42.loopexit.unr-lcssa, label %for.body33, !llvm.loop !19
for.end42.loopexit.unr-lcssa: ; preds = %for.body33, %for.body33.preheader
%t.1.lcssa.ph = phi i64 [ undef, %for.body33.preheader ], [ %t.1.1, %for.body33 ]
%t.088.unr = phi i64 [ %spec.store.select, %for.body33.preheader ], [ %t.1.1, %for.body33 ]
%i.487.unr = phi i64 [ 0, %for.body33.preheader ], [ %inc41.1, %for.body33 ]
%lcmp.mod124.not = icmp eq i64 %xtraiter122, 0
br i1 %lcmp.mod124.not, label %for.end42, label %for.body33.epil
for.body33.epil: ; preds = %for.end42.loopexit.unr-lcssa
%arrayidx34.epil = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %t.088.unr
%31 = load i64, ptr %arrayidx34.epil, align 8, !tbaa !5
%arrayidx35.epil = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %i.487.unr
%32 = load i64, ptr %arrayidx35.epil, align 8, !tbaa !5
%cmp36.epil = icmp sge i64 %31, %32
%cmp37.not.epil = icmp eq i64 %i.487.unr, %j.0.lcssa
%or.cond.epil = or i1 %cmp36.epil, %cmp37.not.epil
%t.1.epil = select i1 %or.cond.epil, i64 %t.088.unr, i64 %i.487.unr
br label %for.end42
for.end42: ; preds = %for.body33.epil, %for.end42.loopexit.unr-lcssa, %for.cond17.preheader.thread, %for.cond17.preheader.thread.thread, %for.end25
%33 = phi i64 [ %25, %for.end25 ], [ %10, %for.cond17.preheader.thread ], [ %8, %for.cond17.preheader.thread.thread ], [ %25, %for.end42.loopexit.unr-lcssa ], [ %25, %for.body33.epil ]
%sum1.0.lcssa104105 = phi i64 [ %add.lcssa, %for.end25 ], [ 0, %for.cond17.preheader.thread ], [ 0, %for.cond17.preheader.thread.thread ], [ %add.lcssa, %for.end42.loopexit.unr-lcssa ], [ %add.lcssa, %for.body33.epil ]
%t.0.lcssa = phi i64 [ %spec.store.select, %for.end25 ], [ 1, %for.cond17.preheader.thread ], [ 1, %for.cond17.preheader.thread.thread ], [ %t.1.lcssa.ph, %for.end42.loopexit.unr-lcssa ], [ %t.1.epil, %for.body33.epil ]
%arrayidx43 = getelementptr inbounds [100005 x i64], ptr %b, i64 0, i64 %t.0.lcssa
%34 = load i64, ptr %arrayidx43, align 8, !tbaa !5
%add44 = add nsw i64 %34, %33
%cmp45.not = icmp sgt i64 %sum1.0.lcssa104105, %add44
%.str.2..str.1 = select i1 %cmp45.not, ptr @.str.2, ptr @.str.1
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %b) #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.vector.reduce.add.v2i64(<2 x i64>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !10}
|
#include <stdio.h>
int main ()
{
long long int a,b,t,g,c,d;
long long int l;
while (scanf("%lld %lld", &a, &b)!=EOF){
if (a==0){
g=a;
}
else if (b==0) {
g=b;
}
else {
d=a;
c=b;
while (c!=0){
t=c;
c=d%c;
d=t;
}
g = d;
}
l = (a*b)/g;
printf ("%lld %lld\n", g, l);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122093/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122093/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%lld %lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not20 = icmp eq i32 %call19, -1
br i1 %cmp.not20, label %while.end10, label %while.body
while.body: ; preds = %entry, %if.end8
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp1 = icmp eq i64 %0, 0
%1 = load i64, ptr %b, align 8
%cmp2 = icmp eq i64 %1, 0
%or.cond = select i1 %cmp1, i1 true, i1 %cmp2
br i1 %or.cond, label %if.end8, label %while.body7
while.body7: ; preds = %while.body, %while.body7
%d.018 = phi i64 [ %c.017, %while.body7 ], [ %0, %while.body ]
%c.017 = phi i64 [ %rem, %while.body7 ], [ %1, %while.body ]
%rem = srem i64 %d.018, %c.017
%cmp6.not = icmp eq i64 %rem, 0
br i1 %cmp6.not, label %if.end8, label %while.body7, !llvm.loop !9
if.end8: ; preds = %while.body7, %while.body
%g.0 = phi i64 [ 0, %while.body ], [ %c.017, %while.body7 ]
%mul = mul nsw i64 %1, %0
%div = sdiv i64 %mul, %g.0
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %g.0, i64 noundef %div)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end10, label %while.body, !llvm.loop !11
while.end10: ; preds = %if.end8, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
long long int a,b;
long long int A,B,temp;
long long int gcd,lcm;
while(scanf("%lld %lld",&a,&b)!=EOF){
A=a;
B=b;
while(A%B!=0){
temp=A%B;
A=B;
B=temp;
}
gcd=B;
lcm=a*b/gcd;
printf("%lld %lld\n",gcd,lcm);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122136/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122136/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%lld %lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not13 = icmp eq i32 %call12, -1
br i1 %cmp.not13, label %while.end6, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
br label %while.cond1
while.cond1: ; preds = %while.cond1, %while.body
%B.0 = phi i64 [ %1, %while.body ], [ %rem, %while.cond1 ]
%A.0 = phi i64 [ %0, %while.body ], [ %B.0, %while.cond1 ]
%rem = srem i64 %A.0, %B.0
%cmp2.not = icmp eq i64 %rem, 0
br i1 %cmp2.not, label %while.end, label %while.cond1, !llvm.loop !9
while.end: ; preds = %while.cond1
%mul = mul nsw i64 %1, %0
%div = sdiv i64 %mul, %B.0
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %B.0, i64 noundef %div)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end6, label %while.body, !llvm.loop !11
while.end6: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
long gcd(long ,long );
long lcm(long ,long );
int main(void){
long a, b, g, l;
while ((scanf("%d %d", &a, &b)) != EOF) {
if (a > 2000000000) {
printf("Error!\n\a");
continue;
} else if (b > 2000000000) {
printf("Error!\n\a");
continue;
} else {
g = gcd(a, b);
l = lcm(a, b);
if (l > 2000000000) {
printf("Error!\n\a");
continue;
}
printf("%d %d\n", g, l);
}
}
return 0;
}
long gcd(long a, long b) {
if ((!a) || (!b)) {
printf("Error!\n\a");
return 0;
}
while (a != b) {
if (a > b)
a = a - b;
else
b = b - a;
}
return a;
}
long lcm(long a, long b) {
if ((!a) || (!b)) {
printf("Error!\n\a");
return 0;
}
return (a / gcd(a, b) * b);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122187/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122187/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"Error!\0A\07\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not27 = icmp eq i32 %call26, -1
br i1 %cmp.not27, label %while.end, label %while.body
while.body: ; preds = %entry, %while.cond.backedge
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp1 = icmp sgt i64 %0, 2000000000
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then, %if.then4, %if.then10, %if.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
if.else: ; preds = %while.body
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp3 = icmp sgt i64 %1, 2000000000
br i1 %cmp3, label %if.then4, label %if.else6
if.then4: ; preds = %if.else
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %while.cond.backedge
if.else6: ; preds = %if.else
%tobool.i = icmp ne i64 %0, 0
%tobool1.i = icmp ne i64 %1, 0
%or.cond.i = and i1 %tobool.i, %tobool1.i
br i1 %or.cond.i, label %while.cond.preheader.i, label %if.then.i
while.cond.preheader.i: ; preds = %if.else6
%cmp.not15.i = icmp eq i64 %0, %1
br i1 %cmp.not15.i, label %gcd.exit, label %while.body.i
if.then.i: ; preds = %if.else6
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%.pre = load i64, ptr %a, align 8, !tbaa !5
%.pre28 = load i64, ptr %b, align 8, !tbaa !5
br label %gcd.exit
while.body.i: ; preds = %while.cond.preheader.i, %while.body.i
%b.addr.017.i = phi i64 [ %b.addr.1.i, %while.body.i ], [ %1, %while.cond.preheader.i ]
%a.addr.016.i = phi i64 [ %a.addr.1.i, %while.body.i ], [ %0, %while.cond.preheader.i ]
%cmp2.i = icmp sgt i64 %a.addr.016.i, %b.addr.017.i
%sub.i = select i1 %cmp2.i, i64 %b.addr.017.i, i64 0
%a.addr.1.i = sub nsw i64 %a.addr.016.i, %sub.i
%sub4.i = select i1 %cmp2.i, i64 0, i64 %a.addr.016.i
%b.addr.1.i = sub nsw i64 %b.addr.017.i, %sub4.i
%cmp.not.i = icmp eq i64 %a.addr.1.i, %b.addr.1.i
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !11
gcd.exit: ; preds = %while.body.i, %while.cond.preheader.i, %if.then.i
%2 = phi i64 [ %.pre28, %if.then.i ], [ %0, %while.cond.preheader.i ], [ %1, %while.body.i ]
%3 = phi i64 [ %.pre, %if.then.i ], [ %0, %while.cond.preheader.i ], [ %0, %while.body.i ]
%retval.0.i = phi i64 [ 0, %if.then.i ], [ %0, %while.cond.preheader.i ], [ %a.addr.1.i, %while.body.i ]
%tobool.i17 = icmp ne i64 %3, 0
%tobool1.i18 = icmp ne i64 %2, 0
%or.cond.i19 = and i1 %tobool.i17, %tobool1.i18
br i1 %or.cond.i19, label %while.cond.preheader.i.i, label %lcm.exit.thread
lcm.exit.thread: ; preds = %gcd.exit
%call.i21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
while.cond.preheader.i.i: ; preds = %gcd.exit
%cmp.not15.i.i = icmp eq i64 %3, %2
br i1 %cmp.not15.i.i, label %lcm.exit, label %while.body.i.i
while.body.i.i: ; preds = %while.cond.preheader.i.i, %while.body.i.i
%b.addr.017.i.i = phi i64 [ %b.addr.1.i.i, %while.body.i.i ], [ %2, %while.cond.preheader.i.i ]
%a.addr.016.i.i = phi i64 [ %a.addr.1.i.i, %while.body.i.i ], [ %3, %while.cond.preheader.i.i ]
%cmp2.i.i = icmp sgt i64 %a.addr.016.i.i, %b.addr.017.i.i
%sub.i.i = select i1 %cmp2.i.i, i64 %b.addr.017.i.i, i64 0
%a.addr.1.i.i = sub nsw i64 %a.addr.016.i.i, %sub.i.i
%sub4.i.i = select i1 %cmp2.i.i, i64 0, i64 %a.addr.016.i.i
%b.addr.1.i.i = sub nsw i64 %b.addr.017.i.i, %sub4.i.i
%cmp.not.i.i = icmp eq i64 %a.addr.1.i.i, %b.addr.1.i.i
br i1 %cmp.not.i.i, label %lcm.exit, label %while.body.i.i, !llvm.loop !11
lcm.exit: ; preds = %while.body.i.i, %while.cond.preheader.i.i
%retval.0.i.i = phi i64 [ %2, %while.cond.preheader.i.i ], [ %a.addr.1.i.i, %while.body.i.i ]
%div.i = sdiv i64 %3, %retval.0.i.i
%mul.i = mul nsw i64 %div.i, %2
%cmp9 = icmp sgt i64 %mul.i, 2000000000
br i1 %cmp9, label %if.then10, label %if.end
if.then10: ; preds = %lcm.exit
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %while.cond.backedge
if.end: ; preds = %lcm.exit.thread, %lcm.exit
%retval.0.i2225 = phi i64 [ 0, %lcm.exit.thread ], [ %mul.i, %lcm.exit ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %retval.0.i, i64 noundef %retval.0.i2225)
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %entry
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: nofree nounwind uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%tobool = icmp ne i64 %a, 0
%tobool1 = icmp ne i64 %b, 0
%or.cond = and i1 %tobool, %tobool1
br i1 %or.cond, label %while.cond.preheader, label %if.then
while.cond.preheader: ; preds = %entry
%cmp.not15 = icmp eq i64 %a, %b
br i1 %cmp.not15, label %return, label %while.body
if.then: ; preds = %entry
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %return
while.body: ; preds = %while.cond.preheader, %while.body
%b.addr.017 = phi i64 [ %b.addr.1, %while.body ], [ %b, %while.cond.preheader ]
%a.addr.016 = phi i64 [ %a.addr.1, %while.body ], [ %a, %while.cond.preheader ]
%cmp2 = icmp sgt i64 %a.addr.016, %b.addr.017
%sub = select i1 %cmp2, i64 %b.addr.017, i64 0
%a.addr.1 = sub nsw i64 %a.addr.016, %sub
%sub4 = select i1 %cmp2, i64 0, i64 %a.addr.016
%b.addr.1 = sub nsw i64 %b.addr.017, %sub4
%cmp.not = icmp eq i64 %a.addr.1, %b.addr.1
br i1 %cmp.not, label %return, label %while.body, !llvm.loop !11
return: ; preds = %while.body, %while.cond.preheader, %if.then
%retval.0 = phi i64 [ 0, %if.then ], [ %a, %while.cond.preheader ], [ %a.addr.1, %while.body ]
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%tobool = icmp ne i64 %a, 0
%tobool1 = icmp ne i64 %b, 0
%or.cond = and i1 %tobool, %tobool1
br i1 %or.cond, label %while.cond.preheader.i, label %if.then
if.then: ; preds = %entry
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %return
while.cond.preheader.i: ; preds = %entry
%cmp.not15.i = icmp eq i64 %a, %b
br i1 %cmp.not15.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %while.cond.preheader.i, %while.body.i
%b.addr.017.i = phi i64 [ %b.addr.1.i, %while.body.i ], [ %b, %while.cond.preheader.i ]
%a.addr.016.i = phi i64 [ %a.addr.1.i, %while.body.i ], [ %a, %while.cond.preheader.i ]
%cmp2.i = icmp sgt i64 %a.addr.016.i, %b.addr.017.i
%sub.i = select i1 %cmp2.i, i64 %b.addr.017.i, i64 0
%a.addr.1.i = sub nsw i64 %a.addr.016.i, %sub.i
%sub4.i = select i1 %cmp2.i, i64 0, i64 %a.addr.016.i
%b.addr.1.i = sub nsw i64 %b.addr.017.i, %sub4.i
%cmp.not.i = icmp eq i64 %a.addr.1.i, %b.addr.1.i
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !11
gcd.exit: ; preds = %while.body.i, %while.cond.preheader.i
%retval.0.i = phi i64 [ %a, %while.cond.preheader.i ], [ %a.addr.1.i, %while.body.i ]
%div = sdiv i64 %a, %retval.0.i
%mul = mul nsw i64 %div, %b
br label %return
return: ; preds = %gcd.exit, %if.then
%retval.0 = phi i64 [ %mul, %gcd.exit ], [ 0, %if.then ]
ret i64 %retval.0
}
; 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
long int n,i;
scanf("%ld",&n);
long int sum[n];
for(i=0;i<n;i++){
long int a;
scanf("%ld",&sum[i]);
}
long int max1=0,max2=0;
for(i=0;i<n;i++){
long int a;
scanf("%ld",&a);
if(a>=max1){
max2=max1;
max1=a;
}
else{
if(a>max2){
max2=a;
}
}
}
int y=0;
long int max=max1+max2;
long int k=0;
for(i=0;i<n;i++){
k+=sum[i];
if(k>max){
y=1;
break;
}
}
if(y==0){
printf("YES");
}
else{
printf("NO");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12223/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12223/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a5 = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp42 = icmp sgt i64 %2, 0
br i1 %cmp42, label %for.body, label %if.end30
for.cond2.preheader: ; preds = %for.body
%cmp344 = icmp sgt i64 %3, 0
br i1 %cmp344, label %for.body4, label %if.end30
for.body: ; preds = %entry, %for.body
%i.043 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.043
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.043, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%max2.047 = phi i64 [ %max2.1, %for.body4 ], [ 0, %for.cond2.preheader ]
%max1.046 = phi i64 [ %max1.1, %for.body4 ], [ 0, %for.cond2.preheader ]
%i.145 = phi i64 [ %inc12, %for.body4 ], [ 0, %for.cond2.preheader ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a5) #5
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a5)
%4 = load i64, ptr %a5, align 8, !tbaa !5
%cmp7.not = icmp slt i64 %4, %max1.046
%spec.select = call i64 @llvm.smax.i64(i64 %4, i64 %max2.047)
%max1.1 = call i64 @llvm.smax.i64(i64 %4, i64 %max1.046)
%max2.1 = select i1 %cmp7.not, i64 %spec.select, i64 %max1.046
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a5) #5
%inc12 = add nuw nsw i64 %i.145, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc12, %5
br i1 %cmp3, label %for.body4, label %for.end13, !llvm.loop !11
for.end13: ; preds = %for.body4
%6 = add nuw nsw i64 %max2.1, %max1.1
%cmp15.not50 = icmp sgt i64 %5, 0
br i1 %cmp15.not50, label %for.body16, label %if.end30
for.cond14: ; preds = %for.body16
%inc23 = add nuw nsw i64 %i.251, 1
%exitcond.not = icmp eq i64 %inc23, %5
br i1 %exitcond.not, label %if.end30, label %for.body16, !llvm.loop !12
for.body16: ; preds = %for.end13, %for.cond14
%k.052 = phi i64 [ %add18, %for.cond14 ], [ 0, %for.end13 ]
%i.251 = phi i64 [ %inc23, %for.cond14 ], [ 0, %for.end13 ]
%arrayidx17 = getelementptr inbounds i64, ptr %vla, i64 %i.251
%7 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%add18 = add nsw i64 %7, %k.052
%cmp19 = icmp sgt i64 %add18, %6
br i1 %cmp19, label %if.end30, label %for.cond14
if.end30: ; preds = %for.body16, %for.cond14, %for.end13, %for.cond2.preheader, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.cond2.preheader ], [ @.str.1, %for.end13 ], [ @.str.1, %for.cond14 ], [ @.str.2, %for.body16 ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main()
{
long a, b, x, y, tmp;
while(scanf("%ld %ld", &x, &y) != EOF) {
if(x < y) {
tmp = x;
x = y;
y = tmp;
}
a = x;
b = y;
do {
tmp = x % y;
x = y;
y = tmp;
} while(y != 0);
printf("%ld %ld\n", x, a * b / x);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122273/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%ld %ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %do.end
%0 = load i64, ptr %x, align 8, !tbaa !5
%1 = load i64, ptr %y, align 8, !tbaa !5
%spec.select = call i64 @llvm.smin.i64(i64 %0, i64 %1)
%spec.select10 = call i64 @llvm.smax.i64(i64 %0, i64 %1)
br label %do.body
do.body: ; preds = %do.body, %while.body
%rem7 = phi i64 [ %rem, %do.body ], [ %spec.select, %while.body ]
%2 = phi i64 [ %rem7, %do.body ], [ %spec.select10, %while.body ]
%rem = srem i64 %2, %rem7
%cmp2.not = icmp eq i64 %rem, 0
br i1 %cmp2.not, label %do.end, label %do.body, !llvm.loop !9
do.end: ; preds = %do.body
store i64 %rem7, ptr %x, align 8, !tbaa !5
store i64 0, ptr %y, align 8, !tbaa !5
%mul = mul nsw i64 %0, %1
%div = sdiv i64 %mul, %rem7
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem7, i64 noundef %div)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %do.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int getGCD( int a, int b );
int main( void )
{
int a;
int b;
int GCD;
int LCM;
while( scanf( "%d %d", &a, &b ) != EOF )
{
GCD = getGCD( a, b );
LCM = ( a / GCD ) * ( b / GCD ) * GCD;
printf( "%d %d\n", GCD, LCM );
}
return (0);
}
int getGCD( int a, int b )
{
int big;
int small;
if( a > b )
{
big = a;
small = b;
}
else
{
big = b;
small = a;
}
if( small == 0 )
{
return ( big );
}
else
{
return ( getGCD( small, big % small ) );
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122323/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %getGCD.exit
%0 = load i32, ptr %a, align 4, !tbaa !5
%.fr = freeze i32 %0
%1 = load i32, ptr %b, align 4, !tbaa !5
%a.b12.i = call i32 @llvm.smax.i32(i32 %.fr, i32 %1)
%b.a13.i = call i32 @llvm.smin.i32(i32 %.fr, i32 %1)
%cmp114.i = icmp eq i32 %b.a13.i, 0
br i1 %cmp114.i, label %getGCD.exit, label %if.else3.i
if.else3.i: ; preds = %while.body, %if.else3.i
%b.a16.i = phi i32 [ %b.a.i, %if.else3.i ], [ %b.a13.i, %while.body ]
%a.b15.i = phi i32 [ %a.b.i, %if.else3.i ], [ %a.b12.i, %while.body ]
%rem.i = srem i32 %a.b15.i, %b.a16.i
%a.b.i = call i32 @llvm.smax.i32(i32 %b.a16.i, i32 %rem.i)
%b.a.i = call i32 @llvm.smin.i32(i32 %b.a16.i, i32 %rem.i)
%cmp1.i = icmp eq i32 %b.a.i, 0
br i1 %cmp1.i, label %getGCD.exit, label %if.else3.i
getGCD.exit: ; preds = %if.else3.i, %while.body
%a.b.lcssa.i = phi i32 [ %a.b12.i, %while.body ], [ %a.b.i, %if.else3.i ]
%div2 = sdiv i32 %1, %a.b.lcssa.i
%2 = srem i32 %.fr, %a.b.lcssa.i
%mul = sub nsw i32 %.fr, %2
%mul3 = mul i32 %mul, %div2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.b.lcssa.i, i32 noundef %mul3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %getGCD.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @getGCD(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%a.b12 = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%b.a13 = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%cmp114 = icmp eq i32 %b.a13, 0
br i1 %cmp114, label %cleanup, label %if.else3
if.else3: ; preds = %entry, %if.else3
%b.a16 = phi i32 [ %b.a, %if.else3 ], [ %b.a13, %entry ]
%a.b15 = phi i32 [ %a.b, %if.else3 ], [ %a.b12, %entry ]
%rem = srem i32 %a.b15, %b.a16
%a.b = tail call i32 @llvm.smax.i32(i32 %b.a16, i32 %rem)
%b.a = tail call i32 @llvm.smin.i32(i32 %b.a16, i32 %rem)
%cmp1 = icmp eq i32 %b.a, 0
br i1 %cmp1, label %cleanup, label %if.else3
cleanup: ; preds = %if.else3, %entry
%a.b.lcssa = phi i32 [ %a.b12, %entry ], [ %a.b, %if.else3 ]
ret i32 %a.b.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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(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"}
|
#include <stdio.h>
int main(void){
int a,b,g;
int x,y;
while(scanf("%d %d",&a,&b) != EOF){
if(a > b){
x=a;y=b;
}else{
x=b;y=a;
}
while(a != b){
if(a > b){
a = a-b;
}else{
b = b-a;
}
}
printf("%d %d\n",a,x*(y/a));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122367/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122367/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%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
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not25 = icmp eq i32 %call24, -1
br i1 %cmp.not25, label %while.end11, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%.16 = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%cmp3.not21 = icmp eq i32 %0, %1
br i1 %cmp3.not21, label %while.end, label %while.body4
while.body4: ; preds = %while.body, %if.end9
%sub1823 = phi i32 [ %sub17, %if.end9 ], [ %0, %while.body ]
%sub82022 = phi i32 [ %sub819, %if.end9 ], [ %1, %while.body ]
%cmp5 = icmp sgt i32 %sub1823, %sub82022
br i1 %cmp5, label %if.then6, label %if.else7
if.then6: ; preds = %while.body4
%sub = sub nsw i32 %sub1823, %sub82022
store i32 %sub, ptr %a, align 4, !tbaa !5
br label %if.end9
if.else7: ; preds = %while.body4
%sub8 = sub nsw i32 %sub82022, %sub1823
store i32 %sub8, ptr %b, align 4, !tbaa !5
br label %if.end9
if.end9: ; preds = %if.else7, %if.then6
%sub819 = phi i32 [ %sub8, %if.else7 ], [ %sub82022, %if.then6 ]
%sub17 = phi i32 [ %sub1823, %if.else7 ], [ %sub, %if.then6 ]
%cmp3.not = icmp eq i32 %sub17, %sub819
br i1 %cmp3.not, label %while.end, label %while.body4, !llvm.loop !9
while.end: ; preds = %if.end9, %while.body
%.lcssa = phi i32 [ %0, %while.body ], [ %sub819, %if.end9 ]
%div = sdiv i32 %.16, %.lcssa
%mul = mul nsw i32 %div, %.
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa, i32 noundef %mul)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end11, label %while.body, !llvm.loop !11
while.end11: ; preds = %while.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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <assert.h>
#define MAX_SIZE 50
int n, m;
char grid[MAX_SIZE][MAX_SIZE + 1];
int mark[MAX_SIZE][MAX_SIZE + 1];
int cycle(int x, int y, int z, char c)
{
if(x < 0 || y < 0 || x > n - 1 || y > m - 1 || grid[x][y] != c)
return 0;
else if(mark[x][y] && z - mark[x][y] >= 4)
return 1;
else if(mark[x][y])
return 0;
else
{
mark[x][y] = z;
return cycle(x - 1, y, z + 1, c) | cycle(x + 1, y, z + 1, c) | cycle(x, y - 1, z + 1, c) | cycle(x, y + 1, z + 1, c);
}
}
int main(void)
{
int i, j;
scanf("%d %d", &n, &m);
for(i = n; i --;)
{
scanf(" %s", grid[i]);
for(j = m; j --;)
mark[i][j] = 0;
}
for(i = n; i --;)
{
for(j = m; j --;)
{
if(!mark[i][j] && cycle(i, j, 1, grid[i][j]))
break;
}
if(j >= 0)
break;
}
if(i >= 0)
puts("Yes");
else
puts("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12241/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12241/source.c"
target datalayout = "e-m:e-p270: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
@m = dso_local global i32 0, align 4
@grid = dso_local global [50 x [51 x i8]] zeroinitializer, align 16
@mark = dso_local local_unnamed_addr global [50 x [51 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @cycle(i32 noundef %x, i32 noundef %y, i32 noundef %z, i8 noundef signext %c) local_unnamed_addr #0 {
entry:
%idxprom = zext i32 %x to i64
%0 = or i32 %y, %x
%or.cond.not80 = icmp sgt i32 %0, -1
%1 = load i32, ptr @n, align 4
%cmp3.not81 = icmp sgt i32 %1, %x
%or.cond82 = select i1 %or.cond.not80, i1 %cmp3.not81, i1 false
%2 = load i32, ptr @m, align 4
%cmp6.not83 = icmp sgt i32 %2, %y
%or.cond7884 = select i1 %or.cond82, i1 %cmp6.not83, i1 false
br i1 %or.cond7884, label %lor.lhs.false7.lr.ph, label %return
lor.lhs.false7.lr.ph: ; preds = %entry
%sub37 = add nsw i32 %x, -1
%add38 = add nuw nsw i32 %x, 1
%3 = zext i32 %y to i64
br label %lor.lhs.false7
lor.lhs.false7: ; preds = %lor.lhs.false7.lr.ph, %if.else32
%indvars.iv = phi i64 [ %3, %lor.lhs.false7.lr.ph ], [ %indvars.iv.next, %if.else32 ]
%z.tr87 = phi i32 [ %z, %lor.lhs.false7.lr.ph ], [ %add, %if.else32 ]
%accumulator.tr85 = phi i32 [ 0, %lor.lhs.false7.lr.ph ], [ %or48, %if.else32 ]
%arrayidx9 = getelementptr inbounds [50 x [51 x i8]], ptr @grid, i64 0, i64 %idxprom, i64 %indvars.iv
%4 = load i8, ptr %arrayidx9, align 1, !tbaa !5
%cmp11.not = icmp eq i8 %4, %c
br i1 %cmp11.not, label %if.else, label %return.loopexit
if.else: ; preds = %lor.lhs.false7
%arrayidx16 = getelementptr inbounds [50 x [51 x i32]], ptr @mark, i64 0, i64 %idxprom, i64 %indvars.iv
%5 = load i32, ptr %arrayidx16, align 4, !tbaa !8
%tobool.not = icmp ne i32 %5, 0
%sub21 = sub nsw i32 %z.tr87, %5
%cmp22 = icmp sgt i32 %sub21, 3
%or.cond79 = select i1 %tobool.not, i1 %cmp22, i1 false
br i1 %or.cond79, label %return.loopexit, label %if.else25
if.else25: ; preds = %if.else
%tobool30.not = icmp eq i32 %5, 0
br i1 %tobool30.not, label %if.else32, label %return.loopexit
if.else32: ; preds = %if.else25
store i32 %z.tr87, ptr %arrayidx16, align 4, !tbaa !8
%add = add nsw i32 %z.tr87, 1
%6 = trunc i64 %indvars.iv to i32
%call = tail call i32 @cycle(i32 noundef %sub37, i32 noundef %6, i32 noundef %add, i8 noundef signext %c), !range !10
%call40 = tail call i32 @cycle(i32 noundef %add38, i32 noundef %6, i32 noundef %add, i8 noundef signext %c), !range !10
%sub41 = add nsw i32 %6, -1
%call43 = tail call i32 @cycle(i32 noundef %x, i32 noundef %sub41, i32 noundef %add, i8 noundef signext %c), !range !10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%7 = or i32 %call, %call40
%8 = or i32 %7, %call43
%or48 = or i32 %8, %accumulator.tr85
%9 = trunc i64 %indvars.iv.next to i32
%10 = or i32 %9, %x
%or.cond.not = icmp sgt i32 %10, -1
%11 = load i32, ptr @n, align 4
%cmp3.not = icmp sgt i32 %11, %x
%or.cond = select i1 %or.cond.not, i1 %cmp3.not, i1 false
%12 = load i32, ptr @m, align 4
%cmp6.not = icmp sgt i32 %12, %9
%or.cond78 = select i1 %or.cond, i1 %cmp6.not, i1 false
br i1 %or.cond78, label %lor.lhs.false7, label %return.loopexit
return.loopexit: ; preds = %if.else25, %if.else, %if.else32, %lor.lhs.false7
%accumulator.tr.lcssa.ph = phi i32 [ %accumulator.tr85, %lor.lhs.false7 ], [ %or48, %if.else32 ], [ %accumulator.tr85, %if.else ], [ %accumulator.tr85, %if.else25 ]
%retval.0.ph = phi i32 [ 0, %lor.lhs.false7 ], [ 0, %if.else32 ], [ 1, %if.else ], [ 0, %if.else25 ]
%13 = or i32 %retval.0.ph, %accumulator.tr.lcssa.ph
br label %return
return: ; preds = %return.loopexit, %entry
%accumulator.ret.tr = phi i32 [ 0, %entry ], [ %13, %return.loopexit ]
ret i32 %accumulator.ret.tr
}
; 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, ptr noundef nonnull @m)
%0 = load i32, ptr @n, align 4, !tbaa !8
%tobool.not57 = icmp eq i32 %0, 0
br i1 %tobool.not57, label %for.cond11.preheader, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add i32 %0, -1
%2 = sext i32 %1 to i64
%3 = mul nsw i64 %2, 204
%4 = sext i32 %0 to i64
%wide.trip.count = zext i32 %0 to i64
%5 = getelementptr i8, ptr @mark, i64 %3
br label %for.body
for.cond.loopexit: ; preds = %for.body5.preheader, %for.body
%indvar.next = add nuw nsw i64 %indvar, 1
%exitcond = icmp eq i64 %indvar.next, %wide.trip.count
br i1 %exitcond, label %for.end10.loopexit, label %for.body, !llvm.loop !11
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv = phi i64 [ %4, %for.body.preheader ], [ %indvars.iv.next, %for.cond.loopexit ]
%indvar = phi i64 [ 0, %for.body.preheader ], [ %indvar.next, %for.cond.loopexit ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [50 x [51 x i8]], ptr @grid, i64 0, i64 %indvars.iv.next
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%6 = load i32, ptr @m, align 4, !tbaa !8
%tobool4.not54 = icmp eq i32 %6, 0
br i1 %tobool4.not54, label %for.cond.loopexit, label %for.body5.preheader
for.body5.preheader: ; preds = %for.body
%7 = mul nsw i64 %indvar, -204
%scevgep = getelementptr i8, ptr %5, i64 %7
%8 = add i32 %6, -1
%9 = sext i32 %8 to i64
%10 = zext i32 %8 to i64
%11 = sub nsw i64 %9, %10
%12 = shl nsw i64 %11, 2
%scevgep65 = getelementptr i8, ptr %scevgep, i64 %12
%13 = zext i32 %6 to i64
%14 = shl nuw nsw i64 %13, 2
tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep65, i8 0, i64 %14, i1 false), !tbaa !8
br label %for.cond.loopexit
for.end10.loopexit: ; preds = %for.cond.loopexit
%.pre = load i32, ptr @n, align 4, !tbaa !8
%15 = sext i32 %.pre to i64
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.end10.loopexit, %entry
%indvars.iv71.ph = phi i64 [ 0, %entry ], [ %15, %for.end10.loopexit ]
br label %for.cond11
for.cond11: ; preds = %for.cond11.preheader, %for.end30
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.end30 ], [ %indvars.iv71.ph, %for.cond11.preheader ]
%indvars.iv.next72 = add nsw i64 %indvars.iv71, -1
%16 = icmp eq i64 %indvars.iv71, 0
br i1 %16, label %if.else, label %for.body14
for.body14: ; preds = %for.cond11
%17 = load i32, ptr @m, align 4, !tbaa !8
%tobool17.not60 = icmp eq i32 %17, 0
br i1 %tobool17.not60, label %for.end30, label %for.body18.preheader
for.body18.preheader: ; preds = %for.body14
%18 = sext i32 %17 to i64
%19 = trunc i64 %indvars.iv.next72 to i32
br label %for.body18
for.body18: ; preds = %for.body18.preheader, %if.end
%indvars.iv68 = phi i64 [ %18, %for.body18.preheader ], [ %indvars.iv.next69, %if.end ]
%indvars.iv.next69 = add nsw i64 %indvars.iv68, -1
%arrayidx22 = getelementptr inbounds [50 x [51 x i32]], ptr @mark, i64 0, i64 %indvars.iv.next72, i64 %indvars.iv.next69
%20 = load i32, ptr %arrayidx22, align 4, !tbaa !8
%tobool23.not = icmp eq i32 %20, 0
br i1 %tobool23.not, label %land.lhs.true, label %for.body18.if.end_crit_edge
for.body18.if.end_crit_edge: ; preds = %for.body18
%.pre74 = trunc i64 %indvars.iv.next69 to i32
br label %if.end
land.lhs.true: ; preds = %for.body18
%arrayidx27 = getelementptr inbounds [50 x [51 x i8]], ptr @grid, i64 0, i64 %indvars.iv.next72, i64 %indvars.iv.next69
%21 = load i8, ptr %arrayidx27, align 1, !tbaa !5
%22 = trunc i64 %indvars.iv.next69 to i32
%call28 = tail call i32 @cycle(i32 noundef %19, i32 noundef %22, i32 noundef 1, i8 noundef signext %21), !range !10
%tobool29.not = icmp eq i32 %call28, 0
br i1 %tobool29.not, label %if.end, label %for.end30.loopexit.split.loop.exit
if.end: ; preds = %for.body18.if.end_crit_edge, %land.lhs.true
%.pre-phi = phi i32 [ %.pre74, %for.body18.if.end_crit_edge ], [ %22, %land.lhs.true ]
%tobool17.not = icmp eq i32 %.pre-phi, 0
br i1 %tobool17.not, label %for.end30, label %for.body18, !llvm.loop !13
for.end30.loopexit.split.loop.exit: ; preds = %land.lhs.true
%23 = trunc i64 %indvars.iv68 to i32
br label %for.end30
for.end30: ; preds = %if.end, %for.end30.loopexit.split.loop.exit, %for.body14
%j.1.lcssa = phi i32 [ 0, %for.body14 ], [ %23, %for.end30.loopexit.split.loop.exit ], [ 0, %if.end ]
%cmp = icmp sgt i32 %j.1.lcssa, 0
br i1 %cmp, label %for.end33, label %for.cond11, !llvm.loop !14
for.end33: ; preds = %for.end30
%24 = trunc i64 %indvars.iv71 to i32
%cmp34 = icmp sgt i32 %24, 0
br i1 %cmp34, label %if.end38, label %if.else
if.else: ; preds = %for.cond11, %for.end33
br label %if.end38
if.end38: ; preds = %for.end33, %if.else
%.str.3.sink = phi ptr [ @.str.3, %if.else ], [ @.str.2, %for.end33 ]
%call37 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{i32 0, i32 2}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
int GCD(int c, int d){
if(c%d == 0){
return d;
}
else{
return GCD(d, c%d);
}
}
int main(void){
long int a, b;
while(scanf("%ld %ld", &a, &b) != EOF){
if(a < b){
long int x = a;
a = b;
b = x;
}
long int gcd_a_b = GCD(a, b);
printf("%d %d\n", gcd_a_b, a*b/gcd_a_b);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122460/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122460/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @GCD(i32 noundef %c, i32 noundef %d) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%c.tr = phi i32 [ %c, %entry ], [ %d.tr, %tailrecurse ]
%d.tr = phi i32 [ %d, %entry ], [ %rem, %tailrecurse ]
%rem = srem i32 %c.tr, %d.tr
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %tailrecurse
return: ; preds = %tailrecurse
ret i32 %d.tr
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %GCD.exit
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp1 = icmp slt i64 %0, %1
br i1 %cmp1, label %if.then, label %if.end
if.then: ; preds = %while.body
store i64 %1, ptr %a, align 8, !tbaa !5
store i64 %0, ptr %b, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body
%2 = phi i64 [ %0, %if.then ], [ %1, %while.body ]
%3 = phi i64 [ %1, %if.then ], [ %0, %while.body ]
%conv = trunc i64 %3 to i32
%conv2 = trunc i64 %2 to i32
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i, %if.end
%c.tr.i = phi i32 [ %conv, %if.end ], [ %d.tr.i, %tailrecurse.i ]
%d.tr.i = phi i32 [ %conv2, %if.end ], [ %rem.i, %tailrecurse.i ]
%rem.i = srem i32 %c.tr.i, %d.tr.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %GCD.exit, label %tailrecurse.i
GCD.exit: ; preds = %tailrecurse.i
%conv4 = sext i32 %d.tr.i to i64
%mul = mul nsw i64 %2, %3
%div = sdiv i64 %mul, %conv4
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %conv4, i64 noundef %div)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %GCD.exit, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %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) #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 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !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);
printf("%d %d %lf\n",a/b,a%b,(double)a/(double)b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122503/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122503/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%d %d %lf\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
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%conv = sitofp i32 %0 to double
%conv1 = sitofp i32 %1 to double
%div2 = fdiv double %conv, %conv1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %rem, double noundef %div2)
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);
int d=a/b;
int r=a%b;
double f=1.0*a/b;
printf("%d %d %f",d,r,f);
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122547/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122547/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %f\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
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%conv = sitofp i32 %0 to double
%conv1 = sitofp i32 %1 to double
%div2 = fdiv double %conv, %conv1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %rem, double noundef %div2)
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 argc, const char * argv[]) {
// 10008
int a,b;
int d,r;
double f;
scanf("%d %d", &a, &b);
d = a/b;
r = a%b;
f = (double)a/b;
printf("%d %d %lf\n",d,r,f);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_122598/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_122598/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"%d %d %lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%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
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%conv = sitofp i32 %0 to double
%conv1 = sitofp i32 %1 to double
%div2 = fdiv double %conv, %conv1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %rem, double noundef %div2)
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"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.