Source_Code
stringlengths 69
484k
| IR_Original
stringlengths 2.05k
17.9M
|
---|---|
#include <stdio.h>
int main(void){
int n;
scanf("%d",&n);
printf("%d\n",n*n*n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109667/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109667/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
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 x;
scanf("%d", &x);
printf("%d\n",x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109717/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109717/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int x;
scanf("%d",&x);
x=x*x*x;
printf("%d\n",x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109760/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109760/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
store i32 %mul1, ptr %x, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int x;
scanf("%d", &x);
printf("%d\n",x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109803/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109803/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int x;
int y;
scanf("%d", &x);
y=x*x*x;
printf("%d\n", y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109847/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109847/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int x;
//printf("x:\n");
scanf("%d", &x);
// if (1 <= x && x <= 100)
printf("%d\n", x * x * x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109890/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109890/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int x;
scanf("%d", &x);
printf("%d\n", x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109940/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109940/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int x;
scanf("%d", &x);
printf("%d\n", x*x*x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_109984/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_109984/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int x;
scanf("%d", &x);
printf("%d\n",x*x*x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110025/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110025/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int X;
scanf("%d",&X);
X = X*X*X;
printf("%d\n",X);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110111/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110111/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %X, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
store i32 %mul1, ptr %X, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void) {
int x, result;
scanf("%d", &x);
printf("%d\n", (x * x * x));
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110155/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110155/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
int MIN(int x, int y){return x<y?x:y;}
int compare_longlong(const void *a, const void *b) {long long *A = (long long *)a;long long *B = (long long *)b;if (*A > *B) return 1;if (*A < *B) return -1;return 0;}
typedef struct{
int x,y;
bool use;
}point;
int comp(const void *a, const void *b){return ((point*)a)->x - ((point*)b)->x;}
int main(void){
int n;
scanf("%d",&n);
point red[n],blue[n];
for(int i=0;i<n;i++)scanf("%d%d",&red[i].x,&red[i].y);
for(int i=0;i<n;i++)scanf("%d%d",&blue[i].x,&blue[i].y);
for(int i=0;i<n;i++)red[i].use = blue[i].use = false;
qsort(red,n,sizeof(point),comp);
qsort(blue,n,sizeof(point),comp);
for(int i=0;i<n;i++){
bool first=false;
int index=-1;
for(int j=0;j<n;j++){
if(!red[j].use && red[j].y<blue[i].y && red[j].x<blue[i].x && !first){
index=j;
first=true;
}
if(!red[j].use && red[j].y<blue[i].y && red[j].x<blue[i].x && first){
if(red[index].y<red[j].y)index=j;
}
}
if(index>=0)red[index].use = true;
}
int ans=0;
for(int i=0;i<n;i++){
if(red[i].use)ans++;
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110199/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110199/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32, i8 }
@.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
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @MIN(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_longlong(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #1 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !9
%1 = load i32, ptr %b, align 4, !tbaa !9
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.point, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !13
%4 = zext i32 %3 to i64
%vla1 = alloca %struct.point, i64 %4, align 16
%cmp175 = icmp sgt i32 %3, 0
br i1 %cmp175, label %for.body, label %for.cond.cleanup23
for.cond6.preheader: ; preds = %for.body
%cmp7177 = icmp sgt i32 %5, 0
br i1 %cmp7177, label %for.body9, label %for.cond.cleanup23
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv
%y = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %y)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !13
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !14
for.cond21.preheader: ; preds = %for.body9
%cmp22179 = icmp sgt i32 %8, 0
br i1 %cmp22179, label %for.body24.preheader, label %for.cond.cleanup23
for.body24.preheader: ; preds = %for.cond21.preheader
%wide.trip.count = zext i32 %8 to i64
%xtraiter = and i64 %wide.trip.count, 1
%7 = icmp eq i32 %8, 1
br i1 %7, label %for.cond.cleanup23.loopexit.unr-lcssa, label %for.body24.preheader.new
for.body24.preheader.new: ; preds = %for.body24.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body24
for.body9: ; preds = %for.cond6.preheader, %for.body9
%indvars.iv194 = phi i64 [ %indvars.iv.next195, %for.body9 ], [ 0, %for.cond6.preheader ]
%arrayidx11 = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv194
%y15 = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv194, i32 1
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11, ptr noundef nonnull %y15)
%indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
%8 = load i32, ptr %n, align 4, !tbaa !13
%9 = sext i32 %8 to i64
%cmp7 = icmp slt i64 %indvars.iv.next195, %9
br i1 %cmp7, label %for.body9, label %for.cond21.preheader, !llvm.loop !16
for.cond.cleanup23.loopexit.unr-lcssa: ; preds = %for.body24, %for.body24.preheader
%indvars.iv197.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next198.1, %for.body24 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup23, label %for.body24.epil
for.body24.epil: ; preds = %for.cond.cleanup23.loopexit.unr-lcssa
%use.epil = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv197.unr, i32 2
store i8 0, ptr %use.epil, align 4, !tbaa !17
%use29.epil = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv197.unr, i32 2
store i8 0, ptr %use29.epil, align 4, !tbaa !17
br label %for.cond.cleanup23
for.cond.cleanup23: ; preds = %for.body24.epil, %for.cond.cleanup23.loopexit.unr-lcssa, %entry, %for.cond6.preheader, %for.cond21.preheader
%.lcssa174217 = phi i32 [ %8, %for.cond21.preheader ], [ %5, %for.cond6.preheader ], [ %3, %entry ], [ %8, %for.cond.cleanup23.loopexit.unr-lcssa ], [ %8, %for.body24.epil ]
%conv = sext i32 %.lcssa174217 to i64
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv, i64 noundef 12, ptr noundef nonnull @comp) #8
%10 = load i32, ptr %n, align 4, !tbaa !13
%conv33 = sext i32 %10 to i64
call void @qsort(ptr noundef nonnull %vla1, i64 noundef %conv33, i64 noundef 12, ptr noundef nonnull @comp) #8
%11 = load i32, ptr %n, align 4, !tbaa !13
%cmp36186 = icmp sgt i32 %11, 0
br i1 %cmp36186, label %for.cond40.preheader.us.preheader, label %for.cond.cleanup121
for.cond40.preheader.us.preheader: ; preds = %for.cond.cleanup23
%wide.trip.count207 = zext i32 %11 to i64
br label %for.cond40.preheader.us
for.cond40.preheader.us: ; preds = %for.cond40.preheader.us.preheader, %if.end113.us
%indvars.iv204 = phi i64 [ 0, %for.cond40.preheader.us.preheader ], [ %indvars.iv.next205, %if.end113.us ]
%y53.us = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv204, i32 1
%arrayidx52.us = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv204
br label %for.body44.us
if.then109.us: ; preds = %for.cond40.for.cond.cleanup43_crit_edge.us
%idxprom110.us = zext i32 %index.2.us to i64
%use112.us = getelementptr inbounds %struct.point, ptr %vla, i64 %idxprom110.us, i32 2
store i8 1, ptr %use112.us, align 4, !tbaa !17
br label %if.end113.us
if.end113.us: ; preds = %if.then109.us, %for.cond40.for.cond.cleanup43_crit_edge.us
%indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
%exitcond208.not = icmp eq i64 %indvars.iv.next205, %wide.trip.count207
br i1 %exitcond208.not, label %for.cond118.preheader, label %for.cond40.preheader.us, !llvm.loop !18
for.body44.us: ; preds = %for.cond40.preheader.us, %for.inc104.us
%indvars.iv200 = phi i64 [ 0, %for.cond40.preheader.us ], [ %indvars.iv.next201, %for.inc104.us ]
%index.0183.us = phi i32 [ -1, %for.cond40.preheader.us ], [ %index.2.us, %for.inc104.us ]
%first.0182.us = phi i8 [ 0, %for.cond40.preheader.us ], [ %first.1171.us, %for.inc104.us ]
%arrayidx46.us = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv200
%use47.us = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv200, i32 2
%12 = load i8, ptr %use47.us, align 4, !tbaa !17, !range !19, !noundef !20
%tobool.not.us = icmp eq i8 %12, 0
br i1 %tobool.not.us, label %land.lhs.true.us, label %for.inc104.us
land.lhs.true.us: ; preds = %for.body44.us
%y50.us = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv200, i32 1
%13 = load i32, ptr %y50.us, align 4, !tbaa !21
%14 = load i32, ptr %y53.us, align 4, !tbaa !21
%cmp54.us = icmp slt i32 %13, %14
br i1 %cmp54.us, label %land.lhs.true80.us, label %for.inc104.us
land.lhs.true80.us: ; preds = %land.lhs.true.us
%15 = load i32, ptr %arrayidx46.us, align 4, !tbaa !9
%16 = load i32, ptr %arrayidx52.us, align 4, !tbaa !9
%cmp63.us = icmp slt i32 %15, %16
%17 = and i8 %first.0182.us, 1
%tobool66.not.us = icmp eq i8 %17, 0
%or.cond.us = select i1 %cmp63.us, i1 %tobool66.not.us, i1 false
%spec.select167.us = select i1 %or.cond.us, i8 1, i8 %first.0182.us
%18 = trunc i64 %indvars.iv200 to i32
%spec.select168.us = select i1 %or.cond.us, i32 %18, i32 %index.0183.us
%19 = load i32, ptr %arrayidx46.us, align 4, !tbaa !9
%20 = load i32, ptr %arrayidx52.us, align 4, !tbaa !9
%cmp87.us = icmp sge i32 %19, %20
%21 = and i8 %spec.select167.us, 1
%tobool90.not.us = icmp eq i8 %21, 0
%or.cond165.us = select i1 %cmp87.us, i1 true, i1 %tobool90.not.us
br i1 %or.cond165.us, label %for.inc104.us, label %if.then92.us
if.then92.us: ; preds = %land.lhs.true80.us
%idxprom93.us = sext i32 %spec.select168.us to i64
%y95.us = getelementptr inbounds %struct.point, ptr %vla, i64 %idxprom93.us, i32 1
%22 = load i32, ptr %y95.us, align 4, !tbaa !21
%cmp99.us = icmp slt i32 %22, %13
%23 = trunc i64 %indvars.iv200 to i32
%spec.select.us = select i1 %cmp99.us, i32 %23, i32 %spec.select168.us
br label %for.inc104.us
for.inc104.us: ; preds = %land.lhs.true.us, %if.then92.us, %land.lhs.true80.us, %for.body44.us
%first.1171.us = phi i8 [ %spec.select167.us, %land.lhs.true80.us ], [ %spec.select167.us, %if.then92.us ], [ %first.0182.us, %for.body44.us ], [ %first.0182.us, %land.lhs.true.us ]
%index.2.us = phi i32 [ %spec.select168.us, %land.lhs.true80.us ], [ %spec.select.us, %if.then92.us ], [ %index.0183.us, %for.body44.us ], [ %index.0183.us, %land.lhs.true.us ]
%indvars.iv.next201 = add nuw nsw i64 %indvars.iv200, 1
%exitcond203.not = icmp eq i64 %indvars.iv.next201, %wide.trip.count207
br i1 %exitcond203.not, label %for.cond40.for.cond.cleanup43_crit_edge.us, label %for.body44.us, !llvm.loop !22
for.cond40.for.cond.cleanup43_crit_edge.us: ; preds = %for.inc104.us
%cmp107.us = icmp sgt i32 %index.2.us, -1
br i1 %cmp107.us, label %if.then109.us, label %if.end113.us
for.body24: ; preds = %for.body24, %for.body24.preheader.new
%indvars.iv197 = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next198.1, %for.body24 ]
%niter = phi i64 [ 0, %for.body24.preheader.new ], [ %niter.next.1, %for.body24 ]
%use = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv197, i32 2
store i8 0, ptr %use, align 8, !tbaa !17
%use29 = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv197, i32 2
store i8 0, ptr %use29, align 8, !tbaa !17
%indvars.iv.next198 = or i64 %indvars.iv197, 1
%use.1 = getelementptr inbounds %struct.point, ptr %vla1, i64 %indvars.iv.next198, i32 2
store i8 0, ptr %use.1, align 4, !tbaa !17
%use29.1 = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv.next198, i32 2
store i8 0, ptr %use29.1, align 4, !tbaa !17
%indvars.iv.next198.1 = add nuw nsw i64 %indvars.iv197, 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.cleanup23.loopexit.unr-lcssa, label %for.body24, !llvm.loop !23
for.cond118.preheader: ; preds = %if.end113.us
br i1 %cmp36186, label %for.body122.preheader, label %for.cond.cleanup121
for.body122.preheader: ; preds = %for.cond118.preheader
%xtraiter225 = and i64 %wide.trip.count207, 3
%24 = icmp ult i32 %11, 4
br i1 %24, label %for.cond.cleanup121.loopexit.unr-lcssa, label %for.body122.preheader.new
for.body122.preheader.new: ; preds = %for.body122.preheader
%unroll_iter228 = and i64 %wide.trip.count207, 4294967292
br label %for.body122
for.cond.cleanup121.loopexit.unr-lcssa: ; preds = %for.body122, %for.body122.preheader
%spec.select166.lcssa.ph = phi i32 [ undef, %for.body122.preheader ], [ %spec.select166.3, %for.body122 ]
%indvars.iv209.unr = phi i64 [ 0, %for.body122.preheader ], [ %indvars.iv.next210.3, %for.body122 ]
%ans.0190.unr = phi i32 [ 0, %for.body122.preheader ], [ %spec.select166.3, %for.body122 ]
%lcmp.mod226.not = icmp eq i64 %xtraiter225, 0
br i1 %lcmp.mod226.not, label %for.cond.cleanup121, label %for.body122.epil
for.body122.epil: ; preds = %for.cond.cleanup121.loopexit.unr-lcssa, %for.body122.epil
%indvars.iv209.epil = phi i64 [ %indvars.iv.next210.epil, %for.body122.epil ], [ %indvars.iv209.unr, %for.cond.cleanup121.loopexit.unr-lcssa ]
%ans.0190.epil = phi i32 [ %spec.select166.epil, %for.body122.epil ], [ %ans.0190.unr, %for.cond.cleanup121.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body122.epil ], [ 0, %for.cond.cleanup121.loopexit.unr-lcssa ]
%use125.epil = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv209.epil, i32 2
%25 = load i8, ptr %use125.epil, align 4, !tbaa !17, !range !19, !noundef !20
%inc128.epil = zext i8 %25 to i32
%spec.select166.epil = add nuw nsw i32 %ans.0190.epil, %inc128.epil
%indvars.iv.next210.epil = add nuw nsw i64 %indvars.iv209.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter225
br i1 %epil.iter.cmp.not, label %for.cond.cleanup121, label %for.body122.epil, !llvm.loop !24
for.cond.cleanup121: ; preds = %for.cond.cleanup121.loopexit.unr-lcssa, %for.body122.epil, %for.cond.cleanup23, %for.cond118.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond118.preheader ], [ 0, %for.cond.cleanup23 ], [ %spec.select166.lcssa.ph, %for.cond.cleanup121.loopexit.unr-lcssa ], [ %spec.select166.epil, %for.body122.epil ]
%call133 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body122: ; preds = %for.body122, %for.body122.preheader.new
%indvars.iv209 = phi i64 [ 0, %for.body122.preheader.new ], [ %indvars.iv.next210.3, %for.body122 ]
%ans.0190 = phi i32 [ 0, %for.body122.preheader.new ], [ %spec.select166.3, %for.body122 ]
%niter229 = phi i64 [ 0, %for.body122.preheader.new ], [ %niter229.next.3, %for.body122 ]
%use125 = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv209, i32 2
%26 = load i8, ptr %use125, align 8, !tbaa !17, !range !19, !noundef !20
%inc128 = zext i8 %26 to i32
%spec.select166 = add nuw nsw i32 %ans.0190, %inc128
%indvars.iv.next210 = or i64 %indvars.iv209, 1
%use125.1 = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv.next210, i32 2
%27 = load i8, ptr %use125.1, align 4, !tbaa !17, !range !19, !noundef !20
%inc128.1 = zext i8 %27 to i32
%spec.select166.1 = add nuw nsw i32 %spec.select166, %inc128.1
%indvars.iv.next210.1 = or i64 %indvars.iv209, 2
%use125.2 = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv.next210.1, i32 2
%28 = load i8, ptr %use125.2, align 16, !tbaa !17, !range !19, !noundef !20
%inc128.2 = zext i8 %28 to i32
%spec.select166.2 = add nuw nsw i32 %spec.select166.1, %inc128.2
%indvars.iv.next210.2 = or i64 %indvars.iv209, 3
%use125.3 = getelementptr inbounds %struct.point, ptr %vla, i64 %indvars.iv.next210.2, i32 2
%29 = load i8, ptr %use125.3, align 4, !tbaa !17, !range !19, !noundef !20
%inc128.3 = zext i8 %29 to i32
%spec.select166.3 = add nuw nsw i32 %spec.select166.2, %inc128.3
%indvars.iv.next210.3 = add nuw nsw i64 %indvars.iv209, 4
%niter229.next.3 = add i64 %niter229, 4
%niter229.ncmp.3 = icmp eq i64 %niter229.next.3, %unroll_iter228
br i1 %niter229.ncmp.3, label %for.cond.cleanup121.loopexit.unr-lcssa, label %for.body122, !llvm.loop !26
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
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(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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !12, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!10, !12, i64 8}
!18 = distinct !{!18, !15}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!10, !11, i64 4}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.unroll.disable"}
!26 = distinct !{!26, !15}
|
#include<stdio.h>
#include<math.h>
int main(){
int n,a,t=0,i=0;
scanf("%d",&n);
for(;i<n;i++){
scanf("%d",&a);
t+=1-a%2;
}
printf("%.f",pow(3,n)-pow(2,t));
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110256/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110256/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%.f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
%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 %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.011 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%t.010 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %1, 2
%reass.sub = add i32 %t.010, 1
%add = sub i32 %reass.sub, %rem
%inc = add nuw nsw i32 %i.011, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%t.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%conv = sitofp i32 %.lcssa to double
%call2 = call double @pow(double noundef 3.000000e+00, double noundef %conv) #5
%ldexp = call double @ldexp(double 1.000000e+00, i32 %t.0.lcssa) #5
%sub5 = fsub double %call2, %ldexp
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub5)
call void @llvm.lifetime.end.p0(i64 4, 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree willreturn }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int arr[n],a;
int x=0,j=n-1;
for(int i=0;i<n;i++)
{
scanf("%d",&a);
if(a%2==0)
arr[j--]=a;
else
arr[x++]=a;
}
for(int i=0;i<n;i++)
printf("%d ",arr[i]);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1103/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1103/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec29 = add nsw i32 %0, -1
store i32 %dec29, ptr %t, align 4, !tbaa !5
%tobool.not30 = icmp eq i32 %0, 0
br i1 %tobool.not30, label %while.end, label %while.body
while.body: ; preds = %entry, %for.cond.cleanup11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %4, 0
br i1 %cmp23, label %for.body.preheader, label %for.cond.cleanup11
for.body.preheader: ; preds = %while.body
%sub = add nsw i32 %4, -1
br label %for.body
for.cond9.preheader: ; preds = %for.body
%cmp1027 = icmp sgt i32 %7, 0
br i1 %cmp1027, label %for.body12, label %for.cond.cleanup11
for.body: ; preds = %for.body.preheader, %for.body
%i.026 = phi i32 [ %inc7, %for.body ], [ 0, %for.body.preheader ]
%j.025 = phi i32 [ %j.1, %for.body ], [ %sub, %for.body.preheader ]
%x.024 = phi i32 [ %x.1, %for.body ], [ 0, %for.body.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%5 = load i32, ptr %a, align 4, !tbaa !5
%6 = and i32 %5, 1
%cmp3 = icmp eq i32 %6, 0
%j.025.sink = select i1 %cmp3, i32 %j.025, i32 %x.024
%x.1 = add i32 %x.024, %6
%dec4 = sext i1 %cmp3 to i32
%j.1 = add nsw i32 %j.025, %dec4
%idxprom = sext i32 %j.025.sink to i64
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %idxprom
store i32 %5, ptr %arrayidx, align 4, !tbaa !5
%inc7 = add nuw nsw i32 %i.026, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc7, %7
br i1 %cmp, label %for.body, label %for.cond9.preheader, !llvm.loop !9
for.cond.cleanup11: ; preds = %for.body12, %while.body, %for.cond9.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%8 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %8, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
for.body12: ; preds = %for.cond9.preheader, %for.body12
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body12 ], [ 0, %for.cond9.preheader ]
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%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
%cmp10 = icmp slt i64 %indvars.iv.next, %11
br i1 %cmp10, label %for.body12, label %for.cond.cleanup11, !llvm.loop !12
while.end: ; preds = %for.cond.cleanup11, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
int main(void) {
double x;
double y;
double angle;
int kazu;
int i;
while(1) {
scanf("%d",&kazu);
if(kazu==-1)break;
x=1;
y=0;
for(i=1;i<kazu;i++) {
angle=atan2(y,x);
x-=sin(angle);
y+=cos(angle);
}
printf("%f\n%f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110357/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110357/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f\0A%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%kazu = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kazu) #4
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kazu)
%0 = load i32, ptr %kazu, align 4, !tbaa !5
%cmp18 = icmp eq i32 %0, -1
br i1 %cmp18, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i32 [ %3, %for.end ], [ %0, %entry ]
%cmp112 = icmp sgt i32 %1, 1
br i1 %cmp112, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%i.015 = phi i32 [ %inc, %for.body ], [ 1, %for.cond.preheader ]
%x.014 = phi double [ %sub, %for.body ], [ 1.000000e+00, %for.cond.preheader ]
%y.013 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ]
%call2 = call double @atan2(double noundef %y.013, double noundef %x.014) #4
%call3 = call double @sin(double noundef %call2) #4
%sub = fsub double %x.014, %call3
%call4 = call double @cos(double noundef %call2) #4
%add = fadd double %y.013, %call4
%inc = add nuw nsw i32 %i.015, 1
%2 = load i32, ptr %kazu, align 4, !tbaa !5
%cmp1 = icmp slt i32 %inc, %2
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%y.0.lcssa = phi double [ 0.000000e+00, %for.cond.preheader ], [ %add, %for.body ]
%x.0.lcssa = phi double [ 1.000000e+00, %for.cond.preheader ], [ %sub, %for.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0.lcssa, double noundef %y.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kazu)
%3 = load i32, ptr %kazu, align 4, !tbaa !5
%cmp = icmp eq i32 %3, -1
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kazu) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @atan2(double noundef, double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// 内部定数
#define D_CHAR_CNT 26 // 文字種類数
// 内部変数
static FILE *szpFpI; // 入力
static char sc1Str[D_CHAR_CNT + 5]; // 文字列
static int si1Char[D_CHAR_CNT]; // 使用文字
// 内部変数 - テスト用
#ifdef D_TEST
static int siRes;
static FILE *szpFpA;
static int siTNo;
#endif
// 1行出力
int
fOutLine(
char *pcpLine // <I> 1行
)
{
char lc1Buf[1024];
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, pcpLine)) {
siRes = -1;
}
#else
printf("%s", pcpLine);
#endif
return 0;
}
// 最小文字 - セット
int
fSetChar(
int piPos // <I> 追加位置
, int piSNo // <I> 開始文字
)
{
int i;
for (i = piSNo; i < D_CHAR_CNT; i++) {
if (si1Char[i] == 0) {
sc1Str[piPos] = 'a' + i;
sc1Str[piPos + 1] = '\0';
return 0;
}
}
return -1;
}
// 実行メイン
int
fMain(
)
{
int i, liRet;
// 文字列 - 取得
fgets(sc1Str, sizeof(sc1Str), szpFpI);
// 使用文字 - 取得
int liNo;
for (i = 0; ; i++) {
liNo = sc1Str[i] - 'a';
if (liNo < 0 || D_CHAR_CNT <= liNo) {
break;
}
else {
si1Char[liNo] = 1;
}
}
// 文字数
int liLen = i;
if (liLen == D_CHAR_CNT) {
// 文字 - カット
for (i = D_CHAR_CNT - 1; i >= 0; i--) {
liNo = sc1Str[i] - 'a';
si1Char[liNo] = 0;
// 最小文字 - セット
liRet = fSetChar(i, liNo + 1);
if (liRet == 0) {
return 0;
}
}
return -1;
}
// 最小文字 - セット
fSetChar(liLen, 0);
return 0;
}
// 1回実行
int
fOne(
)
{
int liRet;
char lc1Buf[1024];
// データ - 初期化
memset(si1Char, 0, sizeof(si1Char)); // 使用文字
// 入力 - セット
#ifdef D_TEST
sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
szpFpI = fopen(lc1Buf, "r");
sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
szpFpA = fopen(lc1Buf, "r");
siRes = 0;
#else
szpFpI = stdin;
#endif
// 実行メイン
liRet = fMain();
// 1行出力
if (liRet == 0) {
sprintf(lc1Buf, "%s\n", sc1Str);
}
else {
sprintf(lc1Buf, "-1\n");
}
fOutLine(lc1Buf);
// 残データ有無
#ifdef D_TEST
lc1Buf[0] = '\0';
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, "")) {
siRes = -1;
}
#endif
// テストファイルクローズ
#ifdef D_TEST
fclose(szpFpI);
fclose(szpFpA);
#endif
// テスト結果
#ifdef D_TEST
if (siRes == 0) {
printf("OK %d\n", siTNo);
}
else {
printf("NG %d\n", siTNo);
}
#endif
return 0;
}
// プログラム開始
int
main()
{
#ifdef D_TEST
int i;
for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
siTNo = i;
fOne();
}
#else
fOne();
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110421/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110421/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@si1Char = internal unnamed_addr global [26 x i32] zeroinitializer, align 16
@sc1Str = internal global [31 x i8] zeroinitializer, align 16
@szpFpI = internal unnamed_addr global ptr null, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fOutLine(ptr noundef %pcpLine) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %pcpLine)
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @fSetChar(i32 noundef %piPos, i32 noundef %piSNo) local_unnamed_addr #3 {
entry:
%cmp12 = icmp slt i32 %piSNo, 26
br i1 %cmp12, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%0 = sext i32 %piSNo to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [26 x i32], ptr @si1Char, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, 0
br i1 %cmp1, label %if.then, label %for.inc
if.then: ; preds = %for.body
%2 = trunc i64 %indvars.iv to i8
%conv = add i8 %2, 97
%idxprom2 = sext i32 %piPos to i64
%arrayidx3 = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %idxprom2
store i8 %conv, ptr %arrayidx3, align 1, !tbaa !9
%add4 = add nsw i32 %piPos, 1
%idxprom5 = sext i32 %add4 to i64
%arrayidx6 = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %idxprom5
store i8 0, ptr %arrayidx6, align 1, !tbaa !9
br label %cleanup
for.inc: ; preds = %for.body
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%3 = and i64 %indvars.iv.next, 4294967295
%exitcond.not = icmp eq i64 %3, 26
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !10
cleanup: ; preds = %for.inc, %entry, %if.then
%retval.0 = phi i32 [ 0, %if.then ], [ -1, %entry ], [ -1, %for.inc ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fMain() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @szpFpI, align 8, !tbaa !12
%call = tail call ptr @fgets(ptr noundef nonnull @sc1Str, i32 noundef 31, ptr noundef %0)
%1 = load i8, ptr @sc1Str, align 16, !tbaa !9
%2 = add i8 %1, -123
%or.cond64 = icmp ult i8 %2, -26
br i1 %or.cond64, label %for.body.i42.preheader, label %if.else
if.else: ; preds = %entry, %if.else
%indvars.iv = phi i64 [ %indvars.iv.next, %if.else ], [ 0, %entry ]
%3 = phi i8 [ %4, %if.else ], [ %1, %entry ]
%conv = zext i8 %3 to i64
%sub = add nuw nsw i64 %conv, 4294967199
%idxprom4 = and i64 %sub, 4294967295
%arrayidx5 = getelementptr inbounds [26 x i32], ptr @si1Char, i64 0, i64 %idxprom4
store i32 1, ptr %arrayidx5, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%5 = add i8 %4, -123
%or.cond = icmp ult i8 %5, -26
br i1 %or.cond, label %for.end, label %if.else
for.end: ; preds = %if.else
%6 = trunc i64 %indvars.iv.next to i32
%cmp6 = icmp eq i32 %6, 26
br i1 %cmp6, label %for.body, label %for.body.i42.preheader
for.body.i42.preheader: ; preds = %entry, %for.end
%i.0.lcssa77 = phi i32 [ %6, %for.end ], [ 0, %entry ]
%7 = load i32, ptr @si1Char, align 16, !tbaa !5
%cmp1.i45 = icmp eq i32 %7, 0
br i1 %cmp1.i45, label %if.then.i50, label %for.inc.i46
for.body: ; preds = %for.end, %for.inc23
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.inc23 ], [ 25, %for.end ]
%arrayidx13 = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %indvars.iv71
%8 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%conv14 = sext i8 %8 to i32
%sub15 = add nsw i32 %conv14, -97
%idxprom16 = sext i32 %sub15 to i64
%arrayidx17 = getelementptr inbounds [26 x i32], ptr @si1Char, i64 0, i64 %idxprom16
store i32 0, ptr %arrayidx17, align 4, !tbaa !5
%cmp12.i = icmp slt i8 %8, 122
br i1 %cmp12.i, label %for.body.preheader.i, label %for.inc23
for.body.preheader.i: ; preds = %for.body
%add = add nsw i32 %conv14, -96
%9 = sext i32 %add to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %9, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%arrayidx.i = getelementptr inbounds [26 x i32], ptr @si1Char, i64 0, i64 %indvars.iv.i
%10 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %10, 0
br i1 %cmp1.i, label %fSetChar.exit, label %for.inc.i
for.inc.i: ; preds = %for.body.i
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
%11 = and i64 %indvars.iv.next.i, 4294967295
%exitcond.not.i = icmp eq i64 %11, 26
br i1 %exitcond.not.i, label %for.inc23, label %for.body.i, !llvm.loop !10
fSetChar.exit: ; preds = %for.body.i
%12 = trunc i64 %indvars.iv.i to i8
%conv.i = add i8 %12, 97
%sext = shl i64 %indvars.iv71, 32
%idxprom2.i = ashr exact i64 %sext, 32
%arrayidx3.i = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %idxprom2.i
store i8 %conv.i, ptr %arrayidx3.i, align 1, !tbaa !9
%add4.i = shl i64 %indvars.iv71, 32
%sext74 = add i64 %add4.i, 4294967296
%idxprom5.i = ashr exact i64 %sext74, 32
br label %cleanup.sink.split
for.inc23: ; preds = %for.inc.i, %for.body
%indvars.iv.next72 = add nsw i64 %indvars.iv71, -1
%cmp10.not = icmp eq i64 %indvars.iv71, 0
br i1 %cmp10.not, label %cleanup, label %for.body, !llvm.loop !14
if.then.i50: ; preds = %for.inc.i46.24, %for.inc.i46.23, %for.inc.i46.22, %for.inc.i46.21, %for.inc.i46.20, %for.inc.i46.19, %for.inc.i46.18, %for.inc.i46.17, %for.inc.i46.16, %for.inc.i46.15, %for.inc.i46.14, %for.inc.i46.13, %for.inc.i46.12, %for.inc.i46.11, %for.inc.i46.10, %for.inc.i46.9, %for.inc.i46.8, %for.inc.i46.7, %for.inc.i46.6, %for.inc.i46.5, %for.inc.i46.4, %for.inc.i46.3, %for.inc.i46.2, %for.inc.i46.1, %for.inc.i46, %for.body.i42.preheader
%indvars.iv.i43.lcssa = phi i8 [ 97, %for.body.i42.preheader ], [ 98, %for.inc.i46 ], [ 99, %for.inc.i46.1 ], [ 100, %for.inc.i46.2 ], [ 101, %for.inc.i46.3 ], [ 102, %for.inc.i46.4 ], [ 103, %for.inc.i46.5 ], [ 104, %for.inc.i46.6 ], [ 105, %for.inc.i46.7 ], [ 106, %for.inc.i46.8 ], [ 107, %for.inc.i46.9 ], [ 108, %for.inc.i46.10 ], [ 109, %for.inc.i46.11 ], [ 110, %for.inc.i46.12 ], [ 111, %for.inc.i46.13 ], [ 112, %for.inc.i46.14 ], [ 113, %for.inc.i46.15 ], [ 114, %for.inc.i46.16 ], [ 115, %for.inc.i46.17 ], [ 116, %for.inc.i46.18 ], [ 117, %for.inc.i46.19 ], [ 118, %for.inc.i46.20 ], [ 119, %for.inc.i46.21 ], [ 120, %for.inc.i46.22 ], [ 121, %for.inc.i46.23 ], [ 122, %for.inc.i46.24 ]
%idxprom2.i52 = zext i32 %i.0.lcssa77 to i64
%arrayidx3.i53 = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %idxprom2.i52
store i8 %indvars.iv.i43.lcssa, ptr %arrayidx3.i53, align 1, !tbaa !9
%add4.i54 = add nuw nsw i32 %i.0.lcssa77, 1
%idxprom5.i55 = zext i32 %add4.i54 to i64
br label %cleanup.sink.split
for.inc.i46: ; preds = %for.body.i42.preheader
%13 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 1), align 4, !tbaa !5
%cmp1.i45.1 = icmp eq i32 %13, 0
br i1 %cmp1.i45.1, label %if.then.i50, label %for.inc.i46.1
for.inc.i46.1: ; preds = %for.inc.i46
%14 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 2), align 8, !tbaa !5
%cmp1.i45.2 = icmp eq i32 %14, 0
br i1 %cmp1.i45.2, label %if.then.i50, label %for.inc.i46.2
for.inc.i46.2: ; preds = %for.inc.i46.1
%15 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 3), align 4, !tbaa !5
%cmp1.i45.3 = icmp eq i32 %15, 0
br i1 %cmp1.i45.3, label %if.then.i50, label %for.inc.i46.3
for.inc.i46.3: ; preds = %for.inc.i46.2
%16 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 4), align 16, !tbaa !5
%cmp1.i45.4 = icmp eq i32 %16, 0
br i1 %cmp1.i45.4, label %if.then.i50, label %for.inc.i46.4
for.inc.i46.4: ; preds = %for.inc.i46.3
%17 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 5), align 4, !tbaa !5
%cmp1.i45.5 = icmp eq i32 %17, 0
br i1 %cmp1.i45.5, label %if.then.i50, label %for.inc.i46.5
for.inc.i46.5: ; preds = %for.inc.i46.4
%18 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 6), align 8, !tbaa !5
%cmp1.i45.6 = icmp eq i32 %18, 0
br i1 %cmp1.i45.6, label %if.then.i50, label %for.inc.i46.6
for.inc.i46.6: ; preds = %for.inc.i46.5
%19 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 7), align 4, !tbaa !5
%cmp1.i45.7 = icmp eq i32 %19, 0
br i1 %cmp1.i45.7, label %if.then.i50, label %for.inc.i46.7
for.inc.i46.7: ; preds = %for.inc.i46.6
%20 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 8), align 16, !tbaa !5
%cmp1.i45.8 = icmp eq i32 %20, 0
br i1 %cmp1.i45.8, label %if.then.i50, label %for.inc.i46.8
for.inc.i46.8: ; preds = %for.inc.i46.7
%21 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 9), align 4, !tbaa !5
%cmp1.i45.9 = icmp eq i32 %21, 0
br i1 %cmp1.i45.9, label %if.then.i50, label %for.inc.i46.9
for.inc.i46.9: ; preds = %for.inc.i46.8
%22 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 10), align 8, !tbaa !5
%cmp1.i45.10 = icmp eq i32 %22, 0
br i1 %cmp1.i45.10, label %if.then.i50, label %for.inc.i46.10
for.inc.i46.10: ; preds = %for.inc.i46.9
%23 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 11), align 4, !tbaa !5
%cmp1.i45.11 = icmp eq i32 %23, 0
br i1 %cmp1.i45.11, label %if.then.i50, label %for.inc.i46.11
for.inc.i46.11: ; preds = %for.inc.i46.10
%24 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 12), align 16, !tbaa !5
%cmp1.i45.12 = icmp eq i32 %24, 0
br i1 %cmp1.i45.12, label %if.then.i50, label %for.inc.i46.12
for.inc.i46.12: ; preds = %for.inc.i46.11
%25 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 13), align 4, !tbaa !5
%cmp1.i45.13 = icmp eq i32 %25, 0
br i1 %cmp1.i45.13, label %if.then.i50, label %for.inc.i46.13
for.inc.i46.13: ; preds = %for.inc.i46.12
%26 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 14), align 8, !tbaa !5
%cmp1.i45.14 = icmp eq i32 %26, 0
br i1 %cmp1.i45.14, label %if.then.i50, label %for.inc.i46.14
for.inc.i46.14: ; preds = %for.inc.i46.13
%27 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 15), align 4, !tbaa !5
%cmp1.i45.15 = icmp eq i32 %27, 0
br i1 %cmp1.i45.15, label %if.then.i50, label %for.inc.i46.15
for.inc.i46.15: ; preds = %for.inc.i46.14
%28 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 16), align 16, !tbaa !5
%cmp1.i45.16 = icmp eq i32 %28, 0
br i1 %cmp1.i45.16, label %if.then.i50, label %for.inc.i46.16
for.inc.i46.16: ; preds = %for.inc.i46.15
%29 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 17), align 4, !tbaa !5
%cmp1.i45.17 = icmp eq i32 %29, 0
br i1 %cmp1.i45.17, label %if.then.i50, label %for.inc.i46.17
for.inc.i46.17: ; preds = %for.inc.i46.16
%30 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 18), align 8, !tbaa !5
%cmp1.i45.18 = icmp eq i32 %30, 0
br i1 %cmp1.i45.18, label %if.then.i50, label %for.inc.i46.18
for.inc.i46.18: ; preds = %for.inc.i46.17
%31 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 19), align 4, !tbaa !5
%cmp1.i45.19 = icmp eq i32 %31, 0
br i1 %cmp1.i45.19, label %if.then.i50, label %for.inc.i46.19
for.inc.i46.19: ; preds = %for.inc.i46.18
%32 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 20), align 16, !tbaa !5
%cmp1.i45.20 = icmp eq i32 %32, 0
br i1 %cmp1.i45.20, label %if.then.i50, label %for.inc.i46.20
for.inc.i46.20: ; preds = %for.inc.i46.19
%33 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 21), align 4, !tbaa !5
%cmp1.i45.21 = icmp eq i32 %33, 0
br i1 %cmp1.i45.21, label %if.then.i50, label %for.inc.i46.21
for.inc.i46.21: ; preds = %for.inc.i46.20
%34 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 22), align 8, !tbaa !5
%cmp1.i45.22 = icmp eq i32 %34, 0
br i1 %cmp1.i45.22, label %if.then.i50, label %for.inc.i46.22
for.inc.i46.22: ; preds = %for.inc.i46.21
%35 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 23), align 4, !tbaa !5
%cmp1.i45.23 = icmp eq i32 %35, 0
br i1 %cmp1.i45.23, label %if.then.i50, label %for.inc.i46.23
for.inc.i46.23: ; preds = %for.inc.i46.22
%36 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 24), align 16, !tbaa !5
%cmp1.i45.24 = icmp eq i32 %36, 0
br i1 %cmp1.i45.24, label %if.then.i50, label %for.inc.i46.24
for.inc.i46.24: ; preds = %for.inc.i46.23
%37 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @si1Char, i64 0, i64 25), align 4, !tbaa !5
%cmp1.i45.25 = icmp eq i32 %37, 0
br i1 %cmp1.i45.25, label %if.then.i50, label %cleanup
cleanup.sink.split: ; preds = %fSetChar.exit, %if.then.i50
%idxprom5.i55.sink = phi i64 [ %idxprom5.i55, %if.then.i50 ], [ %idxprom5.i, %fSetChar.exit ]
%arrayidx6.i56 = getelementptr inbounds [31 x i8], ptr @sc1Str, i64 0, i64 %idxprom5.i55.sink
store i8 0, ptr %arrayidx6.i56, align 1, !tbaa !9
br label %cleanup
cleanup: ; preds = %for.inc23, %cleanup.sink.split, %for.inc.i46.24
%retval.0 = phi i32 [ 0, %for.inc.i46.24 ], [ 0, %cleanup.sink.split ], [ -1, %for.inc23 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fOne() local_unnamed_addr #0 {
entry:
%lc1Buf = alloca [1024 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(104) @si1Char, i8 0, i64 104, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !12
store ptr %0, ptr @szpFpI, align 8, !tbaa !12
%call = tail call i32 @fMain(), !range !15
%cmp = icmp eq i32 %call, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf, ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull @sc1Str) #5
br label %if.end
if.else: ; preds = %entry
store i32 667949, ptr %lc1Buf, align 16
br label %if.end
if.end: ; preds = %if.else, %if.then
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%lc1Buf.i = alloca [1024 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf.i) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(104) @si1Char, i8 0, i64 104, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !12
store ptr %0, ptr @szpFpI, align 8, !tbaa !12
%call.i = tail call i32 @fMain(), !range !15
%cmp.i = icmp eq i32 %call.i, 0
br i1 %cmp.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %entry
%call1.i = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf.i, ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull @sc1Str) #5
br label %fOne.exit
if.else.i: ; preds = %entry
store i32 667949, ptr %lc1Buf.i, align 16
br label %fOne.exit
fOne.exit: ; preds = %if.then.i, %if.else.i
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf.i)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf.i) #5
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = !{i32 -1, i32 1}
|
#include <stdio.h>
int main(){
int i;
char cards[201];
int n;
int k;
int turn;
int rem[2];
while(1){
scanf("%d\n",&n);
if(!n)break;
for(i=0;i<=200;i++){
cards[i]=9;
}
for(i=1;i<=2*n;i++){
cards[i]=1;
}
for(i=1;i<=n;i++){
scanf("%d\n",&k);
cards[k]=0;
}
//start
turn=0;
rem[0]=n;
rem[1]=n;
//int l;for(l=1;l<=2*n;l++){printf(l==2*n?"%d\t":"%d ",cards[l]);}printf("%d %d\n",rem[1],rem[0]);
while(rem[0]>0&&rem[1]>0){
for(i=1;i<=2*n;i++){
if(cards[i]==turn){
cards[i]=7+turn;
rem[turn]--;
if(!rem[0]||!rem[1])break;
//for(l=1;l<=2*n;l++){printf(l==2*n?"%d\t":"%d ",cards[l]);}printf("%d %d\n",rem[1],rem[0]);
turn=1-turn;
}
}
turn=1-turn;
}
printf("%d\n%d\n",rem[1],rem[0]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110472/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110472/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%cards = alloca [201 x i8], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
%rem = alloca [2 x i32], align 4
call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %cards) #5
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 8, ptr nonnull %rem) #5
%call88 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not89 = icmp eq i32 %0, 0
br i1 %tobool.not89, label %while.end54, label %for.cond.preheader.lr.ph
for.cond.preheader.lr.ph: ; preds = %entry
%arrayidx19 = getelementptr inbounds [2 x i32], ptr %rem, i64 0, i64 1
%scevgep = getelementptr inbounds i8, ptr %cards, i64 1
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %while.end
%1 = phi i32 [ %0, %for.cond.preheader.lr.ph ], [ %18, %while.end ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %cards, i8 9, i64 201, i1 false), !tbaa !9
%cmp2.not73 = icmp slt i32 %1, 1
br i1 %cmp2.not73, label %for.end17.thread, label %for.body11.preheader
for.end17.thread: ; preds = %for.cond.preheader
store i32 %1, ptr %rem, align 4, !tbaa !5
store i32 %1, ptr %arrayidx19, align 4, !tbaa !5
br label %while.end
for.body11.preheader: ; preds = %for.cond.preheader
%mul = shl nuw i32 %1, 1
%smax = call i32 @llvm.smax.i32(i32 %mul, i32 1)
%2 = zext i32 %smax to i64
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i8 1, i64 %2, i1 false), !tbaa !9
br label %for.body11
for.body11: ; preds = %for.body11.preheader, %for.body11
%i.276 = phi i32 [ %inc16, %for.body11 ], [ 1, %for.body11.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%3 = load i32, ptr %k, align 4, !tbaa !5
%idxprom13 = sext i32 %3 to i64
%arrayidx14 = getelementptr inbounds [201 x i8], ptr %cards, i64 0, i64 %idxprom13
store i8 0, ptr %arrayidx14, align 1, !tbaa !9
%inc16 = add nuw nsw i32 %i.276, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp10.not.not = icmp slt i32 %i.276, %4
br i1 %cmp10.not.not, label %for.body11, label %for.end17, !llvm.loop !10
for.end17: ; preds = %for.body11
store i32 %4, ptr %rem, align 4, !tbaa !5
store i32 %4, ptr %arrayidx19, align 4, !tbaa !5
%cmp2483 = icmp sgt i32 %4, 0
br i1 %cmp2483, label %for.cond26.preheader.preheader, label %while.end
for.cond26.preheader.preheader: ; preds = %for.end17
%mul27 = shl nuw i32 %4, 1
%smax96 = call i32 @llvm.smax.i32(i32 %mul27, i32 1)
%5 = add nuw nsw i32 %smax96, 1
%wide.trip.count = zext i32 %5 to i64
br label %for.body29
for.body29: ; preds = %for.body29.backedge, %for.cond26.preheader.preheader
%6 = phi i32 [ %4, %for.cond26.preheader.preheader ], [ %.be, %for.body29.backedge ]
%7 = phi i32 [ %4, %for.cond26.preheader.preheader ], [ %.be103, %for.body29.backedge ]
%indvars.iv = phi i64 [ 1, %for.cond26.preheader.preheader ], [ %indvars.iv.be, %for.body29.backedge ]
%turn.179 = phi i32 [ 0, %for.cond26.preheader.preheader ], [ %turn.179.be, %for.body29.backedge ]
%arrayidx31 = getelementptr inbounds [201 x i8], ptr %cards, i64 0, i64 %indvars.iv
%8 = load i8, ptr %arrayidx31, align 1, !tbaa !9
%conv = sext i8 %8 to i32
%cmp32 = icmp eq i32 %turn.179, %conv
br i1 %cmp32, label %if.then34, label %for.inc47
if.then34: ; preds = %for.body29
%9 = trunc i32 %turn.179 to i8
%conv35 = add nuw nsw i8 %9, 7
store i8 %conv35, ptr %arrayidx31, align 1, !tbaa !9
%idxprom38 = zext i32 %turn.179 to i64
%arrayidx39 = getelementptr inbounds [2 x i32], ptr %rem, i64 0, i64 %idxprom38
%10 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%dec = add nsw i32 %10, -1
store i32 %dec, ptr %arrayidx39, align 4, !tbaa !5
%11 = load i32, ptr %rem, align 4, !tbaa !5
%tobool41 = icmp ne i32 %11, 0
%12 = load i32, ptr %arrayidx19, align 4
%tobool43 = icmp ne i32 %12, 0
%or.cond = select i1 %tobool41, i1 %tobool43, i1 false
br i1 %or.cond, label %if.end45, label %for.end49
if.end45: ; preds = %if.then34
%sub = sub nuw nsw i32 1, %turn.179
br label %for.inc47
for.inc47: ; preds = %for.body29, %if.end45
%13 = phi i32 [ %12, %if.end45 ], [ %6, %for.body29 ]
%14 = phi i32 [ %11, %if.end45 ], [ %7, %for.body29 ]
%turn.2 = phi i32 [ %sub, %if.end45 ], [ %turn.179, %for.body29 ]
%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.end49, label %for.body29.backedge
for.body29.backedge: ; preds = %for.inc47, %for.end49
%.be = phi i32 [ %13, %for.inc47 ], [ %15, %for.end49 ]
%.be103 = phi i32 [ %14, %for.inc47 ], [ %16, %for.end49 ]
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc47 ], [ 1, %for.end49 ]
%turn.179.be = phi i32 [ %turn.2, %for.inc47 ], [ %sub50, %for.end49 ]
br label %for.body29, !llvm.loop !12
for.end49: ; preds = %for.inc47, %if.then34
%15 = phi i32 [ %12, %if.then34 ], [ %13, %for.inc47 ]
%16 = phi i32 [ %11, %if.then34 ], [ %14, %for.inc47 ]
%turn.1.lcssa = phi i32 [ %turn.179, %if.then34 ], [ %turn.2, %for.inc47 ]
%sub50 = sub nuw nsw i32 1, %turn.1.lcssa
%cmp22 = icmp sgt i32 %16, 0
%cmp24 = icmp sgt i32 %15, 0
%17 = select i1 %cmp22, i1 %cmp24, i1 false
br i1 %17, label %for.body29.backedge, label %while.end
while.end: ; preds = %for.end49, %for.end17.thread, %for.end17
%.lcssa71 = phi i32 [ %4, %for.end17 ], [ %1, %for.end17.thread ], [ %16, %for.end49 ]
%.lcssa70 = phi i32 [ %4, %for.end17 ], [ %1, %for.end17.thread ], [ %15, %for.end49 ]
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa70, i32 noundef %.lcssa71)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%18 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %18, 0
br i1 %tobool.not, label %while.end54, label %for.cond.preheader
while.end54: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %rem) #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
call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %cards) #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: 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.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
int time[24][60];
int main(void)
{
int i,j,h,m,f;
for(i=0; i<2; ++i) {
scanf("%d",&j);
for(;j>0;--j) {
scanf("%d %d",&h,&m);
time[h][m]=1;
}
}
f=1;
for(i=0;i<24;i++)
for(j=0;j<60;j++)
if(time[i][j]){
if(!f)printf(" ");
else f=0;
printf("%d:%02d",i,j);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110515/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110515/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@time = dso_local local_unnamed_addr global [24 x [60 x i32]] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [8 x i8] c"%d:%02d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%j = alloca i32, align 4
%h = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%.pr = load i32, ptr %j, align 4, !tbaa !5
%cmp237 = icmp sgt i32 %.pr, 0
br i1 %cmp237, label %for.body3, label %for.inc7
for.body3: ; preds = %entry, %for.body3
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %m)
%0 = load i32, ptr %h, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%1 = load i32, ptr %m, align 4, !tbaa !5
%idxprom5 = sext i32 %1 to i64
%arrayidx6 = getelementptr inbounds [24 x [60 x i32]], ptr @time, i64 0, i64 %idxprom, i64 %idxprom5
store i32 1, ptr %arrayidx6, align 4, !tbaa !5
%2 = load i32, ptr %j, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %j, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %2, 1
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !9
for.inc7: ; preds = %for.body3, %entry
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%.pr.1 = load i32, ptr %j, align 4, !tbaa !5
%cmp237.1 = icmp sgt i32 %.pr.1, 0
br i1 %cmp237.1, label %for.body3.1, label %for.cond12.preheader.preheader
for.body3.1: ; preds = %for.inc7, %for.body3.1
%call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %m)
%3 = load i32, ptr %h, align 4, !tbaa !5
%idxprom.1 = sext i32 %3 to i64
%4 = load i32, ptr %m, align 4, !tbaa !5
%idxprom5.1 = sext i32 %4 to i64
%arrayidx6.1 = getelementptr inbounds [24 x [60 x i32]], ptr @time, i64 0, i64 %idxprom.1, i64 %idxprom5.1
store i32 1, ptr %arrayidx6.1, align 4, !tbaa !5
%5 = load i32, ptr %j, align 4, !tbaa !5
%dec.1 = add nsw i32 %5, -1
store i32 %dec.1, ptr %j, align 4, !tbaa !5
%cmp2.1 = icmp sgt i32 %5, 1
br i1 %cmp2.1, label %for.body3.1, label %for.cond12.preheader.preheader, !llvm.loop !9
for.cond12.preheader.preheader: ; preds = %for.body3.1, %for.inc7
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.cond12.preheader.preheader, %for.inc27
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc27 ], [ 0, %for.cond12.preheader.preheader ]
%f.042 = phi i32 [ %f.3, %for.inc27 ], [ 1, %for.cond12.preheader.preheader ]
store i32 0, ptr %j, align 4, !tbaa !5
%6 = trunc i64 %indvars.iv to i32
br label %for.body14
for.body14: ; preds = %for.cond12.preheader, %for.inc24
%f.140 = phi i32 [ %f.042, %for.cond12.preheader ], [ %f.3, %for.inc24 ]
%storemerge39 = phi i32 [ 0, %for.cond12.preheader ], [ %inc25, %for.inc24 ]
%idxprom17 = sext i32 %storemerge39 to i64
%arrayidx18 = getelementptr inbounds [24 x [60 x i32]], ptr @time, i64 0, i64 %indvars.iv, i64 %idxprom17
%7 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %for.inc24, label %if.then
if.then: ; preds = %for.body14
%tobool19.not = icmp eq i32 %f.140, 0
br i1 %tobool19.not, label %if.then20, label %if.end
if.then20: ; preds = %if.then
%putchar36 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %j, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %if.then20
%8 = phi i32 [ %storemerge39, %if.then ], [ %.pre, %if.then20 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %6, i32 noundef %8)
%.pre44 = load i32, ptr %j, align 4, !tbaa !5
br label %for.inc24
for.inc24: ; preds = %for.body14, %if.end
%9 = phi i32 [ %.pre44, %if.end ], [ %storemerge39, %for.body14 ]
%f.3 = phi i32 [ 0, %if.end ], [ %f.140, %for.body14 ]
%inc25 = add nsw i32 %9, 1
store i32 %inc25, ptr %j, align 4, !tbaa !5
%cmp13 = icmp slt i32 %9, 59
br i1 %cmp13, label %for.body14, label %for.inc27, !llvm.loop !11
for.inc27: ; preds = %for.inc24
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 24
br i1 %exitcond.not, label %for.end29, label %for.cond12.preheader, !llvm.loop !12
for.end29: ; preds = %for.inc27
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int A,B,C;
scanf("%d %d %d",&A,&B,&C);
if(C>=A && C<=B)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110566/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110566/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %C, align 4, !tbaa !5
%1 = load i32, ptr %A, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%2 = load i32, ptr %B, align 4
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%str.str.3 = select i1 %or.cond, 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 %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
int a,b,c;
while(~scanf("%d %d %d",&a,&b,&c))
{
if(c>=a&&c<=b)
printf("Yes\n");
else
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110616/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110616/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%tobool.not6 = icmp eq i32 %call5, -1
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%2 = load i32, ptr %b, align 4
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%str.str.3 = select i1 %or.cond, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%tobool.not = icmp eq i32 %call, -1
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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int x , y ,z ;
scanf("%d%d%d",&x , &y , &z);
if(z>=x && z<=y){
printf("Yes");
}else{
printf("No");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110667/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110667/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %z, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%2 = load i32, ptr %y, align 4
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%.str.2..str.1 = select i1 %or.cond, 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 %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int cmp(const void *a,const void *b)
{
int A=*(int *)a;
int B=*(int *)b;
if(A<B)
return -1;
else if(A==B)
return 0;
return 1;
}
int main()
{
int n,sumB,sumW;
int p[101];
scanf("%d",&n);
for(int i=0;i<n/2;i++)
scanf("%d",&p[i]);
qsort(p,n/2,sizeof(p[0]),cmp);
sumB=0;
for(int i=0;i<n/2;i++)
sumB=sumB+abs(p[i]-(i*2+1));
sumW=0;
for(int i=0;i<n/2;i++)
sumW=sumW+abs(p[i]-(i*2+2));
if(sumB<sumW)
printf("%d\n",sumB);
else
printf("%d\n",sumW);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11071/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11071/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%p = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp49 = icmp sgt i32 %0, 1
br i1 %cmp49, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%div48 = sdiv i32 %0, 2
%.pre = sext i32 %div48 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 ], [ %15, %for.body ]
call void @qsort(ptr noundef nonnull %p, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @cmp) #7
%1 = load i32, ptr %n, align 4, !tbaa !5
%div5 = sdiv i32 %1, 2
%cmp651 = icmp sgt i32 %1, 1
br i1 %cmp651, label %for.body9.preheader, label %if.else
for.body9.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %div5 to i64
%min.iters.check = icmp ult i32 %div5, 8
br i1 %min.iters.check, label %for.body9.preheader106, label %vector.ph
vector.ph: ; preds = %for.body9.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi78 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%2 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load80 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = shl <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%step.add = shl <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%5 = xor <4 x i32> %4, <i32 -1, i32 -1, i32 -1, i32 -1>
%6 = add <4 x i32> %wide.load, %5
%reass.sub102 = sub <4 x i32> %wide.load80, %step.add
%7 = add <4 x i32> %reass.sub102, <i32 -9, i32 -9, i32 -9, i32 -9>
%8 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %6, i1 true)
%9 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %7, i1 true)
%10 = add <4 x i32> %8, %vec.phi
%11 = add <4 x i32> %9, %vec.phi78
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %11, %10
%13 = 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.cond17.preheader, label %for.body9.preheader106
for.body9.preheader106: ; preds = %for.body9.preheader, %middle.block
%indvars.iv62.ph = phi i64 [ 0, %for.body9.preheader ], [ %n.vec, %middle.block ]
%sumB.052.ph = phi i32 [ 0, %for.body9.preheader ], [ %13, %middle.block ]
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %p, 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
%14 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %14, 2
%15 = sext i32 %div to i64
%cmp = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond17.preheader: ; preds = %for.body9, %middle.block
%add12.lcssa = phi i32 [ %13, %middle.block ], [ %add12, %for.body9 ]
br i1 %cmp651, label %for.body22.preheader, label %if.else
for.body22.preheader: ; preds = %for.cond17.preheader
%wide.trip.count70 = zext i32 %div5 to i64
%min.iters.check83 = icmp ult i32 %div5, 8
br i1 %min.iters.check83, label %for.body22.preheader103, label %vector.ph84
vector.ph84: ; preds = %for.body22.preheader
%n.vec86 = and i64 %wide.trip.count, 4294967288
br label %vector.body89
vector.body89: ; preds = %vector.body89, %vector.ph84
%index90 = phi i64 [ 0, %vector.ph84 ], [ %index.next99, %vector.body89 ]
%vec.phi91 = phi <4 x i32> [ zeroinitializer, %vector.ph84 ], [ %26, %vector.body89 ]
%vec.phi92 = phi <4 x i32> [ zeroinitializer, %vector.ph84 ], [ %27, %vector.body89 ]
%vec.ind93 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph84 ], [ %vec.ind.next96, %vector.body89 ]
%16 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %index90
%wide.load97 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load98 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = shl <4 x i32> %vec.ind93, <i32 1, i32 1, i32 1, i32 1>
%step.add94 = shl <4 x i32> %vec.ind93, <i32 1, i32 1, i32 1, i32 1>
%19 = add <4 x i32> %step.add94, <i32 8, i32 8, i32 8, i32 8>
%20 = sub <4 x i32> %wide.load97, %18
%21 = sub <4 x i32> %wide.load98, %19
%22 = add <4 x i32> %20, <i32 -2, i32 -2, i32 -2, i32 -2>
%23 = add <4 x i32> %21, <i32 -2, i32 -2, i32 -2, i32 -2>
%24 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %22, i1 true)
%25 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %23, i1 true)
%26 = add <4 x i32> %24, %vec.phi91
%27 = add <4 x i32> %25, %vec.phi92
%index.next99 = add nuw i64 %index90, 8
%vec.ind.next96 = add <4 x i32> %vec.ind93, <i32 8, i32 8, i32 8, i32 8>
%28 = icmp eq i64 %index.next99, %n.vec86
br i1 %28, label %middle.block81, label %vector.body89, !llvm.loop !14
middle.block81: ; preds = %vector.body89
%bin.rdx100 = add <4 x i32> %27, %26
%29 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx100)
%cmp.n88 = icmp eq i64 %n.vec86, %wide.trip.count
br i1 %cmp.n88, label %for.cond.cleanup21, label %for.body22.preheader103
for.body22.preheader103: ; preds = %for.body22.preheader, %middle.block81
%indvars.iv67.ph = phi i64 [ 0, %for.body22.preheader ], [ %n.vec86, %middle.block81 ]
%sumW.057.ph = phi i32 [ 0, %for.body22.preheader ], [ %29, %middle.block81 ]
br label %for.body22
for.body9: ; preds = %for.body9.preheader106, %for.body9
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.body9 ], [ %indvars.iv62.ph, %for.body9.preheader106 ]
%sumB.052 = phi i32 [ %add12, %for.body9 ], [ %sumB.052.ph, %for.body9.preheader106 ]
%arrayidx11 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv62
%30 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv62.tr = trunc i64 %indvars.iv62 to i32
%31 = shl i32 %indvars.iv62.tr, 1
%32 = xor i32 %31, -1
%sub = add i32 %30, %32
%33 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%add12 = add nuw nsw i32 %33, %sumB.052
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count
br i1 %exitcond.not, label %for.cond17.preheader, label %for.body9, !llvm.loop !15
for.cond.cleanup21: ; preds = %for.body22, %middle.block81
%add28.lcssa = phi i32 [ %29, %middle.block81 ], [ %add28, %for.body22 ]
%cmp32 = icmp ult i32 %add12.lcssa, %add28.lcssa
br i1 %cmp32, label %if.end, label %if.else
for.body22: ; preds = %for.body22.preheader103, %for.body22
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.body22 ], [ %indvars.iv67.ph, %for.body22.preheader103 ]
%sumW.057 = phi i32 [ %add28, %for.body22 ], [ %sumW.057.ph, %for.body22.preheader103 ]
%arrayidx24 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv67
%34 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%indvars.iv67.tr = trunc i64 %indvars.iv67 to i32
%35 = shl i32 %indvars.iv67.tr, 1
%reass.sub = sub i32 %34, %35
%sub27 = add i32 %reass.sub, -2
%36 = call i32 @llvm.abs.i32(i32 %sub27, i1 true)
%add28 = add nuw nsw i32 %36, %sumW.057
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70
br i1 %exitcond71.not, label %for.cond.cleanup21, label %for.body22, !llvm.loop !16
if.else: ; preds = %for.cond.cleanup, %for.cond17.preheader, %for.cond.cleanup21
%sumW.0.lcssa77 = phi i32 [ %add28.lcssa, %for.cond.cleanup21 ], [ 0, %for.cond17.preheader ], [ 0, %for.cond.cleanup ]
br label %if.end
if.end: ; preds = %for.cond.cleanup21, %if.else
%sumW.0.lcssa77.sink = phi i32 [ %sumW.0.lcssa77, %if.else ], [ %add12.lcssa, %for.cond.cleanup21 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sumW.0.lcssa77.sink)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5
; 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 <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !12, !11}
|
#include <stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a <= c && b >= c)
{
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110753/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110753/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%2 = load i32, ptr %b, align 4
%cmp1.not = icmp slt i32 %2, %1
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%str.str.3 = select i1 %or.cond, 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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a <= c && c <= b)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110797/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110797/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%2 = load i32, ptr %b, align 4
%cmp1.not = icmp sgt i32 %1, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%str.str.3 = select i1 %or.cond, 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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define ll long long
int main()
{
int t;
scanf("%d",&t);
for(int i = 0;i<t;i++)
{
int n,m;
scanf("%d %d",&n,&m);
ll ans;
ans = n*m +1;
ans/=2;
printf("%lld\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11084/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11084/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %m)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %m, align 4, !tbaa !5
%mul = mul nsw i32 %2, %1
%add = add nsw i32 %mul, 1
%3 = sdiv i32 %add, 2
%div = sext i32 %3 to i64
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%inc = add nuw nsw i32 %i.06, 1
%4 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if((c>=a)&&(c<=b)){
printf("Yes");
}
else{
printf("No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110883/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110883/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%2 = load i32, ptr %b, align 4
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%.str.2..str.1 = select i1 %or.cond, 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 %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(a <= c && b >= c){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110933/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110933/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%2 = load i32, ptr %b, align 4
%cmp3.not = icmp slt i32 %2, %1
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp3.not
%str.str.3 = select i1 %or.cond, 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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define graph_valtype int
#define heap_valtype pair
#define inf (1e18)
typedef struct {
int v_num;
double dis;
}pair;
int compare(heap_valtype a, heap_valtype b){
if(a.dis < b.dis){
return -1;
}
else if(a.dis == b.dis){
return 0;
}
else{
return 1;
}
}
typedef struct graph_edge_sub graph_edge;
typedef struct {
int num;
int next_num;
graph_edge *next;
int prev_num;
}graph_vertex_sub;
struct graph_edge_sub{
graph_vertex_sub *v;
double w;
graph_edge *next;
};
typedef struct graph_v_sub graph_vertex;
struct graph_v_sub{
int num;
graph_valtype val;
int next_num;
graph_vertex **next;
double *next_weight;
int prev_num;
graph_vertex **prev;
double *prev_weight;
};
typedef struct {
int N;
graph_vertex_sub **v_s;
graph_vertex **v;
}graph;
//頂点数N, 各頂点の初期値ini_valのグラフを作る
graph *make_graph(int N, graph_valtype ini_val){
int i;
graph *g = (graph *)malloc(sizeof(graph));
g->N = N;
g->v_s = (graph_vertex_sub **)malloc(sizeof(graph_vertex_sub *) * N);
g->v = (graph_vertex **)malloc(sizeof(graph_vertex *) * N);
for(i = 0; i < N; i++){
(g->v_s)[i] = (graph_vertex_sub *)malloc(sizeof(graph_vertex_sub));
(g->v_s)[i]->num = i;
(g->v_s)[i]->next_num = 0;
(g->v_s)[i]->next = NULL;
(g->v_s)[i]->prev_num = 0;
(g->v)[i] = (graph_vertex *)malloc(sizeof(graph_vertex));
(g->v)[i]->num = i;
(g->v)[i]->val = ini_val;
(g->v)[i]->next_num = 0;
(g->v)[i]->next = NULL;
(g->v)[i]->next_weight = NULL;
(g->v)[i]->prev_num = 0;
(g->v)[i]->prev = NULL;
(g->v)[i]->prev_weight = NULL;
}
return g;
}
//グラフgの頂点aから頂点bに重みwの有向辺を張る (0 <= a, b <= N - 1)
void set_edge_graph(int a, int b, double w, graph *g){
graph_edge *new1 = (graph_edge *)malloc(sizeof(graph_edge));
new1->v = (g->v_s)[b];
new1->w = w;
new1->next = (g->v_s)[a]->next;
(g->v_s)[a]->next = new1;
(g->v_s)[a]->next_num++;
(g->v_s)[b]->prev_num++;
}
//set_edge_graph後に呼び出す
void build_graph(graph *g){
int i;
graph_vertex_sub **v_s = g->v_s;
graph_vertex **v = g->v;
graph_vertex *nowv;
graph_edge *nowe;
for(i = 0; i < g->N; i++){
v[i]->next = (graph_vertex **)malloc(sizeof(graph_vertex *) * v_s[i]->next_num);
v[i]->next_weight = (double *)malloc(sizeof(double) * v_s[i]->next_num);
v[i]->prev = (graph_vertex **)malloc(sizeof(graph_vertex *) * v_s[i]->prev_num);
v[i]->prev_weight = (double *)malloc(sizeof(double) * v_s[i]->prev_num);
}
for(i = 0; i < g->N; i++){
nowv = v[i];
for(nowe = v_s[i]->next; nowe != NULL; nowe = nowe->next){
(nowv->next)[nowv->next_num] = v[nowe->v->num];
(nowv->next_weight)[nowv->next_num] = nowe->w;
nowv->next_num++;
(v[nowe->v->num]->prev)[v[nowe->v->num]->prev_num] = nowv;
(v[nowe->v->num]->prev_weight)[v[nowe->v->num]->prev_num] = nowe->w;
v[nowe->v->num]->prev_num++;
}
}
}
typedef struct heap_node_sub{
heap_valtype val;
struct heap_node_sub *parent;
struct heap_node_sub *prev;
struct heap_node_sub *next;
struct heap_node_sub *left;
struct heap_node_sub *right;
}heap_node;
typedef struct {
int N;
heap_node *root;
heap_node *last;
}heap;
//heapを生成
heap *make_heap(){
heap *h = (heap *)malloc(sizeof(heap));
h->N = 0;
h->root = NULL;
h->last = NULL;
return h;
}
int element_num_heap(heap *h){
return h->N;
}
void up_heapify(heap_node *n, heap *h){
if(n->parent != NULL){
if(compare(n->val, n->parent->val) < 0){
heap_valtype tmp;
tmp = n->val;
n->val = n->parent->val;
n->parent->val = tmp;
up_heapify(n->parent, h);
}
}
}
//データを追加
void add_data_heap(heap_valtype val, heap *h){
heap_node *new = (heap_node *)malloc(sizeof(heap_node));
new->val = val;
new->next = NULL;
new->left = NULL;
new->right = NULL;
if(element_num_heap(h) == 0){
new->parent = NULL;
new->prev = NULL;
h->root = new;
h->last = new;
}
else if(element_num_heap(h) == 1){
new->parent = h->root;
new->prev = h->root;
h->root->left = new;
h->root->next = new;
h->last = new;
up_heapify(new, h);
}
else{
new->prev = h->last;
h->last->next = new;
if(h->last->parent->right == NULL){
new->parent = h->last->parent;
h->last->parent->right = new;
}
else{
new->parent = h->last->parent->next;
h->last->parent->next->left = new;
}
h->last = new;
up_heapify(new, h);
}
h->N++;
}
void down_heappify(heap_node *n, heap *h){
if(n->left != NULL){
heap_valtype tmp;
if(n->right == NULL){
if(compare(n->val, n->left->val) > 0){
tmp = n->val;
n->val = n->left->val;
n->left->val = tmp;
down_heappify(n->left, h);
}
}
else{
if(compare(n->left->val, n->right->val) <= 0 && compare(n->val, n->left->val) > 0){
tmp = n->val;
n->val = n->left->val;
n->left->val = tmp;
down_heappify(n->left, h);
}
else if(compare(n->left->val, n->right->val) > 0 && compare(n->val, n->right->val) > 0){
tmp = n->val;
n->val = n->right->val;
n->right->val = tmp;
down_heappify(n->right, h);
}
}
}
}
//最小のものを取り出す
heap_valtype take_min_heap(heap *h){
if(element_num_heap(h) == 0){
printf("no data in the heap\n");
}
heap_valtype ans = h->root->val;
heap_node *ln = h->last;
if(element_num_heap(h) == 1){
h->root = NULL;
h->last = NULL;
}
else{
ln->prev->next = NULL;
if(ln->parent->right == NULL){
ln->parent->left = NULL;
}
else{
ln->parent->right = NULL;
}
h->last = ln->prev;
h->root->val = ln->val;
down_heappify(h->root, h);
}
free(ln);
h->N--;
return ans;
}
heap_valtype look_min_heap(heap *h){
if(element_num_heap(h) == 0){
printf("no data in the heap\n");
}
return h->root->val;
}
double *Dijkstra(graph *g, int s){
int N = g->N, i;
double *distance = (double *)malloc(sizeof(double) * N);
for(i = 0; i < N; i++){
distance[i] = inf;
}
heap *h = make_heap();
pair p;
p.v_num = s;
p.dis = 0;
add_data_heap(p, h);
graph_vertex *nowv;
while(element_num_heap(h) > 0){
p = take_min_heap(h);
nowv = g->v[p.v_num];
if(p.dis < distance[nowv->num]){
distance[nowv->num] = p.dis;
for(i = 0; i < nowv->next_num; i++){
p.v_num = nowv->next[i]->num;
p.dis = distance[nowv->num] + nowv->next_weight[i];
add_data_heap(p, h);
}
}
}
return distance;
}
double max(double a, double b){
return a >= b ? a : b;
}
int main(){
int N, i, j;
double xs, ys, xt, yt;
scanf("%lf%lf%lf%lf", &xs, &ys, &xt, &yt);
scanf("%d", &N);
double *x = (double *)malloc(sizeof(double) * (N + 2));
double *y = (double *)malloc(sizeof(double) * (N + 2));
double *r = (double *)malloc(sizeof(double) * (N + 2));
x[0] = xs;
y[0] = ys;
r[0] = 0;
for(i = 1; i <= N; i++){
scanf("%lf%lf%lf", &x[i], &y[i], &r[i]);
}
x[N + 1] = xt;
y[N + 1] = yt;
r[N + 1] = 0;
graph *g = make_graph(N + 2, 0);
for(i = 0; i <= N + 1; i++){
for(j = 0; j <= N + 1; j++){
if(i != j){
set_edge_graph(i, j, max(hypot(x[i] - x[j], y[i] - y[j]) - (r[i] + r[j]), 0), g);
}
}
}
build_graph(g);
printf("%.12lf\n", Dijkstra(g, 0)[N + 1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_110977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_110977/source.c"
target datalayout = "e-m:e-p270: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.graph = type { i32, ptr, ptr }
%struct.graph_vertex_sub = type { i32, i32, ptr, i32 }
%struct.graph_v_sub = type { i32, i32, i32, ptr, ptr, i32, ptr, ptr }
%struct.graph_edge_sub = type { ptr, double, ptr }
%struct.heap = type { i32, ptr, ptr }
%struct.pair = type { i32, double }
%struct.heap_node_sub = type { %struct.pair, ptr, ptr, ptr, ptr, ptr }
@.str.1 = private unnamed_addr constant [13 x i8] c"%lf%lf%lf%lf\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"%lf%lf%lf\00", align 1
@.str.4 = private unnamed_addr constant [8 x i8] c"%.12lf\0A\00", align 1
@str.5 = private unnamed_addr constant [20 x i8] c"no data in the heap\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @compare(i32 %a.coerce0, double %a.coerce1, i32 %b.coerce0, double %b.coerce1) local_unnamed_addr #0 {
entry:
%cmp = fcmp olt double %a.coerce1, %b.coerce1
%cmp4 = fcmp une double %a.coerce1, %b.coerce1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @make_graph(i32 noundef %N, i32 noundef %ini_val) local_unnamed_addr #1 {
entry:
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
store i32 %N, ptr %call, align 8, !tbaa !5
%conv = sext i32 %N to i64
%mul = shl nsw i64 %conv, 3
%call2 = tail call noalias ptr @malloc(i64 noundef %mul) #16
%v_s = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 1
store ptr %call2, ptr %v_s, align 8, !tbaa !11
%call5 = tail call noalias ptr @malloc(i64 noundef %mul) #16
%v = getelementptr inbounds %struct.graph, ptr %call, i64 0, i32 2
store ptr %call5, ptr %v, align 8, !tbaa !12
%cmp90 = icmp sgt i32 %N, 0
br i1 %cmp90, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call7 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
%arrayidx = getelementptr inbounds ptr, ptr %call2, i64 %indvars.iv
store ptr %call7, ptr %arrayidx, align 8, !tbaa !13
%0 = trunc i64 %indvars.iv to i32
store i32 %0, ptr %call7, align 8, !tbaa !14
%next_num = getelementptr inbounds %struct.graph_vertex_sub, ptr %call7, i64 0, i32 1
%call21 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #16
%arrayidx24 = getelementptr inbounds ptr, ptr %call5, i64 %indvars.iv
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %next_num, i8 0, i64 16, i1 false)
store ptr %call21, ptr %arrayidx24, align 8, !tbaa !13
store i32 %0, ptr %call21, align 8, !tbaa !16
%val = getelementptr inbounds %struct.graph_v_sub, ptr %call21, i64 0, i32 1
store i32 %ini_val, ptr %val, align 4, !tbaa !18
%next_num35 = getelementptr inbounds %struct.graph_v_sub, ptr %call21, i64 0, i32 2
store i32 0, ptr %next_num35, align 8, !tbaa !19
%next39 = getelementptr inbounds %struct.graph_v_sub, ptr %call21, i64 0, i32 3
%prev = getelementptr inbounds %struct.graph_v_sub, ptr %call21, i64 0, i32 6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %next39, i8 0, i64 20, i1 false)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %prev, i8 0, i64 16, i1 false)
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !20
for.end: ; preds = %for.body, %entry
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local void @set_edge_graph(i32 noundef %a, i32 noundef %b, double noundef %w, ptr nocapture noundef readonly %g) local_unnamed_addr #4 {
entry:
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
%v_s = getelementptr inbounds %struct.graph, ptr %g, i64 0, i32 1
%0 = load ptr, ptr %v_s, align 8, !tbaa !11
%idxprom = sext i32 %b to i64
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !13
store ptr %1, ptr %call, align 8, !tbaa !22
%w1 = getelementptr inbounds %struct.graph_edge_sub, ptr %call, i64 0, i32 1
store double %w, ptr %w1, align 8, !tbaa !25
%idxprom3 = sext i32 %a to i64
%arrayidx4 = getelementptr inbounds ptr, ptr %0, i64 %idxprom3
%2 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%next = getelementptr inbounds %struct.graph_vertex_sub, ptr %2, i64 0, i32 2
%3 = load ptr, ptr %next, align 8, !tbaa !26
%next5 = getelementptr inbounds %struct.graph_edge_sub, ptr %call, i64 0, i32 2
store ptr %3, ptr %next5, align 8, !tbaa !27
%4 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%next9 = getelementptr inbounds %struct.graph_vertex_sub, ptr %4, i64 0, i32 2
store ptr %call, ptr %next9, align 8, !tbaa !26
%5 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%next_num = getelementptr inbounds %struct.graph_vertex_sub, ptr %5, i64 0, i32 1
%6 = load i32, ptr %next_num, align 4, !tbaa !28
%inc = add nsw i32 %6, 1
store i32 %inc, ptr %next_num, align 4, !tbaa !28
%7 = load ptr, ptr %arrayidx, align 8, !tbaa !13
%prev_num = getelementptr inbounds %struct.graph_vertex_sub, ptr %7, i64 0, i32 3
%8 = load i32, ptr %prev_num, align 8, !tbaa !29
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr %prev_num, align 8, !tbaa !29
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @build_graph(ptr nocapture noundef readonly %g) local_unnamed_addr #5 {
entry:
%v_s1 = getelementptr inbounds %struct.graph, ptr %g, i64 0, i32 1
%0 = load ptr, ptr %v_s1, align 8, !tbaa !11
%v2 = getelementptr inbounds %struct.graph, ptr %g, i64 0, i32 2
%1 = load ptr, ptr %v2, align 8, !tbaa !12
%2 = load i32, ptr %g, align 8, !tbaa !5
%cmp136 = icmp sgt i32 %2, 0
br i1 %cmp136, label %for.body.preheader, label %for.end91
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %2 to i64
br label %for.body
for.cond28.preheader: ; preds = %for.body
br i1 %cmp136, label %for.body32.preheader, label %for.end91
for.body32.preheader: ; preds = %for.cond28.preheader
%wide.trip.count151 = zext i32 %2 to i64
br label %for.body32
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
%3 = load ptr, ptr %arrayidx, align 8, !tbaa !13
%next_num = getelementptr inbounds %struct.graph_vertex_sub, ptr %3, i64 0, i32 1
%4 = load i32, ptr %next_num, align 4, !tbaa !28
%conv = sext i32 %4 to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #16
%arrayidx4 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
%5 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%next = getelementptr inbounds %struct.graph_v_sub, ptr %5, i64 0, i32 3
store ptr %call, ptr %next, align 8, !tbaa !30
%6 = load ptr, ptr %arrayidx, align 8, !tbaa !13
%next_num7 = getelementptr inbounds %struct.graph_vertex_sub, ptr %6, i64 0, i32 1
%7 = load i32, ptr %next_num7, align 4, !tbaa !28
%conv8 = sext i32 %7 to i64
%mul9 = shl nsw i64 %conv8, 3
%call10 = tail call noalias ptr @malloc(i64 noundef %mul9) #16
%8 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%next_weight = getelementptr inbounds %struct.graph_v_sub, ptr %8, i64 0, i32 4
store ptr %call10, ptr %next_weight, align 8, !tbaa !31
%9 = load ptr, ptr %arrayidx, align 8, !tbaa !13
%prev_num = getelementptr inbounds %struct.graph_vertex_sub, ptr %9, i64 0, i32 3
%10 = load i32, ptr %prev_num, align 8, !tbaa !29
%conv15 = sext i32 %10 to i64
%mul16 = shl nsw i64 %conv15, 3
%call17 = tail call noalias ptr @malloc(i64 noundef %mul16) #16
%11 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%prev = getelementptr inbounds %struct.graph_v_sub, ptr %11, i64 0, i32 6
store ptr %call17, ptr %prev, align 8, !tbaa !32
%12 = load ptr, ptr %arrayidx, align 8, !tbaa !13
%prev_num22 = getelementptr inbounds %struct.graph_vertex_sub, ptr %12, i64 0, i32 3
%13 = load i32, ptr %prev_num22, align 8, !tbaa !29
%conv23 = sext i32 %13 to i64
%mul24 = shl nsw i64 %conv23, 3
%call25 = tail call noalias ptr @malloc(i64 noundef %mul24) #16
%14 = load ptr, ptr %arrayidx4, align 8, !tbaa !13
%prev_weight = getelementptr inbounds %struct.graph_v_sub, ptr %14, i64 0, i32 7
store ptr %call25, ptr %prev_weight, align 8, !tbaa !33
%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.cond28.preheader, label %for.body, !llvm.loop !34
for.body32: ; preds = %for.body32.preheader, %for.inc89
%indvars.iv148 = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next149, %for.inc89 ]
%arrayidx34 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv148
%15 = load ptr, ptr %arrayidx34, align 8, !tbaa !13
%arrayidx36 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv148
%16 = load ptr, ptr %arrayidx36, align 8, !tbaa !13
%next37 = getelementptr inbounds %struct.graph_vertex_sub, ptr %16, i64 0, i32 2
%nowe.0138 = load ptr, ptr %next37, align 8, !tbaa !13
%cmp39.not139 = icmp eq ptr %nowe.0138, null
br i1 %cmp39.not139, label %for.inc89, label %for.body41.lr.ph
for.body41.lr.ph: ; preds = %for.body32
%next45 = getelementptr inbounds %struct.graph_v_sub, ptr %15, i64 0, i32 3
%next_num46 = getelementptr inbounds %struct.graph_v_sub, ptr %15, i64 0, i32 2
%next_weight49 = getelementptr inbounds %struct.graph_v_sub, ptr %15, i64 0, i32 4
%next_num46.promoted = load i32, ptr %next_num46, align 8, !tbaa !19
%17 = sext i32 %next_num46.promoted to i64
br label %for.body41
for.body41: ; preds = %for.body41.lr.ph, %for.body41
%indvars.iv145 = phi i64 [ %17, %for.body41.lr.ph ], [ %indvars.iv.next146, %for.body41 ]
%nowe.0140 = phi ptr [ %nowe.0138, %for.body41.lr.ph ], [ %nowe.0, %for.body41 ]
%18 = load ptr, ptr %nowe.0140, align 8, !tbaa !22
%19 = load i32, ptr %18, align 8, !tbaa !14
%idxprom43 = sext i32 %19 to i64
%arrayidx44 = getelementptr inbounds ptr, ptr %1, i64 %idxprom43
%20 = load ptr, ptr %arrayidx44, align 8, !tbaa !13
%21 = load ptr, ptr %next45, align 8, !tbaa !30
%arrayidx48 = getelementptr inbounds ptr, ptr %21, i64 %indvars.iv145
store ptr %20, ptr %arrayidx48, align 8, !tbaa !13
%w = getelementptr inbounds %struct.graph_edge_sub, ptr %nowe.0140, i64 0, i32 1
%22 = load double, ptr %w, align 8, !tbaa !25
%23 = load ptr, ptr %next_weight49, align 8, !tbaa !31
%arrayidx52 = getelementptr inbounds double, ptr %23, i64 %indvars.iv145
store double %22, ptr %arrayidx52, align 8, !tbaa !35
%indvars.iv.next146 = add i64 %indvars.iv145, 1
%24 = load ptr, ptr %nowe.0140, align 8, !tbaa !22
%25 = load i32, ptr %24, align 8, !tbaa !14
%idxprom57 = sext i32 %25 to i64
%arrayidx58 = getelementptr inbounds ptr, ptr %1, i64 %idxprom57
%26 = load ptr, ptr %arrayidx58, align 8, !tbaa !13
%prev59 = getelementptr inbounds %struct.graph_v_sub, ptr %26, i64 0, i32 6
%27 = load ptr, ptr %prev59, align 8, !tbaa !32
%prev_num64 = getelementptr inbounds %struct.graph_v_sub, ptr %26, i64 0, i32 5
%28 = load i32, ptr %prev_num64, align 8, !tbaa !36
%idxprom65 = sext i32 %28 to i64
%arrayidx66 = getelementptr inbounds ptr, ptr %27, i64 %idxprom65
store ptr %15, ptr %arrayidx66, align 8, !tbaa !13
%29 = load double, ptr %w, align 8, !tbaa !25
%30 = load ptr, ptr %nowe.0140, align 8, !tbaa !22
%31 = load i32, ptr %30, align 8, !tbaa !14
%idxprom70 = sext i32 %31 to i64
%arrayidx71 = getelementptr inbounds ptr, ptr %1, i64 %idxprom70
%32 = load ptr, ptr %arrayidx71, align 8, !tbaa !13
%prev_weight72 = getelementptr inbounds %struct.graph_v_sub, ptr %32, i64 0, i32 7
%33 = load ptr, ptr %prev_weight72, align 8, !tbaa !33
%prev_num77 = getelementptr inbounds %struct.graph_v_sub, ptr %32, i64 0, i32 5
%34 = load i32, ptr %prev_num77, align 8, !tbaa !36
%idxprom78 = sext i32 %34 to i64
%arrayidx79 = getelementptr inbounds double, ptr %33, i64 %idxprom78
store double %29, ptr %arrayidx79, align 8, !tbaa !35
%inc85 = add nsw i32 %34, 1
store i32 %inc85, ptr %prev_num77, align 8, !tbaa !36
%next87 = getelementptr inbounds %struct.graph_edge_sub, ptr %nowe.0140, i64 0, i32 2
%nowe.0 = load ptr, ptr %next87, align 8, !tbaa !13
%cmp39.not = icmp eq ptr %nowe.0, null
br i1 %cmp39.not, label %for.cond38.for.inc89_crit_edge, label %for.body41, !llvm.loop !37
for.cond38.for.inc89_crit_edge: ; preds = %for.body41
%35 = trunc i64 %indvars.iv.next146 to i32
store i32 %35, ptr %next_num46, align 8, !tbaa !19
br label %for.inc89
for.inc89: ; preds = %for.cond38.for.inc89_crit_edge, %for.body32
%indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
%exitcond152.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count151
br i1 %exitcond152.not, label %for.end91, label %for.body32, !llvm.loop !38
for.end91: ; preds = %for.inc89, %entry, %for.cond28.preheader
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @make_heap() local_unnamed_addr #6 {
entry:
%call = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
store i32 0, ptr %call, align 8, !tbaa !5
%root = getelementptr inbounds %struct.heap, ptr %call, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %root, i8 0, i64 16, i1 false)
ret ptr %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @element_num_heap(ptr nocapture noundef readonly %h) local_unnamed_addr #7 {
entry:
%0 = load i32, ptr %h, align 8, !tbaa !5
ret i32 %0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @up_heapify(ptr nocapture noundef %n, ptr nocapture noundef readnone %h) local_unnamed_addr #8 {
entry:
%tmp = alloca %struct.pair, align 8
%parent20 = getelementptr inbounds %struct.heap_node_sub, ptr %n, i64 0, i32 1
%0 = load ptr, ptr %parent20, align 8, !tbaa !39
%cmp.not21 = icmp eq ptr %0, null
br i1 %cmp.not21, label %if.end12, label %if.then
if.then: ; preds = %entry, %if.then4
%1 = phi ptr [ %7, %if.then4 ], [ %0, %entry ]
%parent23 = phi ptr [ %parent, %if.then4 ], [ %parent20, %entry ]
%n.tr22 = phi ptr [ %6, %if.then4 ], [ %n, %entry ]
%2 = getelementptr inbounds { i32, double }, ptr %n.tr22, i64 0, i32 1
%3 = load double, ptr %2, align 8
%4 = getelementptr inbounds { i32, double }, ptr %1, i64 0, i32 1
%5 = load double, ptr %4, align 8
%cmp.i = fcmp olt double %3, %5
br i1 %cmp.i, label %if.then4, label %if.end12
if.then4: ; preds = %if.then
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %tmp, ptr noundef nonnull align 8 dereferenceable(16) %n.tr22, i64 16, i1 false), !tbaa.struct !42
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %n.tr22, ptr noundef nonnull align 8 dereferenceable(16) %1, i64 16, i1 false), !tbaa.struct !42
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %tmp, i64 16, i1 false), !tbaa.struct !42
%6 = load ptr, ptr %parent23, align 8, !tbaa !39
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp)
%parent = getelementptr inbounds %struct.heap_node_sub, ptr %6, i64 0, i32 1
%7 = load ptr, ptr %parent, align 8, !tbaa !39
%cmp.not = icmp eq ptr %7, null
br i1 %cmp.not, label %if.end12, label %if.then
if.end12: ; preds = %if.then4, %if.then, %entry
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) #9
; Function Attrs: nofree nounwind uwtable
define dso_local void @add_data_heap(i32 %val.coerce0, double %val.coerce1, ptr nocapture noundef %h) local_unnamed_addr #5 {
entry:
%tmp.i84 = alloca %struct.pair, align 8
%tmp.i = alloca %struct.pair, align 8
%call = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #16
store i32 %val.coerce0, ptr %call, align 8, !tbaa.struct !42
%val.sroa.283.0.val1.sroa_idx = getelementptr inbounds i8, ptr %call, i64 8
store double %val.coerce1, ptr %val.sroa.283.0.val1.sroa_idx, align 8, !tbaa.struct !44
%next = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 3
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %next, i8 0, i64 24, i1 false)
%0 = load i32, ptr %h, align 8, !tbaa !5
switch i32 %0, label %if.else15 [
i32 0, label %if.then
i32 1, label %if.then5
]
if.then: ; preds = %entry
%parent = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 1
%root = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %parent, i8 0, i64 16, i1 false)
store ptr %call, ptr %root, align 8, !tbaa !11
%last = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 2
store ptr %call, ptr %last, align 8, !tbaa !12
br label %if.end42
if.then5: ; preds = %entry
%root6 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1
%1 = load ptr, ptr %root6, align 8, !tbaa !11
%parent7 = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 1
store ptr %1, ptr %parent7, align 8, !tbaa !39
%prev9 = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 2
store ptr %1, ptr %prev9, align 8, !tbaa !45
%left11 = getelementptr inbounds %struct.heap_node_sub, ptr %1, i64 0, i32 4
store ptr %call, ptr %left11, align 8, !tbaa !46
%next13 = getelementptr inbounds %struct.heap_node_sub, ptr %1, i64 0, i32 3
store ptr %call, ptr %next13, align 8, !tbaa !47
%last14 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 2
store ptr %call, ptr %last14, align 8, !tbaa !12
br label %if.then.i
if.then.i: ; preds = %if.then5, %if.then4.i
%2 = phi ptr [ %8, %if.then4.i ], [ %1, %if.then5 ]
%parent23.i = phi ptr [ %parent.i, %if.then4.i ], [ %parent7, %if.then5 ]
%n.tr22.i = phi ptr [ %7, %if.then4.i ], [ %call, %if.then5 ]
%3 = getelementptr inbounds { i32, double }, ptr %n.tr22.i, i64 0, i32 1
%4 = load double, ptr %3, align 8
%5 = getelementptr inbounds { i32, double }, ptr %2, i64 0, i32 1
%6 = load double, ptr %5, align 8
%cmp.i.i = fcmp olt double %4, %6
br i1 %cmp.i.i, label %if.then4.i, label %if.end42
if.then4.i: ; preds = %if.then.i
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp.i)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %tmp.i, ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i, i64 16, i1 false), !tbaa.struct !42
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 16, i1 false), !tbaa.struct !42
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %tmp.i, i64 16, i1 false), !tbaa.struct !42
%7 = load ptr, ptr %parent23.i, align 8, !tbaa !39
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp.i)
%parent.i = getelementptr inbounds %struct.heap_node_sub, ptr %7, i64 0, i32 1
%8 = load ptr, ptr %parent.i, align 8, !tbaa !39
%cmp.not.i = icmp eq ptr %8, null
br i1 %cmp.not.i, label %if.end42, label %if.then.i
if.else15: ; preds = %entry
%last16 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 2
%9 = load ptr, ptr %last16, align 8, !tbaa !12
%prev17 = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 2
store ptr %9, ptr %prev17, align 8, !tbaa !45
%next19 = getelementptr inbounds %struct.heap_node_sub, ptr %9, i64 0, i32 3
store ptr %call, ptr %next19, align 8, !tbaa !47
%parent21 = getelementptr inbounds %struct.heap_node_sub, ptr %9, i64 0, i32 1
%10 = load ptr, ptr %parent21, align 8, !tbaa !39
%right22 = getelementptr inbounds %struct.heap_node_sub, ptr %10, i64 0, i32 5
%11 = load ptr, ptr %right22, align 8, !tbaa !48
%cmp23 = icmp eq ptr %11, null
br i1 %cmp23, label %if.end.thread, label %if.end
if.end.thread: ; preds = %if.else15
%parent27 = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 1
store ptr %10, ptr %parent27, align 8, !tbaa !39
%12 = load ptr, ptr %parent21, align 8, !tbaa !39
%right30 = getelementptr inbounds %struct.heap_node_sub, ptr %12, i64 0, i32 5
store ptr %call, ptr %right30, align 8, !tbaa !48
store ptr %call, ptr %last16, align 8, !tbaa !12
br label %if.then.i87.preheader
if.end: ; preds = %if.else15
%next34 = getelementptr inbounds %struct.heap_node_sub, ptr %10, i64 0, i32 3
%13 = load ptr, ptr %next34, align 8, !tbaa !47
%parent35 = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 1
store ptr %13, ptr %parent35, align 8, !tbaa !39
%14 = load ptr, ptr %parent21, align 8, !tbaa !39
%next38 = getelementptr inbounds %struct.heap_node_sub, ptr %14, i64 0, i32 3
%15 = load ptr, ptr %next38, align 8, !tbaa !47
%left39 = getelementptr inbounds %struct.heap_node_sub, ptr %15, i64 0, i32 4
store ptr %call, ptr %left39, align 8, !tbaa !46
store ptr %call, ptr %last16, align 8, !tbaa !12
%cmp.not21.i86 = icmp eq ptr %13, null
br i1 %cmp.not21.i86, label %if.end42, label %if.then.i87.preheader
if.then.i87.preheader: ; preds = %if.end.thread, %if.end
%16 = phi ptr [ %10, %if.end.thread ], [ %13, %if.end ]
%parent20.i85 = getelementptr inbounds %struct.heap_node_sub, ptr %call, i64 0, i32 1
br label %if.then.i87
if.then.i87: ; preds = %if.then.i87.preheader, %if.then4.i91
%17 = phi ptr [ %23, %if.then4.i91 ], [ %16, %if.then.i87.preheader ]
%parent23.i88 = phi ptr [ %parent.i92, %if.then4.i91 ], [ %parent20.i85, %if.then.i87.preheader ]
%n.tr22.i89 = phi ptr [ %22, %if.then4.i91 ], [ %call, %if.then.i87.preheader ]
%18 = getelementptr inbounds { i32, double }, ptr %n.tr22.i89, i64 0, i32 1
%19 = load double, ptr %18, align 8
%20 = getelementptr inbounds { i32, double }, ptr %17, i64 0, i32 1
%21 = load double, ptr %20, align 8
%cmp.i.i90 = fcmp olt double %19, %21
br i1 %cmp.i.i90, label %if.then4.i91, label %if.end42
if.then4.i91: ; preds = %if.then.i87
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp.i84)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %tmp.i84, ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i89, i64 16, i1 false), !tbaa.struct !42
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i89, ptr noundef nonnull align 8 dereferenceable(16) %17, i64 16, i1 false), !tbaa.struct !42
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %tmp.i84, i64 16, i1 false), !tbaa.struct !42
%22 = load ptr, ptr %parent23.i88, align 8, !tbaa !39
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp.i84)
%parent.i92 = getelementptr inbounds %struct.heap_node_sub, ptr %22, i64 0, i32 1
%23 = load ptr, ptr %parent.i92, align 8, !tbaa !39
%cmp.not.i93 = icmp eq ptr %23, null
br i1 %cmp.not.i93, label %if.end42, label %if.then.i87
if.end42: ; preds = %if.then4.i, %if.then.i, %if.then4.i91, %if.then.i87, %if.end, %if.then
%24 = load i32, ptr %h, align 8, !tbaa !5
%inc = add nsw i32 %24, 1
store i32 %inc, ptr %h, align 8, !tbaa !5
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @down_heappify(ptr nocapture noundef %n, ptr nocapture noundef readnone %h) local_unnamed_addr #8 {
entry:
%tmp = alloca %struct.pair, align 8
%left = getelementptr inbounds %struct.heap_node_sub, ptr %n, i64 0, i32 4
%0 = load ptr, ptr %left, align 8, !tbaa !46
%cmp.not = icmp eq ptr %0, null
br i1 %cmp.not, label %if.end57, label %if.then
if.then: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp)
%right = getelementptr inbounds %struct.heap_node_sub, ptr %n, i64 0, i32 5
%1 = load ptr, ptr %right, align 8, !tbaa !48
%cmp1 = icmp eq ptr %1, null
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.then
%2 = getelementptr inbounds { i32, double }, ptr %n, i64 0, i32 1
%3 = load double, ptr %2, align 8
%4 = getelementptr inbounds { i32, double }, ptr %0, i64 0, i32 1
%5 = load double, ptr %4, align 8
%cmp5 = fcmp ugt double %3, %5
br i1 %cmp5, label %if.end56.sink.split, label %if.end56
if.else: ; preds = %if.then
%6 = getelementptr inbounds { i32, double }, ptr %0, i64 0, i32 1
%7 = load double, ptr %6, align 8
%8 = getelementptr inbounds { i32, double }, ptr %1, i64 0, i32 1
%9 = load double, ptr %8, align 8
%cmp19 = fcmp ugt double %7, %9
%10 = getelementptr inbounds { i32, double }, ptr %n, i64 0, i32 1
%11 = load double, ptr %10, align 8
br i1 %cmp19, label %land.lhs.true40, label %land.lhs.true
land.lhs.true: ; preds = %if.else
%cmp24 = fcmp ugt double %11, %7
br i1 %cmp24, label %if.end56.sink.split, label %if.end56
land.lhs.true40: ; preds = %if.else
%cmp45 = fcmp ugt double %11, %9
br i1 %cmp45, label %if.end56.sink.split, label %if.end56
if.end56.sink.split: ; preds = %land.lhs.true40, %land.lhs.true, %if.then2
%.sink104 = phi ptr [ %0, %if.then2 ], [ %0, %land.lhs.true ], [ %1, %land.lhs.true40 ]
%left.sink = phi ptr [ %left, %if.then2 ], [ %left, %land.lhs.true ], [ %right, %land.lhs.true40 ]
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %tmp, ptr noundef nonnull align 8 dereferenceable(16) %n, i64 16, i1 false)
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %n, ptr noundef nonnull align 8 dereferenceable(16) %.sink104, i64 16, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %.sink104, ptr noundef nonnull align 8 dereferenceable(16) %tmp, i64 16, i1 false)
%12 = load ptr, ptr %left.sink, align 8, !tbaa !13
tail call void @down_heappify(ptr noundef %12, ptr noundef %h)
br label %if.end56
if.end56: ; preds = %if.end56.sink.split, %land.lhs.true, %land.lhs.true40, %if.then2
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp)
br label %if.end57
if.end57: ; preds = %if.end56, %entry
ret void
}
; Function Attrs: nounwind uwtable
define dso_local { i32, double } @take_min_heap(ptr nocapture noundef %h) local_unnamed_addr #10 {
entry:
%0 = load i32, ptr %h, align 8, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%.pre = load i32, ptr %h, align 8, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%1 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%root = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1
%2 = load ptr, ptr %root, align 8, !tbaa !11
%retval.sroa.0.0.copyload = load i32, ptr %2, align 8, !tbaa.struct !42
%retval.sroa.237.0.val.sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
%retval.sroa.237.0.copyload = load double, ptr %retval.sroa.237.0.val.sroa_idx, align 8, !tbaa.struct !44
%last = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 2
%3 = load ptr, ptr %last, align 8, !tbaa !12
%cmp3 = icmp eq i32 %1, 1
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %if.end
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %root, i8 0, i64 16, i1 false)
br label %if.end20
if.else: ; preds = %if.end
%prev = getelementptr inbounds %struct.heap_node_sub, ptr %3, i64 0, i32 2
%4 = load ptr, ptr %prev, align 8, !tbaa !45
%next = getelementptr inbounds %struct.heap_node_sub, ptr %4, i64 0, i32 3
store ptr null, ptr %next, align 8, !tbaa !47
%parent = getelementptr inbounds %struct.heap_node_sub, ptr %3, i64 0, i32 1
%5 = load ptr, ptr %parent, align 8, !tbaa !39
%right = getelementptr inbounds %struct.heap_node_sub, ptr %5, i64 0, i32 5
%6 = load ptr, ptr %right, align 8, !tbaa !48
%cmp7 = icmp eq ptr %6, null
%left = getelementptr inbounds %struct.heap_node_sub, ptr %5, i64 0, i32 4
%right.sink = select i1 %cmp7, ptr %left, ptr %right
store ptr null, ptr %right.sink, align 8, !tbaa !13
store ptr %4, ptr %last, align 8, !tbaa !12
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !42
%7 = load ptr, ptr %root, align 8, !tbaa !11
tail call void @down_heappify(ptr noundef %7, ptr noundef nonnull %h)
br label %if.end20
if.end20: ; preds = %if.else, %if.then4
tail call void @free(ptr noundef %3) #17
%8 = load i32, ptr %h, align 8, !tbaa !5
%dec = add nsw i32 %8, -1
store i32 %dec, ptr %h, align 8, !tbaa !5
%.fca.0.insert = insertvalue { i32, double } poison, i32 %retval.sroa.0.0.copyload, 0
%.fca.1.insert = insertvalue { i32, double } %.fca.0.insert, double %retval.sroa.237.0.copyload, 1
ret { i32, double } %.fca.1.insert
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind uwtable
define dso_local { i32, double } @look_min_heap(ptr nocapture noundef readonly %h) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %h, align 8, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end
if.end: ; preds = %if.then, %entry
%root = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1
%1 = load ptr, ptr %root, align 8, !tbaa !11
%retval.sroa.0.0.copyload = load i32, ptr %1, align 8, !tbaa.struct !42
%retval.sroa.23.0.val.sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
%retval.sroa.23.0.copyload = load double, ptr %retval.sroa.23.0.val.sroa_idx, align 8, !tbaa.struct !44
%.fca.0.insert = insertvalue { i32, double } poison, i32 %retval.sroa.0.0.copyload, 0
%.fca.1.insert = insertvalue { i32, double } %.fca.0.insert, double %retval.sroa.23.0.copyload, 1
ret { i32, double } %.fca.1.insert
}
; Function Attrs: nounwind uwtable
define dso_local noalias ptr @Dijkstra(ptr nocapture noundef readonly %g, i32 noundef %s) local_unnamed_addr #10 {
entry:
%tmp.i84.i = alloca %struct.pair, align 8
%tmp.i.i = alloca %struct.pair, align 8
%0 = load i32, ptr %g, align 8, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #16
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 4
br i1 %min.iters.check, label %for.body.preheader85, label %vector.ph
vector.ph: ; preds = %for.body.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 ]
%1 = getelementptr inbounds double, ptr %call, i64 %index
store <2 x double> <double 1.000000e+18, double 1.000000e+18>, ptr %1, align 8, !tbaa !35
%2 = getelementptr inbounds double, ptr %1, i64 2
store <2 x double> <double 1.000000e+18, double 1.000000e+18>, ptr %2, align 8, !tbaa !35
%index.next = add nuw i64 %index, 4
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !49
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader85
for.body.preheader85: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader85, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader85 ]
%arrayidx = getelementptr inbounds double, ptr %call, i64 %indvars.iv
store double 1.000000e+18, ptr %arrayidx, align 8, !tbaa !35
%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 !52
for.end: ; preds = %for.body, %middle.block, %entry
%call.i = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
store i32 0, ptr %call.i, align 8, !tbaa !5
%root.i = getelementptr inbounds %struct.heap, ptr %call.i, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %root.i, i8 0, i64 16, i1 false)
tail call void @add_data_heap(i32 %s, double 0.000000e+00, ptr noundef nonnull %call.i)
%4 = load i32, ptr %call.i, align 8, !tbaa !5
%cmp576 = icmp sgt i32 %4, 0
br i1 %cmp576, label %if.end.i.lr.ph, label %while.end
if.end.i.lr.ph: ; preds = %for.end
%last.i = getelementptr inbounds %struct.heap, ptr %call.i, i64 0, i32 2
%v = getelementptr inbounds %struct.graph, ptr %g, i64 0, i32 2
br label %if.end.i
if.end.i: ; preds = %if.end.i.lr.ph, %if.end
%5 = phi i32 [ %4, %if.end.i.lr.ph ], [ %50, %if.end ]
%6 = load ptr, ptr %root.i, align 8, !tbaa !11
%retval.sroa.0.0.copyload.i = load i32, ptr %6, align 8, !tbaa.struct !42
%retval.sroa.237.0.val.sroa_idx.i = getelementptr inbounds i8, ptr %6, i64 8
%retval.sroa.237.0.copyload.i = load double, ptr %retval.sroa.237.0.val.sroa_idx.i, align 8, !tbaa.struct !44
%7 = load ptr, ptr %last.i, align 8, !tbaa !12
%cmp3.i = icmp eq i32 %5, 1
br i1 %cmp3.i, label %if.then4.i, label %if.else.i
if.then4.i: ; preds = %if.end.i
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %root.i, i8 0, i64 16, i1 false)
br label %take_min_heap.exit
if.else.i: ; preds = %if.end.i
%prev.i = getelementptr inbounds %struct.heap_node_sub, ptr %7, i64 0, i32 2
%8 = load ptr, ptr %prev.i, align 8, !tbaa !45
%next.i = getelementptr inbounds %struct.heap_node_sub, ptr %8, i64 0, i32 3
store ptr null, ptr %next.i, align 8, !tbaa !47
%parent.i = getelementptr inbounds %struct.heap_node_sub, ptr %7, i64 0, i32 1
%9 = load ptr, ptr %parent.i, align 8, !tbaa !39
%right.i = getelementptr inbounds %struct.heap_node_sub, ptr %9, i64 0, i32 5
%10 = load ptr, ptr %right.i, align 8, !tbaa !48
%cmp7.i = icmp eq ptr %10, null
%left.i = getelementptr inbounds %struct.heap_node_sub, ptr %9, i64 0, i32 4
%right.sink.i = select i1 %cmp7.i, ptr %left.i, ptr %right.i
store ptr null, ptr %right.sink.i, align 8, !tbaa !13
store ptr %8, ptr %last.i, align 8, !tbaa !12
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %7, i64 16, i1 false), !tbaa.struct !42
tail call void @down_heappify(ptr noundef nonnull %6, ptr noundef nonnull %call.i)
br label %take_min_heap.exit
take_min_heap.exit: ; preds = %if.then4.i, %if.else.i
tail call void @free(ptr noundef %7) #17
%dec.i = add nsw i32 %5, -1
store i32 %dec.i, ptr %call.i, align 8, !tbaa !5
%11 = load ptr, ptr %v, align 8, !tbaa !12
%idxprom9 = sext i32 %retval.sroa.0.0.copyload.i to i64
%arrayidx10 = getelementptr inbounds ptr, ptr %11, i64 %idxprom9
%12 = load ptr, ptr %arrayidx10, align 8, !tbaa !13
%13 = load i32, ptr %12, align 8, !tbaa !16
%idxprom12 = sext i32 %13 to i64
%arrayidx13 = getelementptr inbounds double, ptr %call, i64 %idxprom12
%14 = load double, ptr %arrayidx13, align 8, !tbaa !35
%cmp14 = fcmp olt double %retval.sroa.237.0.copyload.i, %14
br i1 %cmp14, label %if.then, label %if.end
if.then: ; preds = %take_min_heap.exit
store double %retval.sroa.237.0.copyload.i, ptr %arrayidx13, align 8, !tbaa !35
%next_num = getelementptr inbounds %struct.graph_v_sub, ptr %12, i64 0, i32 2
%15 = load i32, ptr %next_num, align 8, !tbaa !19
%cmp2174 = icmp sgt i32 %15, 0
br i1 %cmp2174, label %for.body23.lr.ph, label %if.end
for.body23.lr.ph: ; preds = %if.then
%next = getelementptr inbounds %struct.graph_v_sub, ptr %12, i64 0, i32 3
%next_weight = getelementptr inbounds %struct.graph_v_sub, ptr %12, i64 0, i32 4
br label %for.body23
for.body23: ; preds = %for.body23.lr.ph, %add_data_heap.exit
%16 = phi i32 [ %dec.i, %for.body23.lr.ph ], [ %inc.i, %add_data_heap.exit ]
%indvars.iv79 = phi i64 [ 0, %for.body23.lr.ph ], [ %indvars.iv.next80, %add_data_heap.exit ]
%17 = load ptr, ptr %next, align 8, !tbaa !30
%arrayidx25 = getelementptr inbounds ptr, ptr %17, i64 %indvars.iv79
%18 = load ptr, ptr %arrayidx25, align 8, !tbaa !13
%19 = load i32, ptr %18, align 8, !tbaa !16
%20 = load i32, ptr %12, align 8, !tbaa !16
%idxprom29 = sext i32 %20 to i64
%arrayidx30 = getelementptr inbounds double, ptr %call, i64 %idxprom29
%21 = load double, ptr %arrayidx30, align 8, !tbaa !35
%22 = load ptr, ptr %next_weight, align 8, !tbaa !31
%arrayidx32 = getelementptr inbounds double, ptr %22, i64 %indvars.iv79
%23 = load double, ptr %arrayidx32, align 8, !tbaa !35
%add = fadd double %21, %23
%call.i64 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #16
store i32 %19, ptr %call.i64, align 8, !tbaa.struct !42
%val.sroa.283.0.val1.sroa_idx.i = getelementptr inbounds i8, ptr %call.i64, i64 8
store double %add, ptr %val.sroa.283.0.val1.sroa_idx.i, align 8, !tbaa.struct !44
%next.i65 = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 3
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %next.i65, i8 0, i64 24, i1 false)
switch i32 %16, label %if.else15.i [
i32 0, label %if.then.i66
i32 1, label %if.then5.i
]
if.then.i66: ; preds = %for.body23
%parent.i67 = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 1
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %parent.i67, i8 0, i64 16, i1 false)
store ptr %call.i64, ptr %root.i, align 8, !tbaa !11
store ptr %call.i64, ptr %last.i, align 8, !tbaa !12
br label %add_data_heap.exit
if.then5.i: ; preds = %for.body23
%24 = load ptr, ptr %root.i, align 8, !tbaa !11
%parent7.i = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 1
store ptr %24, ptr %parent7.i, align 8, !tbaa !39
%prev9.i = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 2
store ptr %24, ptr %prev9.i, align 8, !tbaa !45
%left11.i = getelementptr inbounds %struct.heap_node_sub, ptr %24, i64 0, i32 4
store ptr %call.i64, ptr %left11.i, align 8, !tbaa !46
%next13.i = getelementptr inbounds %struct.heap_node_sub, ptr %24, i64 0, i32 3
store ptr %call.i64, ptr %next13.i, align 8, !tbaa !47
store ptr %call.i64, ptr %last.i, align 8, !tbaa !12
br label %if.then.i.i
if.then.i.i: ; preds = %if.then4.i.i, %if.then5.i
%25 = phi ptr [ %31, %if.then4.i.i ], [ %24, %if.then5.i ]
%parent23.i.i = phi ptr [ %parent.i.i, %if.then4.i.i ], [ %parent7.i, %if.then5.i ]
%n.tr22.i.i = phi ptr [ %30, %if.then4.i.i ], [ %call.i64, %if.then5.i ]
%26 = getelementptr inbounds { i32, double }, ptr %n.tr22.i.i, i64 0, i32 1
%27 = load double, ptr %26, align 8
%28 = getelementptr inbounds { i32, double }, ptr %25, i64 0, i32 1
%29 = load double, ptr %28, align 8
%cmp.i.i.i = fcmp olt double %27, %29
br i1 %cmp.i.i.i, label %if.then4.i.i, label %add_data_heap.exit
if.then4.i.i: ; preds = %if.then.i.i
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp.i.i)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %tmp.i.i, ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i.i, i64 16, i1 false), !tbaa.struct !42
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i.i, ptr noundef nonnull align 8 dereferenceable(16) %25, i64 16, i1 false), !tbaa.struct !42
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(16) %tmp.i.i, i64 16, i1 false), !tbaa.struct !42
%30 = load ptr, ptr %parent23.i.i, align 8, !tbaa !39
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp.i.i)
%parent.i.i = getelementptr inbounds %struct.heap_node_sub, ptr %30, i64 0, i32 1
%31 = load ptr, ptr %parent.i.i, align 8, !tbaa !39
%cmp.not.i.i = icmp eq ptr %31, null
br i1 %cmp.not.i.i, label %add_data_heap.exit, label %if.then.i.i
if.else15.i: ; preds = %for.body23
%32 = load ptr, ptr %last.i, align 8, !tbaa !12
%prev17.i = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 2
store ptr %32, ptr %prev17.i, align 8, !tbaa !45
%next19.i = getelementptr inbounds %struct.heap_node_sub, ptr %32, i64 0, i32 3
store ptr %call.i64, ptr %next19.i, align 8, !tbaa !47
%parent21.i = getelementptr inbounds %struct.heap_node_sub, ptr %32, i64 0, i32 1
%33 = load ptr, ptr %parent21.i, align 8, !tbaa !39
%right22.i = getelementptr inbounds %struct.heap_node_sub, ptr %33, i64 0, i32 5
%34 = load ptr, ptr %right22.i, align 8, !tbaa !48
%cmp23.i = icmp eq ptr %34, null
br i1 %cmp23.i, label %if.end.thread.i, label %if.end.i70
if.end.thread.i: ; preds = %if.else15.i
%parent27.i = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 1
store ptr %33, ptr %parent27.i, align 8, !tbaa !39
%35 = load ptr, ptr %parent21.i, align 8, !tbaa !39
%right30.i = getelementptr inbounds %struct.heap_node_sub, ptr %35, i64 0, i32 5
store ptr %call.i64, ptr %right30.i, align 8, !tbaa !48
store ptr %call.i64, ptr %last.i, align 8, !tbaa !12
br label %if.then.i87.preheader.i
if.end.i70: ; preds = %if.else15.i
%next34.i = getelementptr inbounds %struct.heap_node_sub, ptr %33, i64 0, i32 3
%36 = load ptr, ptr %next34.i, align 8, !tbaa !47
%parent35.i = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 1
store ptr %36, ptr %parent35.i, align 8, !tbaa !39
%37 = load ptr, ptr %parent21.i, align 8, !tbaa !39
%next38.i = getelementptr inbounds %struct.heap_node_sub, ptr %37, i64 0, i32 3
%38 = load ptr, ptr %next38.i, align 8, !tbaa !47
%left39.i = getelementptr inbounds %struct.heap_node_sub, ptr %38, i64 0, i32 4
store ptr %call.i64, ptr %left39.i, align 8, !tbaa !46
store ptr %call.i64, ptr %last.i, align 8, !tbaa !12
%cmp.not21.i86.i = icmp eq ptr %36, null
br i1 %cmp.not21.i86.i, label %add_data_heap.exit, label %if.then.i87.preheader.i
if.then.i87.preheader.i: ; preds = %if.end.i70, %if.end.thread.i
%39 = phi ptr [ %33, %if.end.thread.i ], [ %36, %if.end.i70 ]
%parent20.i85.i = getelementptr inbounds %struct.heap_node_sub, ptr %call.i64, i64 0, i32 1
br label %if.then.i87.i
if.then.i87.i: ; preds = %if.then4.i91.i, %if.then.i87.preheader.i
%40 = phi ptr [ %46, %if.then4.i91.i ], [ %39, %if.then.i87.preheader.i ]
%parent23.i88.i = phi ptr [ %parent.i92.i, %if.then4.i91.i ], [ %parent20.i85.i, %if.then.i87.preheader.i ]
%n.tr22.i89.i = phi ptr [ %45, %if.then4.i91.i ], [ %call.i64, %if.then.i87.preheader.i ]
%41 = getelementptr inbounds { i32, double }, ptr %n.tr22.i89.i, i64 0, i32 1
%42 = load double, ptr %41, align 8
%43 = getelementptr inbounds { i32, double }, ptr %40, i64 0, i32 1
%44 = load double, ptr %43, align 8
%cmp.i.i90.i = fcmp olt double %42, %44
br i1 %cmp.i.i90.i, label %if.then4.i91.i, label %add_data_heap.exit.loopexit
if.then4.i91.i: ; preds = %if.then.i87.i
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp.i84.i)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %tmp.i84.i, ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i89.i, i64 16, i1 false), !tbaa.struct !42
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %n.tr22.i89.i, ptr noundef nonnull align 8 dereferenceable(16) %40, i64 16, i1 false), !tbaa.struct !42
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 8 dereferenceable(16) %tmp.i84.i, i64 16, i1 false), !tbaa.struct !42
%45 = load ptr, ptr %parent23.i88.i, align 8, !tbaa !39
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp.i84.i)
%parent.i92.i = getelementptr inbounds %struct.heap_node_sub, ptr %45, i64 0, i32 1
%46 = load ptr, ptr %parent.i92.i, align 8, !tbaa !39
%cmp.not.i93.i = icmp eq ptr %46, null
br i1 %cmp.not.i93.i, label %add_data_heap.exit.loopexit, label %if.then.i87.i
add_data_heap.exit.loopexit: ; preds = %if.then4.i91.i, %if.then.i87.i
%.pre = load i32, ptr %call.i, align 8, !tbaa !5
br label %add_data_heap.exit
add_data_heap.exit: ; preds = %if.then.i.i, %if.then4.i.i, %add_data_heap.exit.loopexit, %if.then.i66, %if.end.i70
%47 = phi i32 [ %.pre, %add_data_heap.exit.loopexit ], [ 0, %if.then.i66 ], [ %16, %if.end.i70 ], [ 1, %if.then4.i.i ], [ 1, %if.then.i.i ]
%inc.i = add nsw i32 %47, 1
store i32 %inc.i, ptr %call.i, align 8, !tbaa !5
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%48 = load i32, ptr %next_num, align 8, !tbaa !19
%49 = sext i32 %48 to i64
%cmp21 = icmp slt i64 %indvars.iv.next80, %49
br i1 %cmp21, label %for.body23, label %if.end, !llvm.loop !53
if.end: ; preds = %add_data_heap.exit, %if.then, %take_min_heap.exit
%50 = phi i32 [ %dec.i, %if.then ], [ %dec.i, %take_min_heap.exit ], [ %inc.i, %add_data_heap.exit ]
%cmp5 = icmp sgt i32 %50, 0
br i1 %cmp5, label %if.end.i, label %while.end, !llvm.loop !54
while.end: ; preds = %if.end, %for.end
ret ptr %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @max(double noundef %a, double noundef %b) local_unnamed_addr #0 {
entry:
%cmp = fcmp oge double %a, %b
%cond = select i1 %cmp, double %a, double %b
ret double %cond
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%N = alloca i32, align 4
%xs = alloca double, align 8
%ys = alloca double, align 8
%xt = alloca double, align 8
%yt = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xs) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %ys) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %xt) #17
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %yt) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %xs, ptr noundef nonnull %ys, ptr noundef nonnull %xt, ptr noundef nonnull %yt)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !43
%add = add nsw i32 %0, 2
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call2 = call noalias ptr @malloc(i64 noundef %mul) #16
%call6 = call noalias ptr @malloc(i64 noundef %mul) #16
%call10 = call noalias ptr @malloc(i64 noundef %mul) #16
%1 = load double, ptr %xs, align 8, !tbaa !35
store double %1, ptr %call2, align 8, !tbaa !35
%2 = load double, ptr %ys, align 8, !tbaa !35
store double %2, ptr %call6, align 8, !tbaa !35
store double 0.000000e+00, ptr %call10, align 8, !tbaa !35
%cmp.not106 = icmp slt i32 %0, 1
br i1 %cmp.not106, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx14 = getelementptr inbounds double, ptr %call2, i64 %indvars.iv
%arrayidx16 = getelementptr inbounds double, ptr %call6, i64 %indvars.iv
%arrayidx18 = getelementptr inbounds double, ptr %call10, i64 %indvars.iv
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx14, ptr noundef nonnull %arrayidx16, ptr noundef nonnull %arrayidx18)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !43
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.end.loopexit, !llvm.loop !55
for.end.loopexit: ; preds = %for.body
%.pre123 = add nsw i32 %3, 2
%.pre124 = sext i32 %.pre123 to i64
%.pre125 = shl nsw i64 %.pre124, 3
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%mul.i.pre-phi = phi i64 [ %.pre125, %for.end.loopexit ], [ %mul, %entry ]
%add29.pre-phi = phi i32 [ %.pre123, %for.end.loopexit ], [ %add, %entry ]
%5 = phi i32 [ %3, %for.end.loopexit ], [ %0, %entry ]
%6 = load double, ptr %xt, align 8, !tbaa !35
%add20 = add nsw i32 %5, 1
%idxprom21 = sext i32 %add20 to i64
%arrayidx22 = getelementptr inbounds double, ptr %call2, i64 %idxprom21
store double %6, ptr %arrayidx22, align 8, !tbaa !35
%7 = load double, ptr %yt, align 8, !tbaa !35
%arrayidx25 = getelementptr inbounds double, ptr %call6, i64 %idxprom21
store double %7, ptr %arrayidx25, align 8, !tbaa !35
%arrayidx28 = getelementptr inbounds double, ptr %call10, i64 %idxprom21
store double 0.000000e+00, ptr %arrayidx28, align 8, !tbaa !35
%call.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
store i32 %add29.pre-phi, ptr %call.i, align 8, !tbaa !5
%call2.i = call noalias ptr @malloc(i64 noundef %mul.i.pre-phi) #16
%v_s.i = getelementptr inbounds %struct.graph, ptr %call.i, i64 0, i32 1
store ptr %call2.i, ptr %v_s.i, align 8, !tbaa !11
%call5.i = call noalias ptr @malloc(i64 noundef %mul.i.pre-phi) #16
%v.i = getelementptr inbounds %struct.graph, ptr %call.i, i64 0, i32 2
store ptr %call5.i, ptr %v.i, align 8, !tbaa !12
%cmp90.i = icmp sgt i32 %5, -2
br i1 %cmp90.i, label %for.body.preheader.i, label %for.end65
for.body.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %add29.pre-phi 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 ]
%call7.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
%arrayidx.i = getelementptr inbounds ptr, ptr %call2.i, i64 %indvars.iv.i
store ptr %call7.i, ptr %arrayidx.i, align 8, !tbaa !13
%8 = trunc i64 %indvars.iv.i to i32
store i32 %8, ptr %call7.i, align 8, !tbaa !14
%next_num.i = getelementptr inbounds %struct.graph_vertex_sub, ptr %call7.i, i64 0, i32 1
%call21.i = call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #16
%arrayidx24.i = getelementptr inbounds ptr, ptr %call5.i, i64 %indvars.iv.i
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %next_num.i, i8 0, i64 16, i1 false)
store ptr %call21.i, ptr %arrayidx24.i, align 8, !tbaa !13
store i32 %8, ptr %call21.i, align 8, !tbaa !16
%val.i = getelementptr inbounds %struct.graph_v_sub, ptr %call21.i, i64 0, i32 1
store i32 0, ptr %val.i, align 4, !tbaa !18
%next_num35.i = getelementptr inbounds %struct.graph_v_sub, ptr %call21.i, i64 0, i32 2
store i32 0, ptr %next_num35.i, align 8, !tbaa !19
%next39.i = getelementptr inbounds %struct.graph_v_sub, ptr %call21.i, i64 0, i32 3
%prev.i = getelementptr inbounds %struct.graph_v_sub, ptr %call21.i, i64 0, i32 6
%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
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %next39.i, i8 0, i64 20, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %prev.i, i8 0, i64 16, i1 false)
br i1 %exitcond.not.i, label %make_graph.exit, label %for.body.i, !llvm.loop !20
make_graph.exit: ; preds = %for.body.i
%cmp33.not112 = icmp slt i32 %5, -1
br i1 %cmp33.not112, label %for.end65, label %for.cond36.preheader
for.cond36.preheader: ; preds = %make_graph.exit, %for.inc63
%9 = phi i32 [ %28, %for.inc63 ], [ %5, %make_graph.exit ]
%indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.inc63 ], [ 0, %make_graph.exit ]
%cmp38.not109 = icmp slt i32 %9, -1
br i1 %cmp38.not109, label %for.inc63, label %for.body40.lr.ph
for.body40.lr.ph: ; preds = %for.cond36.preheader
%arrayidx44 = getelementptr inbounds double, ptr %call2, i64 %indvars.iv120
%arrayidx48 = getelementptr inbounds double, ptr %call6, i64 %indvars.iv120
%arrayidx54 = getelementptr inbounds double, ptr %call10, i64 %indvars.iv120
%arrayidx4.i = getelementptr inbounds ptr, ptr %call2.i, i64 %indvars.iv120
br label %for.body40
for.body40: ; preds = %for.body40.lr.ph, %for.inc60
%10 = phi i32 [ %9, %for.body40.lr.ph ], [ %25, %for.inc60 ]
%11 = phi i32 [ %9, %for.body40.lr.ph ], [ %26, %for.inc60 ]
%indvars.iv117 = phi i64 [ 0, %for.body40.lr.ph ], [ %indvars.iv.next118, %for.inc60 ]
%cmp41.not = icmp eq i64 %indvars.iv120, %indvars.iv117
br i1 %cmp41.not, label %for.inc60, label %if.then
if.then: ; preds = %for.body40
%12 = load double, ptr %arrayidx44, align 8, !tbaa !35
%arrayidx46 = getelementptr inbounds double, ptr %call2, i64 %indvars.iv117
%13 = load double, ptr %arrayidx46, align 8, !tbaa !35
%sub = fsub double %12, %13
%14 = load double, ptr %arrayidx48, align 8, !tbaa !35
%arrayidx50 = getelementptr inbounds double, ptr %call6, i64 %indvars.iv117
%15 = load double, ptr %arrayidx50, align 8, !tbaa !35
%sub51 = fsub double %14, %15
%call52 = call double @hypot(double noundef %sub, double noundef %sub51) #17
%16 = load double, ptr %arrayidx54, align 8, !tbaa !35
%arrayidx56 = getelementptr inbounds double, ptr %call10, i64 %indvars.iv117
%17 = load double, ptr %arrayidx56, align 8, !tbaa !35
%add57 = fadd double %16, %17
%sub58 = fsub double %call52, %add57
%cmp.i = fcmp oge double %sub58, 0.000000e+00
%cond.i = select i1 %cmp.i, double %sub58, double 0.000000e+00
%call.i102 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #16
%arrayidx.i104 = getelementptr inbounds ptr, ptr %call2.i, i64 %indvars.iv117
%18 = load ptr, ptr %arrayidx.i104, align 8, !tbaa !13
store ptr %18, ptr %call.i102, align 8, !tbaa !22
%w1.i = getelementptr inbounds %struct.graph_edge_sub, ptr %call.i102, i64 0, i32 1
store double %cond.i, ptr %w1.i, align 8, !tbaa !25
%19 = load ptr, ptr %arrayidx4.i, align 8, !tbaa !13
%next.i = getelementptr inbounds %struct.graph_vertex_sub, ptr %19, i64 0, i32 2
%20 = load ptr, ptr %next.i, align 8, !tbaa !26
%next5.i = getelementptr inbounds %struct.graph_edge_sub, ptr %call.i102, i64 0, i32 2
store ptr %20, ptr %next5.i, align 8, !tbaa !27
store ptr %call.i102, ptr %next.i, align 8, !tbaa !26
%21 = load ptr, ptr %arrayidx4.i, align 8, !tbaa !13
%next_num.i105 = getelementptr inbounds %struct.graph_vertex_sub, ptr %21, i64 0, i32 1
%22 = load i32, ptr %next_num.i105, align 4, !tbaa !28
%inc.i = add nsw i32 %22, 1
store i32 %inc.i, ptr %next_num.i105, align 4, !tbaa !28
%23 = load ptr, ptr %arrayidx.i104, align 8, !tbaa !13
%prev_num.i = getelementptr inbounds %struct.graph_vertex_sub, ptr %23, i64 0, i32 3
%24 = load i32, ptr %prev_num.i, align 8, !tbaa !29
%inc16.i = add nsw i32 %24, 1
store i32 %inc16.i, ptr %prev_num.i, align 8, !tbaa !29
%.pre = load i32, ptr %N, align 4, !tbaa !43
br label %for.inc60
for.inc60: ; preds = %for.body40, %if.then
%25 = phi i32 [ %10, %for.body40 ], [ %.pre, %if.then ]
%26 = phi i32 [ %11, %for.body40 ], [ %.pre, %if.then ]
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%27 = sext i32 %26 to i64
%cmp38.not = icmp sgt i64 %indvars.iv117, %27
br i1 %cmp38.not, label %for.inc63, label %for.body40, !llvm.loop !56
for.inc63: ; preds = %for.inc60, %for.cond36.preheader
%28 = phi i32 [ %9, %for.cond36.preheader ], [ %25, %for.inc60 ]
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%29 = sext i32 %28 to i64
%cmp33.not = icmp sgt i64 %indvars.iv120, %29
br i1 %cmp33.not, label %for.end65, label %for.cond36.preheader, !llvm.loop !57
for.end65: ; preds = %for.inc63, %for.end, %make_graph.exit
call void @build_graph(ptr noundef nonnull %call.i)
%call66 = call ptr @Dijkstra(ptr noundef nonnull %call.i, i32 noundef 0)
%30 = load i32, ptr %N, align 4, !tbaa !43
%add67 = add nsw i32 %30, 1
%idxprom68 = sext i32 %add67 to i64
%arrayidx69 = getelementptr inbounds double, ptr %call66, i64 %idxprom68
%31 = load double, ptr %arrayidx69, align 8, !tbaa !35
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %31)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %yt) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xt) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %ys) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %xs) #17
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #14
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #15
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { mustprogress 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 #13 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nofree nounwind }
attributes #15 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #16 = { nounwind allocsize(0) }
attributes #17 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 16}
!13 = !{!10, !10, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16}
!16 = !{!17, !7, i64 0}
!17 = !{!"graph_v_sub", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !10, i64 40, !10, i64 48}
!18 = !{!17, !7, i64 4}
!19 = !{!17, !7, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !10, i64 0}
!23 = !{!"graph_edge_sub", !10, i64 0, !24, i64 8, !10, i64 16}
!24 = !{!"double", !8, i64 0}
!25 = !{!23, !24, i64 8}
!26 = !{!15, !10, i64 8}
!27 = !{!23, !10, i64 16}
!28 = !{!15, !7, i64 4}
!29 = !{!15, !7, i64 16}
!30 = !{!17, !10, i64 16}
!31 = !{!17, !10, i64 24}
!32 = !{!17, !10, i64 40}
!33 = !{!17, !10, i64 48}
!34 = distinct !{!34, !21}
!35 = !{!24, !24, i64 0}
!36 = !{!17, !7, i64 32}
!37 = distinct !{!37, !21}
!38 = distinct !{!38, !21}
!39 = !{!40, !10, i64 16}
!40 = !{!"heap_node_sub", !41, i64 0, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!41 = !{!"", !7, i64 0, !24, i64 8}
!42 = !{i64 0, i64 4, !43, i64 8, i64 8, !35}
!43 = !{!7, !7, i64 0}
!44 = !{i64 0, i64 8, !35}
!45 = !{!40, !10, i64 24}
!46 = !{!40, !10, i64 40}
!47 = !{!40, !10, i64 32}
!48 = !{!40, !10, i64 48}
!49 = distinct !{!49, !21, !50, !51}
!50 = !{!"llvm.loop.isvectorized", i32 1}
!51 = !{!"llvm.loop.unroll.runtime.disable"}
!52 = distinct !{!52, !21, !51, !50}
!53 = distinct !{!53, !21}
!54 = distinct !{!54, !21}
!55 = distinct !{!55, !21}
!56 = distinct !{!56, !21}
!57 = distinct !{!57, !21, !58}
!58 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
int main(void){
char str[1024];
int n;
int i,j;
int count = 0;
int tmp = -1;
scanf("%d",&n);
for(i = 0;i < n;i++){
scanf("%s",str);
j = 0;
while(str[j] != '\0'){
if(str[j] == '0'){
if(tmp == 49){
if(count % 5 == 0){
printf(" ");
count = 0;
j++;
tmp = -1;
}
else if(count % 5 == 1){
printf(".");
count = 0;
j++;
tmp = -1;
}
else if(count % 5 == 2){
printf(",");
count = 0;
j++;
tmp = -1;
}
else if(count % 5 == 3){
printf("!");
count = 0;
j++;
tmp = -1;
}
else{
printf("?");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 50){
if(count % 3 == 0){
printf("c");
count = 0;
j++;
tmp = -1;
}
else if(count % 3 == 1){
printf("a");
count = 0;
j++;
tmp = -1;
}
else{
printf("b");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 51){
if(count % 3 == 0){
printf("f");
count = 0;
j++;
tmp = -1;
}
else if(count % 3 == 1){
printf("d");
count = 0;
j++;
tmp = -1;
}
else{
printf("e");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 52){
if(count % 3 == 0){
printf("i");
count = 0;
j++;
tmp = -1;
}
else if(count % 3 == 1){
printf("g");
count = 0;
j++;
tmp = -1;
}
else{
printf("h");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 53){
if(count % 3 == 0){
printf("l");
count = 0;
j++;
tmp = -1;
}
else if(count % 3 == 1){
printf("j");
count = 0;
j++;
tmp = -1;
}
else{
printf("k");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 54){
if(count % 3 == 0){
printf("o");
count = 0;
j++;
tmp = -1;
}
else if(count % 3 == 1){
printf("m");
count = 0;
j++;
tmp = -1;
}
else{
printf("n");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 55){
if(count % 4 == 0){
printf("s");
count = 0;
j++;
tmp = -1;
}
else if(count % 4 == 1){
printf("p");
count = 0;
j++;
tmp = -1;
}
else if(count % 4 == 2){
printf("q");
count = 0;
j++;
tmp = -1;
}
else{
printf("r");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 56){
if(count % 3 == 0){
printf("v");
count = 0;
j++;
tmp = -1;
}
else if(count % 3 == 1){
printf("t");
count = 0;
j++;
tmp = -1;
}
else{
printf("u");
count = 0;
j++;
tmp = -1;
}
}
else if(tmp == 57){
if(count % 4 == 0){
printf("z");
count = 0;
j++;
tmp = -1;
}
else if(count % 4 == 1){
printf("w");
count = 0;
j++;
tmp = -1;
}
else if(count % 4 == 2){
printf("x");
count = 0;
j++;
tmp = -1;
}
else{
printf("y");
count = 0;
j++;
tmp = -1;
}
}
else{
j++;
}
}
else{
tmp = str[j];
count++;
j++;
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111019/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111019/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1024 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %str) #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
%cmp351 = icmp sgt i32 %0, 0
br i1 %cmp351, label %for.body, label %for.end
for.body: ; preds = %entry, %while.end
%tmp.0354 = phi i32 [ %tmp.1, %while.end ], [ -1, %entry ]
%count.0353 = phi i32 [ %count.1, %while.end ], [ 0, %entry ]
%i.0352 = phi i32 [ %inc253, %while.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str)
br label %while.cond
while.cond: ; preds = %if.end251, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end251 ], [ 0, %for.body ]
%count.1 = phi i32 [ %count.2, %if.end251 ], [ %count.0353, %for.body ]
%tmp.1 = phi i32 [ %tmp.2, %if.end251 ], [ %tmp.0354, %for.body ]
%arrayidx = getelementptr inbounds [1024 x i8], ptr %str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
switch i8 %1, label %if.else245 [
i8 0, label %while.end
i8 48, label %if.then
]
if.then: ; preds = %while.cond
switch i32 %tmp.1, label %if.end251 [
i32 49, label %if.then11
i32 50, label %if.then45
i32 51, label %if.then67
i32 52, label %if.then89
i32 53, label %if.then111
i32 54, label %if.then133
i32 55, label %if.then155
i32 56, label %if.then185
i32 57, label %if.then207
]
if.then11: ; preds = %if.then
%rem = srem i32 %count.1, 5
switch i32 %rem, label %if.else36 [
i32 0, label %if.then14
i32 1, label %if.then19
i32 2, label %if.then26
i32 3, label %if.then33
]
if.then14: ; preds = %if.then11
%putchar350 = call i32 @putchar(i32 32)
br label %if.end251
if.then19: ; preds = %if.then11
%putchar349 = call i32 @putchar(i32 46)
br label %if.end251
if.then26: ; preds = %if.then11
%putchar348 = call i32 @putchar(i32 44)
br label %if.end251
if.then33: ; preds = %if.then11
%putchar347 = call i32 @putchar(i32 33)
br label %if.end251
if.else36: ; preds = %if.then11
%putchar346 = call i32 @putchar(i32 63)
br label %if.end251
if.then45: ; preds = %if.then
%rem46 = srem i32 %count.1, 3
switch i32 %rem46, label %if.else59 [
i32 0, label %if.then49
i32 1, label %if.then56
]
if.then49: ; preds = %if.then45
%putchar345 = call i32 @putchar(i32 99)
br label %if.end251
if.then56: ; preds = %if.then45
%putchar344 = call i32 @putchar(i32 97)
br label %if.end251
if.else59: ; preds = %if.then45
%putchar343 = call i32 @putchar(i32 98)
br label %if.end251
if.then67: ; preds = %if.then
%rem68 = srem i32 %count.1, 3
switch i32 %rem68, label %if.else81 [
i32 0, label %if.then71
i32 1, label %if.then78
]
if.then71: ; preds = %if.then67
%putchar342 = call i32 @putchar(i32 102)
br label %if.end251
if.then78: ; preds = %if.then67
%putchar341 = call i32 @putchar(i32 100)
br label %if.end251
if.else81: ; preds = %if.then67
%putchar340 = call i32 @putchar(i32 101)
br label %if.end251
if.then89: ; preds = %if.then
%rem90 = srem i32 %count.1, 3
switch i32 %rem90, label %if.else103 [
i32 0, label %if.then93
i32 1, label %if.then100
]
if.then93: ; preds = %if.then89
%putchar339 = call i32 @putchar(i32 105)
br label %if.end251
if.then100: ; preds = %if.then89
%putchar338 = call i32 @putchar(i32 103)
br label %if.end251
if.else103: ; preds = %if.then89
%putchar337 = call i32 @putchar(i32 104)
br label %if.end251
if.then111: ; preds = %if.then
%rem112 = srem i32 %count.1, 3
switch i32 %rem112, label %if.else125 [
i32 0, label %if.then115
i32 1, label %if.then122
]
if.then115: ; preds = %if.then111
%putchar336 = call i32 @putchar(i32 108)
br label %if.end251
if.then122: ; preds = %if.then111
%putchar335 = call i32 @putchar(i32 106)
br label %if.end251
if.else125: ; preds = %if.then111
%putchar334 = call i32 @putchar(i32 107)
br label %if.end251
if.then133: ; preds = %if.then
%rem134 = srem i32 %count.1, 3
switch i32 %rem134, label %if.else147 [
i32 0, label %if.then137
i32 1, label %if.then144
]
if.then137: ; preds = %if.then133
%putchar333 = call i32 @putchar(i32 111)
br label %if.end251
if.then144: ; preds = %if.then133
%putchar332 = call i32 @putchar(i32 109)
br label %if.end251
if.else147: ; preds = %if.then133
%putchar331 = call i32 @putchar(i32 110)
br label %if.end251
if.then155: ; preds = %if.then
%rem156 = srem i32 %count.1, 4
switch i32 %rem156, label %if.else176 [
i32 0, label %if.then159
i32 1, label %if.then166
i32 2, label %if.then173
]
if.then159: ; preds = %if.then155
%putchar330 = call i32 @putchar(i32 115)
br label %if.end251
if.then166: ; preds = %if.then155
%putchar329 = call i32 @putchar(i32 112)
br label %if.end251
if.then173: ; preds = %if.then155
%putchar328 = call i32 @putchar(i32 113)
br label %if.end251
if.else176: ; preds = %if.then155
%putchar327 = call i32 @putchar(i32 114)
br label %if.end251
if.then185: ; preds = %if.then
%rem186 = srem i32 %count.1, 3
switch i32 %rem186, label %if.else199 [
i32 0, label %if.then189
i32 1, label %if.then196
]
if.then189: ; preds = %if.then185
%putchar326 = call i32 @putchar(i32 118)
br label %if.end251
if.then196: ; preds = %if.then185
%putchar325 = call i32 @putchar(i32 116)
br label %if.end251
if.else199: ; preds = %if.then185
%putchar324 = call i32 @putchar(i32 117)
br label %if.end251
if.then207: ; preds = %if.then
%rem208 = srem i32 %count.1, 4
switch i32 %rem208, label %if.else228 [
i32 0, label %if.then211
i32 1, label %if.then218
i32 2, label %if.then225
]
if.then211: ; preds = %if.then207
%putchar323 = call i32 @putchar(i32 122)
br label %if.end251
if.then218: ; preds = %if.then207
%putchar322 = call i32 @putchar(i32 119)
br label %if.end251
if.then225: ; preds = %if.then207
%putchar321 = call i32 @putchar(i32 120)
br label %if.end251
if.else228: ; preds = %if.then207
%putchar320 = call i32 @putchar(i32 121)
br label %if.end251
if.else245: ; preds = %while.cond
%conv = sext i8 %1 to i32
%inc249 = add nsw i32 %count.1, 1
br label %if.end251
if.end251: ; preds = %if.then, %if.then19, %if.then33, %if.else36, %if.then26, %if.then14, %if.then78, %if.else81, %if.then71, %if.then122, %if.else125, %if.then115, %if.then166, %if.else176, %if.then173, %if.then159, %if.then218, %if.else228, %if.then225, %if.then211, %if.then189, %if.else199, %if.then196, %if.then137, %if.else147, %if.then144, %if.then93, %if.else103, %if.then100, %if.then49, %if.else59, %if.then56, %if.else245
%count.2 = phi i32 [ 0, %if.then14 ], [ 0, %if.then19 ], [ 0, %if.then26 ], [ 0, %if.then33 ], [ 0, %if.else36 ], [ 0, %if.then49 ], [ 0, %if.then56 ], [ 0, %if.else59 ], [ 0, %if.then71 ], [ 0, %if.then78 ], [ 0, %if.else81 ], [ 0, %if.then93 ], [ 0, %if.then100 ], [ 0, %if.else103 ], [ 0, %if.then115 ], [ 0, %if.then122 ], [ 0, %if.else125 ], [ 0, %if.then137 ], [ 0, %if.then144 ], [ 0, %if.else147 ], [ 0, %if.then159 ], [ 0, %if.then166 ], [ 0, %if.then173 ], [ 0, %if.else176 ], [ 0, %if.then189 ], [ 0, %if.then196 ], [ 0, %if.else199 ], [ 0, %if.then211 ], [ 0, %if.then218 ], [ 0, %if.then225 ], [ 0, %if.else228 ], [ %inc249, %if.else245 ], [ %count.1, %if.then ]
%tmp.2 = phi i32 [ -1, %if.then14 ], [ -1, %if.then19 ], [ -1, %if.then26 ], [ -1, %if.then33 ], [ -1, %if.else36 ], [ -1, %if.then49 ], [ -1, %if.then56 ], [ -1, %if.else59 ], [ -1, %if.then71 ], [ -1, %if.then78 ], [ -1, %if.else81 ], [ -1, %if.then93 ], [ -1, %if.then100 ], [ -1, %if.else103 ], [ -1, %if.then115 ], [ -1, %if.then122 ], [ -1, %if.else125 ], [ -1, %if.then137 ], [ -1, %if.then144 ], [ -1, %if.else147 ], [ -1, %if.then159 ], [ -1, %if.then166 ], [ -1, %if.then173 ], [ -1, %if.else176 ], [ -1, %if.then189 ], [ -1, %if.then196 ], [ -1, %if.else199 ], [ -1, %if.then211 ], [ -1, %if.then218 ], [ -1, %if.then225 ], [ -1, %if.else228 ], [ %conv, %if.else245 ], [ %tmp.1, %if.then ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %while.cond, !llvm.loop !10
while.end: ; preds = %while.cond
%putchar = call i32 @putchar(i32 10)
%inc253 = add nuw nsw i32 %i.0352, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc253, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main()
{
int i, A, B, C, K;
scanf("%d %d %d", &A, &B, &C);
scanf("%d", &K);
if (A >= B && A >= C) for (i = 1; i <= K; i++) A *= 2;
else if (B >= A && B >= C) for (i = 1; i <= K; i++) B *= 2;
else for (i = 1; i <= K; i++) C *= 2;
printf("%d\n", A + B + C);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111077/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111077/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %K)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp.not = icmp slt i32 %0, %1
%2 = load i32, ptr %C, align 4
%cmp2.not = icmp slt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp2.not
br i1 %or.cond, label %if.else, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%3 = load i32, ptr %K, align 4, !tbaa !5
%cmp3.not37 = icmp slt i32 %3, 1
br i1 %cmp3.not37, label %if.end23, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%xtraiter = and i32 %3, 7
%4 = icmp ult i32 %3, 8
br i1 %4, label %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %3, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%mul3638 = phi i32 [ %0, %for.body.preheader.new ], [ %mul, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = shl i32 %mul3638, 8
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa, label %for.body, !llvm.loop !9
if.else: ; preds = %entry
%cmp4.not = icmp slt i32 %1, %0
%cmp6.not = icmp slt i32 %1, %2
%or.cond33 = select i1 %cmp4.not, i1 true, i1 %cmp6.not
%5 = load i32, ptr %K, align 4, !tbaa !5
%cmp17.not45 = icmp slt i32 %5, 1
br i1 %or.cond33, label %for.cond16.preheader, label %for.cond8.preheader
for.cond8.preheader: ; preds = %if.else
br i1 %cmp17.not45, label %if.end23, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond8.preheader
%xtraiter51 = and i32 %5, 7
%6 = icmp ult i32 %5, 8
br i1 %6, label %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter55 = and i32 %5, -8
br label %for.body10
for.cond16.preheader: ; preds = %if.else
br i1 %cmp17.not45, label %if.end23, label %for.body18.preheader
for.body18.preheader: ; preds = %for.cond16.preheader
%xtraiter57 = and i32 %5, 7
%7 = icmp ult i32 %5, 8
br i1 %7, label %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa, label %for.body18.preheader.new
for.body18.preheader.new: ; preds = %for.body18.preheader
%unroll_iter61 = and i32 %5, -8
br label %for.body18
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%mul114042 = phi i32 [ %1, %for.body10.preheader.new ], [ %mul11, %for.body10 ]
%niter56 = phi i32 [ 0, %for.body10.preheader.new ], [ %niter56.next.7, %for.body10 ]
%mul11 = shl i32 %mul114042, 8
%niter56.next.7 = add i32 %niter56, 8
%niter56.ncmp.7 = icmp eq i32 %niter56.next.7, %unroll_iter55
br i1 %niter56.ncmp.7, label %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa, label %for.body10, !llvm.loop !11
for.body18: ; preds = %for.body18, %for.body18.preheader.new
%mul194446 = phi i32 [ %2, %for.body18.preheader.new ], [ %mul19, %for.body18 ]
%niter62 = phi i32 [ 0, %for.body18.preheader.new ], [ %niter62.next.7, %for.body18 ]
%mul19 = shl i32 %mul194446, 8
%niter62.next.7 = add i32 %niter62, 8
%niter62.ncmp.7 = icmp eq i32 %niter62.next.7, %unroll_iter61
br i1 %niter62.ncmp.7, label %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa, label %for.body18, !llvm.loop !12
for.cond16.if.end23.loopexit_crit_edge.unr-lcssa: ; preds = %for.body18, %for.body18.preheader
%mul19.lcssa.ph = phi i32 [ undef, %for.body18.preheader ], [ %mul19, %for.body18 ]
%mul194446.unr = phi i32 [ %2, %for.body18.preheader ], [ %mul19, %for.body18 ]
%lcmp.mod59.not = icmp eq i32 %xtraiter57, 0
br i1 %lcmp.mod59.not, label %for.cond16.if.end23.loopexit_crit_edge, label %for.body18.epil
for.body18.epil: ; preds = %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa, %for.body18.epil
%mul194446.epil = phi i32 [ %mul19.epil, %for.body18.epil ], [ %mul194446.unr, %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa ]
%epil.iter58 = phi i32 [ %epil.iter58.next, %for.body18.epil ], [ 0, %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa ]
%mul19.epil = shl nsw i32 %mul194446.epil, 1
%epil.iter58.next = add i32 %epil.iter58, 1
%epil.iter58.cmp.not = icmp eq i32 %epil.iter58.next, %xtraiter57
br i1 %epil.iter58.cmp.not, label %for.cond16.if.end23.loopexit_crit_edge, label %for.body18.epil, !llvm.loop !13
for.cond16.if.end23.loopexit_crit_edge: ; preds = %for.body18.epil, %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa
%mul19.lcssa = phi i32 [ %mul19.lcssa.ph, %for.cond16.if.end23.loopexit_crit_edge.unr-lcssa ], [ %mul19.epil, %for.body18.epil ]
store i32 %mul19.lcssa, ptr %C, align 4, !tbaa !5
br label %if.end23
for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%mul11.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %mul11, %for.body10 ]
%mul114042.unr = phi i32 [ %1, %for.body10.preheader ], [ %mul11, %for.body10 ]
%lcmp.mod53.not = icmp eq i32 %xtraiter51, 0
br i1 %lcmp.mod53.not, label %for.cond8.if.end23.loopexit34_crit_edge, label %for.body10.epil
for.body10.epil: ; preds = %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa, %for.body10.epil
%mul114042.epil = phi i32 [ %mul11.epil, %for.body10.epil ], [ %mul114042.unr, %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa ]
%epil.iter52 = phi i32 [ %epil.iter52.next, %for.body10.epil ], [ 0, %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa ]
%mul11.epil = shl nsw i32 %mul114042.epil, 1
%epil.iter52.next = add i32 %epil.iter52, 1
%epil.iter52.cmp.not = icmp eq i32 %epil.iter52.next, %xtraiter51
br i1 %epil.iter52.cmp.not, label %for.cond8.if.end23.loopexit34_crit_edge, label %for.body10.epil, !llvm.loop !15
for.cond8.if.end23.loopexit34_crit_edge: ; preds = %for.body10.epil, %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa
%mul11.lcssa = phi i32 [ %mul11.lcssa.ph, %for.cond8.if.end23.loopexit34_crit_edge.unr-lcssa ], [ %mul11.epil, %for.body10.epil ]
store i32 %mul11.lcssa, ptr %B, align 4, !tbaa !5
br label %if.end23
for.cond.if.end23.loopexit35_crit_edge.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %mul, %for.body ]
%mul3638.unr = phi i32 [ %0, %for.body.preheader ], [ %mul, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.if.end23.loopexit35_crit_edge, label %for.body.epil
for.body.epil: ; preds = %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa, %for.body.epil
%mul3638.epil = phi i32 [ %mul.epil, %for.body.epil ], [ %mul3638.unr, %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa ]
%mul.epil = shl nsw i32 %mul3638.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.if.end23.loopexit35_crit_edge, label %for.body.epil, !llvm.loop !16
for.cond.if.end23.loopexit35_crit_edge: ; preds = %for.body.epil, %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa
%mul.lcssa = phi i32 [ %mul.lcssa.ph, %for.cond.if.end23.loopexit35_crit_edge.unr-lcssa ], [ %mul.epil, %for.body.epil ]
store i32 %mul.lcssa, ptr %A, align 4, !tbaa !5
br label %if.end23
if.end23: ; preds = %for.cond.preheader, %for.cond.if.end23.loopexit35_crit_edge, %for.cond8.preheader, %for.cond8.if.end23.loopexit34_crit_edge, %for.cond16.preheader, %for.cond16.if.end23.loopexit_crit_edge
%8 = phi i32 [ %2, %for.cond.preheader ], [ %2, %for.cond.if.end23.loopexit35_crit_edge ], [ %2, %for.cond8.preheader ], [ %2, %for.cond8.if.end23.loopexit34_crit_edge ], [ %2, %for.cond16.preheader ], [ %mul19.lcssa, %for.cond16.if.end23.loopexit_crit_edge ]
%9 = phi i32 [ %1, %for.cond.preheader ], [ %1, %for.cond.if.end23.loopexit35_crit_edge ], [ %1, %for.cond8.preheader ], [ %mul11.lcssa, %for.cond8.if.end23.loopexit34_crit_edge ], [ %1, %for.cond16.preheader ], [ %1, %for.cond16.if.end23.loopexit_crit_edge ]
%10 = phi i32 [ %0, %for.cond.preheader ], [ %mul.lcssa, %for.cond.if.end23.loopexit35_crit_edge ], [ %0, %for.cond8.preheader ], [ %0, %for.cond8.if.end23.loopexit34_crit_edge ], [ %0, %for.cond16.preheader ], [ %0, %for.cond16.if.end23.loopexit_crit_edge ]
%add = add nsw i32 %9, %10
%add24 = add nsw i32 %add, %8
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add24)
%11 = load ptr, ptr @stdout, align 8, !tbaa !17
%call26 = call i32 @fflush(ptr noundef %11)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
#include <math.h>
int main(void) {
int a, b, c, k;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &k);
if((a > b && a > c)){
a = a*pow(2, k);
} else if (b > c){
b = b*pow(2, k);
} else {
c = c*pow(2, k);
}
printf("%d", a+b+c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111127/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111127/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #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 %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp4 = icmp sgt i32 %0, %2
%or.cond = select i1 %cmp, i1 %cmp4, i1 false
%3 = load i32, ptr %k, align 4, !tbaa !5
%ldexp28 = call double @ldexp(double 1.000000e+00, i32 %3) #4
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%conv = sitofp i32 %0 to double
%mul = fmul double %ldexp28, %conv
%conv7 = fptosi double %mul to i32
store i32 %conv7, ptr %a, align 4, !tbaa !5
br label %if.end22
if.else: ; preds = %entry
%cmp8 = icmp sgt i32 %1, %2
br i1 %cmp8, label %if.then10, label %if.else16
if.then10: ; preds = %if.else
%conv11 = sitofp i32 %1 to double
%mul14 = fmul double %ldexp28, %conv11
%conv15 = fptosi double %mul14 to i32
store i32 %conv15, ptr %b, align 4, !tbaa !5
br label %if.end22
if.else16: ; preds = %if.else
%conv17 = sitofp i32 %2 to double
%mul20 = fmul double %ldexp28, %conv17
%conv21 = fptosi double %mul20 to i32
store i32 %conv21, ptr %c, align 4, !tbaa !5
br label %if.end22
if.end22: ; preds = %if.then10, %if.else16, %if.then
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %5, %4
%6 = load i32, ptr %c, align 4, !tbaa !5
%add23 = add nsw i32 %add, %6
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add23)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int desc(const void *a, const void *b) {
return *(int *)b - *(int *)a;
}
int main() {
int number_k;
int number[3];
scanf("%d %d %d", &number[0], &number[1], &number[2]);
qsort(number, 3, sizeof(int), desc);
scanf("%d", &number_k);
printf("%d\n", (int)pow(2, number_k) * number[0] + number[1] + number[2]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111170/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111170/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @desc(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() local_unnamed_addr #1 {
entry:
%number_k = alloca i32, align 4
%number = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number_k) #6
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %number) #6
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %number, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %number, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
call void @qsort(ptr noundef nonnull %number, i64 noundef 3, i64 noundef 4, ptr noundef nonnull @desc) #6
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %number_k)
%0 = load i32, ptr %number_k, align 4, !tbaa !5
%ldexp = call double @ldexp(double 1.000000e+00, i32 %0) #6
%conv5 = fptosi double %ldexp to i32
%1 = load i32, ptr %number, align 4, !tbaa !5
%mul = mul nsw i32 %1, %conv5
%2 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add = add nsw i32 %mul, %2
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%add9 = add nsw i32 %add, %3
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add9)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %number) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number_k) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #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 = { nofree willreturn }
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"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int max(int x, int y)
{
if (x>=y) return x;
else return y;
}
int main()
{
int a, b, c, k;
scanf("%d%d%d", &a, &b, &c);
scanf("%d", &k);
int maxm = 0;
maxm = max(a, max(b,c));
int tmp = maxm;
for (int i=1; i<=k; i++)
{
maxm *= 2;
}
int ans = a + b + c + maxm - tmp;
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111213/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111213/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%y.x = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %y.x
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%y.x.i = call i32 @llvm.smax.i32(i32 %1, i32 %2)
%y.x.i10 = call i32 @llvm.smax.i32(i32 %0, i32 %y.x.i)
%3 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not11 = icmp slt i32 %3, 1
br i1 %cmp.not11, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %3, 7
%4 = icmp ult i32 %3, 8
br i1 %4, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i32 %3, -8
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %mul, %for.body ]
%maxm.013.unr = phi i32 [ %y.x.i10, %for.body.preheader ], [ %mul, %for.body ]
%lcmp.mod.not = icmp eq i32 %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
%maxm.013.epil = phi i32 [ %mul.epil, %for.body.epil ], [ %maxm.013.unr, %for.cond.cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %maxm.013.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry
%maxm.0.lcssa = phi i32 [ %y.x.i10, %entry ], [ %mul.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
%add = add nsw i32 %1, %0
%add4 = add nsw i32 %add, %2
%add5 = sub i32 %add4, %y.x.i10
%sub = add i32 %add5, %maxm.0.lcssa
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
for.body: ; preds = %for.body, %for.body.preheader.new
%maxm.013 = phi i32 [ %y.x.i10, %for.body.preheader.new ], [ %mul, %for.body ]
%niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = shl i32 %maxm.013, 8
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11
}
; 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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int n[3];
int max() {
if (n[0] >= n[1] && n[0] >= n[2]) return 0;
else if (n[1] >= n[2]) return 1;
else return 2;
}
int main(void) {
int k;
for (int i = 0; i < 3; i++) {
scanf("%d", &n[i]);
}
scanf("%d", &k);
for (int i = 0; i < k; i++) {
n[max()] = 2*n[max()];
}
printf("%d", n[0]+n[1]+n[2]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111257/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111257/source.c"
target datalayout = "e-m:e-p270: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 [3 x i32] zeroinitializer, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @max() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%1 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 1), align 4
%cmp.not = icmp slt i32 %0, %1
%2 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 2), align 4
%cmp1.not = icmp slt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%cmp2.not = icmp slt i32 %1, %2
%. = select i1 %cmp2.not, i32 2, i32 1
%retval.0 = select i1 %or.cond, i32 %., i32 0
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%call.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 1))
%call.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 2))
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp428 = icmp sgt i32 %0, 0
br i1 %cmp428, label %for.body6, label %for.cond.cleanup5
for.cond.cleanup5: ; preds = %for.body6, %entry
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 1), align 4, !tbaa !5
%add = add nsw i32 %2, %1
%3 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 2), align 4, !tbaa !5
%add16 = add nsw i32 %add, %3
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add16)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
for.body6: ; preds = %entry, %for.body6
%i2.029 = phi i32 [ %inc14, %for.body6 ], [ 0, %entry ]
%4 = load i32, ptr @n, align 4, !tbaa !5
%5 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 1), align 4
%cmp.not.i = icmp slt i32 %4, %5
%6 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @n, i64 0, i64 2), align 4
%cmp1.not.i = icmp slt i32 %4, %6
%or.cond.i = select i1 %cmp.not.i, i1 true, i1 %cmp1.not.i
%cmp2.not.i = icmp slt i32 %5, %6
%..i = select i1 %cmp2.not.i, i64 2, i64 1
%idxprom8 = select i1 %or.cond.i, i64 %..i, i64 0
%arrayidx9 = getelementptr inbounds [3 x i32], ptr @n, i64 0, i64 %idxprom8
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%mul = shl nsw i32 %7, 1
store i32 %mul, ptr %arrayidx9, align 4, !tbaa !5
%inc14 = add nuw nsw i32 %i2.029, 1
%exitcond.not = icmp eq i32 %inc14, %0
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b,c;
int a2,b2,c2;
int k;
int i=0;
int max=0;
scanf("%d %d %d",&a,&b,&c);
scanf("%d",&k);
a2=a;
for(i=k;i>0;i--){
a2=a2*2;
}
max=a2+b+c;
b2=b;
for(i=k;i>0;i--){
b2=b2*2;
}
if(max<a+b2+c)max=a+b2+c;
c2=c;
for(i=k;i>0;i--){
c2=c2*2;
}
if(max<a+b+c2)max=a+b+c2;
printf("%d\n",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111307/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111307/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%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
%c = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #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 %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %1, 0
br i1 %cmp43, label %for.body.preheader, label %for.end.thread
for.body.preheader: ; preds = %entry
%xtraiter = and i32 %1, 7
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader, %for.body.prol
%i.045.prol = phi i32 [ %dec.prol, %for.body.prol ], [ %1, %for.body.preheader ]
%a2.044.prol = phi i32 [ %mul.prol, %for.body.prol ], [ %0, %for.body.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ]
%mul.prol = shl nsw i32 %a2.044.prol, 1
%dec.prol = add nsw i32 %i.045.prol, -1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !9
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%i.045.unr = phi i32 [ %1, %for.body.preheader ], [ %dec.prol, %for.body.prol ]
%a2.044.unr = phi i32 [ %0, %for.body.preheader ], [ %mul.prol, %for.body.prol ]
%mul.lcssa.unr = phi i32 [ undef, %for.body.preheader ], [ %mul.prol, %for.body.prol ]
%2 = icmp ult i32 %1, 8
br i1 %2, label %for.end, label %for.body
for.end.thread: ; preds = %entry
%3 = load i32, ptr %b, align 4, !tbaa !5
%4 = load i32, ptr %c, align 4, !tbaa !5
br label %for.end21
for.body: ; preds = %for.body.prol.loopexit, %for.body
%i.045 = phi i32 [ %dec.7, %for.body ], [ %i.045.unr, %for.body.prol.loopexit ]
%a2.044 = phi i32 [ %mul, %for.body ], [ %a2.044.unr, %for.body.prol.loopexit ]
%mul = shl i32 %a2.044, 8
%dec.7 = add nsw i32 %i.045, -8
%5 = add i32 %i.045, -9
%cmp.7 = icmp ult i32 %5, -2
br i1 %cmp.7, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %for.body.prol.loopexit
%mul.lcssa = phi i32 [ %mul.lcssa.unr, %for.body.prol.loopexit ], [ %mul, %for.body ]
%6 = load i32, ptr %b, align 4, !tbaa !5
%7 = load i32, ptr %c, align 4, !tbaa !5
br i1 %cmp43, label %for.body5.preheader, label %for.end21
for.body5.preheader: ; preds = %for.end
%xtraiter61 = and i32 %1, 7
%lcmp.mod62.not = icmp eq i32 %xtraiter61, 0
br i1 %lcmp.mod62.not, label %for.body5.prol.loopexit, label %for.body5.prol
for.body5.prol: ; preds = %for.body5.preheader, %for.body5.prol
%i.148.prol = phi i32 [ %dec8.prol, %for.body5.prol ], [ %1, %for.body5.preheader ]
%b2.047.prol = phi i32 [ %mul6.prol, %for.body5.prol ], [ %6, %for.body5.preheader ]
%prol.iter63 = phi i32 [ %prol.iter63.next, %for.body5.prol ], [ 0, %for.body5.preheader ]
%mul6.prol = shl nsw i32 %b2.047.prol, 1
%dec8.prol = add nsw i32 %i.148.prol, -1
%prol.iter63.next = add i32 %prol.iter63, 1
%prol.iter63.cmp.not = icmp eq i32 %prol.iter63.next, %xtraiter61
br i1 %prol.iter63.cmp.not, label %for.body5.prol.loopexit, label %for.body5.prol, !llvm.loop !13
for.body5.prol.loopexit: ; preds = %for.body5.prol, %for.body5.preheader
%i.148.unr = phi i32 [ %1, %for.body5.preheader ], [ %dec8.prol, %for.body5.prol ]
%b2.047.unr = phi i32 [ %6, %for.body5.preheader ], [ %mul6.prol, %for.body5.prol ]
%mul6.lcssa.unr = phi i32 [ undef, %for.body5.preheader ], [ %mul6.prol, %for.body5.prol ]
%8 = icmp ult i32 %1, 8
br i1 %8, label %for.cond15.preheader, label %for.body5
for.cond15.preheader: ; preds = %for.body5, %for.body5.prol.loopexit
%mul6.lcssa = phi i32 [ %mul6.lcssa.unr, %for.body5.prol.loopexit ], [ %mul6, %for.body5 ]
br i1 %cmp43, label %for.body17.preheader, label %for.end21
for.body17.preheader: ; preds = %for.cond15.preheader
%xtraiter64 = and i32 %1, 7
%lcmp.mod65.not = icmp eq i32 %xtraiter64, 0
br i1 %lcmp.mod65.not, label %for.body17.prol.loopexit, label %for.body17.prol
for.body17.prol: ; preds = %for.body17.preheader, %for.body17.prol
%i.252.prol = phi i32 [ %dec20.prol, %for.body17.prol ], [ %1, %for.body17.preheader ]
%c2.051.prol = phi i32 [ %mul18.prol, %for.body17.prol ], [ %7, %for.body17.preheader ]
%prol.iter66 = phi i32 [ %prol.iter66.next, %for.body17.prol ], [ 0, %for.body17.preheader ]
%mul18.prol = shl nsw i32 %c2.051.prol, 1
%dec20.prol = add nsw i32 %i.252.prol, -1
%prol.iter66.next = add i32 %prol.iter66, 1
%prol.iter66.cmp.not = icmp eq i32 %prol.iter66.next, %xtraiter64
br i1 %prol.iter66.cmp.not, label %for.body17.prol.loopexit, label %for.body17.prol, !llvm.loop !14
for.body17.prol.loopexit: ; preds = %for.body17.prol, %for.body17.preheader
%i.252.unr = phi i32 [ %1, %for.body17.preheader ], [ %dec20.prol, %for.body17.prol ]
%c2.051.unr = phi i32 [ %7, %for.body17.preheader ], [ %mul18.prol, %for.body17.prol ]
%mul18.lcssa.unr = phi i32 [ undef, %for.body17.preheader ], [ %mul18.prol, %for.body17.prol ]
%9 = icmp ult i32 %1, 8
br i1 %9, label %for.end21, label %for.body17
for.body5: ; preds = %for.body5.prol.loopexit, %for.body5
%i.148 = phi i32 [ %dec8.7, %for.body5 ], [ %i.148.unr, %for.body5.prol.loopexit ]
%b2.047 = phi i32 [ %mul6, %for.body5 ], [ %b2.047.unr, %for.body5.prol.loopexit ]
%mul6 = shl i32 %b2.047, 8
%dec8.7 = add nsw i32 %i.148, -8
%10 = add i32 %i.148, -9
%cmp4.7 = icmp ult i32 %10, -2
br i1 %cmp4.7, label %for.body5, label %for.cond15.preheader, !llvm.loop !15
for.body17: ; preds = %for.body17.prol.loopexit, %for.body17
%i.252 = phi i32 [ %dec20.7, %for.body17 ], [ %i.252.unr, %for.body17.prol.loopexit ]
%c2.051 = phi i32 [ %mul18, %for.body17 ], [ %c2.051.unr, %for.body17.prol.loopexit ]
%mul18 = shl i32 %c2.051, 8
%dec20.7 = add nsw i32 %i.252, -8
%11 = add i32 %i.252, -9
%cmp16.7 = icmp ult i32 %11, -2
br i1 %cmp16.7, label %for.body17, label %for.end21, !llvm.loop !16
for.end21: ; preds = %for.body17.prol.loopexit, %for.body17, %for.end, %for.end.thread, %for.cond15.preheader
%b2.0.lcssa60 = phi i32 [ %mul6.lcssa, %for.cond15.preheader ], [ %3, %for.end.thread ], [ %6, %for.end ], [ %mul6.lcssa, %for.body17 ], [ %mul6.lcssa, %for.body17.prol.loopexit ]
%a2.0.lcssa5559 = phi i32 [ %mul.lcssa, %for.cond15.preheader ], [ %0, %for.end.thread ], [ %mul.lcssa, %for.end ], [ %mul.lcssa, %for.body17 ], [ %mul.lcssa, %for.body17.prol.loopexit ]
%12 = phi i32 [ %6, %for.cond15.preheader ], [ %3, %for.end.thread ], [ %6, %for.end ], [ %6, %for.body17 ], [ %6, %for.body17.prol.loopexit ]
%13 = phi i32 [ %7, %for.cond15.preheader ], [ %4, %for.end.thread ], [ %7, %for.end ], [ %7, %for.body17 ], [ %7, %for.body17.prol.loopexit ]
%c2.0.lcssa = phi i32 [ %7, %for.cond15.preheader ], [ %4, %for.end.thread ], [ %7, %for.end ], [ %mul18.lcssa.unr, %for.body17.prol.loopexit ], [ %mul18, %for.body17 ]
%add10 = add i32 %13, %0
%add11 = add i32 %add10, %b2.0.lcssa60
%add = add nsw i32 %12, %a2.0.lcssa5559
%add2 = add nsw i32 %add, %13
%spec.select = call i32 @llvm.smax.i32(i32 %add2, i32 %add11)
%add22 = add nsw i32 %12, %0
%add23 = add nsw i32 %add22, %c2.0.lcssa
%spec.select42 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %add23)
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select42)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
|
#include <stdio.h>
int main() {
int a,b,n,m,in,inmax,flag,i;
scanf("%d",&n);
scanf("%d",&m);
in = m;
inmax = m;
flag = 0;
for(i=0;i<n;i++) {
scanf("%d %d",&a,&b);
in = in + a - b;
if(in > inmax ) inmax = in;
if(in < 0) flag = 1;
}
if(flag == 0) printf("%d\n",inmax);
else printf("0\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111350/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111350/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %1, 0
br i1 %cmp17, label %for.body, label %if.then8
for.body: ; preds = %entry, %for.body
%i.021 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%flag.020 = phi i32 [ %flag.1, %for.body ], [ 0, %entry ]
%inmax.019 = phi i32 [ %spec.select, %for.body ], [ %0, %entry ]
%in.018 = phi i32 [ %sub, %for.body ], [ %0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %2, %in.018
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub i32 %add, %3
%spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 %inmax.019)
%cmp4 = icmp slt i32 %sub, 0
%flag.1 = select i1 %cmp4, i32 1, i32 %flag.020
%inc = add nuw nsw i32 %i.021, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%5 = icmp eq i32 %flag.1, 0
br i1 %5, label %if.then8, label %if.else
if.then8: ; preds = %entry, %for.end
%inmax.0.lcssa25 = phi i32 [ %spec.select, %for.end ], [ %0, %entry ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %inmax.0.lcssa25)
br label %if.end11
if.else: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end11
if.end11: ; preds = %if.else, %if.then8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define INF 1001001001
typedef long long ll;
int min(int x, int y) {
return x > y ? y : x;
}
int max(int x, int y) {
return x < y ? y : x;
}
int main() {
int h, w, dp[10][10];
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
dp[i][j] = INF;
}
}
scanf("%d%d", &h, &w);
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
scanf("%d", &dp[i][j]);
}
}
for (int k = 0; k < 10; k++) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}
}
}
int num[10] = {0};
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
int a;
scanf("%d", &a);
if (a != -1)
num[a]++;
}
}
ll ans = 0;
for (int i = 0; i < 10; i++) {
ans += (ll)dp[i][1] * num[i];
}
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111394/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111394/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%dp = alloca [10 x [10 x i32]], align 16
%num = alloca [10 x i32], align 16
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %dp) #6
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %dp, align 16, !tbaa !5
%arrayidx6.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 0, i64 4
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.4, align 16, !tbaa !5
%arrayidx6.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 0, i64 8
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.8, align 16, !tbaa !5
%arrayidx6.2.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 1, i64 2
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.2.1, align 16, !tbaa !5
%arrayidx6.6.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 1, i64 6
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.6.1, align 16, !tbaa !5
%arrayidx6.2150 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 2, i64 0
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.2150, align 16, !tbaa !5
%arrayidx6.4.2 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 2, i64 4
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.4.2, align 16, !tbaa !5
%arrayidx6.8.2 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 2, i64 8
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.8.2, align 16, !tbaa !5
%arrayidx6.2.3 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 3, i64 2
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.2.3, align 16, !tbaa !5
%arrayidx6.6.3 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 3, i64 6
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.6.3, align 16, !tbaa !5
%arrayidx6.4152 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 4, i64 0
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.4152, align 16, !tbaa !5
%arrayidx6.4.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 4, i64 4
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.4.4, align 16, !tbaa !5
%arrayidx6.8.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 4, i64 8
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.8.4, align 16, !tbaa !5
%arrayidx6.2.5 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 5, i64 2
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.2.5, align 16, !tbaa !5
%arrayidx6.6.5 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 5, i64 6
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.6.5, align 16, !tbaa !5
%arrayidx6.6154 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 6, i64 0
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.6154, align 16, !tbaa !5
%arrayidx6.4.6 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 6, i64 4
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.4.6, align 16, !tbaa !5
%arrayidx6.8.6 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 6, i64 8
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.8.6, align 16, !tbaa !5
%arrayidx6.2.7 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 7, i64 2
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.2.7, align 16, !tbaa !5
%arrayidx6.6.7 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 7, i64 6
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.6.7, align 16, !tbaa !5
%arrayidx6.8156 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 8, i64 0
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.8156, align 16, !tbaa !5
%arrayidx6.4.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 8, i64 4
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.4.8, align 16, !tbaa !5
%arrayidx6.8.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 8, i64 8
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.8.8, align 16, !tbaa !5
%arrayidx6.2.9 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 9, i64 2
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.2.9, align 16, !tbaa !5
%arrayidx6.6.9 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 9, i64 6
store <4 x i32> <i32 1001001001, i32 1001001001, i32 1001001001, i32 1001001001>, ptr %arrayidx6.6.9, align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %entry, %for.cond16.preheader
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.cond16.preheader ]
%arrayidx23 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 0
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23)
%arrayidx23.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 1
%call24.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.1)
%arrayidx23.2 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 2
%call24.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.2)
%arrayidx23.3 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 3
%call24.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.3)
%arrayidx23.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 4
%call24.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.4)
%arrayidx23.5 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 5
%call24.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.5)
%arrayidx23.6 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 6
%call24.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.6)
%arrayidx23.7 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 7
%call24.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.7)
%arrayidx23.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 8
%call24.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.8)
%arrayidx23.9 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv, i64 9
%call24.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx23.9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 10
br i1 %exitcond.not, label %for.cond36.preheader, label %for.cond16.preheader, !llvm.loop !9
for.cond36.preheader: ; preds = %for.cond16.preheader, %for.cond.cleanup38
%indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.cond.cleanup38 ], [ 0, %for.cond16.preheader ]
%arrayidx56 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 0
%arrayidx56.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 1
%arrayidx56.2 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 2
%arrayidx56.3 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 3
%arrayidx56.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 4
%arrayidx56.5 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 5
%arrayidx56.6 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 6
%arrayidx56.7 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 7
%arrayidx56.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 8
%arrayidx56.9 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv168, i64 9
br label %for.cond41.preheader
for.cond.cleanup33: ; preds = %for.cond.cleanup38
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %num) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %num, i8 0, i64 40, i1 false)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp73142 = icmp sgt i32 %0, 0
%1 = load i32, ptr %w, align 4
%2 = icmp sgt i32 %1, 0
%or.cond = select i1 %cmp73142, i1 %2, i1 false
br i1 %or.cond, label %for.cond77.preheader, label %for.cond93.preheader
for.cond41.preheader: ; preds = %for.cond36.preheader, %for.cond41.preheader
%indvars.iv164 = phi i64 [ 0, %for.cond36.preheader ], [ %indvars.iv.next165, %for.cond41.preheader ]
%arrayidx52 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 %indvars.iv168
%arrayidx48 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 0
%3 = load i32, ptr %arrayidx48, align 8, !tbaa !5
%4 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx56, align 8, !tbaa !5
%add = add nsw i32 %5, %4
%cond.i = call i32 @llvm.smin.i32(i32 %3, i32 %add)
store i32 %cond.i, ptr %arrayidx48, align 8, !tbaa !5
%arrayidx48.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 1
%6 = load i32, ptr %arrayidx48.1, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx56.1, align 4, !tbaa !5
%add.1 = add nsw i32 %8, %7
%cond.i.1 = call i32 @llvm.smin.i32(i32 %6, i32 %add.1)
store i32 %cond.i.1, ptr %arrayidx48.1, align 4, !tbaa !5
%arrayidx48.2 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 2
%9 = load i32, ptr %arrayidx48.2, align 8, !tbaa !5
%10 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx56.2, align 8, !tbaa !5
%add.2 = add nsw i32 %11, %10
%cond.i.2 = call i32 @llvm.smin.i32(i32 %9, i32 %add.2)
store i32 %cond.i.2, ptr %arrayidx48.2, align 8, !tbaa !5
%arrayidx48.3 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 3
%12 = load i32, ptr %arrayidx48.3, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx56.3, align 4, !tbaa !5
%add.3 = add nsw i32 %14, %13
%cond.i.3 = call i32 @llvm.smin.i32(i32 %12, i32 %add.3)
store i32 %cond.i.3, ptr %arrayidx48.3, align 4, !tbaa !5
%arrayidx48.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 4
%15 = load i32, ptr %arrayidx48.4, align 8, !tbaa !5
%16 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%17 = load i32, ptr %arrayidx56.4, align 8, !tbaa !5
%add.4 = add nsw i32 %17, %16
%cond.i.4 = call i32 @llvm.smin.i32(i32 %15, i32 %add.4)
store i32 %cond.i.4, ptr %arrayidx48.4, align 8, !tbaa !5
%arrayidx48.5 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 5
%18 = load i32, ptr %arrayidx48.5, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%20 = load i32, ptr %arrayidx56.5, align 4, !tbaa !5
%add.5 = add nsw i32 %20, %19
%cond.i.5 = call i32 @llvm.smin.i32(i32 %18, i32 %add.5)
store i32 %cond.i.5, ptr %arrayidx48.5, align 4, !tbaa !5
%arrayidx48.6 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 6
%21 = load i32, ptr %arrayidx48.6, align 8, !tbaa !5
%22 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%23 = load i32, ptr %arrayidx56.6, align 8, !tbaa !5
%add.6 = add nsw i32 %23, %22
%cond.i.6 = call i32 @llvm.smin.i32(i32 %21, i32 %add.6)
store i32 %cond.i.6, ptr %arrayidx48.6, align 8, !tbaa !5
%arrayidx48.7 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 7
%24 = load i32, ptr %arrayidx48.7, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%26 = load i32, ptr %arrayidx56.7, align 4, !tbaa !5
%add.7 = add nsw i32 %26, %25
%cond.i.7 = call i32 @llvm.smin.i32(i32 %24, i32 %add.7)
store i32 %cond.i.7, ptr %arrayidx48.7, align 4, !tbaa !5
%arrayidx48.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 8
%27 = load i32, ptr %arrayidx48.8, align 8, !tbaa !5
%28 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%29 = load i32, ptr %arrayidx56.8, align 8, !tbaa !5
%add.8 = add nsw i32 %29, %28
%cond.i.8 = call i32 @llvm.smin.i32(i32 %27, i32 %add.8)
store i32 %cond.i.8, ptr %arrayidx48.8, align 8, !tbaa !5
%arrayidx48.9 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 %indvars.iv164, i64 9
%30 = load i32, ptr %arrayidx48.9, align 4, !tbaa !5
%31 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%32 = load i32, ptr %arrayidx56.9, align 4, !tbaa !5
%add.9 = add nsw i32 %32, %31
%cond.i.9 = call i32 @llvm.smin.i32(i32 %30, i32 %add.9)
store i32 %cond.i.9, ptr %arrayidx48.9, align 4, !tbaa !5
%indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next165, 10
br i1 %exitcond167.not, label %for.cond.cleanup38, label %for.cond41.preheader, !llvm.loop !11
for.cond.cleanup38: ; preds = %for.cond41.preheader
%indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
%exitcond171.not = icmp eq i64 %indvars.iv.next169, 10
br i1 %exitcond171.not, label %for.cond.cleanup33, label %for.cond36.preheader, !llvm.loop !12
for.cond77.preheader: ; preds = %for.cond.cleanup33, %for.cond.cleanup79
%33 = phi i32 [ %55, %for.cond.cleanup79 ], [ %0, %for.cond.cleanup33 ]
%34 = phi i32 [ %56, %for.cond.cleanup79 ], [ %1, %for.cond.cleanup33 ]
%i71.0143 = phi i32 [ %inc90, %for.cond.cleanup79 ], [ 0, %for.cond.cleanup33 ]
%cmp78140 = icmp sgt i32 %34, 0
br i1 %cmp78140, label %for.body80, label %for.cond.cleanup79
for.cond93.preheader.loopexit: ; preds = %for.cond.cleanup79
%.pre176 = load i32, ptr %num, align 16, !tbaa !5
%arrayidx101.1.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 1
%.pre177 = load i32, ptr %arrayidx101.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx101.2.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 2
%.pre178 = load i32, ptr %arrayidx101.2.phi.trans.insert, align 8, !tbaa !5
%arrayidx101.3.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 3
%.pre179 = load i32, ptr %arrayidx101.3.phi.trans.insert, align 4, !tbaa !5
%arrayidx101.4.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 4
%.pre180 = load i32, ptr %arrayidx101.4.phi.trans.insert, align 16, !tbaa !5
%arrayidx101.5.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 5
%.pre181 = load i32, ptr %arrayidx101.5.phi.trans.insert, align 4, !tbaa !5
%arrayidx101.6.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 6
%.pre182 = load i32, ptr %arrayidx101.6.phi.trans.insert, align 8, !tbaa !5
%arrayidx101.7.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 7
%.pre183 = load i32, ptr %arrayidx101.7.phi.trans.insert, align 4, !tbaa !5
%arrayidx101.8.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 8
%.pre184 = load i32, ptr %arrayidx101.8.phi.trans.insert, align 16, !tbaa !5
%arrayidx101.9.phi.trans.insert = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 9
%.pre185 = load i32, ptr %arrayidx101.9.phi.trans.insert, align 4, !tbaa !5
%35 = sext i32 %.pre176 to i64
%36 = sext i32 %.pre177 to i64
%37 = sext i32 %.pre178 to i64
%38 = sext i32 %.pre179 to i64
%39 = sext i32 %.pre180 to i64
%40 = sext i32 %.pre181 to i64
%41 = sext i32 %.pre182 to i64
%42 = sext i32 %.pre183 to i64
%43 = sext i32 %.pre184 to i64
%44 = sext i32 %.pre185 to i64
br label %for.cond93.preheader
for.cond93.preheader: ; preds = %for.cond93.preheader.loopexit, %for.cond.cleanup33
%conv102.9 = phi i64 [ %44, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.8 = phi i64 [ %43, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.7 = phi i64 [ %42, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.6 = phi i64 [ %41, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.5 = phi i64 [ %40, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.4 = phi i64 [ %39, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.3 = phi i64 [ %38, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.2 = phi i64 [ %37, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102.1 = phi i64 [ %36, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%conv102 = phi i64 [ %35, %for.cond93.preheader.loopexit ], [ 0, %for.cond.cleanup33 ]
%arrayidx6.1.9 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 9, i64 1
%arrayidx6.1.8 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 8, i64 1
%arrayidx6.1.7 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 7, i64 1
%arrayidx6.1.6 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 6, i64 1
%arrayidx6.1.5 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 5, i64 1
%arrayidx6.1.4 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 4, i64 1
%arrayidx6.1.3 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 3, i64 1
%arrayidx6.1.2 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 2, i64 1
%arrayidx6.1.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 1, i64 1
%arrayidx6.1 = getelementptr inbounds [10 x [10 x i32]], ptr %dp, i64 0, i64 0, i64 1
%45 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%conv = sext i32 %45 to i64
%mul = mul nsw i64 %conv102, %conv
%46 = load i32, ptr %arrayidx6.1.1, align 4, !tbaa !5
%conv.1 = sext i32 %46 to i64
%mul.1 = mul nsw i64 %conv102.1, %conv.1
%add103.1 = add nsw i64 %mul.1, %mul
%47 = load i32, ptr %arrayidx6.1.2, align 4, !tbaa !5
%conv.2 = sext i32 %47 to i64
%mul.2 = mul nsw i64 %conv102.2, %conv.2
%add103.2 = add nsw i64 %mul.2, %add103.1
%48 = load i32, ptr %arrayidx6.1.3, align 4, !tbaa !5
%conv.3 = sext i32 %48 to i64
%mul.3 = mul nsw i64 %conv102.3, %conv.3
%add103.3 = add nsw i64 %mul.3, %add103.2
%49 = load i32, ptr %arrayidx6.1.4, align 4, !tbaa !5
%conv.4 = sext i32 %49 to i64
%mul.4 = mul nsw i64 %conv102.4, %conv.4
%add103.4 = add nsw i64 %mul.4, %add103.3
%50 = load i32, ptr %arrayidx6.1.5, align 4, !tbaa !5
%conv.5 = sext i32 %50 to i64
%mul.5 = mul nsw i64 %conv102.5, %conv.5
%add103.5 = add nsw i64 %mul.5, %add103.4
%51 = load i32, ptr %arrayidx6.1.6, align 4, !tbaa !5
%conv.6 = sext i32 %51 to i64
%mul.6 = mul nsw i64 %conv102.6, %conv.6
%add103.6 = add nsw i64 %mul.6, %add103.5
%52 = load i32, ptr %arrayidx6.1.7, align 4, !tbaa !5
%conv.7 = sext i32 %52 to i64
%mul.7 = mul nsw i64 %conv102.7, %conv.7
%add103.7 = add nsw i64 %mul.7, %add103.6
%53 = load i32, ptr %arrayidx6.1.8, align 4, !tbaa !5
%conv.8 = sext i32 %53 to i64
%mul.8 = mul nsw i64 %conv102.8, %conv.8
%add103.8 = add nsw i64 %mul.8, %add103.7
%54 = load i32, ptr %arrayidx6.1.9, align 4, !tbaa !5
%conv.9 = sext i32 %54 to i64
%mul.9 = mul nsw i64 %conv102.9, %conv.9
%add103.9 = add nsw i64 %mul.9, %add103.8
%call107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add103.9)
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %num) #6
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %dp) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
ret i32 0
for.cond.cleanup79.loopexit: ; preds = %if.end
%.pre = load i32, ptr %h, align 4, !tbaa !5
br label %for.cond.cleanup79
for.cond.cleanup79: ; preds = %for.cond.cleanup79.loopexit, %for.cond77.preheader
%55 = phi i32 [ %.pre, %for.cond.cleanup79.loopexit ], [ %33, %for.cond77.preheader ]
%56 = phi i32 [ %59, %for.cond.cleanup79.loopexit ], [ %34, %for.cond77.preheader ]
%inc90 = add nuw nsw i32 %i71.0143, 1
%cmp73 = icmp slt i32 %inc90, %55
br i1 %cmp73, label %for.cond77.preheader, label %for.cond93.preheader.loopexit, !llvm.loop !13
for.body80: ; preds = %for.cond77.preheader, %if.end
%j76.0141 = phi i32 [ %inc87, %if.end ], [ 0, %for.cond77.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
%call81 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%57 = load i32, ptr %a, align 4, !tbaa !5
%cmp82.not = icmp eq i32 %57, -1
br i1 %cmp82.not, label %if.end, label %if.then
if.then: ; preds = %for.body80
%idxprom83 = sext i32 %57 to i64
%arrayidx84 = getelementptr inbounds [10 x i32], ptr %num, i64 0, i64 %idxprom83
%58 = load i32, ptr %arrayidx84, align 4, !tbaa !5
%inc85 = add nsw i32 %58, 1
store i32 %inc85, ptr %arrayidx84, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body80
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
%inc87 = add nuw nsw i32 %j76.0141, 1
%59 = load i32, ptr %w, align 4, !tbaa !5
%cmp78 = icmp slt i32 %inc87, %59
br i1 %cmp78, label %for.body80, label %for.cond.cleanup79.loopexit, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(){
int c[10][10],a,h,w,i,j,d[10]={0},k,s=0;
scanf("%d%d",&h,&w);
for(i=0;i<10;i++)
for(j=0;j<10;j++){
scanf("%d",&c[i][j]);
}
for(i=1;i<=h;i++)for(j=1;j<=w;j++){
scanf("%d",&a);
if(a>=0)d[a]++;
}
for(k=0;k<10;k++)
for(i=0;i<10;i++)
for(j=0;j<10;j++)
if(c[i][j]>c[i][k]+c[k][j])c[i][j]=c[i][k]+c[k][j];
for(i=0;i<10;i++){
if(d[i])s+=d[i]*c[i][1];
}
printf("%d",s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%c = alloca [10 x [10 x i32]], align 16
%a = alloca i32, align 4
%h = alloca i32, align 4
%w = alloca i32, align 4
%d = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %d) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %d, i8 0, i64 40, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%arrayidx5.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.1)
%arrayidx5.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.2)
%arrayidx5.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 3
%call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.3)
%arrayidx5.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 4
%call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.4)
%arrayidx5.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 5
%call6.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.5)
%arrayidx5.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 6
%call6.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.6)
%arrayidx5.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 7
%call6.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.7)
%arrayidx5.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 8
%call6.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.8)
%arrayidx5.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv, i64 9
%call6.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5.9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 10
br i1 %exitcond.not, label %for.cond10.preheader, label %for.cond1.preheader, !llvm.loop !5
for.cond10.preheader: ; preds = %for.cond1.preheader
%0 = load i32, ptr %h, align 4, !tbaa !7
%cmp11.not126 = icmp slt i32 %0, 1
%1 = load i32, ptr %w, align 4
%2 = icmp slt i32 %1, 1
%or.cond = select i1 %cmp11.not126, i1 true, i1 %2
br i1 %or.cond, label %for.cond30.preheader.preheader, label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond10.preheader, %for.inc24
%3 = phi i32 [ %8, %for.inc24 ], [ %0, %for.cond10.preheader ]
%4 = phi i32 [ %9, %for.inc24 ], [ %1, %for.cond10.preheader ]
%i.1127 = phi i32 [ %inc25, %for.inc24 ], [ 1, %for.cond10.preheader ]
%cmp14.not124 = icmp slt i32 %4, 1
br i1 %cmp14.not124, label %for.inc24, label %for.body15
for.body15: ; preds = %for.cond13.preheader, %for.inc21
%j.1125 = phi i32 [ %inc22, %for.inc21 ], [ 1, %for.cond13.preheader ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%5 = load i32, ptr %a, align 4, !tbaa !7
%cmp17 = icmp sgt i32 %5, -1
br i1 %cmp17, label %if.then, label %for.inc21
if.then: ; preds = %for.body15
%idxprom18 = zext i32 %5 to i64
%arrayidx19 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 %idxprom18
%6 = load i32, ptr %arrayidx19, align 4, !tbaa !7
%inc20 = add nsw i32 %6, 1
store i32 %inc20, ptr %arrayidx19, align 4, !tbaa !7
br label %for.inc21
for.inc21: ; preds = %for.body15, %if.then
%inc22 = add nuw nsw i32 %j.1125, 1
%7 = load i32, ptr %w, align 4, !tbaa !7
%cmp14.not.not = icmp slt i32 %j.1125, %7
br i1 %cmp14.not.not, label %for.body15, label %for.inc24.loopexit, !llvm.loop !11
for.inc24.loopexit: ; preds = %for.inc21
%.pre = load i32, ptr %h, align 4, !tbaa !7
br label %for.inc24
for.inc24: ; preds = %for.inc24.loopexit, %for.cond13.preheader
%8 = phi i32 [ %.pre, %for.inc24.loopexit ], [ %3, %for.cond13.preheader ]
%9 = phi i32 [ %7, %for.inc24.loopexit ], [ %4, %for.cond13.preheader ]
%inc25 = add nuw nsw i32 %i.1127, 1
%cmp11.not.not = icmp slt i32 %i.1127, %8
br i1 %cmp11.not.not, label %for.cond13.preheader, label %for.cond30.preheader.preheader, !llvm.loop !12
for.cond30.preheader.preheader: ; preds = %for.inc24, %for.cond10.preheader
br label %for.cond30.preheader
for.cond30.preheader: ; preds = %for.cond30.preheader.preheader, %for.inc70
%indvars.iv144 = phi i64 [ %indvars.iv.next145, %for.inc70 ], [ 0, %for.cond30.preheader.preheader ]
%arrayidx47 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 0
%arrayidx47.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 1
%arrayidx47.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 2
%arrayidx47.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 3
%arrayidx47.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 4
%arrayidx47.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 5
%arrayidx47.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 6
%arrayidx47.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 7
%arrayidx47.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 8
%arrayidx47.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv144, i64 9
br label %for.cond33.preheader
for.cond33.preheader: ; preds = %for.cond30.preheader, %for.inc64.9
%indvars.iv140 = phi i64 [ 0, %for.cond30.preheader ], [ %indvars.iv.next141, %for.inc64.9 ]
%arrayidx43 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 %indvars.iv144
%arrayidx39 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 0
%10 = load i32, ptr %arrayidx39, align 8, !tbaa !7
%11 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%12 = load i32, ptr %arrayidx47, align 8, !tbaa !7
%add = add nsw i32 %12, %11
%cmp48 = icmp sgt i32 %10, %add
br i1 %cmp48, label %if.then49, label %for.inc64
if.then49: ; preds = %for.cond33.preheader
store i32 %add, ptr %arrayidx39, align 8, !tbaa !7
%.pre152 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64
for.inc64: ; preds = %for.cond33.preheader, %if.then49
%13 = phi i32 [ %11, %for.cond33.preheader ], [ %.pre152, %if.then49 ]
%arrayidx39.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 1
%14 = load i32, ptr %arrayidx39.1, align 4, !tbaa !7
%15 = load i32, ptr %arrayidx47.1, align 4, !tbaa !7
%add.1 = add nsw i32 %15, %13
%cmp48.1 = icmp sgt i32 %14, %add.1
br i1 %cmp48.1, label %if.then49.1, label %for.inc64.1
if.then49.1: ; preds = %for.inc64
store i32 %add.1, ptr %arrayidx39.1, align 4, !tbaa !7
%.pre153 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.1
for.inc64.1: ; preds = %if.then49.1, %for.inc64
%16 = phi i32 [ %.pre153, %if.then49.1 ], [ %13, %for.inc64 ]
%arrayidx39.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 2
%17 = load i32, ptr %arrayidx39.2, align 8, !tbaa !7
%18 = load i32, ptr %arrayidx47.2, align 8, !tbaa !7
%add.2 = add nsw i32 %18, %16
%cmp48.2 = icmp sgt i32 %17, %add.2
br i1 %cmp48.2, label %if.then49.2, label %for.inc64.2
if.then49.2: ; preds = %for.inc64.1
store i32 %add.2, ptr %arrayidx39.2, align 8, !tbaa !7
%.pre154 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.2
for.inc64.2: ; preds = %if.then49.2, %for.inc64.1
%19 = phi i32 [ %.pre154, %if.then49.2 ], [ %16, %for.inc64.1 ]
%arrayidx39.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 3
%20 = load i32, ptr %arrayidx39.3, align 4, !tbaa !7
%21 = load i32, ptr %arrayidx47.3, align 4, !tbaa !7
%add.3 = add nsw i32 %21, %19
%cmp48.3 = icmp sgt i32 %20, %add.3
br i1 %cmp48.3, label %if.then49.3, label %for.inc64.3
if.then49.3: ; preds = %for.inc64.2
store i32 %add.3, ptr %arrayidx39.3, align 4, !tbaa !7
%.pre155 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.3
for.inc64.3: ; preds = %if.then49.3, %for.inc64.2
%22 = phi i32 [ %.pre155, %if.then49.3 ], [ %19, %for.inc64.2 ]
%arrayidx39.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 4
%23 = load i32, ptr %arrayidx39.4, align 8, !tbaa !7
%24 = load i32, ptr %arrayidx47.4, align 8, !tbaa !7
%add.4 = add nsw i32 %24, %22
%cmp48.4 = icmp sgt i32 %23, %add.4
br i1 %cmp48.4, label %if.then49.4, label %for.inc64.4
if.then49.4: ; preds = %for.inc64.3
store i32 %add.4, ptr %arrayidx39.4, align 8, !tbaa !7
%.pre156 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.4
for.inc64.4: ; preds = %if.then49.4, %for.inc64.3
%25 = phi i32 [ %.pre156, %if.then49.4 ], [ %22, %for.inc64.3 ]
%arrayidx39.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 5
%26 = load i32, ptr %arrayidx39.5, align 4, !tbaa !7
%27 = load i32, ptr %arrayidx47.5, align 4, !tbaa !7
%add.5 = add nsw i32 %27, %25
%cmp48.5 = icmp sgt i32 %26, %add.5
br i1 %cmp48.5, label %if.then49.5, label %for.inc64.5
if.then49.5: ; preds = %for.inc64.4
store i32 %add.5, ptr %arrayidx39.5, align 4, !tbaa !7
%.pre157 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.5
for.inc64.5: ; preds = %if.then49.5, %for.inc64.4
%28 = phi i32 [ %.pre157, %if.then49.5 ], [ %25, %for.inc64.4 ]
%arrayidx39.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 6
%29 = load i32, ptr %arrayidx39.6, align 8, !tbaa !7
%30 = load i32, ptr %arrayidx47.6, align 8, !tbaa !7
%add.6 = add nsw i32 %30, %28
%cmp48.6 = icmp sgt i32 %29, %add.6
br i1 %cmp48.6, label %if.then49.6, label %for.inc64.6
if.then49.6: ; preds = %for.inc64.5
store i32 %add.6, ptr %arrayidx39.6, align 8, !tbaa !7
%.pre158 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.6
for.inc64.6: ; preds = %if.then49.6, %for.inc64.5
%31 = phi i32 [ %.pre158, %if.then49.6 ], [ %28, %for.inc64.5 ]
%arrayidx39.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 7
%32 = load i32, ptr %arrayidx39.7, align 4, !tbaa !7
%33 = load i32, ptr %arrayidx47.7, align 4, !tbaa !7
%add.7 = add nsw i32 %33, %31
%cmp48.7 = icmp sgt i32 %32, %add.7
br i1 %cmp48.7, label %if.then49.7, label %for.inc64.7
if.then49.7: ; preds = %for.inc64.6
store i32 %add.7, ptr %arrayidx39.7, align 4, !tbaa !7
%.pre159 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.7
for.inc64.7: ; preds = %if.then49.7, %for.inc64.6
%34 = phi i32 [ %.pre159, %if.then49.7 ], [ %31, %for.inc64.6 ]
%arrayidx39.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 8
%35 = load i32, ptr %arrayidx39.8, align 8, !tbaa !7
%36 = load i32, ptr %arrayidx47.8, align 8, !tbaa !7
%add.8 = add nsw i32 %36, %34
%cmp48.8 = icmp sgt i32 %35, %add.8
br i1 %cmp48.8, label %if.then49.8, label %for.inc64.8
if.then49.8: ; preds = %for.inc64.7
store i32 %add.8, ptr %arrayidx39.8, align 8, !tbaa !7
%.pre160 = load i32, ptr %arrayidx43, align 4, !tbaa !7
br label %for.inc64.8
for.inc64.8: ; preds = %if.then49.8, %for.inc64.7
%37 = phi i32 [ %.pre160, %if.then49.8 ], [ %34, %for.inc64.7 ]
%arrayidx39.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 %indvars.iv140, i64 9
%38 = load i32, ptr %arrayidx39.9, align 4, !tbaa !7
%39 = load i32, ptr %arrayidx47.9, align 4, !tbaa !7
%add.9 = add nsw i32 %39, %37
%cmp48.9 = icmp sgt i32 %38, %add.9
br i1 %cmp48.9, label %if.then49.9, label %for.inc64.9
if.then49.9: ; preds = %for.inc64.8
store i32 %add.9, ptr %arrayidx39.9, align 4, !tbaa !7
br label %for.inc64.9
for.inc64.9: ; preds = %if.then49.9, %for.inc64.8
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%exitcond143.not = icmp eq i64 %indvars.iv.next141, 10
br i1 %exitcond143.not, label %for.inc70, label %for.cond33.preheader, !llvm.loop !14
for.inc70: ; preds = %for.inc64.9
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%exitcond147.not = icmp eq i64 %indvars.iv.next145, 10
br i1 %exitcond147.not, label %for.body75.preheader, label %for.cond30.preheader, !llvm.loop !15
for.body75.preheader: ; preds = %for.inc70
%40 = load i32, ptr %d, align 16, !tbaa !7
%arrayidx83 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 0, i64 1
%41 = load i32, ptr %arrayidx83, align 4
%.fr = freeze i32 %41
%mul = mul nsw i32 %.fr, %40
%arrayidx77.1 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 1
%42 = load i32, ptr %arrayidx77.1, align 4, !tbaa !7
%arrayidx83.1 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 1, i64 1
%43 = load i32, ptr %arrayidx83.1, align 4
%.fr162 = freeze i32 %43
%mul.1 = mul nsw i32 %.fr162, %42
%s.1.1 = add nsw i32 %mul, %mul.1
%arrayidx77.2 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 2
%44 = load i32, ptr %arrayidx77.2, align 8, !tbaa !7
%arrayidx83.2 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 2, i64 1
%45 = load i32, ptr %arrayidx83.2, align 4
%.fr163 = freeze i32 %45
%mul.2 = mul nsw i32 %.fr163, %44
%s.1.2 = add nsw i32 %s.1.1, %mul.2
%arrayidx77.3 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 3
%46 = load i32, ptr %arrayidx77.3, align 4, !tbaa !7
%arrayidx83.3 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 3, i64 1
%47 = load i32, ptr %arrayidx83.3, align 4
%.fr164 = freeze i32 %47
%mul.3 = mul nsw i32 %.fr164, %46
%s.1.3 = add nsw i32 %s.1.2, %mul.3
%arrayidx77.4 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 4
%48 = load i32, ptr %arrayidx77.4, align 16, !tbaa !7
%arrayidx83.4 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 4, i64 1
%49 = load i32, ptr %arrayidx83.4, align 4
%.fr165 = freeze i32 %49
%mul.4 = mul nsw i32 %.fr165, %48
%s.1.4 = add nsw i32 %s.1.3, %mul.4
%arrayidx77.5 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 5
%50 = load i32, ptr %arrayidx77.5, align 4, !tbaa !7
%arrayidx83.5 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 5, i64 1
%51 = load i32, ptr %arrayidx83.5, align 4
%.fr166 = freeze i32 %51
%mul.5 = mul nsw i32 %.fr166, %50
%s.1.5 = add nsw i32 %s.1.4, %mul.5
%arrayidx77.6 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 6
%52 = load i32, ptr %arrayidx77.6, align 8, !tbaa !7
%arrayidx83.6 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 6, i64 1
%53 = load i32, ptr %arrayidx83.6, align 4
%.fr167 = freeze i32 %53
%mul.6 = mul nsw i32 %.fr167, %52
%s.1.6 = add nsw i32 %s.1.5, %mul.6
%arrayidx77.7 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 7
%54 = load i32, ptr %arrayidx77.7, align 4, !tbaa !7
%arrayidx83.7 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 7, i64 1
%55 = load i32, ptr %arrayidx83.7, align 4
%.fr168 = freeze i32 %55
%mul.7 = mul nsw i32 %.fr168, %54
%s.1.7 = add nsw i32 %s.1.6, %mul.7
%arrayidx77.8 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 8
%56 = load i32, ptr %arrayidx77.8, align 16, !tbaa !7
%arrayidx83.8 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 8, i64 1
%57 = load i32, ptr %arrayidx83.8, align 4
%.fr169 = freeze i32 %57
%mul.8 = mul nsw i32 %.fr169, %56
%s.1.8 = add nsw i32 %s.1.7, %mul.8
%arrayidx77.9 = getelementptr inbounds [10 x i32], ptr %d, i64 0, i64 9
%58 = load i32, ptr %arrayidx77.9, align 4, !tbaa !7
%arrayidx83.9 = getelementptr inbounds [10 x [10 x i32]], ptr %c, i64 0, i64 9, i64 1
%59 = load i32, ptr %arrayidx83.9, align 4
%.fr170 = freeze i32 %59
%mul.9 = mul nsw i32 %.fr170, %58
%s.1.9 = add nsw i32 %s.1.8, %mul.9
%call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.1.9)
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
|
#include <stdio.h>
int main (void){
int L,A,B,C,D,i,koku,suu,ans;
scanf("%d%d%d%d%d",&L,&A,&B,&C,&D);
if(A%C!=0){
koku=A/C+1;
}
else if(A%C==0){
koku=A/C;
}
if(B%D!=0){
suu=B/D+1;
}
else if(B%D==0){
suu=B/D;
}
if(koku>suu){
ans=L-koku;
}
else if(koku<=suu){
ans=L-suu;
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111480/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%L = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%D = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #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 %C) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %C, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp.not = icmp ne i32 %rem, 0
%div4 = sdiv i32 %0, %1
%add = zext i1 %cmp.not to i32
%koku.0 = add nsw i32 %div4, %add
%2 = load i32, ptr %B, align 4, !tbaa !5
%3 = load i32, ptr %D, align 4, !tbaa !5
%rem6 = srem i32 %2, %3
%cmp7.not = icmp ne i32 %rem6, 0
%div15 = sdiv i32 %2, %3
%add10 = zext i1 %cmp7.not to i32
%suu.0 = add nsw i32 %div15, %add10
%4 = load i32, ptr %L, align 4
%ans.0.v = call i32 @llvm.smax.i32(i32 %koku.0, i32 %suu.0)
%ans.0 = sub nsw i32 %4, %ans.0.v
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #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 4, ptr nonnull %L) #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 a, b, c, d, l, x, y;
scanf("%d",&l);
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
x = a / c;
if(( a % c) != 0){
x++;
}
y = b / d;
if(( b % d) != 0){
y++;
}
if( x > y){
l = l - x;
}else{
l = l - y;
}
printf("%d\n",l);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111523/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111523/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%cmp.not = icmp ne i32 %rem, 0
%inc = zext i1 %cmp.not to i32
%spec.select = add nsw i32 %div, %inc
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%div5 = sdiv i32 %2, %3
%rem6 = srem i32 %2, %3
%cmp7.not = icmp ne i32 %rem6, 0
%inc9 = zext i1 %cmp7.not to i32
%y.0 = add nsw i32 %div5, %inc9
%4 = load i32, ptr %l, align 4
%storemerge.v = call i32 @llvm.smax.i32(i32 %spec.select, i32 %y.0)
%storemerge = sub nsw i32 %4, %storemerge.v
store i32 %storemerge, ptr %l, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %storemerge)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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"}
|
/*??????(Homework)*/
#include <stdio.h>
int main(){
int x, y, z, A, B, C, D, L;
scanf("%d %d %d %d %d", &L, &A, &B, &C, &D);
if (A % C == 0) {
x = A / C;
} else {
x = A / C + 1;
}
if (B % D == 0) {
y = B / D;
} else {
y = B / D + 1;
}
if (x >= y){
z = L - x;
} else {
z = L - y;
}
printf("%d\n", z);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111567/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111567/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%D = alloca i32, align 4
%L = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %D)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %C, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %0, %1
%add = zext i1 %cmp to i32
%x.0 = add nsw i32 %div, %add
%2 = load i32, ptr %B, align 4, !tbaa !5
%3 = load i32, ptr %D, align 4, !tbaa !5
%rem2 = srem i32 %2, %3
%cmp3 = icmp ne i32 %rem2, 0
%div5 = sdiv i32 %2, %3
%add8 = zext i1 %cmp3 to i32
%y.0 = add nsw i32 %div5, %add8
%4 = load i32, ptr %L, align 4
%z.0.v = call i32 @llvm.smax.i32(i32 %x.0, i32 %y.0)
%z.0 = sub nsw i32 %4, %z.0.v
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %z.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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(void){
int hi,koku,suu,kokud,suud;
int n=0,m=0;
scanf("%d",&hi);
scanf("%d",&koku);
scanf("%d",&suu);
scanf("%d",&kokud);
scanf("%d",&suud);
while(!(koku<=0)){
koku-=kokud;
n++;
}
while(!(suu<=0)){
suu-=suud;
m++;
}
if(n>=m){
hi-=n;
}
else{
hi-=m;
}
printf("%d\n",hi);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111617/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111617/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%hi = alloca i32, align 4
%koku = alloca i32, align 4
%suu = alloca i32, align 4
%kokud = alloca i32, align 4
%suud = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hi) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %koku) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %suu) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kokud) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %suud) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hi)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %koku)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %suu)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kokud)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %suud)
%.pr = load i32, ptr %koku, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %.pr, 0
br i1 %cmp21, label %while.body.lr.ph, label %while.cond5thread-pre-split
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %kokud, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%n.022 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%sub = sub nsw i32 %1, %0
%inc = add nuw nsw i32 %n.022, 1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.cond5thread-pre-split_crit_edge, !llvm.loop !9
while.cond.while.cond5thread-pre-split_crit_edge: ; preds = %while.body
store i32 %sub, ptr %koku, align 4, !tbaa !5
br label %while.cond5thread-pre-split
while.cond5thread-pre-split: ; preds = %while.cond.while.cond5thread-pre-split_crit_edge, %entry
%n.0.lcssa = phi i32 [ %inc, %while.cond.while.cond5thread-pre-split_crit_edge ], [ 0, %entry ]
%.pr20 = load i32, ptr %suu, align 4, !tbaa !5
%cmp623 = icmp sgt i32 %.pr20, 0
br i1 %cmp623, label %while.body8.lr.ph, label %while.end11
while.body8.lr.ph: ; preds = %while.cond5thread-pre-split
%2 = load i32, ptr %suud, align 4, !tbaa !5
br label %while.body8
while.body8: ; preds = %while.body8.lr.ph, %while.body8
%m.024 = phi i32 [ 0, %while.body8.lr.ph ], [ %inc10, %while.body8 ]
%3 = phi i32 [ %.pr20, %while.body8.lr.ph ], [ %sub9, %while.body8 ]
%sub9 = sub nsw i32 %3, %2
%inc10 = add nuw nsw i32 %m.024, 1
%cmp6 = icmp sgt i32 %sub9, 0
br i1 %cmp6, label %while.body8, label %while.cond5.while.end11_crit_edge, !llvm.loop !11
while.cond5.while.end11_crit_edge: ; preds = %while.body8
store i32 %sub9, ptr %suu, align 4, !tbaa !5
br label %while.end11
while.end11: ; preds = %while.cond5.while.end11_crit_edge, %while.cond5thread-pre-split
%m.0.lcssa = phi i32 [ %inc10, %while.cond5.while.end11_crit_edge ], [ 0, %while.cond5thread-pre-split ]
%4 = load i32, ptr %hi, align 4
%storemerge.v = call i32 @llvm.umax.i32(i32 %n.0.lcssa, i32 %m.0.lcssa)
%storemerge = sub nsw i32 %4, %storemerge.v
store i32 %storemerge, ptr %hi, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %storemerge)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %suud) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kokud) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %suu) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %koku) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hi) #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.umax.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 l,a,b,c,d,s,j;
scanf("%d",&l);
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
if(a%c==0){
s= a / c;
}
else{
s= a / c + 1;
}
if(b%d==0){
j= b / d;
}
else{
j= b / d + 1;
}
if(s<j){
printf("%d\n",l-j);
}
else{
printf("%d\n",l-s);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111660/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111660/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%l = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #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 %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %0, %1
%add = zext i1 %cmp to i32
%s.0 = add nsw i32 %div, %add
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %d, align 4, !tbaa !5
%rem6 = srem i32 %2, %3
%cmp7 = icmp ne i32 %rem6, 0
%div9 = sdiv i32 %2, %3
%add12 = zext i1 %cmp7 to i32
%j.0 = add nsw i32 %div9, %add12
%4 = load i32, ptr %l, align 4, !tbaa !5
%j.0.s.0 = call i32 @llvm.smax.i32(i32 %s.0, i32 %j.0)
%sub18 = sub nsw i32 %4, %j.0.s.0
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub18)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #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 4, ptr nonnull %l) #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>
#define MAX 9
int count_combi(int);
int main(){
int num, count;
while(scanf("%d", &num) != EOF){
count = count_combi(num);
printf("%d\n", count);
}
return 0;
}
int count_combi(int num){
int count = 0;
int i,j,k,l;
// すぐ数えれるシリーズ
// 36より大きい時と36のとき
if(num > 36){
return 0;
// 9,9,9,9
} else if(num == 36){
return 1;
// その他
} else {
for(i=0;i<=MAX;i++){
for(j=0;j<=MAX;j++){
for(k=0;k<=MAX;k++){
for(l=0;l<=MAX;l++){
if((i+j+k+l) == num){
count++;
}
}
}
}
}
}
return count;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111703/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111703/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %count_combi.exit
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp.i = icmp sgt i32 %0, 36
br i1 %cmp.i, label %count_combi.exit, label %if.else.i
if.else.i: ; preds = %while.body
%cmp1.i = icmp eq i32 %0, 36
br i1 %cmp1.i, label %count_combi.exit, label %for.cond5.preheader.i.preheader
for.cond5.preheader.i.preheader: ; preds = %if.else.i
%broadcast.splatinsert5 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat6 = shufflevector <4 x i32> %broadcast.splatinsert5, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond5.preheader.i
for.cond5.preheader.i: ; preds = %for.cond5.preheader.i.preheader, %for.inc25.i
%i.052.i = phi i32 [ %inc26.i, %for.inc25.i ], [ 0, %for.cond5.preheader.i.preheader ]
%count.051.i = phi i32 [ %123, %for.inc25.i ], [ 0, %for.cond5.preheader.i.preheader ]
br label %vector.ph
vector.ph: ; preds = %for.cond5.preheader.i, %vector.ph
%j.050.i = phi i32 [ 0, %for.cond5.preheader.i ], [ %inc23.i, %vector.ph ]
%count.149.i = phi i32 [ %count.051.i, %for.cond5.preheader.i ], [ %123, %vector.ph ]
%add.i = add nuw nsw i32 %j.050.i, %i.052.i
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add.i, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.149.i, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat6
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat6
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat6
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat6
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat6
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat6
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat6
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat6
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat6
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat6
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat6
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat6
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat6
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat6
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat6
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat6
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat6
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat6
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat6
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat6
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat6
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat6
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat6
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat6
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat6
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat6
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat6
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat6
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat6
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat6
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc23.i = add nuw nsw i32 %j.050.i, 1
%exitcond53.not.i = icmp eq i32 %inc23.i, 10
br i1 %exitcond53.not.i, label %for.inc25.i, label %vector.ph, !llvm.loop !9
for.inc25.i: ; preds = %vector.ph
%inc26.i = add nuw nsw i32 %i.052.i, 1
%exitcond54.not.i = icmp eq i32 %inc26.i, 10
br i1 %exitcond54.not.i, label %count_combi.exit, label %for.cond5.preheader.i, !llvm.loop !11
count_combi.exit: ; preds = %for.inc25.i, %while.body, %if.else.i
%retval.0.i = phi i32 [ 0, %while.body ], [ 1, %if.else.i ], [ %123, %for.inc25.i ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %retval.0.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %count_combi.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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(none) uwtable
define dso_local i32 @count_combi(i32 noundef %num) local_unnamed_addr #3 {
entry:
%cmp = icmp sgt i32 %num, 36
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %num, 36
br i1 %cmp1, label %cleanup, label %for.cond5.preheader.preheader
for.cond5.preheader.preheader: ; preds = %if.else
%broadcast.splatinsert55 = insertelement <4 x i32> poison, i32 %num, i64 0
%broadcast.splat56 = shufflevector <4 x i32> %broadcast.splatinsert55, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.inc25
%i.052 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond5.preheader.preheader ]
%count.051 = phi i32 [ %122, %for.inc25 ], [ 0, %for.cond5.preheader.preheader ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond5.preheader
%j.050 = phi i32 [ 0, %for.cond5.preheader ], [ %inc23, %vector.ph ]
%count.149 = phi i32 [ %count.051, %for.cond5.preheader ], [ %122, %vector.ph ]
%add = add nuw nsw i32 %j.050, %i.052
%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
%0 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.149, i64 0
%1 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%2 = icmp eq <4 x i32> %1, %broadcast.splat56
%3 = zext <4 x i1> %2 to <4 x i32>
%4 = add <4 x i32> %0, %3
%5 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%6 = icmp eq <4 x i32> %5, %broadcast.splat56
%7 = zext <4 x i1> %6 to <4 x i32>
%8 = add <4 x i32> %4, %7
%9 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%10 = icmp eq <4 x i32> %9, %broadcast.splat56
%11 = zext <4 x i1> %10 to <4 x i32>
%12 = add <4 x i32> %8, %11
%13 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%14 = icmp eq <4 x i32> %13, %broadcast.splat56
%15 = zext <4 x i1> %14 to <4 x i32>
%16 = add <4 x i32> %12, %15
%17 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%18 = icmp eq <4 x i32> %17, %broadcast.splat56
%19 = zext <4 x i1> %18 to <4 x i32>
%20 = add <4 x i32> %16, %19
%21 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%22 = icmp eq <4 x i32> %21, %broadcast.splat56
%23 = zext <4 x i1> %22 to <4 x i32>
%24 = add <4 x i32> %20, %23
%25 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%26 = icmp eq <4 x i32> %25, %broadcast.splat56
%27 = zext <4 x i1> %26 to <4 x i32>
%28 = add <4 x i32> %24, %27
%29 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%30 = icmp eq <4 x i32> %29, %broadcast.splat56
%31 = zext <4 x i1> %30 to <4 x i32>
%32 = add <4 x i32> %28, %31
%33 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%34 = icmp eq <4 x i32> %33, %broadcast.splat56
%35 = zext <4 x i1> %34 to <4 x i32>
%36 = add <4 x i32> %32, %35
%37 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%38 = icmp eq <4 x i32> %37, %broadcast.splat56
%39 = zext <4 x i1> %38 to <4 x i32>
%40 = add <4 x i32> %36, %39
%41 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%42 = icmp eq <4 x i32> %41, %broadcast.splat56
%43 = zext <4 x i1> %42 to <4 x i32>
%44 = add <4 x i32> %40, %43
%45 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%46 = icmp eq <4 x i32> %45, %broadcast.splat56
%47 = zext <4 x i1> %46 to <4 x i32>
%48 = add <4 x i32> %44, %47
%49 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%50 = icmp eq <4 x i32> %49, %broadcast.splat56
%51 = zext <4 x i1> %50 to <4 x i32>
%52 = add <4 x i32> %48, %51
%53 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%54 = icmp eq <4 x i32> %53, %broadcast.splat56
%55 = zext <4 x i1> %54 to <4 x i32>
%56 = add <4 x i32> %52, %55
%57 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%58 = icmp eq <4 x i32> %57, %broadcast.splat56
%59 = zext <4 x i1> %58 to <4 x i32>
%60 = add <4 x i32> %56, %59
%61 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%62 = icmp eq <4 x i32> %61, %broadcast.splat56
%63 = zext <4 x i1> %62 to <4 x i32>
%64 = add <4 x i32> %60, %63
%65 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%66 = icmp eq <4 x i32> %65, %broadcast.splat56
%67 = zext <4 x i1> %66 to <4 x i32>
%68 = add <4 x i32> %64, %67
%69 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%70 = icmp eq <4 x i32> %69, %broadcast.splat56
%71 = zext <4 x i1> %70 to <4 x i32>
%72 = add <4 x i32> %68, %71
%73 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%74 = icmp eq <4 x i32> %73, %broadcast.splat56
%75 = zext <4 x i1> %74 to <4 x i32>
%76 = add <4 x i32> %72, %75
%77 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%78 = icmp eq <4 x i32> %77, %broadcast.splat56
%79 = zext <4 x i1> %78 to <4 x i32>
%80 = add <4 x i32> %76, %79
%81 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%82 = icmp eq <4 x i32> %81, %broadcast.splat56
%83 = zext <4 x i1> %82 to <4 x i32>
%84 = add <4 x i32> %80, %83
%85 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%86 = icmp eq <4 x i32> %85, %broadcast.splat56
%87 = zext <4 x i1> %86 to <4 x i32>
%88 = add <4 x i32> %84, %87
%89 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%90 = icmp eq <4 x i32> %89, %broadcast.splat56
%91 = zext <4 x i1> %90 to <4 x i32>
%92 = add <4 x i32> %88, %91
%93 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%94 = icmp eq <4 x i32> %93, %broadcast.splat56
%95 = zext <4 x i1> %94 to <4 x i32>
%96 = add <4 x i32> %92, %95
%97 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%98 = icmp eq <4 x i32> %97, %broadcast.splat56
%99 = zext <4 x i1> %98 to <4 x i32>
%100 = add <4 x i32> %96, %99
%101 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%102 = icmp eq <4 x i32> %101, %broadcast.splat56
%103 = zext <4 x i1> %102 to <4 x i32>
%104 = add <4 x i32> %100, %103
%105 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%106 = icmp eq <4 x i32> %105, %broadcast.splat56
%107 = zext <4 x i1> %106 to <4 x i32>
%108 = add <4 x i32> %104, %107
%109 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%110 = icmp eq <4 x i32> %109, %broadcast.splat56
%111 = zext <4 x i1> %110 to <4 x i32>
%112 = add <4 x i32> %108, %111
%113 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%114 = icmp eq <4 x i32> %113, %broadcast.splat56
%115 = zext <4 x i1> %114 to <4 x i32>
%116 = add <4 x i32> %112, %115
%117 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%118 = icmp eq <4 x i32> %117, %broadcast.splat56
%119 = zext <4 x i1> %118 to <4 x i32>
%120 = add <4 x i32> %116, %119
%121 = shufflevector <4 x i32> %120, <4 x i32> %80, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%122 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %121)
%inc23 = add nuw nsw i32 %j.050, 1
%exitcond53.not = icmp eq i32 %inc23, 10
br i1 %exitcond53.not, label %for.inc25, label %vector.ph, !llvm.loop !9
for.inc25: ; preds = %vector.ph
%inc26 = add nuw nsw i32 %i.052, 1
%exitcond54.not = icmp eq i32 %inc26, 10
br i1 %exitcond54.not, label %cleanup, label %for.cond5.preheader, !llvm.loop !11
cleanup: ; preds = %for.inc25, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ %122, %for.inc25 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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}
|
#include<stdio.h>
int main(void)
{
int x, a=0, b=0, c=0, d=0, e=0;
while(scanf("%d", &x)!=EOF)
{
for (a=0;a<=x && a<=9;a++){
for (b=0;a+b<=x && b<=9;b++){
for (c=0;a+b+c<=x && c<=9;c++){
for (d=0;a+b+c+d<=x && d<=9;d++){
if(a+b+c+d==x)e+=1;}}}}
printf("%d\n", e);
e=0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111798/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111798/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not73 = icmp eq i32 %call72, -1
br i1 %cmp.not73, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end39
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp169 = icmp sgt i32 %0, -1
br i1 %cmp169, label %for.cond3.preheader.preheader, label %for.end39
for.cond3.preheader.preheader: ; preds = %for.cond.preheader
%umin = call i32 @llvm.umin.i32(i32 %0, i32 9)
%broadcast.splatinsert78 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat79 = shufflevector <4 x i32> %broadcast.splatinsert78, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.cond3.preheader.preheader, %for.inc37
%e.171 = phi i32 [ %17, %for.inc37 ], [ 0, %for.cond3.preheader.preheader ]
%a.070 = phi i32 [ %inc38, %for.inc37 ], [ 0, %for.cond3.preheader.preheader ]
br label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.cond3.preheader, %for.inc34
%add68 = phi i32 [ %a.070, %for.cond3.preheader ], [ %add, %for.inc34 ]
%e.267 = phi i32 [ %e.171, %for.cond3.preheader ], [ %17, %for.inc34 ]
%b.066 = phi i32 [ 0, %for.cond3.preheader ], [ %inc35, %for.inc34 ]
%1 = add nuw i32 %a.070, %b.066
br label %vector.ph
vector.ph: ; preds = %middle.block, %for.cond9.preheader
%add1165 = phi i32 [ %add68, %for.cond9.preheader ], [ %add11, %middle.block ]
%e.364 = phi i32 [ %e.267, %for.cond9.preheader ], [ %17, %middle.block ]
%c.063 = phi i32 [ 0, %for.cond9.preheader ], [ %inc32, %middle.block ]
%smax = call i32 @llvm.smax.i32(i32 %0, i32 %add1165)
%2 = add i32 %1, %c.063
%3 = sub i32 %smax, %2
%umin74 = call i32 @llvm.umin.i32(i32 %3, i32 9)
%n.rnd.up = add nuw nsw i32 %umin74, 4
%n.vec = and i32 %n.rnd.up, 28
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %umin74, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%.splatinsert = insertelement <4 x i32> poison, i32 %add1165, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
%4 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %e.364, i64 0
%5 = icmp eq <4 x i32> %induction, %broadcast.splat79
%6 = zext <4 x i1> %5 to <4 x i32>
%7 = add <4 x i32> %4, %6
%8 = icmp eq i32 %n.vec, 4
br i1 %8, label %middle.block, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.ph
%vec.ind.next = add <4 x i32> %.splat, <i32 4, i32 5, i32 6, i32 7>
%9 = icmp eq <4 x i32> %vec.ind.next, %broadcast.splat79
%10 = zext <4 x i1> %9 to <4 x i32>
%11 = add <4 x i32> %7, %10
%12 = icmp eq i32 %n.vec, 8
br i1 %12, label %middle.block, label %vector.body.2, !llvm.loop !9
vector.body.2: ; preds = %vector.body.1
%vec.ind.next.1 = add <4 x i32> %.splat, <i32 8, i32 9, i32 10, i32 11>
%13 = icmp eq <4 x i32> %vec.ind.next.1, %broadcast.splat79
%14 = zext <4 x i1> %13 to <4 x i32>
%15 = add <4 x i32> %11, %14
br label %middle.block
middle.block: ; preds = %vector.body.2, %vector.body.1, %vector.ph
%vec.phi.lcssa = phi <4 x i32> [ %4, %vector.ph ], [ %7, %vector.body.1 ], [ %11, %vector.body.2 ]
%vec.ind76.lcssa = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ <i32 4, i32 5, i32 6, i32 7>, %vector.body.1 ], [ <i32 8, i32 9, i32 10, i32 11>, %vector.body.2 ]
%.lcssa = phi <4 x i32> [ %7, %vector.ph ], [ %11, %vector.body.1 ], [ %15, %vector.body.2 ]
%.not = icmp ugt <4 x i32> %vec.ind76.lcssa, %broadcast.splat
%16 = select <4 x i1> %.not, <4 x i32> %vec.phi.lcssa, <4 x i32> %.lcssa
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %16)
%inc32 = add nuw nsw i32 %c.063, 1
%add11 = add nuw nsw i32 %inc32, %add68
%cmp12 = icmp sle i32 %add11, %0
%cmp14 = icmp ult i32 %c.063, 9
%18 = and i1 %cmp14, %cmp12
br i1 %18, label %vector.ph, label %for.inc34, !llvm.loop !13
for.inc34: ; preds = %middle.block
%inc35 = add nuw nsw i32 %b.066, 1
%add = add nuw nsw i32 %inc35, %a.070
%cmp4 = icmp sle i32 %add, %0
%cmp6 = icmp ult i32 %b.066, 9
%19 = and i1 %cmp6, %cmp4
br i1 %19, label %for.cond9.preheader, label %for.inc37, !llvm.loop !14
for.inc37: ; preds = %for.inc34
%inc38 = add nuw nsw i32 %a.070, 1
%exitcond.not = icmp eq i32 %a.070, %umin
br i1 %exitcond.not, label %for.end39, label %for.cond3.preheader, !llvm.loop !15
for.end39: ; preds = %for.inc37, %for.cond.preheader
%e.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %17, %for.inc37 ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %e.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !16
while.end: ; preds = %for.end39, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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.umin.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int count(int n){
int res=0;
int i,j,k,tem,tem1;
for(i=0; i<10; i++){
if(n-i<0)return res;
tem=n-i;
for(j=0; j<10; j++){
if(tem-j<0)break;
tem1=tem-j;
for(k=0; k<10; k++){
if(tem1-k<0 || tem1-k>9)continue;
res++;
}
}
}
return res;
}
int main(void) {
int n;
while(scanf("%d",&n)!=EOF)printf("%d\n",count(n));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111840/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nosync nounwind memory(none) uwtable
define dso_local i32 @count(i32 noundef %n) local_unnamed_addr #0 {
entry:
%0 = add i32 %n, 1
%smin = tail call i32 @llvm.smin.i32(i32 %n, i32 -1)
%1 = sub i32 %n, %smin
br label %for.body
for.body: ; preds = %entry, %for.inc24
%indvars.iv = phi i32 [ %0, %entry ], [ %indvars.iv.next, %for.inc24 ]
%res.051 = phi i32 [ 0, %entry ], [ %res.1.lcssa, %for.inc24 ]
%i.050 = phi i32 [ 0, %entry ], [ %inc25, %for.inc24 ]
%exitcond53 = icmp eq i32 %i.050, %1
br i1 %exitcond53, label %cleanup, label %for.body5
for.body5: ; preds = %for.body, %for.body13.preheader
%res.149 = phi i32 [ %op.rdx56, %for.body13.preheader ], [ %res.051, %for.body ]
%j.048 = phi i32 [ %inc22, %for.body13.preheader ], [ 0, %for.body ]
%exitcond = icmp eq i32 %j.048, %indvars.iv
br i1 %exitcond, label %for.inc24, label %for.body13.preheader
for.body13.preheader: ; preds = %for.body5
%2 = add nuw i32 %i.050, %j.048
%sub6 = sub i32 %n, %2
%or.cond = icmp ult i32 %sub6, 10
%inc = zext i1 %or.cond to i32
%3 = insertelement <8 x i32> poison, i32 %sub6, i64 0
%4 = shufflevector <8 x i32> %3, <8 x i32> poison, <8 x i32> zeroinitializer
%5 = add nsw <8 x i32> %4, <i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8>
%6 = icmp ult <8 x i32> %5, <i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10>
%sub14.9 = add nsw i32 %sub6, -9
%or.cond.9 = icmp ult i32 %sub14.9, 10
%inc.9 = zext i1 %or.cond.9 to i32
%7 = bitcast <8 x i1> %6 to i8
%8 = tail call i8 @llvm.ctpop.i8(i8 %7), !range !5
%9 = zext i8 %8 to i32
%op.rdx = add nuw nsw i32 %9, %inc
%op.rdx55 = add i32 %res.149, %inc.9
%op.rdx56 = add i32 %op.rdx, %op.rdx55
%inc22 = add nuw nsw i32 %j.048, 1
%exitcond52.not = icmp eq i32 %inc22, 10
br i1 %exitcond52.not, label %for.inc24, label %for.body5, !llvm.loop !6
for.inc24: ; preds = %for.body13.preheader, %for.body5
%res.1.lcssa = phi i32 [ %op.rdx56, %for.body13.preheader ], [ %res.149, %for.body5 ]
%inc25 = add nuw nsw i32 %i.050, 1
%indvars.iv.next = add i32 %indvars.iv, -1
%exitcond54.not = icmp eq i32 %inc25, 10
br i1 %exitcond54.not, label %cleanup, label %for.body, !llvm.loop !8
cleanup: ; preds = %for.inc24, %for.body
%res.0.lcssa = phi i32 [ %res.1.lcssa, %for.inc24 ], [ %res.051, %for.body ]
ret i32 %res.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %count.exit
%0 = load i32, ptr %n, align 4, !tbaa !9
%1 = add i32 %0, 1
%smin.i = call i32 @llvm.smin.i32(i32 %0, i32 -1)
%2 = sub i32 %0, %smin.i
br label %for.body.i
for.body.i: ; preds = %for.inc24.i, %while.body
%indvars.iv.i = phi i32 [ %1, %while.body ], [ %indvars.iv.next.i, %for.inc24.i ]
%res.051.i = phi i32 [ 0, %while.body ], [ %res.1.lcssa.i, %for.inc24.i ]
%i.050.i = phi i32 [ 0, %while.body ], [ %inc25.i, %for.inc24.i ]
%exitcond53.i = icmp eq i32 %i.050.i, %2
br i1 %exitcond53.i, label %count.exit, label %for.body5.i
for.body5.i: ; preds = %for.body.i, %for.body13.preheader.i
%res.149.i = phi i32 [ %op.rdx6, %for.body13.preheader.i ], [ %res.051.i, %for.body.i ]
%j.048.i = phi i32 [ %inc22.i, %for.body13.preheader.i ], [ 0, %for.body.i ]
%exitcond.i = icmp eq i32 %j.048.i, %indvars.iv.i
br i1 %exitcond.i, label %for.inc24.i, label %for.body13.preheader.i
for.body13.preheader.i: ; preds = %for.body5.i
%3 = add nuw nsw i32 %i.050.i, %j.048.i
%sub6.i = sub i32 %0, %3
%or.cond.i = icmp ult i32 %sub6.i, 10
%inc.i = zext i1 %or.cond.i to i32
%4 = insertelement <8 x i32> poison, i32 %sub6.i, i64 0
%5 = shufflevector <8 x i32> %4, <8 x i32> poison, <8 x i32> zeroinitializer
%6 = add nsw <8 x i32> %5, <i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8>
%7 = icmp ult <8 x i32> %6, <i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10>
%sub14.9.i = add nsw i32 %sub6.i, -9
%or.cond.9.i = icmp ult i32 %sub14.9.i, 10
%inc.9.i = zext i1 %or.cond.9.i to i32
%8 = bitcast <8 x i1> %7 to i8
%9 = call i8 @llvm.ctpop.i8(i8 %8), !range !5
%10 = zext i8 %9 to i32
%op.rdx = add nuw nsw i32 %10, %inc.i
%op.rdx5 = add i32 %res.149.i, %inc.9.i
%op.rdx6 = add i32 %op.rdx, %op.rdx5
%inc22.i = add nuw nsw i32 %j.048.i, 1
%exitcond52.not.i = icmp eq i32 %inc22.i, 10
br i1 %exitcond52.not.i, label %for.inc24.i, label %for.body5.i, !llvm.loop !6
for.inc24.i: ; preds = %for.body13.preheader.i, %for.body5.i
%res.1.lcssa.i = phi i32 [ %op.rdx6, %for.body13.preheader.i ], [ %res.149.i, %for.body5.i ]
%inc25.i = add nuw nsw i32 %i.050.i, 1
%indvars.iv.next.i = add i32 %indvars.iv.i, -1
%exitcond54.not.i = icmp eq i32 %inc25.i, 10
br i1 %exitcond54.not.i, label %count.exit, label %for.body.i, !llvm.loop !8
count.exit: ; preds = %for.body.i, %for.inc24.i
%res.0.lcssa.i = phi i32 [ %res.1.lcssa.i, %for.inc24.i ], [ %res.051.i, %for.body.i ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %res.0.lcssa.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %count.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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 i8 @llvm.ctpop.i8(i8) #4
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{i8 0, i8 9}
!6 = distinct !{!6, !7}
!7 = !{!"llvm.loop.mustprogress"}
!8 = distinct !{!8, !7}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = distinct !{!13, !7}
|
#include <stdio.h>
int main()
{
int n,cnt,a,b,c,d;
while(scanf("%d",&n)!=EOF){
cnt=0;
if(n>36){
printf("0\n");
continue;
}
for(a=0;a<=9;a++){
for(b=0;b<=9;b++){
for(c=0;c<=9;c++){
for(d=0;d<=9;d++){
if(a+b+c+d==n) cnt++;
}
}
}
}
printf("%d\n",cnt);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111891/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\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
%call46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not47 = icmp eq i32 %call46, -1
br i1 %cmp.not47, label %while.end, label %while.body
while.body: ; preds = %entry, %while.cond.backedge
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, 36
br i1 %cmp1, label %if.then, label %for.cond4.preheader.preheader
for.cond4.preheader.preheader: ; preds = %while.body
%broadcast.splatinsert50 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat51 = shufflevector <4 x i32> %broadcast.splatinsert50, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond4.preheader
if.then: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then, %for.end27
%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 !9
for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc25
%a.045 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond4.preheader.preheader ]
%cnt.044 = phi i32 [ %123, %for.inc25 ], [ 0, %for.cond4.preheader.preheader ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond4.preheader
%b.043 = phi i32 [ 0, %for.cond4.preheader ], [ %inc23, %vector.ph ]
%cnt.142 = phi i32 [ %cnt.044, %for.cond4.preheader ], [ %123, %vector.ph ]
%add = add nuw nsw i32 %b.043, %a.045
%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
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.142, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat51
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat51
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat51
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat51
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat51
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat51
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat51
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat51
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat51
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat51
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat51
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat51
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat51
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat51
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat51
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat51
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat51
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat51
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat51
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat51
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat51
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat51
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat51
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat51
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat51
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat51
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat51
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat51
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat51
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat51
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc23 = add nuw nsw i32 %b.043, 1
%exitcond48.not = icmp eq i32 %inc23, 10
br i1 %exitcond48.not, label %for.inc25, label %vector.ph, !llvm.loop !11
for.inc25: ; preds = %vector.ph
%inc26 = add nuw nsw i32 %a.045, 1
%exitcond49.not = icmp eq i32 %inc26, 10
br i1 %exitcond49.not, label %for.end27, label %for.cond4.preheader, !llvm.loop !12
for.end27: ; preds = %for.inc25
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %123)
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void) {
int a,b,c;
int n;
int count;
while(!feof(stdin)) {
scanf("%d",&n);
if(feof(stdin))break;
count=0;
for(a=0;a<=9;a++) {
for(b=0;b<=9;b++) {
for(c=0;c<=9;c++) {
if(a+b+c>=n-9 && a+b+c<=n)count++;
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_111956/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_111956/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\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
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call41 = tail call i32 @feof(ptr noundef %0) #4
%tobool.not42 = icmp eq i32 %call41, 0
br i1 %tobool.not42, label %while.body, label %while.end
while.body: ; preds = %entry, %for.end23
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call2 = call i32 @feof(ptr noundef %1) #4
%tobool3.not = icmp eq i32 %call2, 0
br i1 %tobool3.not, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %while.body
%2 = load i32, ptr %n, align 4, !tbaa !9
%sub = add nsw i32 %2, -9
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %2, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert44 = insertelement <4 x i32> poison, i32 %sub, i64 0
%broadcast.splat45 = shufflevector <4 x i32> %broadcast.splatinsert44, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond.preheader
%count.040 = phi i32 [ 0, %for.cond.preheader ], [ %185, %vector.ph ]
%a.039 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %vector.ph ]
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a.039, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.040, i64 0
%4 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%5 = icmp sge <4 x i32> %4, %broadcast.splat45
%6 = icmp sle <4 x i32> %4, %broadcast.splat47
%7 = and <4 x i1> %6, %5
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %3, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%11 = icmp sge <4 x i32> %10, %broadcast.splat45
%12 = icmp slt <4 x i32> %4, %broadcast.splat47
%13 = and <4 x i1> %12, %11
%14 = zext <4 x i1> %13 to <4 x i32>
%15 = add <4 x i32> %9, %14
%16 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%17 = icmp sge <4 x i32> %16, %broadcast.splat45
%18 = icmp sle <4 x i32> %16, %broadcast.splat47
%19 = and <4 x i1> %18, %17
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %15, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%23 = icmp sge <4 x i32> %22, %broadcast.splat45
%24 = icmp sle <4 x i32> %22, %broadcast.splat47
%25 = and <4 x i1> %24, %23
%26 = zext <4 x i1> %25 to <4 x i32>
%27 = add <4 x i32> %21, %26
%28 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%29 = icmp sge <4 x i32> %28, %broadcast.splat45
%30 = icmp sle <4 x i32> %28, %broadcast.splat47
%31 = and <4 x i1> %30, %29
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %27, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%35 = icmp sge <4 x i32> %34, %broadcast.splat45
%36 = icmp sle <4 x i32> %34, %broadcast.splat47
%37 = and <4 x i1> %36, %35
%38 = zext <4 x i1> %37 to <4 x i32>
%39 = add <4 x i32> %33, %38
%40 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%41 = icmp sge <4 x i32> %40, %broadcast.splat45
%42 = icmp sle <4 x i32> %40, %broadcast.splat47
%43 = and <4 x i1> %42, %41
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %39, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%47 = icmp sge <4 x i32> %46, %broadcast.splat45
%48 = icmp sle <4 x i32> %46, %broadcast.splat47
%49 = and <4 x i1> %48, %47
%50 = zext <4 x i1> %49 to <4 x i32>
%51 = add <4 x i32> %45, %50
%52 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%53 = icmp sge <4 x i32> %52, %broadcast.splat45
%54 = icmp sle <4 x i32> %52, %broadcast.splat47
%55 = and <4 x i1> %54, %53
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %51, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%59 = icmp sge <4 x i32> %58, %broadcast.splat45
%60 = icmp sle <4 x i32> %58, %broadcast.splat47
%61 = and <4 x i1> %60, %59
%62 = zext <4 x i1> %61 to <4 x i32>
%63 = add <4 x i32> %57, %62
%64 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%65 = icmp sge <4 x i32> %64, %broadcast.splat45
%66 = icmp sle <4 x i32> %64, %broadcast.splat47
%67 = and <4 x i1> %66, %65
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %63, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%71 = icmp sge <4 x i32> %70, %broadcast.splat45
%72 = icmp slt <4 x i32> %64, %broadcast.splat47
%73 = and <4 x i1> %72, %71
%74 = zext <4 x i1> %73 to <4 x i32>
%75 = add <4 x i32> %69, %74
%76 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%77 = icmp sge <4 x i32> %76, %broadcast.splat45
%78 = icmp sle <4 x i32> %76, %broadcast.splat47
%79 = and <4 x i1> %78, %77
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %75, %80
%82 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%83 = icmp sge <4 x i32> %82, %broadcast.splat45
%84 = icmp sle <4 x i32> %82, %broadcast.splat47
%85 = and <4 x i1> %84, %83
%86 = zext <4 x i1> %85 to <4 x i32>
%87 = add <4 x i32> %81, %86
%88 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%89 = icmp sge <4 x i32> %88, %broadcast.splat45
%90 = icmp sle <4 x i32> %88, %broadcast.splat47
%91 = and <4 x i1> %90, %89
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %87, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%95 = icmp sge <4 x i32> %94, %broadcast.splat45
%96 = icmp sle <4 x i32> %94, %broadcast.splat47
%97 = and <4 x i1> %96, %95
%98 = zext <4 x i1> %97 to <4 x i32>
%99 = add <4 x i32> %93, %98
%100 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%101 = icmp sge <4 x i32> %100, %broadcast.splat45
%102 = icmp sle <4 x i32> %100, %broadcast.splat47
%103 = and <4 x i1> %102, %101
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %99, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%107 = icmp sge <4 x i32> %106, %broadcast.splat45
%108 = icmp sle <4 x i32> %106, %broadcast.splat47
%109 = and <4 x i1> %108, %107
%110 = zext <4 x i1> %109 to <4 x i32>
%111 = add <4 x i32> %105, %110
%112 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%113 = icmp sge <4 x i32> %112, %broadcast.splat45
%114 = icmp sle <4 x i32> %112, %broadcast.splat47
%115 = and <4 x i1> %114, %113
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %111, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%119 = icmp sge <4 x i32> %118, %broadcast.splat45
%120 = icmp sle <4 x i32> %118, %broadcast.splat47
%121 = and <4 x i1> %120, %119
%122 = zext <4 x i1> %121 to <4 x i32>
%123 = add <4 x i32> %117, %122
%124 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%125 = icmp sge <4 x i32> %124, %broadcast.splat45
%126 = icmp sle <4 x i32> %124, %broadcast.splat47
%127 = and <4 x i1> %126, %125
%128 = zext <4 x i1> %127 to <4 x i32>
%129 = add <4 x i32> %123, %128
%130 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%131 = icmp sge <4 x i32> %130, %broadcast.splat45
%132 = icmp slt <4 x i32> %124, %broadcast.splat47
%133 = and <4 x i1> %132, %131
%134 = zext <4 x i1> %133 to <4 x i32>
%135 = add <4 x i32> %129, %134
%136 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%137 = icmp sge <4 x i32> %136, %broadcast.splat45
%138 = icmp sle <4 x i32> %136, %broadcast.splat47
%139 = and <4 x i1> %138, %137
%140 = zext <4 x i1> %139 to <4 x i32>
%141 = add <4 x i32> %135, %140
%142 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%143 = icmp sge <4 x i32> %142, %broadcast.splat45
%144 = icmp sle <4 x i32> %142, %broadcast.splat47
%145 = and <4 x i1> %144, %143
%146 = zext <4 x i1> %145 to <4 x i32>
%147 = add <4 x i32> %141, %146
%148 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%149 = icmp sge <4 x i32> %148, %broadcast.splat45
%150 = icmp sle <4 x i32> %148, %broadcast.splat47
%151 = and <4 x i1> %150, %149
%152 = zext <4 x i1> %151 to <4 x i32>
%153 = add <4 x i32> %147, %152
%154 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%155 = icmp sge <4 x i32> %154, %broadcast.splat45
%156 = icmp sle <4 x i32> %154, %broadcast.splat47
%157 = and <4 x i1> %156, %155
%158 = zext <4 x i1> %157 to <4 x i32>
%159 = add <4 x i32> %153, %158
%160 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%161 = icmp sge <4 x i32> %160, %broadcast.splat45
%162 = icmp sle <4 x i32> %160, %broadcast.splat47
%163 = and <4 x i1> %162, %161
%164 = zext <4 x i1> %163 to <4 x i32>
%165 = add <4 x i32> %159, %164
%166 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%167 = icmp sge <4 x i32> %166, %broadcast.splat45
%168 = icmp sle <4 x i32> %166, %broadcast.splat47
%169 = and <4 x i1> %168, %167
%170 = zext <4 x i1> %169 to <4 x i32>
%171 = add <4 x i32> %165, %170
%172 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%173 = icmp sge <4 x i32> %172, %broadcast.splat45
%174 = icmp sle <4 x i32> %172, %broadcast.splat47
%175 = and <4 x i1> %174, %173
%176 = zext <4 x i1> %175 to <4 x i32>
%177 = add <4 x i32> %171, %176
%178 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%179 = icmp sge <4 x i32> %178, %broadcast.splat45
%180 = icmp sle <4 x i32> %178, %broadcast.splat47
%181 = and <4 x i1> %180, %179
%182 = zext <4 x i1> %181 to <4 x i32>
%183 = add <4 x i32> %177, %182
%184 = shufflevector <4 x i32> %183, <4 x i32> %123, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%185 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %184)
%inc22 = add nuw nsw i32 %a.039, 1
%exitcond43.not = icmp eq i32 %inc22, 10
br i1 %exitcond43.not, label %for.end23, label %vector.ph, !llvm.loop !11
for.end23: ; preds = %vector.ph
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %185)
%186 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call i32 @feof(ptr noundef %186) #4
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %while.body, label %while.end, !llvm.loop !13
while.end: ; preds = %for.end23, %while.body, %entry
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 @feof(ptr nocapture noundef) local_unnamed_addr #2
; 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main(){
int t;
scanf("%d",&t);
while(t--){
int n,m;
scanf("%d %d",&n,&m);
int mul,mod,ans;
mul=n*m;
mod=mul%2;
if(mod==0)
ans=mul/2;
else
ans=(mul/2)+1;
printf("%d\n",ans);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11202/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11202/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [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
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec7 = add nsw i32 %0, -1
store i32 %dec7, ptr %t, align 4, !tbaa !5
%tobool.not8 = icmp eq i32 %0, 0
br i1 %tobool.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %m)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = load i32, ptr %m, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, %1
%3 = and i32 %mul2, 1
%div = sdiv i32 %mul2, 2
%ans.0 = add nsw i32 %div, %3
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
int a,b,c,d,n;
int count;
while(scanf("%d",&n)!=EOF){
count=0;
for(a=0;a<=9;a++){
for(b=0;b<=9;b++){
for(c=0;c<=9;c++){
for(d=0;d<=9;d++){
if(a+b+c+d==n){
count++;
}
}
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112063/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112063/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.139 = phi i32 [ %count.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%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
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%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 %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
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, !10}
|
#include <stdio.h>
int main()
{
int a,b,c,d,n,kai;
while(scanf("%d",&n)!=EOF){
kai=0;
for(a=0;a<10;a++)for(b=0;b<10;b++)for(c=0;c<10;c++)for(d=0;d<10;d++)if(n==a+b+c+d)kai++;
printf("%d\n",kai);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112113/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112113/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%kai.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%kai.139 = phi i32 [ %kai.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%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
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %kai.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %broadcast.splat47, %2
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %broadcast.splat47, %6
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %broadcast.splat47, %10
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %broadcast.splat47, %14
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %broadcast.splat47, %18
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %broadcast.splat47, %22
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %broadcast.splat47, %26
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %broadcast.splat47, %30
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %broadcast.splat47, %34
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %broadcast.splat47, %38
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %broadcast.splat47, %42
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %broadcast.splat47, %46
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %broadcast.splat47, %50
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %broadcast.splat47, %54
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %broadcast.splat47, %58
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %broadcast.splat47, %62
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %broadcast.splat47, %66
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %broadcast.splat47, %70
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %broadcast.splat47, %74
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %broadcast.splat47, %78
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %broadcast.splat47, %82
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %broadcast.splat47, %86
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %broadcast.splat47, %90
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %broadcast.splat47, %94
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %broadcast.splat47, %98
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %broadcast.splat47, %102
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %broadcast.splat47, %106
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %broadcast.splat47, %110
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %broadcast.splat47, %114
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %broadcast.splat47, %118
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%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 %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
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, !10}
|
#include<stdio.h>
int main(){
int n,a,b,c,d,cnt;
while(scanf("%d",&n)!=EOF){
cnt=0;
for(a=0;a<=9;a++){
for(b=0;b<=9;b++){
for(c=0;c<=9;c++){
for(d=0;d<=9;d++){
if(a+b+c+d==n)cnt++;
}
}
}
}
printf("%d\n",cnt);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112164/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112164/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%cnt.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%a.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%cnt.139 = phi i32 [ %cnt.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%b.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %b.038, %a.040
%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
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %b.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %a.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%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 %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
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, !10}
|
#include <stdio.h>
int main(void)
{
int n;
int i, j, k, l;
int count;
while ((scanf("%d", &n)) != EOF){
count = 0;
for (i = 0; i < 10; i++){
for (j = 0; j < 10; j++){
for (k = 0; k < 10; k++){
for (l = 0; l < 10; l++){
if (i + j + k + l == n){
count++;
}
}
}
}
}
printf("%d\n", count);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112207/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%i.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.139 = phi i32 [ %count.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%j.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %j.038, %i.040
%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
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %j.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %i.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%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 %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
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, !10}
|
#include<stdio.h>
int main(){
int i,j,k,l,n,count;
while(scanf("%d",&n)!=EOF){
count=0;
for(i=0;i<10;i++){
for(j=0;j<10;j++){
for(k=0;k<10;k++){
for(l=0;l<10;l++){
if(i+j+k+l==n){
count++;
}
}
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not43 = icmp eq i32 %call42, -1
br i1 %cmp.not43, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end23
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert46 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat47 = shufflevector <4 x i32> %broadcast.splatinsert46, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc21
%count.041 = phi i32 [ 0, %for.cond.preheader ], [ %123, %for.inc21 ]
%i.040 = phi i32 [ 0, %for.cond.preheader ], [ %inc22, %for.inc21 ]
br label %vector.ph
vector.ph: ; preds = %vector.ph, %for.cond2.preheader
%count.139 = phi i32 [ %count.041, %for.cond2.preheader ], [ %123, %vector.ph ]
%j.038 = phi i32 [ 0, %for.cond2.preheader ], [ %inc19, %vector.ph ]
%add = add nuw nsw i32 %j.038, %i.040
%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
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.139, i64 0
%2 = add nuw nsw <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
%3 = icmp eq <4 x i32> %2, %broadcast.splat47
%4 = zext <4 x i1> %3 to <4 x i32>
%5 = add <4 x i32> %1, %4
%6 = add nuw <4 x i32> %broadcast.splat, <i32 1, i32 2, i32 3, i32 4>
%7 = icmp eq <4 x i32> %6, %broadcast.splat47
%8 = zext <4 x i1> %7 to <4 x i32>
%9 = add <4 x i32> %5, %8
%10 = add nuw <4 x i32> %broadcast.splat, <i32 2, i32 3, i32 4, i32 5>
%11 = icmp eq <4 x i32> %10, %broadcast.splat47
%12 = zext <4 x i1> %11 to <4 x i32>
%13 = add <4 x i32> %9, %12
%14 = add nuw <4 x i32> %broadcast.splat, <i32 3, i32 4, i32 5, i32 6>
%15 = icmp eq <4 x i32> %14, %broadcast.splat47
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %13, %16
%18 = add nuw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%19 = icmp eq <4 x i32> %18, %broadcast.splat47
%20 = zext <4 x i1> %19 to <4 x i32>
%21 = add <4 x i32> %17, %20
%22 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%23 = icmp eq <4 x i32> %22, %broadcast.splat47
%24 = zext <4 x i1> %23 to <4 x i32>
%25 = add <4 x i32> %21, %24
%26 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%27 = icmp eq <4 x i32> %26, %broadcast.splat47
%28 = zext <4 x i1> %27 to <4 x i32>
%29 = add <4 x i32> %25, %28
%30 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%31 = icmp eq <4 x i32> %30, %broadcast.splat47
%32 = zext <4 x i1> %31 to <4 x i32>
%33 = add <4 x i32> %29, %32
%34 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%35 = icmp eq <4 x i32> %34, %broadcast.splat47
%36 = zext <4 x i1> %35 to <4 x i32>
%37 = add <4 x i32> %33, %36
%38 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%39 = icmp eq <4 x i32> %38, %broadcast.splat47
%40 = zext <4 x i1> %39 to <4 x i32>
%41 = add <4 x i32> %37, %40
%42 = add nuw nsw <4 x i32> %broadcast.splat, <i32 4, i32 5, i32 6, i32 7>
%43 = icmp eq <4 x i32> %42, %broadcast.splat47
%44 = zext <4 x i1> %43 to <4 x i32>
%45 = add <4 x i32> %41, %44
%46 = add nuw <4 x i32> %broadcast.splat, <i32 5, i32 6, i32 7, i32 8>
%47 = icmp eq <4 x i32> %46, %broadcast.splat47
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %45, %48
%50 = add nuw <4 x i32> %broadcast.splat, <i32 6, i32 7, i32 8, i32 9>
%51 = icmp eq <4 x i32> %50, %broadcast.splat47
%52 = zext <4 x i1> %51 to <4 x i32>
%53 = add <4 x i32> %49, %52
%54 = add nuw <4 x i32> %broadcast.splat, <i32 7, i32 8, i32 9, i32 10>
%55 = icmp eq <4 x i32> %54, %broadcast.splat47
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add <4 x i32> %53, %56
%58 = add nuw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%59 = icmp eq <4 x i32> %58, %broadcast.splat47
%60 = zext <4 x i1> %59 to <4 x i32>
%61 = add <4 x i32> %57, %60
%62 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%63 = icmp eq <4 x i32> %62, %broadcast.splat47
%64 = zext <4 x i1> %63 to <4 x i32>
%65 = add <4 x i32> %61, %64
%66 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%67 = icmp eq <4 x i32> %66, %broadcast.splat47
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %65, %68
%70 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%71 = icmp eq <4 x i32> %70, %broadcast.splat47
%72 = zext <4 x i1> %71 to <4 x i32>
%73 = add <4 x i32> %69, %72
%74 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%75 = icmp eq <4 x i32> %74, %broadcast.splat47
%76 = zext <4 x i1> %75 to <4 x i32>
%77 = add <4 x i32> %73, %76
%78 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%79 = icmp eq <4 x i32> %78, %broadcast.splat47
%80 = zext <4 x i1> %79 to <4 x i32>
%81 = add <4 x i32> %77, %80
%82 = add nuw nsw <4 x i32> %broadcast.splat, <i32 8, i32 9, i32 10, i32 11>
%83 = icmp eq <4 x i32> %82, %broadcast.splat47
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add <4 x i32> %81, %84
%86 = add nuw <4 x i32> %broadcast.splat, <i32 9, i32 10, i32 11, i32 12>
%87 = icmp eq <4 x i32> %86, %broadcast.splat47
%88 = zext <4 x i1> %87 to <4 x i32>
%89 = add <4 x i32> %85, %88
%90 = add nuw <4 x i32> %broadcast.splat, <i32 10, i32 11, i32 12, i32 13>
%91 = icmp eq <4 x i32> %90, %broadcast.splat47
%92 = zext <4 x i1> %91 to <4 x i32>
%93 = add <4 x i32> %89, %92
%94 = add nuw <4 x i32> %broadcast.splat, <i32 11, i32 12, i32 13, i32 14>
%95 = icmp eq <4 x i32> %94, %broadcast.splat47
%96 = zext <4 x i1> %95 to <4 x i32>
%97 = add <4 x i32> %93, %96
%98 = add nuw <4 x i32> %broadcast.splat, <i32 12, i32 13, i32 14, i32 15>
%99 = icmp eq <4 x i32> %98, %broadcast.splat47
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %97, %100
%102 = add nuw <4 x i32> %broadcast.splat, <i32 13, i32 14, i32 15, i32 16>
%103 = icmp eq <4 x i32> %102, %broadcast.splat47
%104 = zext <4 x i1> %103 to <4 x i32>
%105 = add <4 x i32> %101, %104
%106 = add nuw <4 x i32> %broadcast.splat, <i32 14, i32 15, i32 16, i32 17>
%107 = icmp eq <4 x i32> %106, %broadcast.splat47
%108 = zext <4 x i1> %107 to <4 x i32>
%109 = add <4 x i32> %105, %108
%110 = add nuw <4 x i32> %broadcast.splat, <i32 15, i32 16, i32 17, i32 18>
%111 = icmp eq <4 x i32> %110, %broadcast.splat47
%112 = zext <4 x i1> %111 to <4 x i32>
%113 = add <4 x i32> %109, %112
%114 = add nuw <4 x i32> %broadcast.splat, <i32 16, i32 17, i32 18, i32 19>
%115 = icmp eq <4 x i32> %114, %broadcast.splat47
%116 = zext <4 x i1> %115 to <4 x i32>
%117 = add <4 x i32> %113, %116
%118 = add nuw <4 x i32> %broadcast.splat, <i32 17, i32 18, i32 19, i32 20>
%119 = icmp eq <4 x i32> %118, %broadcast.splat47
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %117, %120
%122 = shufflevector <4 x i32> %121, <4 x i32> %81, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
%123 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %122)
%inc19 = add nuw nsw i32 %j.038, 1
%exitcond44.not = icmp eq i32 %inc19, 10
br i1 %exitcond44.not, label %for.inc21, label %vector.ph, !llvm.loop !9
for.inc21: ; preds = %vector.ph
%inc22 = add nuw nsw i32 %i.040, 1
%exitcond45.not = icmp eq i32 %inc22, 10
br i1 %exitcond45.not, label %for.end23, label %for.cond2.preheader, !llvm.loop !11
for.end23: ; preds = %for.inc21
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %123)
%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 %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end23, %entry
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, !10}
|
// AOJ 1010: Dominoes Arrangement
// 2017.12.15 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char f['7'], g['7'];
int main()
{
int n, i, k, ans;
char buf[60], *p;
while (fgets(buf, 6, stdin) != NULL) {
n = atoi(buf);
memset(f, 0, sizeof(f));
memset(g, 0, sizeof(g));
fgets(p=buf, 60, stdin);
for (i = 0; i < n; i++) {
if (*p == *(p+1)) g[*p] = 1;
else f[*p]++, f[*(p+1)]++;
p+=3;
}
ans = 0;
if (n == 1) { ans = 1; goto done; }
for (i = '0'; i <= '6'; i++) if (g[i] && !f[i]) goto done;
k = 0; for (i = '0'; i <= '6'; i++) if (f[i] & 1) k++;
ans = !k || k == 2;
done: puts(ans ? "Yes" : "No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112300/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112300/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@f = dso_local local_unnamed_addr global [55 x i8] zeroinitializer, align 16
@g = dso_local local_unnamed_addr global [55 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.1 = 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:
%buf = alloca [60 x i8], align 16
call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %buf) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call84 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 6, ptr noundef %0)
%cmp.not85 = icmp eq ptr %call84, null
br i1 %cmp.not85, label %while.end, label %while.body
while.body: ; preds = %entry, %done.thread74
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %buf, ptr noundef null, i32 noundef 10) #5
%conv.i = trunc i64 %call.i to i32
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(55) @f, i8 0, i64 55, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(55) @g, i8 0, i64 55, i1 false)
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call4 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 60, ptr noundef %1)
%cmp578 = icmp sgt i32 %conv.i, 0
br i1 %cmp578, label %for.body, label %for.body24.preheader
for.body: ; preds = %while.body, %if.end
%p.080 = phi ptr [ %add.ptr15, %if.end ], [ %buf, %while.body ]
%i.079 = phi i32 [ %inc16, %if.end ], [ 0, %while.body ]
%2 = load i8, ptr %p.080, align 1, !tbaa !9
%add.ptr = getelementptr inbounds i8, ptr %p.080, i64 1
%3 = load i8, ptr %add.ptr, align 1, !tbaa !9
%cmp7 = icmp eq i8 %2, %3
%idxprom = sext i8 %2 to i64
br i1 %cmp7, label %if.then, label %if.else
if.then: ; preds = %for.body
%arrayidx = getelementptr inbounds [55 x i8], ptr @g, i64 0, i64 %idxprom
store i8 1, ptr %arrayidx, align 1, !tbaa !9
br label %if.end
if.else: ; preds = %for.body
%arrayidx10 = getelementptr inbounds [55 x i8], ptr @f, i64 0, i64 %idxprom
%4 = load i8, ptr %arrayidx10, align 1, !tbaa !9
%inc = add i8 %4, 1
store i8 %inc, ptr %arrayidx10, align 1, !tbaa !9
%idxprom12 = sext i8 %3 to i64
%arrayidx13 = getelementptr inbounds [55 x i8], ptr @f, i64 0, i64 %idxprom12
%5 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%inc14 = add i8 %5, 1
store i8 %inc14, ptr %arrayidx13, align 1, !tbaa !9
br label %if.end
if.end: ; preds = %if.else, %if.then
%add.ptr15 = getelementptr inbounds i8, ptr %p.080, i64 3
%inc16 = add nuw nsw i32 %i.079, 1
%exitcond.not = icmp eq i32 %inc16, %conv.i
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %if.end
%cmp17 = icmp eq i32 %conv.i, 1
br i1 %cmp17, label %done.thread74, label %for.body24.preheader
for.body24.preheader: ; preds = %while.body, %for.end
%6 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 48), align 16, !tbaa !9
%tobool.not = icmp ne i8 %6, 0
%7 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 48), align 16
%tobool30.not = icmp eq i8 %7, 0
%or.cond = select i1 %tobool.not, i1 %tobool30.not, i1 false
br i1 %or.cond, label %done.thread, label %for.inc33
for.inc33: ; preds = %for.body24.preheader
%8 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 49), align 1, !tbaa !9
%tobool.not.1 = icmp ne i8 %8, 0
%9 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 49), align 1
%tobool30.not.1 = icmp eq i8 %9, 0
%or.cond97 = select i1 %tobool.not.1, i1 %tobool30.not.1, i1 false
br i1 %or.cond97, label %done.thread, label %for.inc33.1
for.inc33.1: ; preds = %for.inc33
%10 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 50), align 2, !tbaa !9
%tobool.not.2 = icmp ne i8 %10, 0
%11 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 50), align 2
%tobool30.not.2 = icmp eq i8 %11, 0
%or.cond98 = select i1 %tobool.not.2, i1 %tobool30.not.2, i1 false
br i1 %or.cond98, label %done.thread, label %for.inc33.2
for.inc33.2: ; preds = %for.inc33.1
%12 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 51), align 1, !tbaa !9
%tobool.not.3 = icmp ne i8 %12, 0
%13 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 51), align 1
%tobool30.not.3 = icmp eq i8 %13, 0
%or.cond99 = select i1 %tobool.not.3, i1 %tobool30.not.3, i1 false
br i1 %or.cond99, label %done.thread, label %for.inc33.3
for.inc33.3: ; preds = %for.inc33.2
%14 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 52), align 4, !tbaa !9
%tobool.not.4 = icmp ne i8 %14, 0
%15 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 52), align 4
%tobool30.not.4 = icmp eq i8 %15, 0
%or.cond100 = select i1 %tobool.not.4, i1 %tobool30.not.4, i1 false
br i1 %or.cond100, label %done.thread, label %for.inc33.4
for.inc33.4: ; preds = %for.inc33.3
%16 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 53), align 1, !tbaa !9
%tobool.not.5 = icmp ne i8 %16, 0
%17 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 53), align 1
%tobool30.not.5 = icmp eq i8 %17, 0
%or.cond101 = select i1 %tobool.not.5, i1 %tobool30.not.5, i1 false
br i1 %or.cond101, label %done.thread, label %for.inc33.5
for.inc33.5: ; preds = %for.inc33.4
%18 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @g, i64 0, i64 54), align 2, !tbaa !9
%tobool.not.6 = icmp ne i8 %18, 0
%.pre = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 54), align 2, !tbaa !9
%.fr.6 = freeze i8 %.pre
%tobool30.not.6 = icmp eq i8 %.fr.6, 0
%or.cond102 = and i1 %tobool.not.6, %tobool30.not.6
br i1 %or.cond102, label %done.thread, label %for.inc33.6
for.inc33.6: ; preds = %for.inc33.5
%19 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 48), align 16, !tbaa !9
%.fr = freeze i8 %19
%20 = and i8 %.fr, 1
%21 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 49), align 1, !tbaa !9
%.fr.1 = freeze i8 %21
%22 = and i8 %.fr.1, 1
%narrow = add nuw nsw i8 %20, %22
%23 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 50), align 2, !tbaa !9
%.fr.2 = freeze i8 %23
%24 = and i8 %.fr.2, 1
%narrow91 = add nuw nsw i8 %narrow, %24
%25 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 51), align 1, !tbaa !9
%.fr.3 = freeze i8 %25
%26 = and i8 %.fr.3, 1
%narrow92 = add nuw nsw i8 %narrow91, %26
%27 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 52), align 4, !tbaa !9
%.fr.4 = freeze i8 %27
%28 = and i8 %.fr.4, 1
%narrow93 = add nuw nsw i8 %narrow92, %28
%29 = load i8, ptr getelementptr inbounds ([55 x i8], ptr @f, i64 0, i64 53), align 1, !tbaa !9
%.fr.5 = freeze i8 %29
%30 = and i8 %.fr.5, 1
%narrow94 = add nuw nsw i8 %narrow93, %30
%31 = and i8 %.fr.6, 1
%narrow95 = add nuw nsw i8 %narrow94, %31
%32 = and i8 %narrow95, -3
%.not = icmp eq i8 %32, 0
br i1 %.not, label %done.thread74, label %done.thread
done.thread: ; preds = %for.inc33.5, %for.inc33.4, %for.inc33.3, %for.inc33.2, %for.inc33.1, %for.inc33, %for.body24.preheader, %for.inc33.6
br label %done.thread74
done.thread74: ; preds = %for.end, %for.inc33.6, %done.thread
%33 = phi ptr [ @.str.1, %done.thread ], [ @.str, %for.inc33.6 ], [ @.str, %for.end ]
%call54 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %33)
%34 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 6, ptr noundef %34)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %done.thread74, %entry
call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %buf) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a%2==0){
printf("%d\n",a/2);
}
if(a%2!=0){
printf("%d\n",a/2+1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = and i32 %0, 1
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %if.end, label %if.then4
if.end: ; preds = %entry
%div = sdiv i32 %0, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
%.pre = load i32, ptr %a, align 4, !tbaa !5
%.pre8 = and i32 %.pre, 1
%2 = icmp eq i32 %.pre8, 0
br i1 %2, label %if.end7, label %if.then4
if.then4: ; preds = %entry, %if.end
%3 = phi i32 [ %.pre, %if.end ], [ %0, %entry ]
%div5 = sdiv i32 %3, 2
%add = add nsw i32 %div5, 1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end7
if.end7: ; preds = %if.then4, %if.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a;
scanf("%d",&a);
printf("%d",(a+1)/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int N;
scanf("%d", &N);
int cnt = 0;
while (N - 2 >= 0) {
N = N - 2;
cnt++;
}
if (N == 1) {
cnt++;
}
printf("%d\n", cnt);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112430/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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)
%.pr = load i32, ptr %N, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %.pr, 1
br i1 %cmp7, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%0 = add nsw i32 %.pr, -2
%1 = add nuw i32 %.pr, 1
%smin = call i32 @llvm.smin.i32(i32 %.pr, i32 3)
%2 = sub nuw i32 %1, %smin
%3 = lshr i32 %2, 1
%4 = and i32 %2, -2
%5 = sub nsw i32 %0, %4
%6 = add nuw nsw i32 %3, 1
store i32 %5, ptr %N, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.body.preheader, %entry
%.lcssa = phi i32 [ %5, %while.body.preheader ], [ %.pr, %entry ]
%cnt.0.lcssa = phi i32 [ %6, %while.body.preheader ], [ 0, %entry ]
%cmp2 = icmp eq i32 %.lcssa, 1
%inc3 = zext i1 %cmp2 to i32
%spec.select = add nuw nsw i32 %cnt.0.lcssa, %inc3
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main() {
int a;
scanf("%d", &a);
printf("%d\n", a/2+a%2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%div = sdiv i32 %0, 2
%rem = srem i32 %0, 2
%add = add nsw i32 %div, %rem
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
if(n%2==0){
printf("%d\n",n/2);
}
else{
printf("%d\n",(n/2)+1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112517/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112517/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%add.sink = add nsw i32 %div, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define REP(i,n) for(i=0;i<n;i++)
#define MAX 1000000
#define MOD 1000000007
long long fac[MAX], finv[MAX], inv[MAX];
//prototype declaration
int i_in();
long long ll_in();
double d_in();
char c_in();
void s_in(char *s);
void i_out(int i);
void ll_out(long long i);
void d_out(double i);
void c_out(char c);
void s_out(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long ll_gcd(long long a, long long b);
long long ll_lcm(long long a, long long b);
void sort_asc(int *a);
void sort_desc(int *a);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);
void ll_sort_asc(long long *a);
void ll_sort_desc(long long *a);
int ll_asc(const void *a, const void *b);
int ll_desc(const void *a, const void *b);
double to_deg(double rad);
double distance(int xi, int yi, int xj, int yj);
void initComb();
long long comb(int n, int k);
//main function
int main() {
int n = i_in();
i_out(n/2 + n%2);
return 0;
}
//body function
int i_in() {
int i;
scanf("%d", &i);
return i;
}
long long ll_in() {
long long i;
scanf("%lld", &i);
return i;
}
double d_in() {
double i;
scanf("%lf", &i);
return i;
}
char c_in() {
char c;
scanf("%c", &c);
return c;
}
void s_in(char *s) {
scanf("%s", s);
}
void i_out(int i) {
printf("%d\n", i);
}
void ll_out(long long i) {
printf("%lld\n", i);
}
void d_out(double i) {
printf("%lf\n", i);
}
void c_out(char c) {
printf("%c\n", c);
}
void s_out(char *s) {
printf("%s\n", s);
}
/*
int型の最大公約数
*/
int gcd(int a, int b) {
int r;
if (a < b) {
r = a;
a = b;
b = r;
}
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
/*
int型の最小公倍数
*/
int lcm(int a, int b) {
int r = ll_gcd(a, b);
a /= r;
return a * b;
}
/*
long long型の最大公約数
*/
long long ll_gcd(long long a, long long b) {
long long r;
if (a < b) {
r = a;
a = b;
b = r;
}
r = a % b;
while (r != 0) {
a = b;
b = r;
r = a % b;
}
return b;
}
/*
long long型の最小公倍数
*/
long long ll_lcm(long long a, long long b) {
long long r = ll_gcd(a, b);
a /= r;
return a * b;
}
/*
int型の昇順ソート
*/
void sort_asc(int *a) {
qsort(a, sizeof(a)/sizeof(int), sizeof(int), asc);
}
/*
int型の降順ソート
*/
void sort_desc(int *a) {
qsort(a, sizeof(a)/sizeof(int), sizeof(int), desc);
}
/*
int型の昇順用比較関数
*/
int asc(const void *a, const void *b) {
return *(int *)a - *(int *)b;
}
/*
int型の降順用比較関数
*/
int desc(const void *a, const void *b) {
return *(int *)b - *(int *)a;
}
/*
long long型の昇順ソート
*/
void ll_sort_asc(long long *a) {
qsort(a, sizeof(a)/sizeof(long long), sizeof(long long), ll_asc);
}
/*
long long型の降順ソート
*/
void ll_sort_desc(long long *a) {
qsort(a, sizeof(a)/sizeof(long long), sizeof(long long), ll_desc);
}
/*
long long型の昇順用比較関数
*/
int ll_asc(const void *a, const void *b) {
long long *A = (long long *)a;
long long *B = (long long *)b;
if (*A > *B) return 1;
else if (*A < *B) return -1;
else return 0;
}
/*
long long型の降順用比較関数
*/
int ll_desc(const void *a, const void *b) {
long long *A = (long long *)a;
long long *B = (long long *)b;
if (*A < *B) return 1;
else if (*A > *B) return -1;
else return 0;
}
/*
弧度法を度数法に
*/
double to_deg(double rad) {
return rad * 180.0 / (atan(1.0) * 4.0);
}
/*
二点間の距離
*/
double distance(int xi, int yi, int xj, int yj) {
return hypot(xj - xi, yj - yi);
}
/*
組み合わせ用配列の初期化
*/
void initComb() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
/*
nCkの組み合わせ計算
*/
long long comb(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112560/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112560/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.7 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c"%c\0A\00", align 1
@fac = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@finv = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@inv = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i.i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #13
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i)
%0 = load i32, ptr %i.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #13
%div = sdiv i32 %0, 2
%rem = srem i32 %0, 2
%add = add nsw i32 %div, %rem
%call.i2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %add)
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @i_out(i32 noundef %i) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %i)
ret void
}
; Function Attrs: 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 @i_in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #13
ret i32 %0
}
; 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 i64 @ll_in() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #13
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @d_in() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #13
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local signext i8 @c_in() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !13
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #13
ret i8 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @s_in(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @ll_out(i64 noundef %i) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %i)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @d_out(double noundef %i) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, double noundef %i)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @c_out(i8 noundef signext %c) local_unnamed_addr #0 {
entry:
%conv = sext i8 %c to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %conv)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @s_out(ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %s)
ret void
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%spec.select = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%spec.select13 = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select, %spec.select13
%cmp1.not14 = icmp eq i32 %rem, 0
br i1 %cmp1.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.016 = phi i32 [ %rem2, %while.body ], [ %rem, %entry ]
%b.addr.115 = phi i32 [ %r.016, %while.body ], [ %spec.select13, %entry ]
%rem2 = srem i32 %b.addr.115, %r.016
%cmp1.not = icmp eq i32 %rem2, 0
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select13, %entry ], [ %r.016, %while.body ]
ret i32 %b.addr.1.lcssa
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64
%spec.select.i = tail call i64 @llvm.smax.i64(i64 %conv, i64 %conv1)
%spec.select13.i = tail call i64 @llvm.smin.i64(i64 %conv, i64 %conv1)
%rem.i = srem i64 %spec.select.i, %spec.select13.i
%cmp1.not14.i = icmp eq i64 %rem.i, 0
br i1 %cmp1.not14.i, label %ll_gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%r.016.i = phi i64 [ %rem2.i, %while.body.i ], [ %rem.i, %entry ]
%b.addr.115.i = phi i64 [ %r.016.i, %while.body.i ], [ %spec.select13.i, %entry ]
%rem2.i = srem i64 %b.addr.115.i, %r.016.i
%cmp1.not.i = icmp eq i64 %rem2.i, 0
br i1 %cmp1.not.i, label %ll_gcd.exit, label %while.body.i, !llvm.loop !16
ll_gcd.exit: ; preds = %while.body.i, %entry
%b.addr.1.lcssa.i = phi i64 [ %spec.select13.i, %entry ], [ %r.016.i, %while.body.i ]
%conv2 = trunc i64 %b.addr.1.lcssa.i to i32
%div = sdiv i32 %a, %conv2
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @ll_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%spec.select = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
%spec.select13 = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
%rem = srem i64 %spec.select, %spec.select13
%cmp1.not14 = icmp eq i64 %rem, 0
br i1 %cmp1.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.016 = phi i64 [ %rem2, %while.body ], [ %rem, %entry ]
%b.addr.115 = phi i64 [ %r.016, %while.body ], [ %spec.select13, %entry ]
%rem2 = srem i64 %b.addr.115, %r.016
%cmp1.not = icmp eq i64 %rem2, 0
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%b.addr.1.lcssa = phi i64 [ %spec.select13, %entry ], [ %r.016, %while.body ]
ret i64 %b.addr.1.lcssa
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @ll_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%spec.select.i = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
%spec.select13.i = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
%rem.i = srem i64 %spec.select.i, %spec.select13.i
%cmp1.not14.i = icmp eq i64 %rem.i, 0
br i1 %cmp1.not14.i, label %ll_gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%r.016.i = phi i64 [ %rem2.i, %while.body.i ], [ %rem.i, %entry ]
%b.addr.115.i = phi i64 [ %r.016.i, %while.body.i ], [ %spec.select13.i, %entry ]
%rem2.i = srem i64 %b.addr.115.i, %r.016.i
%cmp1.not.i = icmp eq i64 %rem2.i, 0
br i1 %cmp1.not.i, label %ll_gcd.exit, label %while.body.i, !llvm.loop !16
ll_gcd.exit: ; preds = %while.body.i, %entry
%b.addr.1.lcssa.i = phi i64 [ %spec.select13.i, %entry ], [ %r.016.i, %while.body.i ]
%div = sdiv i64 %a, %b.addr.1.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_asc(ptr noundef %a) local_unnamed_addr #0 {
entry:
tail call void @qsort(ptr noundef %a, i64 noundef 2, i64 noundef 4, ptr noundef nonnull @asc) #13
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort_desc(ptr noundef %a) local_unnamed_addr #0 {
entry:
tail call void @qsort(ptr noundef %a, i64 noundef 2, i64 noundef 4, ptr noundef nonnull @desc) #13
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @ll_sort_asc(ptr noundef %a) local_unnamed_addr #0 {
entry:
tail call void @qsort(ptr noundef %a, i64 noundef 1, i64 noundef 8, ptr noundef nonnull @ll_asc) #13
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ll_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @ll_sort_desc(ptr noundef %a) local_unnamed_addr #0 {
entry:
tail call void @qsort(ptr noundef %a, i64 noundef 1, i64 noundef 8, ptr noundef nonnull @ll_desc) #13
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ll_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @to_deg(double noundef %rad) local_unnamed_addr #6 {
entry:
%mul = fmul double %rad, 1.800000e+02
%div = fdiv double %mul, 0x400921FB54442D18
ret double %div
}
; Function Attrs: nounwind uwtable
define dso_local double @distance(i32 noundef %xi, i32 noundef %yi, i32 noundef %xj, i32 noundef %yj) local_unnamed_addr #7 {
entry:
%sub = sub nsw i32 %xj, %xi
%conv = sitofp i32 %sub to double
%sub1 = sub nsw i32 %yj, %yi
%conv2 = sitofp i32 %sub1 to double
%call = tail call double @hypot(double noundef %conv, double noundef %conv2) #13
ret double %call
}
; Function Attrs: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #8
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initComb() local_unnamed_addr #9 {
entry:
store i64 1, ptr getelementptr inbounds ([1000000 x i64], ptr @fac, i64 0, i64 1), align 8, !tbaa !9
store i64 1, ptr @fac, align 16, !tbaa !9
store i64 1, ptr getelementptr inbounds ([1000000 x i64], ptr @finv, i64 0, i64 1), align 8, !tbaa !9
store i64 1, ptr @finv, align 16, !tbaa !9
store i64 1, ptr getelementptr inbounds ([1000000 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !9
br label %for.body
for.cond.cleanup: ; preds = %for.body
ret void
for.body: ; preds = %entry, %for.body
%0 = phi i64 [ 1, %entry ], [ %rem18, %for.body ]
%1 = phi i64 [ 1, %entry ], [ %rem, %for.body ]
%indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %for.body ]
%mul = mul nsw i64 %1, %indvars.iv
%rem = srem i64 %mul, 1000000007
%arrayidx2 = getelementptr inbounds [1000000 x i64], ptr @fac, i64 0, i64 %indvars.iv
store i64 %rem, ptr %arrayidx2, align 8, !tbaa !9
%2 = trunc i64 %indvars.iv to i32
%rem3 = urem i32 1000000007, %2
%idxprom4 = zext i32 %rem3 to i64
%arrayidx5 = getelementptr inbounds [1000000 x i64], ptr @inv, i64 0, i64 %idxprom4
%3 = load i64, ptr %arrayidx5, align 8, !tbaa !9
%div = udiv i32 1000000007, %2
%conv6 = zext i32 %div to i64
%mul7 = mul nsw i64 %3, %conv6
%rem8 = srem i64 %mul7, 1000000007
%sub9 = sub nsw i64 1000000007, %rem8
%arrayidx11 = getelementptr inbounds [1000000 x i64], ptr @inv, i64 0, i64 %indvars.iv
store i64 %sub9, ptr %arrayidx11, align 8, !tbaa !9
%mul17 = mul nuw nsw i64 %sub9, %0
%rem18 = urem i64 %mul17, 1000000007
%arrayidx20 = getelementptr inbounds [1000000 x i64], ptr @finv, i64 0, i64 %indvars.iv
store i64 %rem18, ptr %arrayidx20, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000000
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !17
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @comb(i32 noundef %n, i32 noundef %k) local_unnamed_addr #10 {
entry:
%cmp = icmp sge i32 %n, %k
%0 = or i32 %k, %n
%or.cond.not = icmp sgt i32 %0, -1
%or.cond = and i1 %cmp, %or.cond.not
br i1 %or.cond, label %if.end4, label %return
if.end4: ; preds = %entry
%idxprom = zext i32 %n to i64
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @fac, i64 0, i64 %idxprom
%1 = load i64, ptr %arrayidx, align 8, !tbaa !9
%idxprom5 = zext i32 %k to i64
%arrayidx6 = getelementptr inbounds [1000000 x i64], ptr @finv, i64 0, i64 %idxprom5
%2 = load i64, ptr %arrayidx6, align 8, !tbaa !9
%sub = sub nsw i32 %n, %k
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds [1000000 x i64], ptr @finv, i64 0, i64 %idxprom7
%3 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%mul = mul nsw i64 %3, %2
%rem = srem i64 %mul, 1000000007
%mul9 = mul nsw i64 %rem, %1
%rem10 = srem i64 %mul9, 1000000007
br label %return
return: ; preds = %entry, %if.end4
%retval.0 = phi i64 [ %rem10, %if.end4 ], [ 0, %entry ]
ret i64 %retval.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 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress 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 #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 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 #10 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind }
attributes #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
|
#include <stdio.h>
int main(void)
{
int N;
scanf("%d\n",&N);
if(N%2==0) printf("%d\n",N/2);
else printf("%d\n",N/2+1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112610/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112610/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%add.sink = add nsw i32 %div, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add.sink)
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(void){
int n;
scanf("%d",&n);
if(n%2==0)
printf("%d",n/2);
else
printf("%d",n/2+1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112654/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%add.sink = add nsw i32 %div, %1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
const int MOD = 1000000007;
int main()
{
int n = 0;
scanf("%d", &n);
n++;
n /= 2;
printf("%d",n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112698/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112698/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@MOD = dso_local local_unnamed_addr constant i32 1000000007, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; 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) #3
store i32 0, ptr %n, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
%div = sdiv i32 %inc, 2
store i32 %div, ptr %n, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
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(void){
int N,a=0;
scanf("%d",&N);
if(N%2==1)
++a;
a+=N/2;
printf("%d",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112740/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = and i32 %0, -2147483647
%cmp = icmp eq i32 %1, 1
%spec.select = zext i1 %cmp to i32
%div = sdiv i32 %0, 2
%add = add nsw i32 %div, %spec.select
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int n ;
scanf("%d", &n);
if(n % 2 ==1) {
n++;
}
printf("%d", n/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112784/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112784/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, -2147483647
%cmp = icmp eq i32 %1, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%inc = add nuw nsw i32 %0, 1
store i32 %inc, ptr %n, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %inc, %if.then ], [ %0, %entry ]
%div = sdiv i32 %2, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
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>
#define MAX 1000
int main(void)
{
int i;
while (1){
char in_str[MAX];
scanf("%s", in_str);
if (in_str[0] == '0'){
break;
}
int sum = 0;
for (i = 0; i < MAX; i++){
if (in_str[i] == '\0'){
break;
}
int in_num = in_str[i] - '0';
sum += in_num;
}
printf("%d\n", sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112827/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112827/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%in_str = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %in_str) #3
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in_str)
%0 = load i8, ptr %in_str, align 16, !tbaa !5
%cmp24 = icmp eq i8 %0, 48
br i1 %cmp24, label %while.end, label %for.body
for.body: ; preds = %entry, %for.body.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.body.backedge ], [ 0, %entry ]
%sum.022 = phi i32 [ %sum.022.be, %for.body.backedge ], [ 0, %entry ]
%arrayidx4 = getelementptr inbounds [1000 x i8], ptr %in_str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%cmp6 = icmp eq i8 %1, 0
br i1 %cmp6, label %cleanup, label %if.end9
if.end9: ; preds = %for.body
%conv5 = sext i8 %1 to i32
%sub = add i32 %sum.022, -48
%add = add i32 %sub, %conv5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000
br i1 %exitcond.not, label %cleanup, label %for.body.backedge
for.body.backedge: ; preds = %if.end9, %cleanup
%indvars.iv.be = phi i64 [ %indvars.iv.next, %if.end9 ], [ 0, %cleanup ]
%sum.022.be = phi i32 [ %add, %if.end9 ], [ 0, %cleanup ]
br label %for.body, !llvm.loop !8
cleanup: ; preds = %if.end9, %for.body
%sum.0.lcssa = phi i32 [ %add, %if.end9 ], [ %sum.022, %for.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %in_str) #3
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %in_str) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in_str)
%2 = load i8, ptr %in_str, align 16, !tbaa !5
%cmp = icmp eq i8 %2, 48
br i1 %cmp, label %while.end, label %for.body.backedge
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %in_str) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define BUFMAX 1002
int main(void){
int sum,i;
char buf[BUFMAX];
while(fgets(buf,sizeof(buf),stdin)!=NULL){
if(buf[0]=='0')break;
for(i=0,sum=0;buf[i]!='\n';i++){
sum+=(buf[i]-'0');
}
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%buf = alloca [1002 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1002, ptr nonnull %buf) #3
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call17 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 1002, ptr noundef %0)
%cmp18 = icmp eq ptr %call17, null
%1 = load i8, ptr %buf, align 16
%cmp119 = icmp eq i8 %1, 48
%or.cond20 = select i1 %cmp18, i1 true, i1 %cmp119
br i1 %or.cond20, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%2 = phi i8 [ %6, %for.end ], [ %1, %entry ]
%cmp5.not14 = icmp eq i8 %2, 10
br i1 %cmp5.not14, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%3 = phi i8 [ %4, %for.body ], [ %2, %for.cond.preheader ]
%sum.015 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%conv4 = sext i8 %3 to i32
%sub = add i32 %sum.015, -48
%add = add i32 %sub, %conv4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [1002 x i8], ptr %buf, i64 0, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx3, align 1, !tbaa !9
%cmp5.not = icmp eq i8 %4, 10
br i1 %cmp5.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 1002, ptr noundef %5)
%cmp = icmp eq ptr %call, null
%6 = load i8, ptr %buf, align 16
%cmp1 = icmp eq i8 %6, 48
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
br i1 %or.cond, label %while.end, label %for.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1002, ptr nonnull %buf) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(void)
{
int i, sum;
char number[1001];
while (1) {
i = 0;
sum = 0;
scanf("%s", number);
if (number[0] == '0')
break;
while (number[i] != '\0') {
sum += number[i] - '0';
i++;
}
printf("%d\n", sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%number = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %number) #3
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%0 = load i8, ptr %number, align 16, !tbaa !5
%cmp20 = icmp eq i8 %0, 48
br i1 %cmp20, label %while.end12, label %while.cond2.preheader
while.cond2.preheader: ; preds = %entry, %while.end
%1 = phi i8 [ %4, %while.end ], [ %0, %entry ]
%cmp5.not16 = icmp eq i8 %1, 0
br i1 %cmp5.not16, label %while.end, label %while.body7
while.body7: ; preds = %while.cond2.preheader, %while.body7
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body7 ], [ 0, %while.cond2.preheader ]
%2 = phi i8 [ %3, %while.body7 ], [ %1, %while.cond2.preheader ]
%sum.018 = phi i32 [ %add, %while.body7 ], [ 0, %while.cond2.preheader ]
%conv4 = sext i8 %2 to i32
%sub = add i32 %sum.018, -48
%add = add i32 %sub, %conv4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [1001 x i8], ptr %number, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5.not = icmp eq i8 %3, 0
br i1 %cmp5.not, label %while.end, label %while.body7, !llvm.loop !8
while.end: ; preds = %while.body7, %while.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %while.cond2.preheader ], [ %add, %while.body7 ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%4 = load i8, ptr %number, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %while.end12, label %while.cond2.preheader
while.end12: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %number) #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"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int i=0,number;
char num[1001]={0};
while(1){
number = 0;
scanf("%s",num);
if(num[0]=='0') break;
for(i=0; num[i]!='\0'; i++){ //ヌル文字と会うまで繰り返す。
number += num[i]-'0';
}
printf("%d\n",number);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_112971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_112971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%num = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %num) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1001) %num, i8 0, i64 1001, i1 false)
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i8, ptr %num, align 16, !tbaa !5
%cmp17 = icmp eq i8 %0, 48
br i1 %cmp17, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i8 [ %4, %for.end ], [ %0, %entry ]
%cmp4.not13 = icmp eq i8 %1, 0
br i1 %cmp4.not13, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%2 = phi i8 [ %3, %for.body ], [ %1, %for.cond.preheader ]
%number.015 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%conv3 = sext i8 %2 to i32
%sub = add i32 %number.015, -48
%add = add i32 %sub, %conv3
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds [1001 x i8], ptr %num, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4.not = icmp eq i8 %3, 0
br i1 %cmp4.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %for.cond.preheader
%number.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %number.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%4 = load i8, ptr %num, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
char s[1000]={'\0'};
int i;
for(;;){
int sum=0;
scanf("%s",s);
for(i=0;i<1000 && s[i]!='\0';i++)
sum+=s[i]-'0';
if(sum==0)
break;
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113020/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113020/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %s, i8 0, i64 1000, i1 false)
br label %for.cond
for.cond: ; preds = %cleanup, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
br label %land.rhs
land.rhs: ; preds = %for.body.3, %for.cond
%indvars.iv = phi i64 [ 0, %for.cond ], [ %indvars.iv.next.3, %for.body.3 ]
%sum.021 = phi i32 [ 0, %for.cond ], [ %add.3, %for.body.3 ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !5
%cmp2.not = icmp eq i8 %0, 0
br i1 %cmp2.not, label %for.end, label %for.body
for.body: ; preds = %land.rhs
%conv = sext i8 %0 to i32
%sub = add i32 %sum.021, -48
%add = add i32 %sub, %conv
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp2.not.1 = icmp eq i8 %1, 0
br i1 %cmp2.not.1, label %for.end, label %for.body.1
for.body.1: ; preds = %for.body
%conv.1 = sext i8 %1 to i32
%sub.1 = add i32 %add, -48
%add.1 = add i32 %sub.1, %conv.1
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next.1
%2 = load i8, ptr %arrayidx.2, align 2, !tbaa !5
%cmp2.not.2 = icmp eq i8 %2, 0
br i1 %cmp2.not.2, label %for.end, label %for.body.2
for.body.2: ; preds = %for.body.1
%conv.2 = sext i8 %2 to i32
%sub.2 = add i32 %add.1, -48
%add.2 = add i32 %sub.2, %conv.2
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [1000 x i8], ptr %s, i64 0, i64 %indvars.iv.next.2
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%cmp2.not.3 = icmp eq i8 %3, 0
br i1 %cmp2.not.3, label %for.end, label %for.body.3
for.body.3: ; preds = %for.body.2
%conv.3 = sext i8 %3 to i32
%sub.3 = add i32 %add.2, -48
%add.3 = add i32 %sub.3, %conv.3
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 1000
br i1 %exitcond.not.3, label %for.end, label %land.rhs, !llvm.loop !8
for.end: ; preds = %for.body.3, %for.body.2, %for.body.1, %for.body, %land.rhs
%sum.0.lcssa = phi i32 [ %sum.021, %land.rhs ], [ %add, %for.body ], [ %add.1, %for.body.1 ], [ %add.2, %for.body.2 ], [ %add.3, %for.body.3 ]
%cmp7 = icmp eq i32 %sum.0.lcssa, 0
br i1 %cmp7, label %for.end10, label %cleanup
cleanup: ; preds = %for.end
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
br label %for.cond
for.end10: ; preds = %for.end
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
long long ans=0,tmp=0;
char s[200020];
scanf("%s",s);
for (int i=0; i<strlen(s); i++){
if (s[i]=='B'){
tmp++;
} else {
ans+=tmp;
}
}
printf("%lld\n",ans);
return 0 ;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113079/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113079/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [200020 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200020, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%cmp13.not = icmp eq i64 %call2, 0
br i1 %cmp13.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call2, 1
%0 = icmp eq i64 %call2, 1
br i1 %0, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call2, -2
br label %for.body
for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%ans.1.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %ans.1.1, %for.body ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
%tmp.015.unr = phi i64 [ 0, %for.body.preheader ], [ %tmp.1.1, %for.body ]
%ans.014.unr = phi i64 [ 0, %for.body.preheader ], [ %ans.1.1, %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
%arrayidx.epil = getelementptr inbounds [200020 x i8], ptr %s, i64 0, i64 %indvars.iv.unr
%1 = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
%cmp5.epil = icmp eq i8 %1, 66
%add.epil = select i1 %cmp5.epil, i64 0, i64 %tmp.015.unr
%ans.1.epil = add nuw nsw i64 %add.epil, %ans.014.unr
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.epil, %for.cond.cleanup.loopexit.unr-lcssa, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %ans.1.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body.epil ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200020, ptr nonnull %s) #4
ret i32 0
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
%tmp.015 = phi i64 [ 0, %for.body.preheader.new ], [ %tmp.1.1, %for.body ]
%ans.014 = phi i64 [ 0, %for.body.preheader.new ], [ %ans.1.1, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
%arrayidx = getelementptr inbounds [200020 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 2, !tbaa !5
%cmp5 = icmp eq i8 %2, 66
%add = select i1 %cmp5, i64 0, i64 %tmp.015
%ans.1 = add nuw nsw i64 %add, %ans.014
%inc = zext i1 %cmp5 to i64
%tmp.1 = add nuw nsw i64 %tmp.015, %inc
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [200020 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp5.1 = icmp eq i8 %3, 66
%add.1 = select i1 %cmp5.1, i64 0, i64 %tmp.1
%ans.1.1 = add nuw nsw i64 %add.1, %ans.1
%inc.1 = zext i1 %cmp5.1 to i64
%tmp.1.1 = add nuw nsw i64 %tmp.1, %inc.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !8
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#define int long long
signed main(){
int N, i, now, ans = 0;
char *S = (char *)malloc(sizeof(char) * 200001);
scanf("%s", S);
for(N = 0; S[N] != '\0'; N++);
for(i = 0, now = 0; i < N; i++){
if(S[i] == 'W'){
ans += i - now;
now++;
}
}
printf("%lld\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113121/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113121/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(200001) ptr @malloc(i64 noundef 200001) #3
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call)
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%N.0 = phi i64 [ 0, %entry ], [ %inc, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %call, i64 %N.0
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 0
%inc = add nuw nsw i64 %N.0, 1
br i1 %cmp.not, label %for.cond3.preheader, label %for.cond, !llvm.loop !8
for.cond3.preheader: ; preds = %for.cond
%cmp425.not = icmp eq i64 %N.0, 0
br i1 %cmp425.not, label %for.end14, label %for.body6.preheader
for.body6.preheader: ; preds = %for.cond3.preheader
%xtraiter = and i64 %N.0, 1
%1 = icmp eq i64 %N.0, 1
br i1 %1, label %for.end14.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %N.0, 9223372036854775806
br label %for.body6
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%ans.028 = phi i64 [ 0, %for.body6.preheader.new ], [ %ans.1.1, %for.body6 ]
%now.027 = phi i64 [ 0, %for.body6.preheader.new ], [ %now.1.1, %for.body6 ]
%i.026 = phi i64 [ 0, %for.body6.preheader.new ], [ %inc13.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx7 = getelementptr inbounds i8, ptr %call, i64 %i.026
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp9 = icmp eq i8 %2, 87
%sub = sub nsw i64 %i.026, %now.027
%inc11 = zext i1 %cmp9 to i64
%now.1 = add nuw nsw i64 %now.027, %inc11
%add = select i1 %cmp9, i64 %sub, i64 0
%ans.1 = add nsw i64 %add, %ans.028
%inc13 = or i64 %i.026, 1
%arrayidx7.1 = getelementptr inbounds i8, ptr %call, i64 %inc13
%3 = load i8, ptr %arrayidx7.1, align 1, !tbaa !5
%cmp9.1 = icmp eq i8 %3, 87
%sub.1 = sub nsw i64 %inc13, %now.1
%inc11.1 = zext i1 %cmp9.1 to i64
%now.1.1 = add nuw nsw i64 %now.1, %inc11.1
%add.1 = select i1 %cmp9.1, i64 %sub.1, i64 0
%ans.1.1 = add nsw i64 %add.1, %ans.1
%inc13.1 = add nuw nsw i64 %i.026, 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.end14.loopexit.unr-lcssa, label %for.body6, !llvm.loop !10
for.end14.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%ans.1.lcssa.ph = phi i64 [ undef, %for.body6.preheader ], [ %ans.1.1, %for.body6 ]
%ans.028.unr = phi i64 [ 0, %for.body6.preheader ], [ %ans.1.1, %for.body6 ]
%now.027.unr = phi i64 [ 0, %for.body6.preheader ], [ %now.1.1, %for.body6 ]
%i.026.unr = phi i64 [ 0, %for.body6.preheader ], [ %inc13.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end14, label %for.body6.epil
for.body6.epil: ; preds = %for.end14.loopexit.unr-lcssa
%arrayidx7.epil = getelementptr inbounds i8, ptr %call, i64 %i.026.unr
%4 = load i8, ptr %arrayidx7.epil, align 1, !tbaa !5
%cmp9.epil = icmp eq i8 %4, 87
%sub.epil = sub nsw i64 %i.026.unr, %now.027.unr
%add.epil = select i1 %cmp9.epil, i64 %sub.epil, i64 0
%ans.1.epil = add nsw i64 %add.epil, %ans.028.unr
br label %for.end14
for.end14: ; preds = %for.body6.epil, %for.end14.loopexit.unr-lcssa, %for.cond3.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond3.preheader ], [ %ans.1.lcssa.ph, %for.end14.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body6.epil ]
%call15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="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 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include<stdio.h>
#define N 36
struct card{
char mark;
int value;
};
int n;
int isStable(struct card in[],struct card out[]){
int i,j,a,b;
for(i = 0; i < n; i++){
for(j = i+1; j < n; j++){
for(a = 0; a < n; a++){
for(b = a+1; b < n; b++){
if((in[i].value == in[j].value) && ((in[i].value == out[b].value && in[i].mark == out[b].mark) && (in[j].value == out[a].value && in[j].mark == out[a].mark))) return 0;
}
}
}
}
return 1;
}
void bubbleSort(struct card A[],int n){
int i,j;
int flag;
struct card swap;
flag = 1;
i = 0;
while(flag){
flag = 0;
for(j = n - 1; j >= i + 1; j--){
if(A[j].value < A[j - 1].value){
swap = A[j];
A[j] = A[j - 1];
A[j - 1] = swap;
flag = 1;
}
}
i++;
}
}
void selectionSort(struct card A[],int n){
int i,j,minj;
struct card swap;
for(i = 0; i <= n - 1; i++){
minj = i;
for(j = i; j <= n - 1; j++){
if(A[j].value < A[minj].value) {
minj = j;
}
}
swap = A[i];
A[i] = A[minj];
A[minj] = swap;
}
}
int main(){
int i;
struct card C[N];
struct card D[N];
scanf("%d",&n);
for(i = 0; i < n; i++){
scanf(" %c",&C[i].mark);
scanf("%d",&C[i].value);
D[i] = C[i];
}
bubbleSort(C,n);
for(i = 0; i < n; i++){
if(i == n - 1) printf("%c%d",C[i].mark,C[i].value);
else
printf("%c%d ",C[i].mark,C[i].value);
}
printf("\nStable\n");
selectionSort(D,n);
for(i = 0; i < n; i++){
if(i == n - 1) printf("%c%d",D[i].mark,D[i].value);
else
printf("%c%d ",D[i].mark,D[i].value);
}
if(isStable(C,D) == 1) printf("\nStable\n");
else printf("\nNot stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113165/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113165/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i32 }
@n = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@str.6 = private unnamed_addr constant [12 x i8] c"\0ANot stable\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %in, ptr nocapture noundef readonly %out) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp101 = icmp sgt i32 %0, 0
br i1 %cmp101, label %for.body.us.preheader, label %cleanup
for.body.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%wide.trip.count124 = zext i32 %0 to i64
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond.loopexit.us
%indvars.iv121 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next122, %for.cond.loopexit.us ]
%indvars.iv114 = phi i64 [ 1, %for.body.us.preheader ], [ %indvars.iv.next115, %for.cond.loopexit.us ]
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%cmp293.us = icmp ult i64 %indvars.iv.next122, %1
br i1 %cmp293.us, label %for.cond4.preheader.lr.ph.us, label %for.cond.loopexit.us
for.cond.loopexit.us: ; preds = %for.cond4.for.inc54_crit_edge.us.us, %for.body.us
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%exitcond125.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count124
br i1 %exitcond125.not, label %cleanup, label %for.body.us, !llvm.loop !9
for.cond4.preheader.lr.ph.us: ; preds = %for.body.us
%arrayidx.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv121
%value.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv121, i32 1
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.for.inc54_crit_edge.us.us, %for.cond4.preheader.lr.ph.us
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.cond4.for.inc54_crit_edge.us.us ], [ %indvars.iv114, %for.cond4.preheader.lr.ph.us ]
%arrayidx12.us.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv116
%value13.us.us = getelementptr inbounds %struct.card, ptr %in, i64 %indvars.iv116, i32 1
br label %for.body6.us.us
for.body6.us.us: ; preds = %for.cond4.loopexit.us.us, %for.cond4.preheader.us.us
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.cond4.loopexit.us.us ], [ 0, %for.cond4.preheader.us.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond4.loopexit.us.us ], [ 1, %for.cond4.preheader.us.us ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%cmp989.us.us = icmp ult i64 %indvars.iv.next110, %1
br i1 %cmp989.us.us, label %for.body10.lr.ph.us.us, label %for.cond4.loopexit.us.us
for.cond4.loopexit.us.us: ; preds = %for.inc.us.us.us, %for.body10.lr.ph.us.us, %for.body6.us.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond113.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count124
br i1 %exitcond113.not, label %for.cond4.for.inc54_crit_edge.us.us, label %for.body6.us.us, !llvm.loop !11
for.body10.lr.ph.us.us: ; preds = %for.body6.us.us
%2 = load i32, ptr %value.us, align 4, !tbaa !12
%3 = load i32, ptr %value13.us.us, align 4, !tbaa !12
%cmp14.us.us = icmp eq i32 %2, %3
%value37.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv109, i32 1
%arrayidx36.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv109
br i1 %cmp14.us.us, label %for.body10.us.us.us, label %for.cond4.loopexit.us.us
for.body10.us.us.us: ; preds = %for.body10.lr.ph.us.us, %for.inc.us.us.us
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.inc.us.us.us ], [ %indvars.iv, %for.body10.lr.ph.us.us ]
%value20.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv106, i32 1
%4 = load i32, ptr %value20.us.us.us, align 4, !tbaa !12
%cmp21.us.us.us = icmp eq i32 %2, %4
br i1 %cmp21.us.us.us, label %land.lhs.true22.us.us.us, label %for.inc.us.us.us
land.lhs.true22.us.us.us: ; preds = %for.body10.us.us.us
%arrayidx19.us.us.us = getelementptr inbounds %struct.card, ptr %out, i64 %indvars.iv106
%5 = load i8, ptr %arrayidx.us, align 4, !tbaa !14
%6 = load i8, ptr %arrayidx19.us.us.us, align 4, !tbaa !14
%cmp29.us.us.us = icmp eq i8 %5, %6
br i1 %cmp29.us.us.us, label %land.lhs.true31.us.us.us, label %for.inc.us.us.us
land.lhs.true31.us.us.us: ; preds = %land.lhs.true22.us.us.us
%7 = load i32, ptr %value37.us.us, align 4, !tbaa !12
%cmp38.us.us.us = icmp eq i32 %2, %7
br i1 %cmp38.us.us.us, label %land.lhs.true40.us.us.us, label %for.inc.us.us.us
land.lhs.true40.us.us.us: ; preds = %land.lhs.true31.us.us.us
%8 = load i8, ptr %arrayidx12.us.us, align 4, !tbaa !14
%9 = load i8, ptr %arrayidx36.us.us, align 4, !tbaa !14
%cmp49.us.us.us = icmp eq i8 %8, %9
br i1 %cmp49.us.us.us, label %cleanup, label %for.inc.us.us.us
for.inc.us.us.us: ; preds = %land.lhs.true40.us.us.us, %land.lhs.true31.us.us.us, %land.lhs.true22.us.us.us, %for.body10.us.us.us
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%exitcond.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count124
br i1 %exitcond.not, label %for.cond4.loopexit.us.us, label %for.body10.us.us.us, !llvm.loop !15
for.cond4.for.inc54_crit_edge.us.us: ; preds = %for.cond4.loopexit.us.us
%indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
%exitcond120.not = icmp eq i64 %indvars.iv.next117, %wide.trip.count124
br i1 %exitcond120.not, label %for.cond.loopexit.us, label %for.cond4.preheader.us.us, !llvm.loop !16
cleanup: ; preds = %for.cond.loopexit.us, %land.lhs.true40.us.us.us, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %land.lhs.true40.us.us.us ], [ 1, %for.cond.loopexit.us ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubbleSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #2 {
entry:
%0 = sext i32 %n to i64
br label %for.cond.preheader
while.cond.loopexit: ; preds = %for.inc
%tobool.not = icmp eq i32 %flag.2, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !17
for.cond.preheader: ; preds = %entry, %while.cond.loopexit
%indvars.iv38 = phi i64 [ 0, %entry ], [ %indvars.iv.next39, %while.cond.loopexit ]
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%cmp.not.not30 = icmp slt i64 %indvars.iv.next39, %0
br i1 %cmp.not.not30, label %for.body, label %while.end
for.body: ; preds = %for.cond.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond.preheader ]
%flag.132 = phi i32 [ %flag.2, %for.inc ], [ 0, %for.cond.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i32, ptr %value, align 4, !tbaa !12
%2 = add nsw i64 %indvars.iv, -2
%value4 = getelementptr inbounds %struct.card, ptr %A, i64 %2, i32 1
%3 = load i32, ptr %value4, align 4, !tbaa !12
%cmp5 = icmp slt i32 %1, %3
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %for.body
%arrayidx3 = getelementptr inbounds %struct.card, ptr %A, i64 %2
%4 = load <2 x i64>, ptr %arrayidx3, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx3, align 4
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%flag.2 = phi i32 [ 1, %if.then ], [ %flag.132, %for.body ]
%cmp.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next39
br i1 %cmp.not.not, label %for.body, label %while.cond.loopexit, !llvm.loop !18
while.end: ; preds = %for.cond.preheader, %while.cond.loopexit
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @selectionSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp.not.not38 = icmp sgt i32 %n, 0
br i1 %cmp.not.not38, label %for.cond1.preheader.preheader, label %for.end19
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body4
for.body4: ; preds = %for.cond1.preheader, %for.body4
%indvars.iv40 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next41, %for.body4 ]
%minj.037 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body4 ]
%value = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv40, i32 1
%2 = load i32, ptr %value, align 4, !tbaa !12
%idxprom5 = sext i32 %minj.037 to i64
%value7 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom5, i32 1
%3 = load i32, ptr %value7, align 4, !tbaa !12
%cmp8 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv40 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.037
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%cmp3.not.not = icmp ult i64 %indvars.iv.next41, %0
br i1 %cmp3.not.not, label %for.body4, label %for.end, !llvm.loop !19
for.end: ; preds = %for.body4
%arrayidx10 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%5 = load i64, ptr %arrayidx10, align 4
%idxprom13 = sext i32 %spec.select to i64
%arrayidx14 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom13
%6 = load i64, ptr %arrayidx14, align 4
store i64 %6, ptr %arrayidx10, align 4
store i64 %5, ptr %arrayidx14, align 4
%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.end19, label %for.cond1.preheader, !llvm.loop !20
for.end19: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%C = alloca [36 x %struct.card], align 16
%D = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C) #7
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %D) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp104 = icmp sgt i32 %0, 0
br i1 %cmp104, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%value = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %value)
%arrayidx6 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv
%1 = load i64, ptr %arrayidx, align 8
store i64 %1, ptr %arrayidx6, align 8
%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 !21
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %3, %for.body ]
%4 = phi i32 [ %0, %entry.for.end_crit_edge ], [ %2, %for.body ]
%smax = call i64 @llvm.smax.i64(i64 %.pre-phi, i64 1)
%5 = add nsw i64 %smax, -1
br label %for.cond.preheader.i
while.cond.loopexit.i: ; preds = %for.inc.i
%tobool.not.i = icmp eq i32 %flag.2.i, 0
br i1 %tobool.not.i, label %bubbleSort.exit, label %for.cond.preheader.i, !llvm.loop !17
for.cond.preheader.i: ; preds = %while.cond.loopexit.i, %for.end
%indvars.iv38.i = phi i64 [ 0, %for.end ], [ %indvars.iv.next39.i, %while.cond.loopexit.i ]
%indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1
%exitcond.not = icmp eq i64 %indvars.iv38.i, %5
br i1 %exitcond.not, label %bubbleSort.exit, label %for.body.i
for.body.i: ; preds = %for.cond.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %.pre-phi, %for.cond.preheader.i ]
%flag.132.i = phi i32 [ %flag.2.i, %for.inc.i ], [ 0, %for.cond.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv.next.i, i32 1
%6 = load i32, ptr %value.i, align 4, !tbaa !12
%7 = add nsw i64 %indvars.iv.i, -2
%value4.i = getelementptr inbounds %struct.card, ptr %C, i64 %7, i32 1
%8 = load i32, ptr %value4.i, align 4, !tbaa !12
%cmp5.i = icmp slt i32 %6, %8
br i1 %cmp5.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%arrayidx3.i = getelementptr inbounds %struct.card, ptr %C, i64 %7
%9 = load <2 x i64>, ptr %arrayidx3.i, align 8
%10 = shufflevector <2 x i64> %9, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %10, ptr %arrayidx3.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i
%flag.2.i = phi i32 [ 1, %if.then.i ], [ %flag.132.i, %for.body.i ]
%cmp.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next39.i
br i1 %cmp.not.not.i, label %for.body.i, label %while.cond.loopexit.i, !llvm.loop !18
bubbleSort.exit: ; preds = %while.cond.loopexit.i, %for.cond.preheader.i
%cmp10106 = icmp sgt i32 %4, 0
br i1 %cmp10106, label %for.body11, label %for.end30
for.body11: ; preds = %bubbleSort.exit, %for.body11
%indvars.iv114 = phi i64 [ %indvars.iv.next115, %for.body11 ], [ 0, %bubbleSort.exit ]
%11 = phi i32 [ %15, %for.body11 ], [ %4, %bubbleSort.exit ]
%sub = add nsw i32 %11, -1
%12 = zext i32 %sub to i64
%cmp12 = icmp eq i64 %indvars.iv114, %12
%arrayidx14 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv114
%13 = load i8, ptr %arrayidx14, align 8, !tbaa !14
%conv = sext i8 %13 to i32
%value18 = getelementptr inbounds [36 x %struct.card], ptr %C, i64 0, i64 %indvars.iv114, i32 1
%14 = load i32, ptr %value18, align 4, !tbaa !12
%.str.2..str.3 = select i1 %cmp12, ptr @.str.2, ptr @.str.3
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %conv, i32 noundef %14)
%indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp10 = icmp slt i64 %indvars.iv.next115, %16
br i1 %cmp10, label %for.body11, label %for.end30, !llvm.loop !22
for.end30: ; preds = %for.body11, %bubbleSort.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%17 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not38.i = icmp sgt i32 %17, 0
br i1 %cmp.not.not38.i, label %for.cond1.preheader.preheader.i, label %if.end71
for.cond1.preheader.preheader.i: ; preds = %for.end30
%18 = zext i32 %17 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i95 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i97, %for.end.i ]
%19 = trunc i64 %indvars.iv.i95 to i32
br label %for.body4.i
for.body4.i: ; preds = %for.body4.i, %for.cond1.preheader.i
%indvars.iv40.i = phi i64 [ %indvars.iv.i95, %for.cond1.preheader.i ], [ %indvars.iv.next41.i, %for.body4.i ]
%minj.037.i = phi i32 [ %19, %for.cond1.preheader.i ], [ %spec.select.i, %for.body4.i ]
%value.i96 = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv40.i, i32 1
%20 = load i32, ptr %value.i96, align 4, !tbaa !12
%idxprom5.i = sext i32 %minj.037.i to i64
%value7.i = getelementptr inbounds %struct.card, ptr %D, i64 %idxprom5.i, i32 1
%21 = load i32, ptr %value7.i, align 4, !tbaa !12
%cmp8.i = icmp slt i32 %20, %21
%22 = trunc i64 %indvars.iv40.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %22, i32 %minj.037.i
%indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1
%cmp3.not.not.i = icmp ult i64 %indvars.iv.next41.i, %18
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.end.i, !llvm.loop !19
for.end.i: ; preds = %for.body4.i
%arrayidx10.i = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv.i95
%23 = load i64, ptr %arrayidx10.i, align 8
%idxprom13.i = sext i32 %spec.select.i to i64
%arrayidx14.i = getelementptr inbounds %struct.card, ptr %D, i64 %idxprom13.i
%24 = load i64, ptr %arrayidx14.i, align 8
store i64 %24, ptr %arrayidx10.i, align 8
store i64 %23, ptr %arrayidx14.i, align 8
%indvars.iv.next.i97 = add nuw nsw i64 %indvars.iv.i95, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i97, %18
br i1 %exitcond.not.i, label %selectionSort.exit, label %for.cond1.preheader.i, !llvm.loop !20
selectionSort.exit: ; preds = %for.end.i
br i1 %cmp.not.not38.i, label %for.body36, label %if.end71
for.body36: ; preds = %selectionSort.exit, %for.body36
%indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.body36 ], [ 0, %selectionSort.exit ]
%25 = phi i32 [ %29, %for.body36 ], [ %17, %selectionSort.exit ]
%sub37 = add nsw i32 %25, -1
%26 = zext i32 %sub37 to i64
%cmp38 = icmp eq i64 %indvars.iv117, %26
%arrayidx42 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv117
%27 = load i8, ptr %arrayidx42, align 8, !tbaa !14
%conv44 = sext i8 %27 to i32
%value47 = getelementptr inbounds [36 x %struct.card], ptr %D, i64 0, i64 %indvars.iv117, i32 1
%28 = load i32, ptr %value47, align 4, !tbaa !12
%.str.2..str.3125 = select i1 %cmp38, ptr @.str.2, ptr @.str.3
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3125, i32 noundef %conv44, i32 noundef %28)
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp34 = icmp slt i64 %indvars.iv.next118, %30
br i1 %cmp34, label %for.body36, label %for.end61, !llvm.loop !23
for.end61: ; preds = %for.body36
%cmp101.i = icmp sgt i32 %29, 0
br i1 %cmp101.i, label %for.body.us.preheader.i, label %if.end71
for.body.us.preheader.i: ; preds = %for.end61
%31 = zext i32 %29 to i64
br label %for.body.us.i
for.body.us.i: ; preds = %for.cond.loopexit.us.i, %for.body.us.preheader.i
%indvars.iv121.i = phi i64 [ 0, %for.body.us.preheader.i ], [ %indvars.iv.next122.i, %for.cond.loopexit.us.i ]
%indvars.iv114.i = phi i64 [ 1, %for.body.us.preheader.i ], [ %indvars.iv.next115.i, %for.cond.loopexit.us.i ]
%indvars.iv.next122.i = add nuw nsw i64 %indvars.iv121.i, 1
%cmp293.us.i = icmp ult i64 %indvars.iv.next122.i, %31
br i1 %cmp293.us.i, label %for.cond4.preheader.lr.ph.us.i, label %for.cond.loopexit.us.i
for.cond.loopexit.us.i: ; preds = %for.cond4.for.inc54_crit_edge.us.us.i, %for.body.us.i
%indvars.iv.next115.i = add nuw nsw i64 %indvars.iv114.i, 1
%exitcond125.not.i = icmp eq i64 %indvars.iv.next122.i, %31
br i1 %exitcond125.not.i, label %if.end71, label %for.body.us.i, !llvm.loop !9
for.cond4.preheader.lr.ph.us.i: ; preds = %for.body.us.i
%arrayidx.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv121.i
%value.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv121.i, i32 1
br label %for.cond4.preheader.us.us.i
for.cond4.preheader.us.us.i: ; preds = %for.cond4.for.inc54_crit_edge.us.us.i, %for.cond4.preheader.lr.ph.us.i
%indvars.iv116.i = phi i64 [ %indvars.iv.next117.i, %for.cond4.for.inc54_crit_edge.us.us.i ], [ %indvars.iv114.i, %for.cond4.preheader.lr.ph.us.i ]
%arrayidx12.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv116.i
%value13.us.us.i = getelementptr inbounds %struct.card, ptr %C, i64 %indvars.iv116.i, i32 1
br label %for.body6.us.us.i
for.body6.us.us.i: ; preds = %for.cond4.loopexit.us.us.i, %for.cond4.preheader.us.us.i
%indvars.iv109.i = phi i64 [ %indvars.iv.next110.i, %for.cond4.loopexit.us.us.i ], [ 0, %for.cond4.preheader.us.us.i ]
%indvars.iv.i98 = phi i64 [ %indvars.iv.next.i99, %for.cond4.loopexit.us.us.i ], [ 1, %for.cond4.preheader.us.us.i ]
%indvars.iv.next110.i = add nuw nsw i64 %indvars.iv109.i, 1
%cmp989.us.us.i = icmp ult i64 %indvars.iv.next110.i, %31
br i1 %cmp989.us.us.i, label %for.body10.lr.ph.us.us.i, label %for.cond4.loopexit.us.us.i
for.cond4.loopexit.us.us.i: ; preds = %for.inc.us.us.us.i, %for.body10.lr.ph.us.us.i, %for.body6.us.us.i
%indvars.iv.next.i99 = add nuw nsw i64 %indvars.iv.i98, 1
%exitcond113.not.i = icmp eq i64 %indvars.iv.next110.i, %31
br i1 %exitcond113.not.i, label %for.cond4.for.inc54_crit_edge.us.us.i, label %for.body6.us.us.i, !llvm.loop !11
for.body10.lr.ph.us.us.i: ; preds = %for.body6.us.us.i
%32 = load i32, ptr %value.us.i, align 4, !tbaa !12
%33 = load i32, ptr %value13.us.us.i, align 4, !tbaa !12
%cmp14.us.us.i = icmp eq i32 %32, %33
%value37.us.us.i = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv109.i, i32 1
%arrayidx36.us.us.i = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv109.i
br i1 %cmp14.us.us.i, label %for.body10.us.us.us.i, label %for.cond4.loopexit.us.us.i
for.body10.us.us.us.i: ; preds = %for.body10.lr.ph.us.us.i, %for.inc.us.us.us.i
%indvars.iv106.i = phi i64 [ %indvars.iv.next107.i, %for.inc.us.us.us.i ], [ %indvars.iv.i98, %for.body10.lr.ph.us.us.i ]
%value20.us.us.us.i = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv106.i, i32 1
%34 = load i32, ptr %value20.us.us.us.i, align 4, !tbaa !12
%cmp21.us.us.us.i = icmp eq i32 %32, %34
br i1 %cmp21.us.us.us.i, label %land.lhs.true22.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true22.us.us.us.i: ; preds = %for.body10.us.us.us.i
%arrayidx19.us.us.us.i = getelementptr inbounds %struct.card, ptr %D, i64 %indvars.iv106.i
%35 = load i8, ptr %arrayidx.us.i, align 8, !tbaa !14
%36 = load i8, ptr %arrayidx19.us.us.us.i, align 8, !tbaa !14
%cmp29.us.us.us.i = icmp eq i8 %35, %36
br i1 %cmp29.us.us.us.i, label %land.lhs.true31.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true31.us.us.us.i: ; preds = %land.lhs.true22.us.us.us.i
%37 = load i32, ptr %value37.us.us.i, align 4, !tbaa !12
%cmp38.us.us.us.i = icmp eq i32 %32, %37
br i1 %cmp38.us.us.us.i, label %land.lhs.true40.us.us.us.i, label %for.inc.us.us.us.i
land.lhs.true40.us.us.us.i: ; preds = %land.lhs.true31.us.us.us.i
%38 = load i8, ptr %arrayidx12.us.us.i, align 8, !tbaa !14
%39 = load i8, ptr %arrayidx36.us.us.i, align 8, !tbaa !14
%cmp49.us.us.us.i = icmp eq i8 %38, %39
br i1 %cmp49.us.us.us.i, label %if.end71, label %for.inc.us.us.us.i
for.inc.us.us.us.i: ; preds = %land.lhs.true40.us.us.us.i, %land.lhs.true31.us.us.us.i, %land.lhs.true22.us.us.us.i, %for.body10.us.us.us.i
%indvars.iv.next107.i = add nuw nsw i64 %indvars.iv106.i, 1
%exitcond.not.i100 = icmp eq i64 %indvars.iv.next107.i, %31
br i1 %exitcond.not.i100, label %for.cond4.loopexit.us.us.i, label %for.body10.us.us.us.i, !llvm.loop !15
for.cond4.for.inc54_crit_edge.us.us.i: ; preds = %for.cond4.loopexit.us.us.i
%indvars.iv.next117.i = add nuw nsw i64 %indvars.iv116.i, 1
%exitcond120.not.i = icmp eq i64 %indvars.iv.next117.i, %31
br i1 %exitcond120.not.i, label %for.cond.loopexit.us.i, label %for.cond4.preheader.us.us.i, !llvm.loop !16
if.end71: ; preds = %for.cond.loopexit.us.i, %land.lhs.true40.us.us.us.i, %for.end61, %selectionSort.exit, %for.end30
%str.6.sink = phi ptr [ @str.7, %for.end30 ], [ @str.7, %selectionSort.exit ], [ @str.7, %for.end61 ], [ @str.6, %land.lhs.true40.us.us.us.i ], [ @str.7, %for.cond.loopexit.us.i ]
%puts93 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %D) #7
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6
attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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, !6, i64 4}
!13 = !{!"card", !7, i64 0, !6, i64 4}
!14 = !{!13, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
|
#include <stdio.h>
void s(int *a,int *b){int i=*a;*a=*b;*b=i;}
void c(char *a,char *b){char i=*a;*a=*b;*b=i;}
void sB(int *A,char *C,int a){
int i,j;
for(i=0;i<a-1;i++)
for(j=a-1;j>i;j--)
if(A[j]<A[j-1]){
s(&A[j],&A[j-1]);
c(&C[j],&C[j-1]);
}
}
void sS(int *A,char *C,int a){
int i,j;
for(i=0;i<a;i++){
int m=i;
for(j=i;j<a;j++)
if(A[j]<A[m])
m=j;
if(A[i]!=A[m]){
s(&A[i],&A[m]);
c(&C[i],&C[m]);
}
}
}
int cS(int *Ac,char *Cc,int *A,char *C,int N){
int n=0;
for(n=0;n<N-2;n++){
if(Ac[n]==Ac[n+1]){
int m=0;
while((Ac[n]==Ac[n+1])&&(n<N-2)){
while(Ac[n]!=A[m])
m++;
if(Cc[n]!=C[m])
return 1;
n++; m++;
}
}
}
return 0;
}
int main(void){
int n,N,No[36],Nb[36],Ns[36];char C[36],Cb[36],Cs[36];
scanf("%d\n",&N);
for(n=0;n<N;n++){
scanf("%c%d ",&C[n],&No[n]);
Cb[n]=C[n];Cs[n]=C[n];Nb[n]=No[n];Ns[n]=No[n];
}
sB(Nb,Cb,N);
for(n=0;n<N-1;n++)
printf("%c%d ",Cb[n],Nb[n]);
printf("%c%d\n",Cb[N-1],Nb[N-1]);
if(cS(Nb,Cb,No,C,N))
printf("Not Stable\n");
else
printf("Stable\n");
sS(Ns,Cs,N);
for(n=0;n<N-1;n++)
printf("%c%d ",Cs[n],Ns[n]);
printf("%c%d\n",Cs[N-1],Ns[N-1]);
if(cS(Ns,Cs,No,C,N))
printf("Not stable\n");
else
printf("Stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113208/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113208/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"%c%d \00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not Stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @s(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @c(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
store i8 %1, ptr %a, align 1, !tbaa !9
store i8 %0, ptr %b, align 1, !tbaa !9
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sB(ptr nocapture noundef %A, ptr nocapture noundef %C, i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp36 = icmp sgt i32 %a, 1
br i1 %cmp36, label %for.cond2.preheader.preheader, label %for.end20
for.cond2.preheader.preheader: ; preds = %entry
%sub = add nsw i32 %a, -1
%0 = zext i32 %a to i64
%1 = add nsw i64 %0, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc19
%indvars.iv39 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next40, %for.inc19 ]
br label %for.body4
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx7 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp slt i32 %2, %3
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body4
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
store i32 %2, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx15 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv
%arrayidx18 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx15, align 1, !tbaa !9
%5 = load i8, ptr %arrayidx18, align 1, !tbaa !9
store i8 %5, ptr %arrayidx15, align 1, !tbaa !9
store i8 %4, ptr %arrayidx18, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv39
br i1 %cmp3, label %for.body4, label %for.inc19, !llvm.loop !10
for.inc19: ; preds = %for.inc
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.cond2.preheader, !llvm.loop !12
for.end20: ; preds = %for.inc19, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sS(ptr nocapture noundef %A, ptr nocapture noundef %C, i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp46 = icmp sgt i32 %a, 0
br i1 %cmp46, label %for.cond1.preheader.preheader, label %for.end24
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %a to i64
%wide.trip.count = zext i32 %a to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %if.end21
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %if.end21 ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv48 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next49, %for.body3 ]
%m.045 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv48
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom4 = sext i32 %m.045 to i64
%arrayidx5 = getelementptr inbounds i32, ptr %A, i64 %idxprom4
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv48 to i32
%spec.select = select i1 %cmp6, i32 %4, i32 %m.045
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%cmp2 = icmp ult i64 %indvars.iv.next49, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body3
%arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%idxprom9 = sext i32 %spec.select to i64
%arrayidx10 = getelementptr inbounds i32, ptr %A, i64 %idxprom9
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp eq i32 %5, %6
br i1 %cmp11.not, label %if.end21, label %if.then12
if.then12: ; preds = %for.end
store i32 %6, ptr %arrayidx8, align 4, !tbaa !5
store i32 %5, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv
%arrayidx20 = getelementptr inbounds i8, ptr %C, i64 %idxprom9
%7 = load i8, ptr %arrayidx18, align 1, !tbaa !9
%8 = load i8, ptr %arrayidx20, align 1, !tbaa !9
store i8 %8, ptr %arrayidx18, align 1, !tbaa !9
store i8 %7, ptr %arrayidx20, align 1, !tbaa !9
br label %if.end21
if.end21: ; preds = %if.then12, %for.end
%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.end24, label %for.cond1.preheader, !llvm.loop !14
for.end24: ; preds = %if.end21, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @cS(ptr nocapture noundef readonly %Ac, ptr nocapture noundef readonly %Cc, ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%sub = add nsw i32 %N, -2
%cmp65 = icmp sgt i32 %N, 2
br i1 %cmp65, label %for.body.preheader, label %cleanup32
for.body.preheader: ; preds = %entry
%0 = zext i32 %sub to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%n.066 = phi i32 [ %inc31, %for.inc ], [ 0, %for.body.preheader ]
%idxprom = sext i32 %n.066 to i64
%arrayidx = getelementptr inbounds i32, ptr %Ac, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %n.066, 1
%idxprom1 = sext i32 %add to i64
%arrayidx2 = getelementptr inbounds i32, ptr %Ac, i64 %idxprom1
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3 = icmp eq i32 %1, %2
%cmp1158.not = icmp slt i32 %n.066, %sub
%or.cond = select i1 %cmp3, i1 %cmp1158.not, i1 false
br i1 %or.cond, label %while.cond12.preheader.preheader, label %for.inc
while.cond12.preheader.preheader: ; preds = %for.body
%3 = add nsw i64 %idxprom, 1
br label %while.cond12.preheader
while.cond: ; preds = %while.end
%inc28 = add i64 %indvars.iv, 1
%arrayidx5 = getelementptr inbounds i32, ptr %Ac, i64 %indvars.iv73
%4 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%indvars.iv.next74 = add nsw i64 %indvars.iv73, 1
%arrayidx8 = getelementptr inbounds i32, ptr %Ac, i64 %indvars.iv.next74
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp ne i32 %4, %5
%cmp11 = icmp sge i64 %indvars.iv73, %0
%.not = or i1 %cmp11, %cmp9
br i1 %.not, label %for.inc.loopexit, label %while.cond12.preheader, !llvm.loop !15
while.cond12.preheader: ; preds = %while.cond12.preheader.preheader, %while.cond
%indvars.iv73 = phi i64 [ %3, %while.cond12.preheader.preheader ], [ %indvars.iv.next74, %while.cond ]
%6 = phi i32 [ %1, %while.cond12.preheader.preheader ], [ %4, %while.cond ]
%idxprom462 = phi i64 [ %idxprom, %while.cond12.preheader.preheader ], [ %indvars.iv73, %while.cond ]
%m.061 = phi i64 [ 0, %while.cond12.preheader.preheader ], [ %inc28, %while.cond ]
%sext = shl i64 %m.061, 32
%7 = ashr exact i64 %sext, 32
br label %while.cond12
while.cond12: ; preds = %while.cond12, %while.cond12.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond12 ], [ %7, %while.cond12.preheader ]
%arrayidx16 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17.not = icmp eq i32 %6, %8
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp17.not, label %while.end, label %while.cond12, !llvm.loop !16
while.end: ; preds = %while.cond12
%arrayidx20 = getelementptr inbounds i8, ptr %Cc, i64 %idxprom462
%9 = load i8, ptr %arrayidx20, align 1, !tbaa !9
%arrayidx22 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv
%10 = load i8, ptr %arrayidx22, align 1, !tbaa !9
%cmp24.not = icmp eq i8 %9, %10
br i1 %cmp24.not, label %while.cond, label %cleanup32
for.inc.loopexit: ; preds = %while.cond
%11 = trunc i64 %indvars.iv73 to i32
br label %for.inc
for.inc: ; preds = %for.inc.loopexit, %for.body
%n.2 = phi i32 [ %n.066, %for.body ], [ %11, %for.inc.loopexit ]
%inc31 = add nsw i32 %n.2, 1
%cmp = icmp slt i32 %inc31, %sub
br i1 %cmp, label %for.body, label %cleanup32, !llvm.loop !17
cleanup32: ; preds = %for.inc, %while.end, %entry
%retval.3 = phi i32 [ 0, %entry ], [ 1, %while.end ], [ 0, %for.inc ]
ret i32 %retval.3
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%N = alloca i32, align 4
%No = alloca [36 x i32], align 16
%Nb = alloca [36 x i32], align 16
%Ns = alloca [36 x i32], align 16
%C = alloca [36 x i8], align 16
%Cb = alloca [36 x i8], align 16
%Cs = alloca [36 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %No) #7
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %Nb) #7
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %Ns) #7
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %C) #7
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %Cb) #7
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %Cs) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp168 = icmp sgt i32 %0, 0
br i1 %cmp168, label %for.body, label %sB.exit.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x i8], ptr %C, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [36 x i32], ptr %No, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%arrayidx7 = getelementptr inbounds [36 x i8], ptr %Cb, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx7, align 1, !tbaa !9
%arrayidx11 = getelementptr inbounds [36 x i8], ptr %Cs, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx11, align 1, !tbaa !9
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%arrayidx15 = getelementptr inbounds [36 x i32], ptr %Nb, i64 0, i64 %indvars.iv
store i32 %2, ptr %arrayidx15, align 4, !tbaa !5
%arrayidx19 = getelementptr inbounds [36 x i32], ptr %Ns, i64 0, i64 %indvars.iv
store i32 %2, ptr %arrayidx19, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !18
for.end: ; preds = %for.body
%cmp36.i = icmp sgt i32 %3, 1
br i1 %cmp36.i, label %for.cond2.preheader.preheader.i, label %sB.exit.thread
sB.exit.thread: ; preds = %for.end, %entry
%5 = phi i32 [ %3, %for.end ], [ %0, %entry ]
%.pre192 = add nsw i32 %5, -1
br label %sB.exit.for.end31_crit_edge
for.cond2.preheader.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %3, -1
%6 = zext i32 %3 to i64
%7 = add nsw i64 %6, -1
%wide.trip.count.i = zext i32 %sub.i to i64
%arrayidx.i.phi.trans.insert = getelementptr inbounds i32, ptr %Nb, i64 %7
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc19.i, %for.cond2.preheader.preheader.i
%indvars.iv39.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next40.i, %for.inc19.i ]
%.pre = load i32, ptr %arrayidx.i.phi.trans.insert, align 4, !tbaa !5
br label %for.body4.i
for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%8 = phi i32 [ %.pre, %for.cond2.preheader.i ], [ %12, %for.inc.i ]
%indvars.iv.i = phi i64 [ %7, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%arrayidx7.i = getelementptr inbounds i32, ptr %Nb, i64 %indvars.iv.next.i
%9 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%cmp8.i = icmp slt i32 %8, %9
br i1 %cmp8.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx.i = getelementptr inbounds i32, ptr %Nb, i64 %indvars.iv.i
store i32 %9, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %8, ptr %arrayidx7.i, align 4, !tbaa !5
%arrayidx15.i = getelementptr inbounds i8, ptr %Cb, i64 %indvars.iv.i
%arrayidx18.i = getelementptr inbounds i8, ptr %Cb, i64 %indvars.iv.next.i
%10 = load i8, ptr %arrayidx15.i, align 1, !tbaa !9
%11 = load i8, ptr %arrayidx18.i, align 1, !tbaa !9
store i8 %11, ptr %arrayidx15.i, align 1, !tbaa !9
store i8 %10, ptr %arrayidx18.i, align 1, !tbaa !9
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%12 = phi i32 [ %8, %if.then.i ], [ %9, %for.body4.i ]
%cmp3.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv39.i
br i1 %cmp3.i, label %for.body4.i, label %for.inc19.i, !llvm.loop !10
for.inc19.i: ; preds = %for.inc.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next40.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %sB.exit, label %for.cond2.preheader.i, !llvm.loop !12
sB.exit: ; preds = %for.inc19.i
br i1 %cmp36.i, label %for.body23, label %sB.exit.for.end31_crit_edge
sB.exit.for.end31_crit_edge: ; preds = %sB.exit.thread, %sB.exit
%sub170.pre-phi200 = phi i32 [ %.pre192, %sB.exit.thread ], [ %sub.i, %sB.exit ]
%.pre193 = sext i32 %sub170.pre-phi200 to i64
br label %for.end31
for.body23: ; preds = %sB.exit, %for.body23
%indvars.iv184 = phi i64 [ %indvars.iv.next185, %for.body23 ], [ 0, %sB.exit ]
%arrayidx25 = getelementptr inbounds [36 x i8], ptr %Cb, i64 0, i64 %indvars.iv184
%13 = load i8, ptr %arrayidx25, align 1, !tbaa !9
%conv = sext i8 %13 to i32
%arrayidx27 = getelementptr inbounds [36 x i32], ptr %Nb, i64 0, i64 %indvars.iv184
%14 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %14)
%indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
%15 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %15, -1
%16 = sext i32 %sub to i64
%cmp22 = icmp slt i64 %indvars.iv.next185, %16
br i1 %cmp22, label %for.body23, label %for.end31, !llvm.loop !19
for.end31: ; preds = %for.body23, %sB.exit.for.end31_crit_edge
%idxprom33.pre-phi = phi i64 [ %.pre193, %sB.exit.for.end31_crit_edge ], [ %16, %for.body23 ]
%arrayidx34 = getelementptr inbounds [36 x i8], ptr %Cb, i64 0, i64 %idxprom33.pre-phi
%17 = load i8, ptr %arrayidx34, align 1, !tbaa !9
%conv35 = sext i8 %17 to i32
%arrayidx38 = getelementptr inbounds [36 x i32], ptr %Nb, i64 0, i64 %idxprom33.pre-phi
%18 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv35, i32 noundef %18)
%19 = load i32, ptr %N, align 4, !tbaa !5
%sub.i104 = add nsw i32 %19, -2
%cmp65.i = icmp sgt i32 %19, 2
br i1 %cmp65.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %for.end31
%20 = zext i32 %sub.i104 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i107, %for.body.preheader.i
%n.066.i = phi i32 [ %inc31.i.pre-phi, %for.inc.i107 ], [ 0, %for.body.preheader.i ]
%idxprom.i = sext i32 %n.066.i to i64
%arrayidx.i105 = getelementptr inbounds i32, ptr %Nb, i64 %idxprom.i
%21 = load i32, ptr %arrayidx.i105, align 4, !tbaa !5
%add.i = add nsw i32 %n.066.i, 1
%idxprom1.i = sext i32 %add.i to i64
%arrayidx2.i = getelementptr inbounds i32, ptr %Nb, i64 %idxprom1.i
%22 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp3.i106 = icmp eq i32 %21, %22
%cmp1158.not.i = icmp slt i32 %n.066.i, %sub.i104
%or.cond.i = select i1 %cmp3.i106, i1 %cmp1158.not.i, i1 false
br i1 %or.cond.i, label %while.cond12.preheader.preheader.i, label %for.inc.i107
while.cond12.preheader.preheader.i: ; preds = %for.body.i
%23 = add nsw i64 %idxprom.i, 1
br label %while.cond12.preheader.i
while.cond.i: ; preds = %while.end.i
%arrayidx5.i = getelementptr inbounds i32, ptr %Nb, i64 %indvars.iv73.i
%24 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%indvars.iv.next74.i = add nsw i64 %indvars.iv73.i, 1
%arrayidx8.i = getelementptr inbounds i32, ptr %Nb, i64 %indvars.iv.next74.i
%25 = load i32, ptr %arrayidx8.i, align 4, !tbaa !5
%cmp9.i = icmp ne i32 %24, %25
%cmp11.i = icmp sge i64 %indvars.iv73.i, %20
%.not.i = or i1 %cmp11.i, %cmp9.i
br i1 %.not.i, label %for.inc.loopexit.i, label %while.cond12.preheader.i, !llvm.loop !15
while.cond12.preheader.i: ; preds = %while.cond.i, %while.cond12.preheader.preheader.i
%indvars.iv73.i = phi i64 [ %23, %while.cond12.preheader.preheader.i ], [ %indvars.iv.next74.i, %while.cond.i ]
%26 = phi i32 [ %21, %while.cond12.preheader.preheader.i ], [ %24, %while.cond.i ]
%idxprom462.i = phi i64 [ %idxprom.i, %while.cond12.preheader.preheader.i ], [ %indvars.iv73.i, %while.cond.i ]
%m.061.i = phi i64 [ 0, %while.cond12.preheader.preheader.i ], [ %indvars.iv.next.i109, %while.cond.i ]
%sext.i = shl i64 %m.061.i, 32
%27 = ashr exact i64 %sext.i, 32
br label %while.cond12.i
while.cond12.i: ; preds = %while.cond12.i, %while.cond12.preheader.i
%indvars.iv.i108 = phi i64 [ %indvars.iv.next.i109, %while.cond12.i ], [ %27, %while.cond12.preheader.i ]
%arrayidx16.i = getelementptr inbounds i32, ptr %No, i64 %indvars.iv.i108
%28 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%cmp17.not.i = icmp eq i32 %26, %28
%indvars.iv.next.i109 = add i64 %indvars.iv.i108, 1
br i1 %cmp17.not.i, label %while.end.i, label %while.cond12.i, !llvm.loop !16
while.end.i: ; preds = %while.cond12.i
%arrayidx20.i = getelementptr inbounds i8, ptr %Cb, i64 %idxprom462.i
%29 = load i8, ptr %arrayidx20.i, align 1, !tbaa !9
%arrayidx22.i = getelementptr inbounds i8, ptr %C, i64 %indvars.iv.i108
%30 = load i8, ptr %arrayidx22.i, align 1, !tbaa !9
%cmp24.not.i = icmp eq i8 %29, %30
br i1 %cmp24.not.i, label %while.cond.i, label %if.end
for.inc.loopexit.i: ; preds = %while.cond.i
%31 = trunc i64 %indvars.iv73.i to i32
%.pre190 = add nsw i32 %31, 1
br label %for.inc.i107
for.inc.i107: ; preds = %for.inc.loopexit.i, %for.body.i
%inc31.i.pre-phi = phi i32 [ %.pre190, %for.inc.loopexit.i ], [ %add.i, %for.body.i ]
%cmp.i = icmp slt i32 %inc31.i.pre-phi, %sub.i104
br i1 %cmp.i, label %for.body.i, label %if.end, !llvm.loop !17
if.end: ; preds = %for.inc.i107, %while.end.i, %for.end31
%str.sink = phi ptr [ @str.7, %for.end31 ], [ @str.6, %while.end.i ], [ @str.7, %for.inc.i107 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%32 = load i32, ptr %N, align 4, !tbaa !5
%cmp46.i = icmp sgt i32 %32, 0
br i1 %cmp46.i, label %for.cond1.preheader.preheader.i, label %sS.exit.for.end62_crit_edge
for.cond1.preheader.preheader.i: ; preds = %if.end
%33 = zext i32 %32 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %if.end21.i, %for.cond1.preheader.preheader.i
%indvars.iv.i111 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i117, %if.end21.i ]
%34 = trunc i64 %indvars.iv.i111 to i32
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%indvars.iv48.i = phi i64 [ %indvars.iv.i111, %for.cond1.preheader.i ], [ %indvars.iv.next49.i, %for.body3.i ]
%m.045.i = phi i32 [ %34, %for.cond1.preheader.i ], [ %spec.select.i, %for.body3.i ]
%arrayidx.i112 = getelementptr inbounds i32, ptr %Ns, i64 %indvars.iv48.i
%35 = load i32, ptr %arrayidx.i112, align 4, !tbaa !5
%idxprom4.i = sext i32 %m.045.i to i64
%arrayidx5.i113 = getelementptr inbounds i32, ptr %Ns, i64 %idxprom4.i
%36 = load i32, ptr %arrayidx5.i113, align 4, !tbaa !5
%cmp6.i = icmp slt i32 %35, %36
%37 = trunc i64 %indvars.iv48.i to i32
%spec.select.i = select i1 %cmp6.i, i32 %37, i32 %m.045.i
%indvars.iv.next49.i = add nuw nsw i64 %indvars.iv48.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next49.i, %33
br i1 %cmp2.i, label %for.body3.i, label %for.end.i, !llvm.loop !13
for.end.i: ; preds = %for.body3.i
%arrayidx8.i114 = getelementptr inbounds i32, ptr %Ns, i64 %indvars.iv.i111
%38 = load i32, ptr %arrayidx8.i114, align 4, !tbaa !5
%idxprom9.i = sext i32 %spec.select.i to i64
%arrayidx10.i = getelementptr inbounds i32, ptr %Ns, i64 %idxprom9.i
%39 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%cmp11.not.i = icmp eq i32 %38, %39
br i1 %cmp11.not.i, label %if.end21.i, label %if.then12.i
if.then12.i: ; preds = %for.end.i
store i32 %39, ptr %arrayidx8.i114, align 4, !tbaa !5
store i32 %38, ptr %arrayidx10.i, align 4, !tbaa !5
%arrayidx18.i115 = getelementptr inbounds i8, ptr %Cs, i64 %indvars.iv.i111
%arrayidx20.i116 = getelementptr inbounds i8, ptr %Cs, i64 %idxprom9.i
%40 = load i8, ptr %arrayidx18.i115, align 1, !tbaa !9
%41 = load i8, ptr %arrayidx20.i116, align 1, !tbaa !9
store i8 %41, ptr %arrayidx18.i115, align 1, !tbaa !9
store i8 %40, ptr %arrayidx20.i116, align 1, !tbaa !9
br label %if.end21.i
if.end21.i: ; preds = %if.then12.i, %for.end.i
%indvars.iv.next.i117 = add nuw nsw i64 %indvars.iv.i111, 1
%exitcond.not.i118 = icmp eq i64 %indvars.iv.next.i117, %33
br i1 %exitcond.not.i118, label %sS.exit, label %for.cond1.preheader.i, !llvm.loop !14
sS.exit: ; preds = %if.end21.i
%cmp51175 = icmp sgt i32 %32, 1
br i1 %cmp51175, label %for.body53, label %sS.exit.for.end62_crit_edge
sS.exit.for.end62_crit_edge: ; preds = %if.end, %sS.exit
%sub50174 = add nsw i32 %32, -1
%.pre194 = sext i32 %sub50174 to i64
br label %for.end62
for.body53: ; preds = %sS.exit, %for.body53
%indvars.iv187 = phi i64 [ %indvars.iv.next188, %for.body53 ], [ 0, %sS.exit ]
%arrayidx55 = getelementptr inbounds [36 x i8], ptr %Cs, i64 0, i64 %indvars.iv187
%42 = load i8, ptr %arrayidx55, align 1, !tbaa !9
%conv56 = sext i8 %42 to i32
%arrayidx58 = getelementptr inbounds [36 x i32], ptr %Ns, i64 0, i64 %indvars.iv187
%43 = load i32, ptr %arrayidx58, align 4, !tbaa !5
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv56, i32 noundef %43)
%indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
%44 = load i32, ptr %N, align 4, !tbaa !5
%sub50 = add nsw i32 %44, -1
%45 = sext i32 %sub50 to i64
%cmp51 = icmp slt i64 %indvars.iv.next188, %45
br i1 %cmp51, label %for.body53, label %for.end62, !llvm.loop !20
for.end62: ; preds = %for.body53, %sS.exit.for.end62_crit_edge
%idxprom64.pre-phi = phi i64 [ %.pre194, %sS.exit.for.end62_crit_edge ], [ %45, %for.body53 ]
%arrayidx65 = getelementptr inbounds [36 x i8], ptr %Cs, i64 0, i64 %idxprom64.pre-phi
%46 = load i8, ptr %arrayidx65, align 1, !tbaa !9
%conv66 = sext i8 %46 to i32
%arrayidx69 = getelementptr inbounds [36 x i32], ptr %Ns, i64 0, i64 %idxprom64.pre-phi
%47 = load i32, ptr %arrayidx69, align 4, !tbaa !5
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv66, i32 noundef %47)
%48 = load i32, ptr %N, align 4, !tbaa !5
%sub.i119 = add nsw i32 %48, -2
%cmp65.i120 = icmp sgt i32 %48, 2
br i1 %cmp65.i120, label %for.body.preheader.i122, label %if.end81
for.body.preheader.i122: ; preds = %for.end62
%49 = zext i32 %sub.i119 to i64
br label %for.body.i123
for.body.i123: ; preds = %for.inc.i133, %for.body.preheader.i122
%n.066.i124 = phi i32 [ %inc31.i135.pre-phi, %for.inc.i133 ], [ 0, %for.body.preheader.i122 ]
%idxprom.i125 = sext i32 %n.066.i124 to i64
%arrayidx.i126 = getelementptr inbounds i32, ptr %Ns, i64 %idxprom.i125
%50 = load i32, ptr %arrayidx.i126, align 4, !tbaa !5
%add.i127 = add nsw i32 %n.066.i124, 1
%idxprom1.i128 = sext i32 %add.i127 to i64
%arrayidx2.i129 = getelementptr inbounds i32, ptr %Ns, i64 %idxprom1.i128
%51 = load i32, ptr %arrayidx2.i129, align 4, !tbaa !5
%cmp3.i130 = icmp eq i32 %50, %51
%cmp1158.not.i131 = icmp slt i32 %n.066.i124, %sub.i119
%or.cond.i132 = select i1 %cmp3.i130, i1 %cmp1158.not.i131, i1 false
br i1 %or.cond.i132, label %while.cond12.preheader.preheader.i137, label %for.inc.i133
while.cond12.preheader.preheader.i137: ; preds = %for.body.i123
%52 = add nsw i64 %idxprom.i125, 1
br label %while.cond12.preheader.i138
while.cond.i152: ; preds = %while.end.i148
%arrayidx5.i154 = getelementptr inbounds i32, ptr %Ns, i64 %indvars.iv73.i139
%53 = load i32, ptr %arrayidx5.i154, align 4, !tbaa !5
%indvars.iv.next74.i155 = add nsw i64 %indvars.iv73.i139, 1
%arrayidx8.i156 = getelementptr inbounds i32, ptr %Ns, i64 %indvars.iv.next74.i155
%54 = load i32, ptr %arrayidx8.i156, align 4, !tbaa !5
%cmp9.i157 = icmp ne i32 %53, %54
%cmp11.i158 = icmp sge i64 %indvars.iv73.i139, %49
%.not.i159 = or i1 %cmp11.i158, %cmp9.i157
br i1 %.not.i159, label %for.inc.loopexit.i160, label %while.cond12.preheader.i138, !llvm.loop !15
while.cond12.preheader.i138: ; preds = %while.cond.i152, %while.cond12.preheader.preheader.i137
%indvars.iv73.i139 = phi i64 [ %52, %while.cond12.preheader.preheader.i137 ], [ %indvars.iv.next74.i155, %while.cond.i152 ]
%55 = phi i32 [ %50, %while.cond12.preheader.preheader.i137 ], [ %53, %while.cond.i152 ]
%idxprom462.i140 = phi i64 [ %idxprom.i125, %while.cond12.preheader.preheader.i137 ], [ %indvars.iv73.i139, %while.cond.i152 ]
%m.061.i141 = phi i64 [ 0, %while.cond12.preheader.preheader.i137 ], [ %indvars.iv.next.i147, %while.cond.i152 ]
%sext.i142 = shl i64 %m.061.i141, 32
%56 = ashr exact i64 %sext.i142, 32
br label %while.cond12.i143
while.cond12.i143: ; preds = %while.cond12.i143, %while.cond12.preheader.i138
%indvars.iv.i144 = phi i64 [ %indvars.iv.next.i147, %while.cond12.i143 ], [ %56, %while.cond12.preheader.i138 ]
%arrayidx16.i145 = getelementptr inbounds i32, ptr %No, i64 %indvars.iv.i144
%57 = load i32, ptr %arrayidx16.i145, align 4, !tbaa !5
%cmp17.not.i146 = icmp eq i32 %55, %57
%indvars.iv.next.i147 = add i64 %indvars.iv.i144, 1
br i1 %cmp17.not.i146, label %while.end.i148, label %while.cond12.i143, !llvm.loop !16
while.end.i148: ; preds = %while.cond12.i143
%arrayidx20.i149 = getelementptr inbounds i8, ptr %Cs, i64 %idxprom462.i140
%58 = load i8, ptr %arrayidx20.i149, align 1, !tbaa !9
%arrayidx22.i150 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv.i144
%59 = load i8, ptr %arrayidx22.i150, align 1, !tbaa !9
%cmp24.not.i151 = icmp eq i8 %58, %59
br i1 %cmp24.not.i151, label %while.cond.i152, label %if.end81
for.inc.loopexit.i160: ; preds = %while.cond.i152
%60 = trunc i64 %indvars.iv73.i139 to i32
%.pre191 = add nsw i32 %60, 1
br label %for.inc.i133
for.inc.i133: ; preds = %for.inc.loopexit.i160, %for.body.i123
%inc31.i135.pre-phi = phi i32 [ %.pre191, %for.inc.loopexit.i160 ], [ %add.i127, %for.body.i123 ]
%cmp.i136 = icmp slt i32 %inc31.i135.pre-phi, %sub.i119
br i1 %cmp.i136, label %for.body.i123, label %if.end81, !llvm.loop !17
if.end81: ; preds = %for.inc.i133, %while.end.i148, %for.end62
%str.7.sink = phi ptr [ @str.7, %for.end62 ], [ @str.8, %while.end.i148 ], [ @str.7, %for.inc.i133 ]
%puts102 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %Cs) #7
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %Cb) #7
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %C) #7
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %Ns) #7
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %Nb) #7
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %No) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #3 = { 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 #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
|
#include <stdio.h>
struct card{
char mark[1];
int value;
};
int main(){
int N, min_j, flag=1, i, j;
struct card c[36];
struct card d[36];
struct card temp;
scanf("%d", &N);
for(i=0; i<N; i++){
scanf("%1s%d", c[i].mark, &c[i].value);
d[i] = c[i];
}
//Bubble
while(flag){
flag = 0;
for(i=N-1; i>=1; i--){
if(c[i].value<c[i-1].value){
temp = c[i];
c[i] = c[i-1];
c[i-1] = temp;
flag = 1;
}
}
}
for(i=0; i<N; i++){
if(i!=0){
printf(" ");
}
printf("%s%d", c[i].mark, c[i].value);
}
printf("\nStable\n");
//Select
for(i=0; i<N; i++){
min_j = i;
for(j=i; j<N; j++){
if(d[j].value<d[min_j].value){
min_j = j;
}
}
if(i!=min_j){
temp = d[min_j];
d[min_j] = d[i];
d[i] = temp;
}
}
flag = 0;
for(i=0; i<N; i++){
if(i!=0){
printf(" ");
}
printf("%s%d", d[i].mark, d[i].value);
if(c[i].mark[0]!=d[i].mark[0]){
flag = 1;
}
}
printf("\n");
if(flag==0){
printf("Stable\n");
}else{
printf("Not stable\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113266/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113266/source.c"
target datalayout = "e-m:e-p270: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.card = type { [1 x i8], i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%1s%d\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%s%d\00", align 1
@str = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.9 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%c = alloca [36 x %struct.card], align 16
%d = alloca [36 x %struct.card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp164 = icmp sgt i32 %0, 0
br i1 %cmp164, label %for.body, label %for.end48
while.cond.preheader: ; preds = %for.body
%cmp9167 = icmp sgt i32 %7, 1
br i1 %cmp9167, label %for.cond8.preheader.us.preheader, label %for.cond31.preheader
for.cond8.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %7 to i64
br label %for.body10.us
for.body10.us: ; preds = %for.body10.us.backedge, %for.cond8.preheader.us.preheader
%indvars.iv184 = phi i64 [ %1, %for.cond8.preheader.us.preheader ], [ %indvars.iv184.be, %for.body10.us.backedge ]
%flag.1168.us = phi i32 [ 0, %for.cond8.preheader.us.preheader ], [ %flag.1168.us.be, %for.body10.us.backedge ]
%indvars.iv.next185 = add nsw i64 %indvars.iv184, -1
%idxprom11.us = and i64 %indvars.iv.next185, 4294967295
%value13.us = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %idxprom11.us, i32 1
%2 = load i32, ptr %value13.us, align 4, !tbaa !9
%sub14.us = add i64 %indvars.iv184, 4294967294
%idxprom15.us = and i64 %sub14.us, 4294967295
%value17.us = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %idxprom15.us, i32 1
%3 = load i32, ptr %value17.us, align 4, !tbaa !9
%cmp18.us = icmp slt i32 %2, %3
br i1 %cmp18.us, label %if.then.us, label %for.inc29.us
if.then.us: ; preds = %for.body10.us
%arrayidx16.us = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %idxprom15.us
%arrayidx12.us = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %idxprom11.us
%4 = load i64, ptr %arrayidx12.us, align 8
%5 = load i64, ptr %arrayidx16.us, align 8
store i64 %5, ptr %arrayidx12.us, align 8
store i64 %4, ptr %arrayidx16.us, align 8
br label %for.inc29.us
for.inc29.us: ; preds = %if.then.us, %for.body10.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.1168.us, %for.body10.us ]
%cmp9.us = icmp sgt i64 %indvars.iv184, 2
br i1 %cmp9.us, label %for.body10.us.backedge, label %for.cond8.while.cond.loopexit_crit_edge.us
for.body10.us.backedge: ; preds = %for.inc29.us, %for.cond8.while.cond.loopexit_crit_edge.us
%indvars.iv184.be = phi i64 [ %indvars.iv.next185, %for.inc29.us ], [ %1, %for.cond8.while.cond.loopexit_crit_edge.us ]
%flag.1168.us.be = phi i32 [ %flag.2.us, %for.inc29.us ], [ 0, %for.cond8.while.cond.loopexit_crit_edge.us ]
br label %for.body10.us, !llvm.loop !11
for.cond8.while.cond.loopexit_crit_edge.us: ; preds = %for.inc29.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %for.cond31.preheader, label %for.body10.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value)
%arrayidx5 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %indvars.iv
%6 = load i64, ptr %arrayidx, align 8
store i64 %6, ptr %arrayidx5, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !13
for.cond31.preheader: ; preds = %for.cond8.while.cond.loopexit_crit_edge.us, %while.cond.preheader
%cmp32172 = icmp sgt i32 %7, 0
br i1 %cmp32172, label %if.end37.peel, label %for.end48
if.end37.peel: ; preds = %for.cond31.preheader
%value44.peel.phi.trans.insert = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 0, i32 1
%.pre = load i32, ptr %value44.peel.phi.trans.insert, align 4, !tbaa !9
%call45.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %c, i32 noundef %.pre)
%9 = load i32, ptr %N, align 4, !tbaa !5
%cmp32.peel = icmp sgt i32 %9, 1
br i1 %cmp32.peel, label %if.end37, label %for.end48
if.end37: ; preds = %if.end37.peel, %if.end37
%indvars.iv187 = phi i64 [ %indvars.iv.next188, %if.end37 ], [ 1, %if.end37.peel ]
%putchar162 = call i32 @putchar(i32 32)
%arrayidx39 = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %indvars.iv187
%value44 = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %indvars.iv187, i32 1
%10 = load i32, ptr %value44, align 4, !tbaa !9
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %arrayidx39, i32 noundef %10)
%indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
%11 = load i32, ptr %N, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp32 = icmp slt i64 %indvars.iv.next188, %12
br i1 %cmp32, label %if.end37, label %for.end48, !llvm.loop !14
for.end48: ; preds = %if.end37, %entry, %if.end37.peel, %for.cond31.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%13 = load i32, ptr %N, align 4, !tbaa !5
%cmp51176 = icmp sgt i32 %13, 0
br i1 %cmp51176, label %for.cond53.preheader.preheader, label %for.end112.thread
for.cond53.preheader.preheader: ; preds = %for.end48
%14 = zext i32 %13 to i64
%wide.trip.count = zext i32 %13 to i64
br label %for.cond53.preheader
for.cond53.preheader: ; preds = %for.cond53.preheader.preheader, %for.inc79
%indvars.iv192 = phi i64 [ 0, %for.cond53.preheader.preheader ], [ %indvars.iv.next193, %for.inc79 ]
%15 = trunc i64 %indvars.iv192 to i32
br label %for.body55
for.cond82.preheader: ; preds = %for.inc79
br i1 %cmp51176, label %if.end88.peel, label %for.end112.thread
if.end88.peel: ; preds = %for.cond82.preheader
%value95.peel = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 0, i32 1
%16 = load i32, ptr %value95.peel, align 4, !tbaa !9
%call96.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %d, i32 noundef %16)
%17 = load i8, ptr %c, align 16, !tbaa !16
%18 = load i8, ptr %d, align 16, !tbaa !16
%cmp106.not.peel = icmp ne i8 %17, %18
%spec.select163.peel = zext i1 %cmp106.not.peel to i32
%19 = load i32, ptr %N, align 4, !tbaa !5
%cmp83.peel = icmp sgt i32 %19, 1
br i1 %cmp83.peel, label %if.end88, label %for.end112
for.body55: ; preds = %for.cond53.preheader, %for.body55
%indvars.iv194 = phi i64 [ %indvars.iv192, %for.cond53.preheader ], [ %indvars.iv.next195, %for.body55 ]
%min_j.0174 = phi i32 [ %15, %for.cond53.preheader ], [ %spec.select, %for.body55 ]
%value58 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %indvars.iv194, i32 1
%20 = load i32, ptr %value58, align 4, !tbaa !9
%idxprom59 = sext i32 %min_j.0174 to i64
%value61 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %idxprom59, i32 1
%21 = load i32, ptr %value61, align 4, !tbaa !9
%cmp62 = icmp slt i32 %20, %21
%22 = trunc i64 %indvars.iv194 to i32
%spec.select = select i1 %cmp62, i32 %22, i32 %min_j.0174
%indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
%cmp54 = icmp ult i64 %indvars.iv.next195, %14
br i1 %cmp54, label %for.body55, label %for.end67, !llvm.loop !17
for.end67: ; preds = %for.body55
%23 = zext i32 %spec.select to i64
%cmp68.not = icmp eq i64 %indvars.iv192, %23
br i1 %cmp68.not, label %for.inc79, label %if.then69
if.then69: ; preds = %for.end67
%idxprom70 = sext i32 %spec.select to i64
%arrayidx71 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %idxprom70
%24 = load i64, ptr %arrayidx71, align 8
%arrayidx75 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %indvars.iv192
%25 = load i64, ptr %arrayidx75, align 8
store i64 %25, ptr %arrayidx71, align 8
store i64 %24, ptr %arrayidx75, align 8
br label %for.inc79
for.inc79: ; preds = %for.end67, %if.then69
%indvars.iv.next193 = add nuw nsw i64 %indvars.iv192, 1
%exitcond.not = icmp eq i64 %indvars.iv.next193, %wide.trip.count
br i1 %exitcond.not, label %for.cond82.preheader, label %for.cond53.preheader, !llvm.loop !18
if.end88: ; preds = %if.end88.peel, %if.end88
%indvars.iv200 = phi i64 [ %indvars.iv.next201, %if.end88 ], [ 1, %if.end88.peel ]
%flag.3179 = phi i32 [ %spec.select163, %if.end88 ], [ %spec.select163.peel, %if.end88.peel ]
%putchar161 = call i32 @putchar(i32 32)
%arrayidx90 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %indvars.iv200
%value95 = getelementptr inbounds [36 x %struct.card], ptr %d, i64 0, i64 %indvars.iv200, i32 1
%26 = load i32, ptr %value95, align 4, !tbaa !9
%call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %arrayidx90, i32 noundef %26)
%arrayidx98 = getelementptr inbounds [36 x %struct.card], ptr %c, i64 0, i64 %indvars.iv200
%27 = load i8, ptr %arrayidx98, align 8, !tbaa !16
%28 = load i8, ptr %arrayidx90, align 8, !tbaa !16
%cmp106.not = icmp eq i8 %27, %28
%spec.select163 = select i1 %cmp106.not, i32 %flag.3179, i32 1
%indvars.iv.next201 = add nuw nsw i64 %indvars.iv200, 1
%29 = load i32, ptr %N, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp83 = icmp slt i64 %indvars.iv.next201, %30
br i1 %cmp83, label %if.end88, label %for.end112, !llvm.loop !19
for.end112.thread: ; preds = %for.cond82.preheader, %for.end48
%putchar208 = call i32 @putchar(i32 10)
br label %if.end119
for.end112: ; preds = %if.end88, %if.end88.peel
%spec.select163.lcssa = phi i32 [ %spec.select163.peel, %if.end88.peel ], [ %spec.select163, %if.end88 ]
%31 = icmp eq i32 %spec.select163.lcssa, 0
%putchar = call i32 @putchar(i32 10)
%spec.select210 = select i1 %31, ptr @str.9, ptr @str.8
br label %if.end119
if.end119: ; preds = %for.end112, %for.end112.thread
%str.8.sink = phi ptr [ @str.9, %for.end112.thread ], [ %spec.select210, %for.end112 ]
%puts159 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %c) #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"card", !7, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12, !15}
|
#include<stdio.h>
#include<string.h>
int main(){
int n,i,j,min,flag=1,sum=0;
char c1[36];
int c2[36];
char babble1[36];
int babble2[36];
char esc1;
int esc2;
scanf("%d",&n);
for(i=0;i<n;i++) scanf(" %c%d",&c1[i],&c2[i]);
for(i=0;i<n;i++){
babble1[i]=c1[i];
babble2[i]=c2[i];
}
if(n==1){
printf("%c%d\nStable\n",c1[0],c2[0]);
printf("%c%d\nStable\n",c1[0],c2[0]);
}
if(n!=1){
//start babble
while(flag){
flag=0;
for(j=n-1;j>=1;j--){
if(babble2[j] < babble2[j-1]){
esc1=babble1[j-1];
esc2=babble2[j-1];
babble1[j-1]=babble1[j];
babble2[j-1]=babble2[j];
babble1[j]=esc1;
babble2[j]=esc2;
flag=1;
}
}
}
for(i=0;i<n;i++){
printf("%c%d",babble1[i],babble2[i]);
if(i==n-1) break;
printf(" ");
}
printf("\nStable\n"); //end babble
//start select
for(i=0;i<n-1;i++){
min=i;
for(j=i+1;j<n;j++){
if(c2[j]<c2[min]){
min=j;
}
}
if(i==min) continue;
esc1=c1[i];
esc2=c2[i];
c1[i]=c1[min];
c2[i]=c2[min];
c1[min]=esc1;
c2[min]=esc2;
}
for(i=0;i<n;i++){
printf("%c%d",c1[i],c2[i]);
if( !((c1[i]==babble1[i]) && (c2[i]==babble2[i]))) sum++;
if(i==n-1) break;
printf(" ");
}
if(sum==0) printf("\nStable\n");
else printf("\nNot stable\n");
//end select
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113309/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113309/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [13 x i8] c"%c%d\0AStable\0A\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.7 = private unnamed_addr constant [12 x i8] c"\0ANot stable\00", align 1
@str.8 = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%c1 = alloca [36 x i8], align 16
%c2 = alloca [36 x i32], align 16
%babble1 = alloca [36 x i8], align 16
%babble2 = alloca [36 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %c1) #5
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %c2) #5
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %babble1) #5
call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %babble2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp229 = icmp sgt i32 %0, 0
br i1 %cmp229, label %for.body, label %for.end82
for.cond4.preheader: ; preds = %for.body
%cmp5231 = icmp sgt i32 %1, 0
br i1 %cmp5231, label %for.end17, label %for.end82
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x i8], ptr %c1, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [36 x i32], ptr %c2, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%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.cond4.preheader, !llvm.loop !9
for.end17: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %babble1, ptr nonnull align 16 %c1, i64 %3, i1 false), !tbaa !11
%4 = shl nuw nsw i64 %3, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %babble2, ptr nonnull align 16 %c2, i64 %4, i1 false), !tbaa !5
%cmp18 = icmp eq i32 %1, 1
br i1 %cmp18, label %if.end, label %for.cond29.preheader.us.preheader
if.end: ; preds = %for.end17
%5 = load i8, ptr %c1, align 16, !tbaa !11
%conv = sext i8 %5 to i32
%6 = load i32, ptr %c2, align 16, !tbaa !5
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %6)
%7 = load i8, ptr %c1, align 16, !tbaa !11
%conv23 = sext i8 %7 to i32
%8 = load i32, ptr %c2, align 16, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv23, i32 noundef %8)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp26.not = icmp eq i32 %.pre, 1
br i1 %cmp26.not, label %if.end169, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%cmp30234 = icmp sgt i32 %.pre, 1
br i1 %cmp30234, label %for.cond29.preheader.us.preheader, label %for.end82
for.cond29.preheader.us.preheader: ; preds = %for.end17, %while.cond.preheader
%9 = phi i32 [ %.pre, %while.cond.preheader ], [ %1, %for.end17 ]
%10 = zext i32 %9 to i64
br label %for.body32.us
for.body32.us: ; preds = %for.body32.us.backedge, %for.cond29.preheader.us.preheader
%indvars.iv257 = phi i64 [ %10, %for.cond29.preheader.us.preheader ], [ %indvars.iv257.be, %for.body32.us.backedge ]
%flag.1236.us = phi i32 [ 0, %for.cond29.preheader.us.preheader ], [ %flag.1236.us.be, %for.body32.us.backedge ]
%indvars.iv.next258 = add nsw i64 %indvars.iv257, -1
%idxprom33.us = and i64 %indvars.iv.next258, 4294967295
%arrayidx34.us = getelementptr inbounds [36 x i32], ptr %babble2, i64 0, i64 %idxprom33.us
%11 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%sub35.us = add i64 %indvars.iv257, 4294967294
%idxprom36.us = and i64 %sub35.us, 4294967295
%arrayidx37.us = getelementptr inbounds [36 x i32], ptr %babble2, i64 0, i64 %idxprom36.us
%12 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5
%cmp38.us = icmp slt i32 %11, %12
br i1 %cmp38.us, label %if.then40.us, label %for.inc62.us
if.then40.us: ; preds = %for.body32.us
%arrayidx43.us = getelementptr inbounds [36 x i8], ptr %babble1, i64 0, i64 %idxprom36.us
%13 = load i8, ptr %arrayidx43.us, align 1, !tbaa !11
%arrayidx48.us = getelementptr inbounds [36 x i8], ptr %babble1, i64 0, i64 %idxprom33.us
%14 = load i8, ptr %arrayidx48.us, align 1, !tbaa !11
store i8 %14, ptr %arrayidx43.us, align 1, !tbaa !11
store i32 %11, ptr %arrayidx37.us, align 4, !tbaa !5
store i8 %13, ptr %arrayidx48.us, align 1, !tbaa !11
store i32 %12, ptr %arrayidx34.us, align 4, !tbaa !5
br label %for.inc62.us
for.inc62.us: ; preds = %if.then40.us, %for.body32.us
%flag.2.us = phi i32 [ 1, %if.then40.us ], [ %flag.1236.us, %for.body32.us ]
%cmp30.us = icmp sgt i64 %indvars.iv257, 2
br i1 %cmp30.us, label %for.body32.us.backedge, label %for.cond29.while.cond.loopexit_crit_edge.us
for.body32.us.backedge: ; preds = %for.inc62.us, %for.cond29.while.cond.loopexit_crit_edge.us
%indvars.iv257.be = phi i64 [ %indvars.iv.next258, %for.inc62.us ], [ %10, %for.cond29.while.cond.loopexit_crit_edge.us ]
%flag.1236.us.be = phi i32 [ %flag.2.us, %for.inc62.us ], [ 0, %for.cond29.while.cond.loopexit_crit_edge.us ]
br label %for.body32.us, !llvm.loop !12
for.cond29.while.cond.loopexit_crit_edge.us: ; preds = %for.inc62.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %for.cond64.preheader, label %for.body32.us.backedge
for.cond64.preheader: ; preds = %for.cond29.while.cond.loopexit_crit_edge.us
%cmp65239 = icmp sgt i32 %9, 0
br i1 %cmp65239, label %for.body67, label %for.end82
for.body67: ; preds = %for.cond64.preheader, %if.end78
%indvars.iv260 = phi i64 [ %indvars.iv.next261, %if.end78 ], [ 0, %for.cond64.preheader ]
%arrayidx69 = getelementptr inbounds [36 x i8], ptr %babble1, i64 0, i64 %indvars.iv260
%15 = load i8, ptr %arrayidx69, align 1, !tbaa !11
%conv70 = sext i8 %15 to i32
%arrayidx72 = getelementptr inbounds [36 x i32], ptr %babble2, i64 0, i64 %indvars.iv260
%16 = load i32, ptr %arrayidx72, align 4, !tbaa !5
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv70, i32 noundef %16)
%17 = load i32, ptr %n, align 4, !tbaa !5
%sub74 = add nsw i32 %17, -1
%18 = zext i32 %sub74 to i64
%cmp75 = icmp eq i64 %indvars.iv260, %18
br i1 %cmp75, label %for.end82, label %if.end78
if.end78: ; preds = %for.body67
%putchar = call i32 @putchar(i32 32)
%indvars.iv.next261 = add nuw nsw i64 %indvars.iv260, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp65 = icmp slt i64 %indvars.iv.next261, %20
br i1 %cmp65, label %for.body67, label %for.end82, !llvm.loop !13
for.end82: ; preds = %if.end78, %for.body67, %entry, %for.cond4.preheader, %while.cond.preheader, %for.cond64.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %n, align 4, !tbaa !5
%cmp86245 = icmp sgt i32 %21, 1
br i1 %cmp86245, label %for.body88.preheader, label %for.cond127.preheader
for.body88.preheader: ; preds = %for.end82
%sub85 = add nsw i32 %21, -1
%22 = zext i32 %21 to i64
%wide.trip.count274 = zext i32 %sub85 to i64
%wide.trip.count = zext i32 %21 to i64
br label %for.body88
for.cond127.preheader: ; preds = %for.inc124, %for.end82
%cmp128247 = icmp sgt i32 %21, 0
br i1 %cmp128247, label %for.body130, label %if.end169.sink.split
for.body88: ; preds = %for.body88.preheader, %for.inc124
%indvars.iv270 = phi i64 [ 0, %for.body88.preheader ], [ %indvars.iv.next271, %for.inc124 ]
%indvars.iv264 = phi i64 [ 1, %for.body88.preheader ], [ %indvars.iv.next265, %for.inc124 ]
%indvars.iv.next271 = add nuw nsw i64 %indvars.iv270, 1
%cmp90241 = icmp ult i64 %indvars.iv.next271, %22
%23 = trunc i64 %indvars.iv270 to i32
br i1 %cmp90241, label %for.body92, label %for.end103
for.body92: ; preds = %for.body88, %for.body92
%indvars.iv266 = phi i64 [ %indvars.iv.next267, %for.body92 ], [ %indvars.iv264, %for.body88 ]
%min.0243 = phi i32 [ %spec.select, %for.body92 ], [ %23, %for.body88 ]
%arrayidx94 = getelementptr inbounds [36 x i32], ptr %c2, i64 0, i64 %indvars.iv266
%24 = load i32, ptr %arrayidx94, align 4, !tbaa !5
%idxprom95 = sext i32 %min.0243 to i64
%arrayidx96 = getelementptr inbounds [36 x i32], ptr %c2, i64 0, i64 %idxprom95
%25 = load i32, ptr %arrayidx96, align 4, !tbaa !5
%cmp97 = icmp slt i32 %24, %25
%26 = trunc i64 %indvars.iv266 to i32
%spec.select = select i1 %cmp97, i32 %26, i32 %min.0243
%indvars.iv.next267 = add nuw nsw i64 %indvars.iv266, 1
%exitcond.not = icmp eq i64 %indvars.iv.next267, %wide.trip.count
br i1 %exitcond.not, label %for.end103, label %for.body92, !llvm.loop !14
for.end103: ; preds = %for.body92, %for.body88
%min.0.lcssa = phi i32 [ %23, %for.body88 ], [ %spec.select, %for.body92 ]
%27 = zext i32 %min.0.lcssa to i64
%cmp104 = icmp eq i64 %indvars.iv270, %27
br i1 %cmp104, label %for.inc124, label %if.end107
if.end107: ; preds = %for.end103
%arrayidx109 = getelementptr inbounds [36 x i8], ptr %c1, i64 0, i64 %indvars.iv270
%28 = load i8, ptr %arrayidx109, align 1, !tbaa !11
%arrayidx111 = getelementptr inbounds [36 x i32], ptr %c2, i64 0, i64 %indvars.iv270
%29 = load i32, ptr %arrayidx111, align 4, !tbaa !5
%idxprom112 = sext i32 %min.0.lcssa to i64
%arrayidx113 = getelementptr inbounds [36 x i8], ptr %c1, i64 0, i64 %idxprom112
%30 = load i8, ptr %arrayidx113, align 1, !tbaa !11
store i8 %30, ptr %arrayidx109, align 1, !tbaa !11
%arrayidx117 = getelementptr inbounds [36 x i32], ptr %c2, i64 0, i64 %idxprom112
%31 = load i32, ptr %arrayidx117, align 4, !tbaa !5
store i32 %31, ptr %arrayidx111, align 4, !tbaa !5
store i8 %28, ptr %arrayidx113, align 1, !tbaa !11
store i32 %29, ptr %arrayidx117, align 4, !tbaa !5
br label %for.inc124
for.inc124: ; preds = %for.end103, %if.end107
%indvars.iv.next265 = add nuw nsw i64 %indvars.iv264, 1
%exitcond275.not = icmp eq i64 %indvars.iv.next271, %wide.trip.count274
br i1 %exitcond275.not, label %for.cond127.preheader, label %for.body88, !llvm.loop !15
for.body130: ; preds = %for.cond127.preheader, %if.end158
%indvars.iv276 = phi i64 [ %indvars.iv.next277, %if.end158 ], [ 0, %for.cond127.preheader ]
%sum.0249 = phi i32 [ %sum.1, %if.end158 ], [ 0, %for.cond127.preheader ]
%arrayidx132 = getelementptr inbounds [36 x i8], ptr %c1, i64 0, i64 %indvars.iv276
%32 = load i8, ptr %arrayidx132, align 1, !tbaa !11
%conv133 = sext i8 %32 to i32
%arrayidx135 = getelementptr inbounds [36 x i32], ptr %c2, i64 0, i64 %indvars.iv276
%33 = load i32, ptr %arrayidx135, align 4, !tbaa !5
%call136 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv133, i32 noundef %33)
%34 = load i8, ptr %arrayidx132, align 1, !tbaa !11
%arrayidx141 = getelementptr inbounds [36 x i8], ptr %babble1, i64 0, i64 %indvars.iv276
%35 = load i8, ptr %arrayidx141, align 1, !tbaa !11
%cmp143 = icmp eq i8 %34, %35
br i1 %cmp143, label %land.lhs.true, label %if.then151
land.lhs.true: ; preds = %for.body130
%36 = load i32, ptr %arrayidx135, align 4, !tbaa !5
%arrayidx148 = getelementptr inbounds [36 x i32], ptr %babble2, i64 0, i64 %indvars.iv276
%37 = load i32, ptr %arrayidx148, align 4, !tbaa !5
%cmp149 = icmp eq i32 %36, %37
br i1 %cmp149, label %if.end153, label %if.then151
if.then151: ; preds = %land.lhs.true, %for.body130
%inc152 = add nsw i32 %sum.0249, 1
br label %if.end153
if.end153: ; preds = %if.then151, %land.lhs.true
%sum.1 = phi i32 [ %sum.0249, %land.lhs.true ], [ %inc152, %if.then151 ]
%38 = load i32, ptr %n, align 4, !tbaa !5
%sub154 = add nsw i32 %38, -1
%39 = zext i32 %sub154 to i64
%cmp155 = icmp eq i64 %indvars.iv276, %39
br i1 %cmp155, label %for.end162, label %if.end158
if.end158: ; preds = %if.end153
%putchar226 = call i32 @putchar(i32 32)
%indvars.iv.next277 = add nuw nsw i64 %indvars.iv276, 1
%40 = load i32, ptr %n, align 4, !tbaa !5
%41 = sext i32 %40 to i64
%cmp128 = icmp slt i64 %indvars.iv.next277, %41
br i1 %cmp128, label %for.body130, label %for.end162, !llvm.loop !16
for.end162: ; preds = %if.end158, %if.end153
%42 = icmp eq i32 %sum.1, 0
%spec.select291 = select i1 %42, ptr @str.8, ptr @str.7
br label %if.end169.sink.split
if.end169.sink.split: ; preds = %for.end162, %for.cond127.preheader
%str.8.sink = phi ptr [ @str.8, %for.cond127.preheader ], [ %spec.select291, %for.end162 ]
%puts228 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
br label %if.end169
if.end169: ; preds = %if.end169.sink.split, %if.end
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %babble2) #5
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %babble1) #5
call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %c2) #5
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %c1) #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 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
#include<string.h>
typedef struct{
int val;
char pattern;
}Card;
void BubbleSort(Card *, int);
void SelectionSort(Card *, int);
int main(){
int n, i, flagb=1, flags=1;
char tmp;
Card cb[36], cs[36];
scanf("%d%c",&n, &tmp);
for(i = 0; i < n; i++)
scanf("%c%d%c",&cb[i].pattern, &cb[i].val, &tmp);
for(i = 0; i < n; i++)
cs[i] = cb[i];
SelectionSort(cs, n);
BubbleSort(cb, n);
for(i = 0; i < n; i++){
printf("%c%d",cb[i].pattern, cb[i].val);
if(i != n - 1) printf(" ");
if(cb[i].pattern != cb[i].pattern || cb[i].val != cb[i].val) flagb = 0;
}
printf("\n");
if(flagb == 1) printf("Stable\n");
else printf("Not stable\n");
for(i = 0; i < n; i++){
printf("%c%d",cs[i].pattern, cs[i].val);
if(i != n-1) printf(" ");
if(cs[i].pattern != cb[i].pattern || cs[i].val != cb[i].val) flags = 0;
}
printf("\n");
if(flags == 1) printf("Stable\n");
else printf("Not stable\n");
return 0;
}
void BubbleSort(Card *c, int n){
int i, j;
Card tmp;
for(i = 0; i <= n-1; i++){
for(j = n-1 ; j > i ; j--){
if(c[j].val < c[j-1].val){
tmp = c[j];
c[j] = c[j-1];
c[j-1] = tmp;
}
}
}
return;
}
void SelectionSort(Card *c, int n){
int i, j, minj;
Card tmp;
for(i = 0; i <= n-1; i++){
minj = i;
for(j = i ; j <= n-1 ; j++){
if(c[j].val < c[minj].val){
minj = j;
}
}
tmp = c[i];
c[i] = c[minj];
c[minj] = tmp;
}
return;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113352/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113352/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i32, i8 }
@.str = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%d%c\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%tmp = alloca i8, align 1
%cb = alloca [36 x %struct.Card], align 16
%cs = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %tmp) #6
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %cb) #6
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %cs) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %tmp)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp144 = icmp sgt i32 %0, 0
br i1 %cmp144, label %for.body, label %for.end50
for.cond4.preheader: ; preds = %for.body
%cmp5146 = icmp sgt i32 %1, 0
br i1 %cmp5146, label %for.cond1.preheader.preheader.i, label %for.end50
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.Card], ptr %cb, i64 0, i64 %indvars.iv
%pattern = getelementptr inbounds [36 x %struct.Card], ptr %cb, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %pattern, ptr noundef nonnull %arrayidx, ptr noundef nonnull %tmp)
%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.cond4.preheader, !llvm.loop !9
for.cond1.preheader.preheader.i: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %cs, ptr nonnull align 16 %cb, i64 %4, i1 false)
%5 = zext i32 %1 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i, %for.end.i ]
%6 = trunc i64 %indvars.iv.i to i32
br label %for.body4.i
for.body4.i: ; preds = %for.body4.i, %for.cond1.preheader.i
%indvars.iv40.i = phi i64 [ %indvars.iv.i, %for.cond1.preheader.i ], [ %indvars.iv.next41.i, %for.body4.i ]
%minj.037.i = phi i32 [ %6, %for.cond1.preheader.i ], [ %spec.select.i, %for.body4.i ]
%arrayidx.i = getelementptr inbounds %struct.Card, ptr %cs, i64 %indvars.iv40.i
%7 = load i32, ptr %arrayidx.i, align 8, !tbaa !11
%idxprom5.i = sext i32 %minj.037.i to i64
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %cs, i64 %idxprom5.i
%8 = load i32, ptr %arrayidx6.i, align 8, !tbaa !11
%cmp8.i = icmp slt i32 %7, %8
%9 = trunc i64 %indvars.iv40.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %9, i32 %minj.037.i
%indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1
%cmp3.not.not.i = icmp ult i64 %indvars.iv.next41.i, %5
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.end.i, !llvm.loop !13
for.end.i: ; preds = %for.body4.i
%arrayidx10.i = getelementptr inbounds %struct.Card, ptr %cs, i64 %indvars.iv.i
%10 = load i64, ptr %arrayidx10.i, align 8
%idxprom13.i = sext i32 %spec.select.i to i64
%arrayidx14.i = getelementptr inbounds %struct.Card, ptr %cs, i64 %idxprom13.i
%11 = load i64, ptr %arrayidx14.i, align 8
store i64 %11, ptr %arrayidx10.i, align 8
store i64 %10, ptr %arrayidx14.i, align 8
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %5
br i1 %exitcond.not.i, label %for.cond2.preheader.lr.ph.i, label %for.cond1.preheader.i, !llvm.loop !14
for.cond2.preheader.lr.ph.i: ; preds = %for.end.i
%j.037.i = add nsw i32 %1, -1
%12 = add nsw i64 %5, -1
%13 = zext i32 %j.037.i to i64
%invariant.gep.i = getelementptr %struct.Card, ptr %cb, i64 -2
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc20.i, %for.cond2.preheader.lr.ph.i
%indvars.iv49.i = phi i64 [ 0, %for.cond2.preheader.lr.ph.i ], [ %indvars.iv.next50.i, %for.inc20.i ]
%cmp338.i = icmp ult i64 %indvars.iv49.i, %13
br i1 %cmp338.i, label %for.body4.i140, label %for.inc20.i
for.body4.i140: ; preds = %for.cond2.preheader.i, %for.inc.i
%indvars.iv43.i = phi i64 [ %indvars.iv.next44.i, %for.inc.i ], [ %5, %for.cond2.preheader.i ]
%indvars.iv.i141 = phi i64 [ %indvars.iv.next.i143, %for.inc.i ], [ %12, %for.cond2.preheader.i ]
%indvars.iv.next44.i = add nsw i64 %indvars.iv43.i, -1
%arrayidx.i142 = getelementptr inbounds %struct.Card, ptr %cb, i64 %indvars.iv.i141
%14 = load i32, ptr %arrayidx.i142, align 8, !tbaa !11
%gep.i = getelementptr %struct.Card, ptr %invariant.gep.i, i64 %indvars.iv43.i
%15 = load i32, ptr %gep.i, align 8, !tbaa !11
%cmp9.i = icmp slt i32 %14, %15
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i140
%16 = load i64, ptr %arrayidx.i142, align 8
%17 = load i64, ptr %gep.i, align 8
store i64 %17, ptr %arrayidx.i142, align 8
store i64 %16, ptr %gep.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i140
%indvars.iv.next.i143 = add nsw i64 %indvars.iv.i141, -1
%cmp3.i = icmp sgt i64 %indvars.iv.next.i143, %indvars.iv49.i
br i1 %cmp3.i, label %for.body4.i140, label %for.inc20.i, !llvm.loop !15
for.inc20.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%indvars.iv.next50.i = add nuw nsw i64 %indvars.iv49.i, 1
%exitcond.not.i139 = icmp eq i64 %indvars.iv.next50.i, %5
br i1 %exitcond.not.i139, label %BubbleSort.exit, label %for.cond2.preheader.i, !llvm.loop !16
BubbleSort.exit: ; preds = %for.inc20.i
br i1 %cmp5146, label %for.body17, label %for.end50
for.body17: ; preds = %BubbleSort.exit, %for.inc48
%indvars.iv159 = phi i64 [ %indvars.iv.next160, %for.inc48 ], [ 0, %BubbleSort.exit ]
%arrayidx19 = getelementptr inbounds [36 x %struct.Card], ptr %cb, i64 0, i64 %indvars.iv159
%pattern20 = getelementptr inbounds [36 x %struct.Card], ptr %cb, i64 0, i64 %indvars.iv159, i32 1
%18 = load i8, ptr %pattern20, align 4, !tbaa !17
%conv = sext i8 %18 to i32
%19 = load i32, ptr %arrayidx19, align 8, !tbaa !11
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %19)
%20 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %20, -1
%21 = zext i32 %sub to i64
%cmp25.not = icmp eq i64 %indvars.iv159, %21
br i1 %cmp25.not, label %for.inc48, label %if.then
if.then: ; preds = %for.body17
%putchar137 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc48
for.inc48: ; preds = %if.then, %for.body17
%22 = phi i32 [ %.pre, %if.then ], [ %20, %for.body17 ]
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%23 = sext i32 %22 to i64
%cmp16 = icmp slt i64 %indvars.iv.next160, %23
br i1 %cmp16, label %for.body17, label %for.end50, !llvm.loop !18
for.end50: ; preds = %for.inc48, %for.cond4.preheader, %entry, %BubbleSort.exit
%putchar = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%24 = load i32, ptr %n, align 4, !tbaa !5
%cmp59150 = icmp sgt i32 %24, 0
br i1 %cmp59150, label %for.body61, label %for.end99.thread
for.end99.thread: ; preds = %for.end50
%putchar133171 = call i32 @putchar(i32 10)
br label %if.end107
for.body61: ; preds = %for.end50, %for.inc97
%indvars.iv162 = phi i64 [ %indvars.iv.next163, %for.inc97 ], [ 0, %for.end50 ]
%flags.0152 = phi i32 [ %flags.1, %for.inc97 ], [ 1, %for.end50 ]
%arrayidx63 = getelementptr inbounds [36 x %struct.Card], ptr %cs, i64 0, i64 %indvars.iv162
%pattern64 = getelementptr inbounds [36 x %struct.Card], ptr %cs, i64 0, i64 %indvars.iv162, i32 1
%25 = load i8, ptr %pattern64, align 4, !tbaa !17
%conv65 = sext i8 %25 to i32
%26 = load i32, ptr %arrayidx63, align 8, !tbaa !11
%call69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv65, i32 noundef %26)
%27 = load i32, ptr %n, align 4, !tbaa !5
%sub70 = add nsw i32 %27, -1
%28 = zext i32 %sub70 to i64
%cmp71.not = icmp eq i64 %indvars.iv162, %28
br i1 %cmp71.not, label %if.end75, label %if.then73
if.then73: ; preds = %for.body61
%putchar136 = call i32 @putchar(i32 32)
br label %if.end75
if.end75: ; preds = %if.then73, %for.body61
%pattern82 = getelementptr inbounds [36 x %struct.Card], ptr %cb, i64 0, i64 %indvars.iv162, i32 1
%29 = load i8, ptr %pattern82, align 4, !tbaa !17
%cmp84.not = icmp eq i8 %25, %29
br i1 %cmp84.not, label %lor.lhs.false86, label %if.then95
lor.lhs.false86: ; preds = %if.end75
%arrayidx81 = getelementptr inbounds [36 x %struct.Card], ptr %cb, i64 0, i64 %indvars.iv162
%30 = load i32, ptr %arrayidx81, align 8, !tbaa !11
%cmp93.not = icmp eq i32 %26, %30
br i1 %cmp93.not, label %for.inc97, label %if.then95
if.then95: ; preds = %lor.lhs.false86, %if.end75
br label %for.inc97
for.inc97: ; preds = %lor.lhs.false86, %if.then95
%flags.1 = phi i32 [ 0, %if.then95 ], [ %flags.0152, %lor.lhs.false86 ]
%indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1
%31 = load i32, ptr %n, align 4, !tbaa !5
%32 = sext i32 %31 to i64
%cmp59 = icmp slt i64 %indvars.iv.next163, %32
br i1 %cmp59, label %for.body61, label %for.end99, !llvm.loop !19
for.end99: ; preds = %for.inc97
%33 = icmp eq i32 %flags.1, 1
%putchar133 = call i32 @putchar(i32 10)
%spec.select = select i1 %33, ptr @str.8, ptr @str.7
br label %if.end107
if.end107: ; preds = %for.end99, %for.end99.thread
%str.7.sink = phi ptr [ @str.8, %for.end99.thread ], [ %spec.select, %for.end99 ]
%puts134 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %cs) #6
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %cb) #6
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %tmp) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree 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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %c, i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp.not.not38 = icmp sgt i32 %n, 0
br i1 %cmp.not.not38, label %for.cond1.preheader.preheader, label %for.end19
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body4
for.body4: ; preds = %for.cond1.preheader, %for.body4
%indvars.iv40 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next41, %for.body4 ]
%minj.037 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body4 ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv40
%2 = load i32, ptr %arrayidx, align 4, !tbaa !11
%idxprom5 = sext i32 %minj.037 to i64
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %c, i64 %idxprom5
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !11
%cmp8 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv40 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.037
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%cmp3.not.not = icmp ult i64 %indvars.iv.next41, %0
br i1 %cmp3.not.not, label %for.body4, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body4
%arrayidx10 = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv
%5 = load i64, ptr %arrayidx10, align 4
%idxprom13 = sext i32 %spec.select to i64
%arrayidx14 = getelementptr inbounds %struct.Card, ptr %c, i64 %idxprom13
%6 = load i64, ptr %arrayidx14, align 4
store i64 %6, ptr %arrayidx10, align 4
store i64 %5, ptr %arrayidx14, align 4
%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.end19, label %for.cond1.preheader, !llvm.loop !14
for.end19: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %c, i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp.not.not41 = icmp sgt i32 %n, 0
br i1 %cmp.not.not41, label %for.cond2.preheader.lr.ph, label %for.end21
for.cond2.preheader.lr.ph: ; preds = %entry
%j.037 = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%2 = zext i32 %j.037 to i64
%wide.trip.count = zext i32 %n to i64
%invariant.gep = getelementptr %struct.Card, ptr %c, i64 -2
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.inc20
%indvars.iv49 = phi i64 [ 0, %for.cond2.preheader.lr.ph ], [ %indvars.iv.next50, %for.inc20 ]
%cmp338 = icmp ult i64 %indvars.iv49, %2
br i1 %cmp338, label %for.body4, label %for.inc20
for.body4: ; preds = %for.cond2.preheader, %for.inc
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.inc ], [ %0, %for.cond2.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %1, %for.cond2.preheader ]
%indvars.iv.next44 = add nsw i64 %indvars.iv43, -1
%arrayidx = getelementptr inbounds %struct.Card, ptr %c, i64 %indvars.iv
%3 = load i32, ptr %arrayidx, align 4, !tbaa !11
%gep = getelementptr %struct.Card, ptr %invariant.gep, i64 %indvars.iv43
%4 = load i32, ptr %gep, align 4, !tbaa !11
%cmp9 = icmp slt i32 %3, %4
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%5 = load i64, ptr %arrayidx, align 4
%6 = load i64, ptr %gep, align 4
store i64 %6, ptr %arrayidx, align 4
store i64 %5, ptr %gep, align 4
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp3 = icmp sgt i64 %indvars.iv.next, %indvars.iv49
br i1 %cmp3, label %for.body4, label %for.inc20, !llvm.loop !15
for.inc20: ; preds = %for.inc, %for.cond2.preheader
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
br i1 %exitcond.not, label %for.end21, label %for.cond2.preheader, !llvm.loop !16
for.end21: ; preds = %for.inc20, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !7, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!12, !7, i64 4}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include <stdio.h>
#define N 36
int main() {
int i, j;
int n, minj;
int flag = 0;
char bcard[N][2], scard[N][2];
char temp[2];
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%s", bcard[i]);
for(i = 0; i < n; i++)
for(j = 0; j < 2; j++)
scard[i][j] = bcard[i][j];
//Bubble Sort
for(i = 0; i < n; i++) {
for(j = n - 1; j >= 0; j--) {
if(bcard[j-1][1] > bcard[j][1]) {
temp[0] = bcard[j][0];
temp[1] = bcard[j][1];
bcard[j][0] = bcard[j-1][0];
bcard[j][1] = bcard[j-1][1];
bcard[j-1][0] = temp[0];
bcard[j-1][1] = temp[1];
}
}
}
//printBubbleSort
for(i = 0; i < n; i++) {
for(j = 0; j < 2; j++) {
printf("%c", bcard[i][j]);
}
if(i < n - 1) printf(" ");
}
printf("\n");
printf("Stable\n");
//Selection Sort
for(i = 0; i < n - 1; i++) {
minj = i;
for(j = i; j < n; j++) {
if(scard[minj][1] > scard[j][1]) minj = j;
}
if(scard[minj][1] < scard[i][1]) {
temp[0] = scard[i][0];
temp[1] = scard[i][1];
scard[i][0] = scard[minj][0];
scard[i][1] = scard[minj][1];
scard[minj][0] = temp[0];
scard[minj][1] = temp[1];
}
}
//Compare
for(i = 0; i < n; i++)
for(j = 0; j < 2; j++)
if(bcard[i][j] != scard[i][j]) flag = 1;
//printSelectionSort
for(i = 0; i < n; i++) {
for(j = 0; j < 2; j++) {
printf("%c", scard[i][j]);
}
if(i < n - 1) printf(" ");
}
printf("\n");
if(flag == 0) printf("Stable\n");
else printf("Not stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113396/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113396/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%bcard = alloca [36 x [2 x i8]], align 16
%scard = alloca [36 x [2 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %bcard) #5
call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %scard) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp305 = icmp sgt i32 %0, 0
br i1 %cmp305, label %for.body, label %for.end100
for.cond2.preheader: ; preds = %for.body
%cmp3308 = icmp sgt i32 %1, 0
br i1 %cmp3308, label %for.cond25.preheader.lr.ph, label %for.end100
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond25.preheader.lr.ph: ; preds = %for.cond2.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %scard, ptr nonnull align 16 %bcard, i64 %4, i1 false), !tbaa !11
%5 = zext i32 %1 to i64
br label %for.cond25.preheader.us
for.cond25.preheader.us: ; preds = %for.cond25.for.inc72_crit_edge.us, %for.cond25.preheader.lr.ph
%i.2315.us = phi i32 [ 0, %for.cond25.preheader.lr.ph ], [ %inc73.us, %for.cond25.for.inc72_crit_edge.us ]
br label %for.body27.us
for.body27.us: ; preds = %for.cond25.preheader.us, %for.inc70.us
%indvars.iv341 = phi i64 [ %5, %for.cond25.preheader.us ], [ %indvars.iv.next342, %for.inc70.us ]
%indvars.iv.next342 = add nsw i64 %indvars.iv341, -1
%6 = add nsw i64 %indvars.iv341, -2
%arrayidx31.us = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %6, i64 1
%7 = load i8, ptr %arrayidx31.us, align 1, !tbaa !11
%arrayidx34.us = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv.next342, i64 1
%8 = load i8, ptr %arrayidx34.us, align 1, !tbaa !11
%cmp36.us = icmp sgt i8 %7, %8
br i1 %cmp36.us, label %if.then.us, label %for.inc70.us
if.then.us: ; preds = %for.body27.us
%arrayidx33.us = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv.next342
%arrayidx30.us = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %6
%9 = load i8, ptr %arrayidx33.us, align 2, !tbaa !11
%10 = load i8, ptr %arrayidx30.us, align 2, !tbaa !11
store i8 %10, ptr %arrayidx33.us, align 2, !tbaa !11
store i8 %7, ptr %arrayidx34.us, align 1, !tbaa !11
store i8 %9, ptr %arrayidx30.us, align 2, !tbaa !11
store i8 %8, ptr %arrayidx31.us, align 1, !tbaa !11
br label %for.inc70.us
for.inc70.us: ; preds = %if.then.us, %for.body27.us
%cmp26.us = icmp sgt i64 %indvars.iv341, 1
br i1 %cmp26.us, label %for.body27.us, label %for.cond25.for.inc72_crit_edge.us, !llvm.loop !12
for.cond25.for.inc72_crit_edge.us: ; preds = %for.inc70.us
%inc73.us = add nuw nsw i32 %i.2315.us, 1
%exitcond.not = icmp eq i32 %inc73.us, %1
br i1 %exitcond.not, label %for.cond75.preheader, label %for.cond25.preheader.us, !llvm.loop !13
for.cond75.preheader: ; preds = %for.cond25.for.inc72_crit_edge.us
br i1 %cmp3308, label %for.cond79.preheader, label %for.end100
for.cond79.preheader: ; preds = %for.cond75.preheader, %for.inc98
%indvars.iv348 = phi i64 [ %indvars.iv.next349, %for.inc98 ], [ 0, %for.cond75.preheader ]
%arrayidx86 = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv348, i64 0
%11 = load i8, ptr %arrayidx86, align 2, !tbaa !11
%conv87 = sext i8 %11 to i32
%putchar302 = call i32 @putchar(i32 %conv87)
%arrayidx86.1 = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv348, i64 1
%12 = load i8, ptr %arrayidx86.1, align 1, !tbaa !11
%conv87.1 = sext i8 %12 to i32
%putchar302.1 = call i32 @putchar(i32 %conv87.1)
%13 = load i32, ptr %n, align 4, !tbaa !5
%sub92 = add nsw i32 %13, -1
%14 = sext i32 %sub92 to i64
%cmp93 = icmp slt i64 %indvars.iv348, %14
br i1 %cmp93, label %if.then95, label %for.inc98
if.then95: ; preds = %for.cond79.preheader
%putchar301 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc98
for.inc98: ; preds = %for.cond79.preheader, %if.then95
%15 = phi i32 [ %13, %for.cond79.preheader ], [ %.pre, %if.then95 ]
%indvars.iv.next349 = add nuw nsw i64 %indvars.iv348, 1
%16 = sext i32 %15 to i64
%cmp76 = icmp slt i64 %indvars.iv.next349, %16
br i1 %cmp76, label %for.cond79.preheader, label %for.end100, !llvm.loop !14
for.end100: ; preds = %for.inc98, %for.cond2.preheader, %entry, %for.cond75.preheader
%putchar = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%17 = load i32, ptr %n, align 4, !tbaa !5
%cmp105323 = icmp sgt i32 %17, 1
br i1 %cmp105323, label %for.cond108.preheader.preheader, label %for.cond170.preheader
for.cond108.preheader.preheader: ; preds = %for.end100
%sub104 = add nsw i32 %17, -1
%18 = zext i32 %17 to i64
%wide.trip.count358 = zext i32 %sub104 to i64
%wide.trip.count = zext i32 %17 to i64
br label %for.cond108.preheader
for.cond108.preheader: ; preds = %for.cond108.preheader.preheader, %for.inc167
%indvars.iv351 = phi i64 [ 0, %for.cond108.preheader.preheader ], [ %indvars.iv.next352, %for.inc167 ]
%cmp109319 = icmp ult i64 %indvars.iv351, %18
%19 = trunc i64 %indvars.iv351 to i32
br i1 %cmp109319, label %for.body111, label %for.end126
for.cond170.preheader: ; preds = %for.inc167, %for.end100
%cmp171328 = icmp sgt i32 %17, 0
br i1 %cmp171328, label %for.cond174.preheader.preheader, label %for.end223.thread
for.end223.thread: ; preds = %for.cond170.preheader
%putchar296383 = call i32 @putchar(i32 10)
br label %if.end230
for.cond174.preheader.preheader: ; preds = %for.cond170.preheader
%wide.trip.count366 = zext i32 %17 to i64
%xtraiter = and i64 %wide.trip.count366, 1
%20 = icmp eq i32 %17, 1
br i1 %20, label %for.cond198.preheader.unr-lcssa, label %for.cond174.preheader.preheader.new
for.cond174.preheader.preheader.new: ; preds = %for.cond174.preheader.preheader
%unroll_iter = and i64 %wide.trip.count366, 4294967294
br label %for.cond174.preheader
for.body111: ; preds = %for.cond108.preheader, %for.body111
%indvars.iv353 = phi i64 [ %indvars.iv.next354, %for.body111 ], [ %indvars.iv351, %for.cond108.preheader ]
%minj.0321 = phi i32 [ %spec.select, %for.body111 ], [ %19, %for.cond108.preheader ]
%idxprom112 = sext i32 %minj.0321 to i64
%arrayidx114 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %idxprom112, i64 1
%21 = load i8, ptr %arrayidx114, align 1, !tbaa !11
%arrayidx118 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv353, i64 1
%22 = load i8, ptr %arrayidx118, align 1, !tbaa !11
%cmp120 = icmp sgt i8 %21, %22
%23 = trunc i64 %indvars.iv353 to i32
%spec.select = select i1 %cmp120, i32 %23, i32 %minj.0321
%indvars.iv.next354 = add nuw nsw i64 %indvars.iv353, 1
%exitcond356.not = icmp eq i64 %indvars.iv.next354, %wide.trip.count
br i1 %exitcond356.not, label %for.end126, label %for.body111, !llvm.loop !15
for.end126: ; preds = %for.body111, %for.cond108.preheader
%minj.0.lcssa = phi i32 [ %19, %for.cond108.preheader ], [ %spec.select, %for.body111 ]
%idxprom127 = sext i32 %minj.0.lcssa to i64
%arrayidx129 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %idxprom127, i64 1
%24 = load i8, ptr %arrayidx129, align 1, !tbaa !11
%arrayidx133 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv351, i64 1
%25 = load i8, ptr %arrayidx133, align 1, !tbaa !11
%cmp135 = icmp slt i8 %24, %25
br i1 %cmp135, label %if.then137, label %for.inc167
if.then137: ; preds = %for.end126
%arrayidx132 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv351
%arrayidx128 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %idxprom127
%26 = load i8, ptr %arrayidx132, align 2, !tbaa !11
%27 = load i8, ptr %arrayidx128, align 2, !tbaa !11
store i8 %27, ptr %arrayidx132, align 2, !tbaa !11
store i8 %24, ptr %arrayidx133, align 1, !tbaa !11
store i8 %26, ptr %arrayidx128, align 2, !tbaa !11
store i8 %25, ptr %arrayidx129, align 1, !tbaa !11
br label %for.inc167
for.inc167: ; preds = %for.end126, %if.then137
%indvars.iv.next352 = add nuw nsw i64 %indvars.iv351, 1
%exitcond359.not = icmp eq i64 %indvars.iv.next352, %wide.trip.count358
br i1 %exitcond359.not, label %for.cond170.preheader, label %for.cond108.preheader, !llvm.loop !16
for.cond174.preheader: ; preds = %for.cond174.preheader, %for.cond174.preheader.preheader.new
%indvars.iv363 = phi i64 [ 0, %for.cond174.preheader.preheader.new ], [ %indvars.iv.next364.1, %for.cond174.preheader ]
%flag.0330 = phi i32 [ 0, %for.cond174.preheader.preheader.new ], [ %spec.select303.1.1, %for.cond174.preheader ]
%niter = phi i64 [ 0, %for.cond174.preheader.preheader.new ], [ %niter.next.1, %for.cond174.preheader ]
%arrayidx181 = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv363, i64 0
%28 = load i8, ptr %arrayidx181, align 4, !tbaa !11
%arrayidx186 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv363, i64 0
%29 = load i8, ptr %arrayidx186, align 4, !tbaa !11
%cmp188.not = icmp eq i8 %28, %29
%arrayidx181.1 = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv363, i64 1
%30 = load i8, ptr %arrayidx181.1, align 1, !tbaa !11
%arrayidx186.1 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv363, i64 1
%31 = load i8, ptr %arrayidx186.1, align 1, !tbaa !11
%cmp188.not.1 = icmp eq i8 %30, %31
%indvars.iv.next364 = or i64 %indvars.iv363, 1
%arrayidx181.1386 = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv.next364, i64 0
%32 = load i8, ptr %arrayidx181.1386, align 2, !tbaa !11
%arrayidx186.1387 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv.next364, i64 0
%33 = load i8, ptr %arrayidx186.1387, align 2, !tbaa !11
%cmp188.not.1388 = icmp eq i8 %32, %33
%arrayidx181.1.1 = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv.next364, i64 1
%34 = load i8, ptr %arrayidx181.1.1, align 1, !tbaa !11
%arrayidx186.1.1 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv.next364, i64 1
%35 = load i8, ptr %arrayidx186.1.1, align 1, !tbaa !11
%cmp188.not.1.1 = icmp eq i8 %34, %35
%36 = select i1 %cmp188.not.1.1, i1 %cmp188.not.1388, i1 false
%37 = select i1 %36, i1 %cmp188.not.1, i1 false
%38 = select i1 %37, i1 %cmp188.not, i1 false
%spec.select303.1.1 = select i1 %38, i32 %flag.0330, i32 1
%indvars.iv.next364.1 = add nuw nsw i64 %indvars.iv363, 2
%niter.next.1 = add nuw i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond198.preheader.unr-lcssa, label %for.cond174.preheader, !llvm.loop !17
for.cond198.preheader.unr-lcssa: ; preds = %for.cond174.preheader, %for.cond174.preheader.preheader
%spec.select303.1.lcssa.ph = phi i32 [ undef, %for.cond174.preheader.preheader ], [ %spec.select303.1.1, %for.cond174.preheader ]
%indvars.iv363.unr = phi i64 [ 0, %for.cond174.preheader.preheader ], [ %indvars.iv.next364.1, %for.cond174.preheader ]
%flag.0330.unr = phi i32 [ 0, %for.cond174.preheader.preheader ], [ %spec.select303.1.1, %for.cond174.preheader ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond198.preheader, label %for.cond174.preheader.epil
for.cond174.preheader.epil: ; preds = %for.cond198.preheader.unr-lcssa
%arrayidx181.epil = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv363.unr, i64 0
%39 = load i8, ptr %arrayidx181.epil, align 2, !tbaa !11
%arrayidx186.epil = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv363.unr, i64 0
%40 = load i8, ptr %arrayidx186.epil, align 2, !tbaa !11
%cmp188.not.epil = icmp eq i8 %39, %40
%arrayidx181.1.epil = getelementptr inbounds [36 x [2 x i8]], ptr %bcard, i64 0, i64 %indvars.iv363.unr, i64 1
%41 = load i8, ptr %arrayidx181.1.epil, align 1, !tbaa !11
%arrayidx186.1.epil = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv363.unr, i64 1
%42 = load i8, ptr %arrayidx186.1.epil, align 1, !tbaa !11
%cmp188.not.1.epil = icmp eq i8 %41, %42
%43 = select i1 %cmp188.not.1.epil, i1 %cmp188.not.epil, i1 false
%spec.select303.1.epil = select i1 %43, i32 %flag.0330.unr, i32 1
br label %for.cond198.preheader
for.cond198.preheader: ; preds = %for.cond198.preheader.unr-lcssa, %for.cond174.preheader.epil
%spec.select303.1.lcssa = phi i32 [ %spec.select303.1.lcssa.ph, %for.cond198.preheader.unr-lcssa ], [ %spec.select303.1.epil, %for.cond174.preheader.epil ]
%44 = icmp eq i32 %spec.select303.1.lcssa, 0
br i1 %cmp171328, label %for.cond202.preheader, label %for.end223
for.cond202.preheader: ; preds = %for.cond198.preheader, %for.inc221
%indvars.iv371 = phi i64 [ %indvars.iv.next372, %for.inc221 ], [ 0, %for.cond198.preheader ]
%arrayidx209 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv371, i64 0
%45 = load i8, ptr %arrayidx209, align 2, !tbaa !11
%conv210 = sext i8 %45 to i32
%putchar300 = call i32 @putchar(i32 %conv210)
%arrayidx209.1 = getelementptr inbounds [36 x [2 x i8]], ptr %scard, i64 0, i64 %indvars.iv371, i64 1
%46 = load i8, ptr %arrayidx209.1, align 1, !tbaa !11
%conv210.1 = sext i8 %46 to i32
%putchar300.1 = call i32 @putchar(i32 %conv210.1)
%47 = load i32, ptr %n, align 4, !tbaa !5
%sub215 = add nsw i32 %47, -1
%48 = sext i32 %sub215 to i64
%cmp216 = icmp slt i64 %indvars.iv371, %48
br i1 %cmp216, label %if.then218, label %for.inc221
if.then218: ; preds = %for.cond202.preheader
%putchar299 = call i32 @putchar(i32 32)
%.pre374 = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc221
for.inc221: ; preds = %for.cond202.preheader, %if.then218
%49 = phi i32 [ %47, %for.cond202.preheader ], [ %.pre374, %if.then218 ]
%indvars.iv.next372 = add nuw nsw i64 %indvars.iv371, 1
%50 = sext i32 %49 to i64
%cmp199 = icmp slt i64 %indvars.iv.next372, %50
br i1 %cmp199, label %for.cond202.preheader, label %for.end223, !llvm.loop !18
for.end223: ; preds = %for.inc221, %for.cond198.preheader
%putchar296 = call i32 @putchar(i32 10)
%spec.select384 = select i1 %44, ptr @str.8, ptr @str.7
br label %if.end230
if.end230: ; preds = %for.end223, %for.end223.thread
%str.7.sink = phi ptr [ @str.8, %for.end223.thread ], [ %spec.select384, %for.end223 ]
%puts297 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %scard) #5
call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %bcard) #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 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
|
#include<stdio.h>
int main(){
int i, j, n, w[100], wb[100], ws[100], a[100], ab[100], as[100], flag=1, tmp, minj, count=0;
scanf("%d", &n);
for(i=0; i<n; i++)scanf(" %c%d", &w[i], &a[i]);
for(i=0; i<n; i++){
ab[i]=a[i];
as[i]=a[i];
wb[i]=w[i];
ws[i]=w[i];
}
while(flag){
flag=0;
for(i=n-1; i>0; i--)if(ab[i]<ab[i-1]){
tmp=ab[i];
ab[i]=ab[i-1];
ab[i-1]=tmp;
tmp=wb[i];
wb[i]=wb[i-1];
wb[i-1]=tmp;
flag=1;
}
}
for(i=0; i<n; i++){
minj=i;
for(j=i; j<n; j++)if(as[j]<as[minj]){
minj=j;
}
tmp=as[i];
as[i]=as[minj];
as[minj]=tmp;
tmp=ws[i];
ws[i]=ws[minj];
ws[minj]=tmp;
}
for(i=0; i<n-1; i++)printf("%c%d ", wb[i], ab[i]);
printf("%c%d\n", wb[n-1], ab[n-1]);
printf("Stable\n");
for(i=0; i<n-1; i++)printf("%c%d ", ws[i], as[i]);
printf("%c%d\n", ws[n-1], as[n-1]);
for(i=0; i<n; i++)if(wb[i]!=ws[i]){
count=1;
break;
}
if(count==0)printf("Stable\n");
else printf("Not stable\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113439/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113439/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%w = alloca [100 x i32], align 16
%wb = alloca [100 x i32], align 16
%ws = alloca [100 x i32], align 16
%a = alloca [100 x i32], align 16
%ab = alloca [100 x i32], align 16
%as = 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 400, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %wb) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %ws) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %ab) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %as) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp207 = icmp sgt i32 %0, 0
br i1 %cmp207, label %for.body, label %for.cond92.preheader.for.end103_crit_edge
for.cond4.preheader: ; preds = %for.body
%cmp5209 = icmp sgt i32 %1, 0
br i1 %cmp5209, label %while.cond.preheader, label %for.cond92.preheader.for.end103_crit_edge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %w, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%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.cond4.preheader, !llvm.loop !9
while.cond.preheader: ; preds = %for.cond4.preheader
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %ab, ptr nonnull align 16 %a, i64 %4, i1 false), !tbaa !5
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %as, ptr nonnull align 16 %a, i64 %4, i1 false), !tbaa !5
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %wb, ptr nonnull align 16 %w, i64 %4, i1 false), !tbaa !5
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %ws, ptr nonnull align 16 %w, i64 %4, i1 false), !tbaa !5
%cmp27212 = icmp ne i32 %1, 1
br i1 %cmp27212, label %for.cond26.preheader.us.preheader, label %for.cond60.preheader.preheader
for.cond26.preheader.us.preheader: ; preds = %while.cond.preheader
%5 = zext i32 %1 to i64
br label %for.body28.us
for.body28.us: ; preds = %for.body28.us.backedge, %for.cond26.preheader.us.preheader
%indvars.iv238 = phi i64 [ %5, %for.cond26.preheader.us.preheader ], [ %indvars.iv238.be, %for.body28.us.backedge ]
%flag.1214.us = phi i32 [ 0, %for.cond26.preheader.us.preheader ], [ %flag.1214.us.be, %for.body28.us.backedge ]
%indvars.iv.next239 = add nsw i64 %indvars.iv238, -1
%idxprom29.us = and i64 %indvars.iv.next239, 4294967295
%arrayidx30.us = getelementptr inbounds [100 x i32], ptr %ab, i64 0, i64 %idxprom29.us
%6 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%sub31.us = add i64 %indvars.iv238, 4294967294
%idxprom32.us = and i64 %sub31.us, 4294967295
%arrayidx33.us = getelementptr inbounds [100 x i32], ptr %ab, i64 0, i64 %idxprom32.us
%7 = load i32, ptr %arrayidx33.us, align 4, !tbaa !5
%cmp34.us = icmp slt i32 %6, %7
br i1 %cmp34.us, label %if.then.us, label %for.inc55.us
if.then.us: ; preds = %for.body28.us
store i32 %7, ptr %arrayidx30.us, align 4, !tbaa !5
store i32 %6, ptr %arrayidx33.us, align 4, !tbaa !5
%arrayidx46.us = getelementptr inbounds [100 x i32], ptr %wb, i64 0, i64 %idxprom29.us
%8 = load i32, ptr %arrayidx46.us, align 4, !tbaa !5
%arrayidx49.us = getelementptr inbounds [100 x i32], ptr %wb, i64 0, i64 %idxprom32.us
%9 = load i32, ptr %arrayidx49.us, align 4, !tbaa !5
store i32 %9, ptr %arrayidx46.us, align 4, !tbaa !5
store i32 %8, ptr %arrayidx49.us, align 4, !tbaa !5
br label %for.inc55.us
for.inc55.us: ; preds = %if.then.us, %for.body28.us
%flag.2.us = phi i32 [ 1, %if.then.us ], [ %flag.1214.us, %for.body28.us ]
%cmp27.us = icmp sgt i64 %indvars.iv238, 2
br i1 %cmp27.us, label %for.body28.us.backedge, label %for.cond26.while.cond.loopexit_crit_edge.us
for.body28.us.backedge: ; preds = %for.inc55.us, %for.cond26.while.cond.loopexit_crit_edge.us
%indvars.iv238.be = phi i64 [ %indvars.iv.next239, %for.inc55.us ], [ %5, %for.cond26.while.cond.loopexit_crit_edge.us ]
%flag.1214.us.be = phi i32 [ %flag.2.us, %for.inc55.us ], [ 0, %for.cond26.while.cond.loopexit_crit_edge.us ]
br label %for.body28.us, !llvm.loop !11
for.cond26.while.cond.loopexit_crit_edge.us: ; preds = %for.inc55.us
%tobool.not.us = icmp eq i32 %flag.2.us, 0
br i1 %tobool.not.us, label %for.cond57.preheader, label %for.body28.us.backedge
for.cond57.preheader: ; preds = %for.cond26.while.cond.loopexit_crit_edge.us
br i1 %cmp5209, label %for.cond60.preheader.preheader, label %for.cond92.preheader
for.cond60.preheader.preheader: ; preds = %while.cond.preheader, %for.cond57.preheader
%10 = phi i32 [ %1, %for.cond57.preheader ], [ 1, %while.cond.preheader ]
%cmp27212269273 = phi i1 [ %cmp27212, %for.cond57.preheader ], [ false, %while.cond.preheader ]
%11 = zext i32 %10 to i64
%wide.trip.count = zext i32 %10 to i64
br label %for.cond60.preheader
for.cond60.preheader: ; preds = %for.cond60.preheader.preheader, %for.end72
%indvars.iv241 = phi i64 [ 0, %for.cond60.preheader.preheader ], [ %indvars.iv.next242, %for.end72 ]
%12 = trunc i64 %indvars.iv241 to i32
br label %for.body62
for.cond92.preheader: ; preds = %for.end72, %for.cond57.preheader
%13 = phi i32 [ %1, %for.cond57.preheader ], [ %10, %for.end72 ]
%cmp27212269272 = phi i1 [ %cmp27212, %for.cond57.preheader ], [ %cmp27212269273, %for.end72 ]
br i1 %cmp27212269272, label %for.body95, label %for.cond92.preheader.for.end103_crit_edge
for.cond92.preheader.for.end103_crit_edge: ; preds = %for.cond4.preheader, %entry, %for.cond92.preheader
%14 = phi i32 [ %13, %for.cond92.preheader ], [ %1, %for.cond4.preheader ], [ %0, %entry ]
%sub93221 = add nsw i32 %14, -1
%.pre = sext i32 %sub93221 to i64
br label %for.end103
for.body62: ; preds = %for.cond60.preheader, %for.body62
%indvars.iv243 = phi i64 [ %indvars.iv241, %for.cond60.preheader ], [ %indvars.iv.next244, %for.body62 ]
%minj.0218 = phi i32 [ %12, %for.cond60.preheader ], [ %spec.select, %for.body62 ]
%arrayidx64 = getelementptr inbounds [100 x i32], ptr %as, i64 0, i64 %indvars.iv243
%15 = load i32, ptr %arrayidx64, align 4, !tbaa !5
%idxprom65 = sext i32 %minj.0218 to i64
%arrayidx66 = getelementptr inbounds [100 x i32], ptr %as, i64 0, i64 %idxprom65
%16 = load i32, ptr %arrayidx66, align 4, !tbaa !5
%cmp67 = icmp slt i32 %15, %16
%17 = trunc i64 %indvars.iv243 to i32
%spec.select = select i1 %cmp67, i32 %17, i32 %minj.0218
%indvars.iv.next244 = add nuw nsw i64 %indvars.iv243, 1
%cmp61 = icmp ult i64 %indvars.iv.next244, %11
br i1 %cmp61, label %for.body62, label %for.end72, !llvm.loop !12
for.end72: ; preds = %for.body62
%arrayidx74 = getelementptr inbounds [100 x i32], ptr %as, i64 0, i64 %indvars.iv241
%18 = load i32, ptr %arrayidx74, align 4, !tbaa !5
%idxprom75 = sext i32 %spec.select to i64
%arrayidx76 = getelementptr inbounds [100 x i32], ptr %as, i64 0, i64 %idxprom75
%19 = load i32, ptr %arrayidx76, align 4, !tbaa !5
store i32 %19, ptr %arrayidx74, align 4, !tbaa !5
store i32 %18, ptr %arrayidx76, align 4, !tbaa !5
%arrayidx82 = getelementptr inbounds [100 x i32], ptr %ws, i64 0, i64 %indvars.iv241
%20 = load i32, ptr %arrayidx82, align 4, !tbaa !5
%arrayidx84 = getelementptr inbounds [100 x i32], ptr %ws, i64 0, i64 %idxprom75
%21 = load i32, ptr %arrayidx84, align 4, !tbaa !5
store i32 %21, ptr %arrayidx82, align 4, !tbaa !5
store i32 %20, ptr %arrayidx84, align 4, !tbaa !5
%indvars.iv.next242 = add nuw nsw i64 %indvars.iv241, 1
%exitcond.not = icmp eq i64 %indvars.iv.next242, %wide.trip.count
br i1 %exitcond.not, label %for.cond92.preheader, label %for.cond60.preheader, !llvm.loop !13
for.body95: ; preds = %for.cond92.preheader, %for.body95
%indvars.iv249 = phi i64 [ %indvars.iv.next250, %for.body95 ], [ 0, %for.cond92.preheader ]
%arrayidx97 = getelementptr inbounds [100 x i32], ptr %wb, i64 0, i64 %indvars.iv249
%22 = load i32, ptr %arrayidx97, align 4, !tbaa !5
%arrayidx99 = getelementptr inbounds [100 x i32], ptr %ab, i64 0, i64 %indvars.iv249
%23 = load i32, ptr %arrayidx99, align 4, !tbaa !5
%call100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %22, i32 noundef %23)
%indvars.iv.next250 = add nuw nsw i64 %indvars.iv249, 1
%24 = load i32, ptr %n, align 4, !tbaa !5
%sub93 = add nsw i32 %24, -1
%25 = sext i32 %sub93 to i64
%cmp94 = icmp slt i64 %indvars.iv.next250, %25
br i1 %cmp94, label %for.body95, label %for.end103, !llvm.loop !14
for.end103: ; preds = %for.body95, %for.cond92.preheader.for.end103_crit_edge
%idxprom105.pre-phi = phi i64 [ %.pre, %for.cond92.preheader.for.end103_crit_edge ], [ %25, %for.body95 ]
%arrayidx106 = getelementptr inbounds [100 x i32], ptr %wb, i64 0, i64 %idxprom105.pre-phi
%26 = load i32, ptr %arrayidx106, align 4, !tbaa !5
%arrayidx109 = getelementptr inbounds [100 x i32], ptr %ab, i64 0, i64 %idxprom105.pre-phi
%27 = load i32, ptr %arrayidx109, align 4, !tbaa !5
%call110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %26, i32 noundef %27)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%28 = load i32, ptr %n, align 4, !tbaa !5
%cmp114226 = icmp sgt i32 %28, 1
br i1 %cmp114226, label %for.body115, label %for.end103.for.end123_crit_edge
for.end103.for.end123_crit_edge: ; preds = %for.end103
%sub113225 = add nsw i32 %28, -1
%.pre263 = sext i32 %sub113225 to i64
br label %for.end123
for.body115: ; preds = %for.end103, %for.body115
%indvars.iv253 = phi i64 [ %indvars.iv.next254, %for.body115 ], [ 0, %for.end103 ]
%arrayidx117 = getelementptr inbounds [100 x i32], ptr %ws, i64 0, i64 %indvars.iv253
%29 = load i32, ptr %arrayidx117, align 4, !tbaa !5
%arrayidx119 = getelementptr inbounds [100 x i32], ptr %as, i64 0, i64 %indvars.iv253
%30 = load i32, ptr %arrayidx119, align 4, !tbaa !5
%call120 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %29, i32 noundef %30)
%indvars.iv.next254 = add nuw nsw i64 %indvars.iv253, 1
%31 = load i32, ptr %n, align 4, !tbaa !5
%sub113 = add nsw i32 %31, -1
%32 = sext i32 %sub113 to i64
%cmp114 = icmp slt i64 %indvars.iv.next254, %32
br i1 %cmp114, label %for.body115, label %for.end123, !llvm.loop !15
for.end123: ; preds = %for.body115, %for.end103.for.end123_crit_edge
%idxprom125.pre-phi = phi i64 [ %.pre263, %for.end103.for.end123_crit_edge ], [ %32, %for.body115 ]
%arrayidx126 = getelementptr inbounds [100 x i32], ptr %ws, i64 0, i64 %idxprom125.pre-phi
%33 = load i32, ptr %arrayidx126, align 4, !tbaa !5
%arrayidx129 = getelementptr inbounds [100 x i32], ptr %as, i64 0, i64 %idxprom125.pre-phi
%34 = load i32, ptr %arrayidx129, align 4, !tbaa !5
%call130 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %33, i32 noundef %34)
%35 = load i32, ptr %n, align 4, !tbaa !5
%cmp132.not229 = icmp sgt i32 %35, 0
br i1 %cmp132.not229, label %for.body133.preheader, label %if.end148
for.body133.preheader: ; preds = %for.end123
%wide.trip.count261 = zext i32 %35 to i64
br label %for.body133
for.cond131: ; preds = %for.body133
%indvars.iv.next258 = add nuw nsw i64 %indvars.iv257, 1
%exitcond262.not = icmp eq i64 %indvars.iv.next258, %wide.trip.count261
br i1 %exitcond262.not, label %if.end148, label %for.body133, !llvm.loop !16
for.body133: ; preds = %for.body133.preheader, %for.cond131
%indvars.iv257 = phi i64 [ 0, %for.body133.preheader ], [ %indvars.iv.next258, %for.cond131 ]
%arrayidx135 = getelementptr inbounds [100 x i32], ptr %wb, i64 0, i64 %indvars.iv257
%36 = load i32, ptr %arrayidx135, align 4, !tbaa !5
%arrayidx137 = getelementptr inbounds [100 x i32], ptr %ws, i64 0, i64 %indvars.iv257
%37 = load i32, ptr %arrayidx137, align 4, !tbaa !5
%cmp138.not = icmp eq i32 %36, %37
br i1 %cmp138.not, label %for.cond131, label %if.end148
if.end148: ; preds = %for.body133, %for.cond131, %for.end123
%str.6.sink = phi ptr [ @str.7, %for.end123 ], [ @str.7, %for.cond131 ], [ @str.6, %for.body133 ]
%puts205 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %as) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %ab) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %ws) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %wb) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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<stdlib.h>
#include<stdio.h>
#include<string.h>
typedef struct{
int x;
char c;
}card;
int main(){
int i,j,n,hantei,mini;
card **A,**B,*swap;
scanf("%d",&n);
A=malloc(n*sizeof(card *));
B=malloc(n*sizeof(card *));
for(i=0;i<n;i++) A[i]=malloc(sizeof(card));
for(i=0;i<n;i++) B[i]=malloc(sizeof(card));
for(i=0;i<n;i++){
scanf(" %c %d",&(A[i]->c),&(A[i]->x));
}
for(i=0;i<n;i++){
B[i]->x=A[i]->x;
B[i]->c=A[i]->c;
}
for(i=0;i<n-1;i++){
hantei=0;
for(j=n-1;j>=i+1;j--){
if((A[j]->x)<(A[j-1]->x)){
swap=A[j];
A[j]=A[j-1];
A[j-1]=swap;
hantei=1;
}
}
if(hantei==0) break;
}
for(i=0;i<n-1;i++) printf("%c%d ",A[i]->c,A[i]->x);
printf("%c%d\n",A[n-1]->c,A[n-1]->x);
printf("Stable\n");
for(i=0;i<n-1;i++){
mini=i;
for(j=i+1;j<n;j++){
if((B[mini]->x)>(B[j]->x)) mini=j;
}
if(mini!=i){
swap=B[mini];
B[mini]=B[i];
B[i]=swap;
}
}
for(i=0;i<n-1;i++) printf("%c%d ",B[i]->c,B[i]->x);
printf("%c%d\n",B[n-1]->c,B[n-1]->x);
for(i=0;i<n;i++){
if(A[i]->c!=B[i]->c){
printf("Not stable\n");
return 0;
}
}
printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113482/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113482/source.c"
target datalayout = "e-m:e-p270: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.card = type { i32, i8 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c" %c %d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%call4 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp286 = icmp sgt i32 %0, 0
br i1 %cmp286, label %for.body.preheader, label %for.cond29.preheader.for.cond48.preheader_crit_edge
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond7.preheader: ; preds = %for.body
br i1 %cmp286, label %for.body10.preheader, label %for.cond29.preheader.for.cond48.preheader_crit_edge
for.body10.preheader: ; preds = %for.cond7.preheader
%wide.trip.count319 = zext i32 %0 to i64
br label %for.body10
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%call6 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #7
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call6, ptr %arrayidx, align 8, !tbaa !9
%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.cond7.preheader, label %for.body, !llvm.loop !11
for.cond17.preheader: ; preds = %for.body10
br i1 %cmp286, label %for.body20, label %for.cond29.preheader.for.cond48.preheader_crit_edge
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv316 = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next317, %for.body10 ]
%call11 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #7
%arrayidx13 = getelementptr inbounds ptr, ptr %call4, i64 %indvars.iv316
store ptr %call11, ptr %arrayidx13, align 8, !tbaa !9
%indvars.iv.next317 = add nuw nsw i64 %indvars.iv316, 1
%exitcond320.not = icmp eq i64 %indvars.iv.next317, %wide.trip.count319
br i1 %exitcond320.not, label %for.cond17.preheader, label %for.body10, !llvm.loop !13
for.cond29.preheader: ; preds = %for.body20
%cmp30292 = icmp sgt i32 %3, 0
br i1 %cmp30292, label %for.body32, label %for.cond29.preheader.for.cond48.preheader_crit_edge
for.cond29.preheader.for.cond48.preheader_crit_edge: ; preds = %entry, %for.cond7.preheader, %for.cond17.preheader, %for.cond29.preheader
%1 = phi i32 [ %3, %for.cond29.preheader ], [ %0, %for.cond17.preheader ], [ %0, %for.cond7.preheader ], [ %0, %entry ]
%.pre358 = sext i32 %1 to i64
br label %for.cond48.preheader
for.body20: ; preds = %for.cond17.preheader, %for.body20
%indvars.iv321 = phi i64 [ %indvars.iv.next322, %for.body20 ], [ 0, %for.cond17.preheader ]
%arrayidx22 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv321
%2 = load ptr, ptr %arrayidx22, align 8, !tbaa !9
%c = getelementptr inbounds %struct.card, ptr %2, i64 0, i32 1
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c, ptr noundef %2)
%indvars.iv.next322 = add nuw nsw i64 %indvars.iv321, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp18 = icmp slt i64 %indvars.iv.next322, %4
br i1 %cmp18, label %for.body20, label %for.cond29.preheader, !llvm.loop !14
for.cond48.preheader: ; preds = %for.body32, %for.cond29.preheader.for.cond48.preheader_crit_edge
%.pre-phi = phi i64 [ %.pre358, %for.cond29.preheader.for.cond48.preheader_crit_edge ], [ %12, %for.body32 ]
%5 = phi i32 [ %1, %for.cond29.preheader.for.cond48.preheader_crit_edge ], [ %11, %for.body32 ]
%sub = add nsw i32 %5, -1
%6 = add nsw i64 %.pre-phi, -1
%smax = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%wide.trip.count333 = zext i32 %smax to i64
%arrayidx58.phi.trans.insert = getelementptr inbounds ptr, ptr %call1, i64 %6
br label %for.cond48
for.body32: ; preds = %for.cond29.preheader, %for.body32
%indvars.iv324 = phi i64 [ %indvars.iv.next325, %for.body32 ], [ 0, %for.cond29.preheader ]
%arrayidx34 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv324
%7 = load ptr, ptr %arrayidx34, align 8, !tbaa !9
%8 = load i32, ptr %7, align 4, !tbaa !15
%arrayidx37 = getelementptr inbounds ptr, ptr %call4, i64 %indvars.iv324
%9 = load ptr, ptr %arrayidx37, align 8, !tbaa !9
store i32 %8, ptr %9, align 4, !tbaa !15
%c41 = getelementptr inbounds %struct.card, ptr %7, i64 0, i32 1
%10 = load i8, ptr %c41, align 4, !tbaa !17
%c44 = getelementptr inbounds %struct.card, ptr %9, i64 0, i32 1
store i8 %10, ptr %c44, align 4, !tbaa !17
%indvars.iv.next325 = add nuw nsw i64 %indvars.iv324, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp30 = icmp slt i64 %indvars.iv.next325, %12
br i1 %cmp30, label %for.body32, label %for.cond48.preheader, !llvm.loop !18
for.cond48: ; preds = %for.cond48.preheader, %for.end77
%indvars.iv330 = phi i64 [ 0, %for.cond48.preheader ], [ %indvars.iv.next331, %for.end77 ]
%exitcond334.not = icmp eq i64 %indvars.iv330, %wide.trip.count333
br i1 %exitcond334.not, label %for.end84, label %for.body56.preheader
for.body56.preheader: ; preds = %for.cond48
%.pre = load ptr, ptr %arrayidx58.phi.trans.insert, align 8, !tbaa !9
br label %for.body56
for.body56: ; preds = %for.body56.preheader, %for.inc76
%13 = phi ptr [ %.pre, %for.body56.preheader ], [ %17, %for.inc76 ]
%indvars.iv327 = phi i64 [ %6, %for.body56.preheader ], [ %indvars.iv.next328, %for.inc76 ]
%hantei.0295 = phi i32 [ 0, %for.body56.preheader ], [ %hantei.1, %for.inc76 ]
%14 = load i32, ptr %13, align 4, !tbaa !15
%indvars.iv.next328 = add nsw i64 %indvars.iv327, -1
%arrayidx62 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv.next328
%15 = load ptr, ptr %arrayidx62, align 8, !tbaa !9
%16 = load i32, ptr %15, align 4, !tbaa !15
%cmp64 = icmp slt i32 %14, %16
br i1 %cmp64, label %if.then, label %for.inc76
if.then: ; preds = %for.body56
%arrayidx58 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv327
store ptr %15, ptr %arrayidx58, align 8, !tbaa !9
store ptr %13, ptr %arrayidx62, align 8, !tbaa !9
br label %for.inc76
for.inc76: ; preds = %for.body56, %if.then
%17 = phi ptr [ %13, %if.then ], [ %15, %for.body56 ]
%hantei.1 = phi i32 [ 1, %if.then ], [ %hantei.0295, %for.body56 ]
%cmp54.not.not = icmp sgt i64 %indvars.iv.next328, %indvars.iv330
br i1 %cmp54.not.not, label %for.body56, label %for.end77, !llvm.loop !19
for.end77: ; preds = %for.inc76
%indvars.iv.next331 = add nuw nsw i64 %indvars.iv330, 1
%cmp78 = icmp eq i32 %hantei.1, 0
br i1 %cmp78, label %for.end84, label %for.cond48, !llvm.loop !20
for.end84: ; preds = %for.end77, %for.cond48
%cmp87297 = icmp sgt i32 %5, 1
br i1 %cmp87297, label %for.body89, label %for.end84.for.end100_crit_edge
for.end84.for.end100_crit_edge: ; preds = %for.end84
%.pre359 = sext i32 %sub to i64
br label %for.end100
for.body89: ; preds = %for.end84, %for.body89
%indvars.iv335 = phi i64 [ %indvars.iv.next336, %for.body89 ], [ 0, %for.end84 ]
%arrayidx91 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv335
%18 = load ptr, ptr %arrayidx91, align 8, !tbaa !9
%c92 = getelementptr inbounds %struct.card, ptr %18, i64 0, i32 1
%19 = load i8, ptr %c92, align 4, !tbaa !17
%conv93 = sext i8 %19 to i32
%20 = load i32, ptr %18, align 4, !tbaa !15
%call97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv93, i32 noundef %20)
%indvars.iv.next336 = add nuw nsw i64 %indvars.iv335, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%sub86 = add nsw i32 %21, -1
%22 = sext i32 %sub86 to i64
%cmp87 = icmp slt i64 %indvars.iv.next336, %22
br i1 %cmp87, label %for.body89, label %for.end100, !llvm.loop !21
for.end100: ; preds = %for.body89, %for.end84.for.end100_crit_edge
%idxprom102.pre-phi = phi i64 [ %.pre359, %for.end84.for.end100_crit_edge ], [ %22, %for.body89 ]
%arrayidx103 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom102.pre-phi
%23 = load ptr, ptr %arrayidx103, align 8, !tbaa !9
%c104 = getelementptr inbounds %struct.card, ptr %23, i64 0, i32 1
%24 = load i8, ptr %c104, align 4, !tbaa !17
%conv105 = sext i8 %24 to i32
%25 = load i32, ptr %23, align 4, !tbaa !15
%call110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv105, i32 noundef %25)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%26 = load i32, ptr %n, align 4, !tbaa !5
%sub113 = add i32 %26, -1
%cmp114304 = icmp sgt i32 %26, 1
br i1 %cmp114304, label %for.body116.preheader, label %for.cond150.preheader.for.end165_crit_edge
for.body116.preheader: ; preds = %for.end100
%27 = zext i32 %26 to i64
%wide.trip.count348 = zext i32 %sub113 to i64
%wide.trip.count343 = zext i32 %26 to i64
br label %for.body116
for.cond150.preheader: ; preds = %for.inc147
br i1 %cmp114304, label %for.body154, label %for.cond150.preheader.for.end165_crit_edge
for.cond150.preheader.for.end165_crit_edge: ; preds = %for.end100, %for.cond150.preheader
%.pre360 = sext i32 %sub113 to i64
br label %for.end165
for.body116: ; preds = %for.body116.preheader, %for.inc147
%indvars.iv345 = phi i64 [ 0, %for.body116.preheader ], [ %indvars.iv.next346, %for.inc147 ]
%indvars.iv338 = phi i64 [ 1, %for.body116.preheader ], [ %indvars.iv.next339, %for.inc147 ]
%indvars.iv.next346 = add nuw nsw i64 %indvars.iv345, 1
%cmp119300 = icmp ult i64 %indvars.iv.next346, %27
%28 = trunc i64 %indvars.iv345 to i32
br i1 %cmp119300, label %for.body121, label %for.end134
for.body121: ; preds = %for.body116, %for.body121
%indvars.iv340 = phi i64 [ %indvars.iv.next341, %for.body121 ], [ %indvars.iv338, %for.body116 ]
%mini.0302 = phi i32 [ %spec.select, %for.body121 ], [ %28, %for.body116 ]
%idxprom122 = sext i32 %mini.0302 to i64
%arrayidx123 = getelementptr inbounds ptr, ptr %call4, i64 %idxprom122
%29 = load ptr, ptr %arrayidx123, align 8, !tbaa !9
%30 = load i32, ptr %29, align 4, !tbaa !15
%arrayidx126 = getelementptr inbounds ptr, ptr %call4, i64 %indvars.iv340
%31 = load ptr, ptr %arrayidx126, align 8, !tbaa !9
%32 = load i32, ptr %31, align 4, !tbaa !15
%cmp128 = icmp sgt i32 %30, %32
%33 = trunc i64 %indvars.iv340 to i32
%spec.select = select i1 %cmp128, i32 %33, i32 %mini.0302
%indvars.iv.next341 = add nuw nsw i64 %indvars.iv340, 1
%exitcond344.not = icmp eq i64 %indvars.iv.next341, %wide.trip.count343
br i1 %exitcond344.not, label %for.end134, label %for.body121, !llvm.loop !22
for.end134: ; preds = %for.body121, %for.body116
%mini.0.lcssa = phi i32 [ %28, %for.body116 ], [ %spec.select, %for.body121 ]
%34 = zext i32 %mini.0.lcssa to i64
%cmp135.not = icmp eq i64 %indvars.iv345, %34
br i1 %cmp135.not, label %for.inc147, label %if.then137
if.then137: ; preds = %for.end134
%idxprom138 = sext i32 %mini.0.lcssa to i64
%arrayidx139 = getelementptr inbounds ptr, ptr %call4, i64 %idxprom138
%35 = load ptr, ptr %arrayidx139, align 8, !tbaa !9
%arrayidx141 = getelementptr inbounds ptr, ptr %call4, i64 %indvars.iv345
%36 = load ptr, ptr %arrayidx141, align 8, !tbaa !9
store ptr %36, ptr %arrayidx139, align 8, !tbaa !9
store ptr %35, ptr %arrayidx141, align 8, !tbaa !9
br label %for.inc147
for.inc147: ; preds = %for.end134, %if.then137
%indvars.iv.next339 = add nuw nsw i64 %indvars.iv338, 1
%exitcond349.not = icmp eq i64 %indvars.iv.next346, %wide.trip.count348
br i1 %exitcond349.not, label %for.cond150.preheader, label %for.body116, !llvm.loop !23
for.body154: ; preds = %for.cond150.preheader, %for.body154
%indvars.iv350 = phi i64 [ %indvars.iv.next351, %for.body154 ], [ 0, %for.cond150.preheader ]
%arrayidx156 = getelementptr inbounds ptr, ptr %call4, i64 %indvars.iv350
%37 = load ptr, ptr %arrayidx156, align 8, !tbaa !9
%c157 = getelementptr inbounds %struct.card, ptr %37, i64 0, i32 1
%38 = load i8, ptr %c157, align 4, !tbaa !17
%conv158 = sext i8 %38 to i32
%39 = load i32, ptr %37, align 4, !tbaa !15
%call162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv158, i32 noundef %39)
%indvars.iv.next351 = add nuw nsw i64 %indvars.iv350, 1
%40 = load i32, ptr %n, align 4, !tbaa !5
%sub151 = add nsw i32 %40, -1
%41 = sext i32 %sub151 to i64
%cmp152 = icmp slt i64 %indvars.iv.next351, %41
br i1 %cmp152, label %for.body154, label %for.end165, !llvm.loop !24
for.end165: ; preds = %for.body154, %for.cond150.preheader.for.end165_crit_edge
%idxprom167.pre-phi = phi i64 [ %.pre360, %for.cond150.preheader.for.end165_crit_edge ], [ %41, %for.body154 ]
%arrayidx168 = getelementptr inbounds ptr, ptr %call4, i64 %idxprom167.pre-phi
%42 = load ptr, ptr %arrayidx168, align 8, !tbaa !9
%c169 = getelementptr inbounds %struct.card, ptr %42, i64 0, i32 1
%43 = load i8, ptr %c169, align 4, !tbaa !17
%conv170 = sext i8 %43 to i32
%44 = load i32, ptr %42, align 4, !tbaa !15
%call175 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv170, i32 noundef %44)
%45 = load i32, ptr %n, align 4, !tbaa !5
%cmp177310 = icmp sgt i32 %45, 0
br i1 %cmp177310, label %for.body179.preheader, label %cleanup
for.body179.preheader: ; preds = %for.end165
%wide.trip.count356 = zext i32 %45 to i64
br label %for.body179
for.cond176: ; preds = %for.body179
%indvars.iv.next354 = add nuw nsw i64 %indvars.iv353, 1
%exitcond357.not = icmp eq i64 %indvars.iv.next354, %wide.trip.count356
br i1 %exitcond357.not, label %cleanup, label %for.body179, !llvm.loop !25
for.body179: ; preds = %for.body179.preheader, %for.cond176
%indvars.iv353 = phi i64 [ 0, %for.body179.preheader ], [ %indvars.iv.next354, %for.cond176 ]
%arrayidx181 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv353
%46 = load ptr, ptr %arrayidx181, align 8, !tbaa !9
%c182 = getelementptr inbounds %struct.card, ptr %46, i64 0, i32 1
%47 = load i8, ptr %c182, align 4, !tbaa !17
%arrayidx185 = getelementptr inbounds ptr, ptr %call4, i64 %indvars.iv353
%48 = load ptr, ptr %arrayidx185, align 8, !tbaa !9
%c186 = getelementptr inbounds %struct.card, ptr %48, i64 0, i32 1
%49 = load i8, ptr %c186, align 4, !tbaa !17
%cmp188.not = icmp eq i8 %47, %49
br i1 %cmp188.not, label %for.cond176, label %cleanup
cleanup: ; preds = %for.cond176, %for.body179, %for.end165
%str.6.sink = phi ptr [ @str.6, %for.end165 ], [ @str.7, %for.body179 ], [ @str.6, %for.cond176 ]
%puts284 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !6, i64 0}
!16 = !{!"", !6, i64 0, !7, i64 4}
!17 = !{!16, !7, i64 4}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
|
#include<stdio.h>
int main()
{
long long n,t,d,r,s;
scanf("%lld",&t);
while(t--)
{
scanf("%lld%lld",&n,&r);
if(n>r)
{
s = (r*(r+1))/2;
}
else if(n<=r)
{
n = n-1;
s = (n*(n+1))/2 + 1;
}
printf("%lld\n",s);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11354/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11354/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%t = alloca i64, align 8
%r = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec11 = add nsw i64 %0, -1
store i64 %dec11, ptr %t, align 8, !tbaa !5
%tobool.not12 = icmp eq i64 %0, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end8
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %r)
%1 = load i64, ptr %n, align 8, !tbaa !5
%2 = load i64, ptr %r, align 8, !tbaa !5
%cmp = icmp sgt i64 %1, %2
br i1 %cmp, label %if.then, label %if.then3
if.then: ; preds = %while.body
%add = add nsw i64 %2, 1
%mul = mul nsw i64 %add, %2
%div = sdiv i64 %mul, 2
br label %if.end8
if.then3: ; preds = %while.body
%sub = add nsw i64 %1, -1
store i64 %sub, ptr %n, align 8, !tbaa !5
%mul5 = mul nsw i64 %sub, %1
%div6 = sdiv i64 %mul5, 2
%add7 = add nsw i64 %div6, 1
br label %if.end8
if.end8: ; preds = %if.then3, %if.then
%s.1 = phi i64 [ %div, %if.then ], [ %add7, %if.then3 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %s.1)
%3 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %3, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end8, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
struct Card {
char suit[3];
char value;
int i;
};
void BubbleSort(struct Card[], int);
void SelectionSort(struct Card[], int);
void Stable(struct Card[], int);
int main(){
int N, i;
struct Card C1[36];
struct Card C2[36];
scanf("%d",&N);
for( i = 0 ; i < N ; i++ ){
scanf("%s",&C1[i].suit);
C1[i].value = C1[i].suit[1];
C1[i].i = i;
C2[i] = C1[i];
}
BubbleSort(C1, N);
SelectionSort(C2, N);
printf("%s",C1[0].suit);
for( i = 1 ; i < N ; i ++ ){
printf(" %s",C1[i].suit);
}
printf("\n");
Stable(C1, N);
printf("%s",C2[0].suit);
for( i = 1 ; i < N ; i ++ ){
printf(" %s",C2[i].suit);
}
printf("\n");
Stable(C2, N);
return 0;
}
void BubbleSort(struct Card C[], int N){
int i, j;
struct Card tmp;
for( i = 0 ; i < N ; i++ ){
for( j = N-1 ; j >= i+1 ; j-- ){
if( C[j].value < C[j-1].value ){
tmp = C[j];
C[j] = C[j-1];
C[j-1] = tmp;
}
}
}
}
void SelectionSort(struct Card C[], int N){
int i, j, minj;
struct Card tmp;
for( i = 0 ; i < N ; i++ ){
minj = i;
for( j = i ; j < N ; j++ ){
if( C[j].value < C[minj].value ) minj = j;
}
tmp = C[i];
C[i] = C[minj];
C[minj] = tmp;
}
}
void Stable(struct Card C[], int N){
int i, flag=0;
for( i = 0 ; i < N-1 ; i++ ){
if( C[i].value == C[i+1].value ){
if( C[i].i > C[i+1].i ){
printf("Not stable\n");
flag = 1;
break;
}
}
}
if( flag == 0 )printf("Stable\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113583/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113583/source.c"
target datalayout = "e-m:e-p270: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.Card = type { [3 x i8], i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %s\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%C1 = alloca [36 x %struct.Card], align 16
%C2 = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C1) #5
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp98 = icmp sgt i32 %0, 0
br i1 %cmp98, label %for.body, label %SelectionSort.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%arrayidx5 = getelementptr inbounds [3 x i8], ptr %arrayidx, i64 0, i64 1
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !9
%value = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %1, ptr %value, align 1, !tbaa !10
%i10 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 2
%2 = trunc i64 %indvars.iv to i32
store i32 %2, ptr %i10, align 4, !tbaa !12
%arrayidx12 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv
%3 = load i64, ptr %arrayidx, align 8
store i64 %3, ptr %arrayidx12, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body
%cmp42.i = icmp sgt i32 %4, 0
br i1 %cmp42.i, label %for.cond1.preheader.lr.ph.i, label %SelectionSort.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end
%6 = zext i32 %4 to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next47.i, %6
br i1 %exitcond.not.i, label %for.cond1.preheader.i66, label %for.cond1.preheader.i, !llvm.loop !15
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv46.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next47.i, %for.cond.loopexit.i ]
%indvars.iv.next47.i = add nuw nsw i64 %indvars.iv46.i, 1
%cmp2.not.not39.i = icmp ult i64 %indvars.iv.next47.i, %6
br i1 %cmp2.not.not39.i, label %for.body3.i, label %for.cond.loopexit.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %6, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%7 = load i8, ptr %value.i, align 1, !tbaa !10
%8 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %8, i32 1
%9 = load i8, ptr %value7.i, align 1, !tbaa !10
%cmp9.i = icmp slt i8 %7, %9
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %8
%10 = load <2 x i64>, ptr %arrayidx6.i, align 8
%11 = shufflevector <2 x i64> %10, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %11, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next47.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond.loopexit.i, !llvm.loop !16
for.cond1.preheader.i66: ; preds = %for.cond.loopexit.i, %for.end.i
%indvars.iv.i67 = phi i64 [ %indvars.iv.next.i70, %for.end.i ], [ 0, %for.cond.loopexit.i ]
%12 = trunc i64 %indvars.iv.i67 to i32
br label %for.body3.i68
for.body3.i68: ; preds = %for.body3.i68, %for.cond1.preheader.i66
%indvars.iv41.i = phi i64 [ %indvars.iv.i67, %for.cond1.preheader.i66 ], [ %indvars.iv.next42.i, %for.body3.i68 ]
%minj.038.i = phi i32 [ %12, %for.cond1.preheader.i66 ], [ %spec.select.i, %for.body3.i68 ]
%value.i69 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%13 = load i8, ptr %value.i69, align 1, !tbaa !10
%idxprom4.i = sext i32 %minj.038.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%14 = load i8, ptr %value6.i, align 1, !tbaa !10
%cmp8.i = icmp slt i8 %13, %14
%15 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %15, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %6
br i1 %cmp2.i, label %for.body3.i68, label %for.end.i, !llvm.loop !17
for.end.i: ; preds = %for.body3.i68
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i67
%16 = load i64, ptr %arrayidx11.i, align 8
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%17 = load i64, ptr %arrayidx15.i, align 8
store i64 %17, ptr %arrayidx11.i, align 8
store i64 %16, ptr %arrayidx15.i, align 8
%indvars.iv.next.i70 = add nuw nsw i64 %indvars.iv.i67, 1
%exitcond.not.i71 = icmp eq i64 %indvars.iv.next.i70, %6
br i1 %exitcond.not.i71, label %SelectionSort.exit, label %for.cond1.preheader.i66, !llvm.loop !18
SelectionSort.exit: ; preds = %for.end.i, %entry, %for.end
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %C1)
%18 = load i32, ptr %N, align 4, !tbaa !5
%cmp21100 = icmp sgt i32 %18, 1
br i1 %cmp21100, label %for.body22, label %for.end30
for.body22: ; preds = %SelectionSort.exit, %for.body22
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.body22 ], [ 1, %SelectionSort.exit ]
%arrayidx24 = getelementptr inbounds [36 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv106
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx24)
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp21 = icmp slt i64 %indvars.iv.next107, %20
br i1 %cmp21, label %for.body22, label %for.end30, !llvm.loop !19
for.end30: ; preds = %for.body22, %SelectionSort.exit
%putchar = call i32 @putchar(i32 10)
%21 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not32.i = icmp sgt i32 %21, 1
br i1 %cmp.not32.i, label %for.body.preheader.i, label %Stable.exit
for.body.preheader.i: ; preds = %for.end30
%sub.i = add nsw i32 %21, -1
%wide.trip.count.i72 = zext i32 %sub.i to i64
%value.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre.i = load i8, ptr %value.phi.trans.insert.i, align 1, !tbaa !10
br label %for.body.i
for.body.i: ; preds = %for.inc.i75, %for.body.preheader.i
%22 = phi i8 [ %.pre.i, %for.body.preheader.i ], [ %23, %for.inc.i75 ]
%indvars.iv.i73 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i74, %for.inc.i75 ]
%indvars.iv.next.i74 = add nuw nsw i64 %indvars.iv.i73, 1
%value3.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i74, i32 1
%23 = load i8, ptr %value3.i, align 1, !tbaa !10
%cmp5.i = icmp eq i8 %22, %23
br i1 %cmp5.i, label %if.then.i77, label %for.inc.i75
if.then.i77: ; preds = %for.body.i
%i9.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i73, i32 2
%24 = load i32, ptr %i9.i, align 4, !tbaa !12
%i13.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i74, i32 2
%25 = load i32, ptr %i13.i, align 4, !tbaa !12
%cmp14.i = icmp sgt i32 %24, %25
br i1 %cmp14.i, label %Stable.exit, label %for.inc.i75
for.inc.i75: ; preds = %if.then.i77, %for.body.i
%exitcond.not.i76 = icmp eq i64 %indvars.iv.next.i74, %wide.trip.count.i72
br i1 %exitcond.not.i76, label %Stable.exit, label %for.body.i, !llvm.loop !20
Stable.exit: ; preds = %if.then.i77, %for.inc.i75, %for.end30
%str.sink.i = phi ptr [ @str.6, %for.end30 ], [ @str.6, %for.inc.i75 ], [ @str, %if.then.i77 ]
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %C2)
%26 = load i32, ptr %N, align 4, !tbaa !5
%cmp38102 = icmp sgt i32 %26, 1
br i1 %cmp38102, label %for.body39, label %for.end47
for.body39: ; preds = %Stable.exit, %for.body39
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.body39 ], [ 1, %Stable.exit ]
%arrayidx41 = getelementptr inbounds [36 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv109
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx41)
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%27 = load i32, ptr %N, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp38 = icmp slt i64 %indvars.iv.next110, %28
br i1 %cmp38, label %for.body39, label %for.end47, !llvm.loop !21
for.end47: ; preds = %for.body39, %Stable.exit
%putchar64 = call i32 @putchar(i32 10)
%29 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not32.i78 = icmp sgt i32 %29, 1
br i1 %cmp.not32.i78, label %for.body.preheader.i81, label %Stable.exit97
for.body.preheader.i81: ; preds = %for.end47
%sub.i82 = add nsw i32 %29, -1
%wide.trip.count.i83 = zext i32 %sub.i82 to i64
%value.phi.trans.insert.i84 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre.i85 = load i8, ptr %value.phi.trans.insert.i84, align 1, !tbaa !10
br label %for.body.i86
for.body.i86: ; preds = %for.inc.i91, %for.body.preheader.i81
%30 = phi i8 [ %.pre.i85, %for.body.preheader.i81 ], [ %31, %for.inc.i91 ]
%indvars.iv.i87 = phi i64 [ 0, %for.body.preheader.i81 ], [ %indvars.iv.next.i88, %for.inc.i91 ]
%indvars.iv.next.i88 = add nuw nsw i64 %indvars.iv.i87, 1
%value3.i89 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.next.i88, i32 1
%31 = load i8, ptr %value3.i89, align 1, !tbaa !10
%cmp5.i90 = icmp eq i8 %30, %31
br i1 %cmp5.i90, label %if.then.i93, label %for.inc.i91
if.then.i93: ; preds = %for.body.i86
%i9.i94 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i87, i32 2
%32 = load i32, ptr %i9.i94, align 4, !tbaa !12
%i13.i95 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.next.i88, i32 2
%33 = load i32, ptr %i13.i95, align 4, !tbaa !12
%cmp14.i96 = icmp sgt i32 %32, %33
br i1 %cmp14.i96, label %Stable.exit97, label %for.inc.i91
for.inc.i91: ; preds = %if.then.i93, %for.body.i86
%exitcond.not.i92 = icmp eq i64 %indvars.iv.next.i88, %wide.trip.count.i83
br i1 %exitcond.not.i92, label %Stable.exit97, label %for.body.i86, !llvm.loop !20
Stable.exit97: ; preds = %if.then.i93, %for.inc.i91, %for.end47
%str.sink.i79 = phi ptr [ @str.6, %for.end47 ], [ @str.6, %for.inc.i91 ], [ @str, %if.then.i93 ]
%puts.i80 = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i79)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C2) #5
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C1) #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(argmem: readwrite) uwtable
define dso_local void @BubbleSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp42 = icmp sgt i32 %N, 0
br i1 %cmp42, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.cond1.preheader, !llvm.loop !15
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv46 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next47, %for.cond.loopexit ]
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp2.not.not39 = icmp ult i64 %indvars.iv.next47, %0
br i1 %cmp2.not.not39, label %for.body3, label %for.cond.loopexit
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !10
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %C, i64 %2, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !10
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %C, i64 %2
%4 = load <2 x i64>, ptr %arrayidx6, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx6, align 4
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next47
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !16
for.end22: ; preds = %for.cond.loopexit, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @SelectionSort(ptr nocapture noundef %C, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !10
%idxprom4 = sext i32 %minj.038 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %C, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !10
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv
%5 = load i64, ptr %arrayidx11, align 4
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %C, i64 %idxprom14
%6 = load i64, ptr %arrayidx15, align 4
store i64 %6, ptr %arrayidx11, align 4
store i64 %5, ptr %arrayidx15, align 4
%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.end20, label %for.cond1.preheader, !llvm.loop !18
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @Stable(ptr nocapture noundef readonly %C, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp.not32 = icmp sgt i32 %N, 1
br i1 %cmp.not32, label %for.body.preheader, label %if.end22
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %N, -1
%wide.trip.count = zext i32 %sub to i64
%value.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %C, i64 0, i32 1
%.pre = load i8, ptr %value.phi.trans.insert, align 1, !tbaa !10
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%0 = phi i8 [ %.pre, %for.body.preheader ], [ %1, %for.inc ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%value3 = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value3, align 1, !tbaa !10
%cmp5 = icmp eq i8 %0, %1
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %for.body
%i9 = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv, i32 2
%2 = load i32, ptr %i9, align 4, !tbaa !12
%i13 = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv.next, i32 2
%3 = load i32, ptr %i13, align 4, !tbaa !12
%cmp14 = icmp sgt i32 %2, %3
br i1 %cmp14, label %if.end22, label %for.inc
for.inc: ; preds = %for.body, %if.then
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.end22, label %for.body, !llvm.loop !20
if.end22: ; preds = %for.inc, %if.then, %entry
%str.sink = phi ptr [ @str.6, %entry ], [ @str, %if.then ], [ @str.6, %for.inc ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 3}
!11 = !{!"Card", !7, i64 0, !7, i64 3, !6, i64 4}
!12 = !{!11, !6, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
|
#include <stdio.h>
#include <stdbool.h>
struct card{char suit, value;} ;
void bubblesort(struct card a[],int n){
for(int i=0;i<n;i++){
for(int j=n-1;j>=i;j--){
if(a[j].value<a[j-1].value){
struct card t=a[j];a[j]=a[j-1];a[j-1]=t;
}
}
}
}
void selection(struct card a[],int n){
for(int i=0;i<n;i++){
int minj=i;
for(int j=i;j<n;j++){
if(a[j].value<a[minj].value)
minj=j;
}
struct card t=a[i];a[i]=a[minj];a[minj]=t;
}
}
void print(struct card a[],int n){
for(int i=0;i<n;i++){
if(i>0)printf(" ");
printf("%c%c",a[i].suit,a[i].value);
}
printf("\n");
}
bool isstable(struct card c1[],struct card c2[],int n){
for(int i=0;i<n;i++)
if(c1[i].suit!=c2[i].suit)
return false;
return true;
}
int main(){
struct card c1[100],c2[100];
int n;
int i;
char copy[100];
scanf("%d\n",&n);
for(i=0;i<n;i++){
scanf("%s",©);
c1[i].suit=copy[0];
c1[i].value=copy[1];
}
for(i=0;i<n;i++)
c2[i]=c1[i];
bubblesort(c1,n);
selection(c2,n);
print(c1,n);
printf("Stable\n");
print(c2,n);
if(isstable(c1,c2,n))
printf("Stable\n");
else
printf("Not stable\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113633/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113633/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubblesort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp42 = icmp sgt i32 %n, 0
br i1 %cmp42, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.cleanup3
%indvars.iv46 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next47, %for.cond.cleanup3 ]
br label %for.body4
for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry
ret void
for.cond.cleanup3: ; preds = %for.inc
%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.cond.cleanup, label %for.cond1.preheader, !llvm.loop !5
for.body4: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.card, ptr %a, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !7
%2 = add nsw i64 %indvars.iv, -2
%value8 = getelementptr inbounds %struct.card, ptr %a, i64 %2, i32 1
%3 = load i8, ptr %value8, align 1, !tbaa !7
%cmp10 = icmp slt i8 %1, %3
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.card, ptr %a, i64 %2
%4 = load <2 x i16>, ptr %arrayidx7, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx7, align 1
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv46
br i1 %cmp2.not.not, label %for.body4, label %for.cond.cleanup3, !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 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: 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 void @selection(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.cond1.preheader.preheader, label %for.cond.cleanup
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.cond.cleanup3
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.cond.cleanup3 ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body4
for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry
ret void
for.cond.cleanup3: ; preds = %for.body4
%arrayidx12 = getelementptr inbounds %struct.card, ptr %a, i64 %indvars.iv
%2 = load i16, ptr %arrayidx12, align 1
%idxprom15 = sext i32 %spec.select to i64
%arrayidx16 = getelementptr inbounds %struct.card, ptr %a, i64 %idxprom15
%3 = load i16, ptr %arrayidx16, align 1
store i16 %3, ptr %arrayidx12, align 1
store i16 %2, ptr %arrayidx16, align 1
%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.cond1.preheader, !llvm.loop !12
for.body4: ; preds = %for.cond1.preheader, %for.body4
%indvars.iv42 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next43, %for.body4 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body4 ]
%value = getelementptr inbounds %struct.card, ptr %a, i64 %indvars.iv42, i32 1
%4 = load i8, ptr %value, align 1, !tbaa !7
%idxprom5 = sext i32 %minj.038 to i64
%value7 = getelementptr inbounds %struct.card, ptr %a, i64 %idxprom5, i32 1
%5 = load i8, ptr %value7, align 1, !tbaa !7
%cmp9 = icmp slt i8 %4, %5
%6 = trunc i64 %indvars.iv42 to i32
%spec.select = select i1 %cmp9, i32 %6, i32 %minj.038
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%cmp2 = icmp ult i64 %indvars.iv.next43, %0
br i1 %cmp2, label %for.body4, label %for.cond.cleanup3, !llvm.loop !13
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %if.end.peel, label %for.cond.cleanup
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.card, ptr %a, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !7
%.pre = load i8, ptr %a, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%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 ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.card, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.card, ptr %a, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !7
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 !15
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @isstable(ptr nocapture noundef readonly %c1, ptr nocapture noundef readonly %c2, i32 noundef %n) local_unnamed_addr #5 {
entry:
%cmp10 = icmp slt i32 %n, 1
br i1 %cmp10, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
%1 = load i8, ptr %c1, align 1, !tbaa !14
%2 = load i8, ptr %c2, align 1, !tbaa !14
%cmp5.not14 = icmp eq i8 %1, %2
br i1 %cmp5.not14, label %for.cond, label %cleanup
for.cond: ; preds = %for.body.preheader, %for.body
%indvars.iv15 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv15, 1
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %cleanup.loopexit, label %for.body, !llvm.loop !17
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %3, %4
br i1 %cmp5.not, label %for.cond, label %cleanup.loopexit, !llvm.loop !17
cleanup.loopexit: ; preds = %for.cond, %for.body
%cmp.le = icmp uge i64 %indvars.iv.next, %0
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %for.body.preheader, %entry
%cmp.lcssa = phi i1 [ true, %entry ], [ false, %for.body.preheader ], [ %cmp.le, %cleanup.loopexit ]
ret i1 %cmp.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%c1 = alloca [100 x %struct.card], align 16
%c2 = alloca [100 x %struct.card], align 16
%n = alloca i32, align 4
%copy = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %c1) #7
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %c2) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %copy) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body.lr.ph, label %print.exit
for.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [100 x i8], ptr %copy, i64 0, i64 1
br label %for.body
for.cond6.preheader: ; preds = %for.body
%cmp778 = icmp sgt i32 %3, 0
br i1 %cmp778, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %copy)
%1 = load i8, ptr %copy, align 16, !tbaa !20
%arrayidx2 = getelementptr inbounds [100 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx2, align 2, !tbaa !14
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !20
%value = getelementptr inbounds [100 x %struct.card], ptr %c1, i64 0, i64 %indvars.iv, i32 1
store i8 %2, ptr %value, align 1, !tbaa !7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !18
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond6.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %c2, ptr nonnull align 16 %c1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.cond.cleanup3.i, %for.cond1.preheader.lr.ph.i
%indvars.iv46.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next47.i, %for.cond.cleanup3.i ]
br label %for.body4.i
for.cond.cleanup3.i: ; preds = %for.inc.i
%indvars.iv.next47.i = add nuw nsw i64 %indvars.iv46.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next47.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i35, label %for.cond1.preheader.i, !llvm.loop !5
for.body4.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %7, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i, align 1, !tbaa !7
%9 = add nsw i64 %indvars.iv.i, -2
%value8.i = getelementptr inbounds %struct.card, ptr %c1, i64 %9, i32 1
%10 = load i8, ptr %value8.i, align 1, !tbaa !7
%cmp10.i = icmp slt i8 %8, %10
br i1 %cmp10.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.card, ptr %c1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx7.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx7.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv46.i
br i1 %cmp2.not.not.i, label %for.body4.i, label %for.cond.cleanup3.i, !llvm.loop !11
for.cond1.preheader.i35: ; preds = %for.cond.cleanup3.i, %for.cond.cleanup3.i39
%indvars.iv.i36 = phi i64 [ %indvars.iv.next.i40, %for.cond.cleanup3.i39 ], [ 0, %for.cond.cleanup3.i ]
%13 = trunc i64 %indvars.iv.i36 to i32
br label %for.body4.i37
for.cond.cleanup3.i39: ; preds = %for.body4.i37
%arrayidx12.i = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i36
%14 = load i16, ptr %arrayidx12.i, align 2
%idxprom15.i = sext i32 %spec.select.i to i64
%arrayidx16.i = getelementptr inbounds %struct.card, ptr %c2, i64 %idxprom15.i
%15 = load i16, ptr %arrayidx16.i, align 2
store i16 %15, ptr %arrayidx12.i, align 2
store i16 %14, ptr %arrayidx16.i, align 2
%indvars.iv.next.i40 = add nuw nsw i64 %indvars.iv.i36, 1
%exitcond.not.i41 = icmp eq i64 %indvars.iv.next.i40, %7
br i1 %exitcond.not.i41, label %if.end.peel.i, label %for.cond1.preheader.i35, !llvm.loop !12
for.body4.i37: ; preds = %for.body4.i37, %for.cond1.preheader.i35
%indvars.iv42.i = phi i64 [ %indvars.iv.i36, %for.cond1.preheader.i35 ], [ %indvars.iv.next43.i, %for.body4.i37 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i35 ], [ %spec.select.i, %for.body4.i37 ]
%value.i38 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv42.i, i32 1
%16 = load i8, ptr %value.i38, align 1, !tbaa !7
%idxprom5.i = sext i32 %minj.038.i to i64
%value7.i = getelementptr inbounds %struct.card, ptr %c2, i64 %idxprom5.i, i32 1
%17 = load i8, ptr %value7.i, align 1, !tbaa !7
%cmp9.i = icmp slt i8 %16, %17
%18 = trunc i64 %indvars.iv42.i to i32
%spec.select.i = select i1 %cmp9.i, i32 %18, i32 %minj.038.i
%indvars.iv.next43.i = add nuw nsw i64 %indvars.iv42.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next43.i, %7
br i1 %cmp2.i, label %for.body4.i37, label %for.cond.cleanup3.i39, !llvm.loop !13
if.end.peel.i: ; preds = %for.cond.cleanup3.i39
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.card, ptr %c1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !7
%.pre.i = load i8, ptr %c1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i43 = phi i64 [ %indvars.iv.next.i46, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i44 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i43
%19 = load i8, ptr %arrayidx.i44, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i45 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.i43, i32 1
%20 = load i8, ptr %value.i45, align 1, !tbaa !7
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i46 = add nuw nsw i64 %indvars.iv.i43, 1
%exitcond.not.i47 = icmp eq i64 %indvars.iv.next.i46, %7
br i1 %exitcond.not.i47, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %entry, %for.cond6.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %n, align 4, !tbaa !18
%cmp13.i48 = icmp sgt i32 %21, 0
br i1 %cmp13.i48, label %if.end.peel.i50, label %print.exit69
if.end.peel.i50: ; preds = %print.exit
%wide.trip.count.i51 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i52 = getelementptr inbounds %struct.card, ptr %c2, i64 0, i32 1
%.pre17.i53 = load i8, ptr %value.peel.phi.trans.insert.i52, align 1, !tbaa !7
%.pre.i54 = load i8, ptr %c2, align 16, !tbaa !14
%conv.peel.i55 = sext i8 %.pre.i54 to i32
%conv4.peel.i56 = sext i8 %.pre17.i53 to i32
%call5.peel.i57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i55, i32 noundef %conv4.peel.i56)
%exitcond.peel.not.i58 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i58, label %print.exit69, label %if.end.i59
if.end.i59: ; preds = %if.end.peel.i50, %if.end.i59
%indvars.iv.i60 = phi i64 [ %indvars.iv.next.i67, %if.end.i59 ], [ 1, %if.end.peel.i50 ]
%putchar12.i61 = call i32 @putchar(i32 32)
%arrayidx.i62 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i60
%22 = load i8, ptr %arrayidx.i62, align 2, !tbaa !14
%conv.i63 = sext i8 %22 to i32
%value.i64 = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.i60, i32 1
%23 = load i8, ptr %value.i64, align 1, !tbaa !7
%conv4.i65 = sext i8 %23 to i32
%call5.i66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i63, i32 noundef %conv4.i65)
%indvars.iv.next.i67 = add nuw nsw i64 %indvars.iv.i60, 1
%exitcond.not.i68 = icmp eq i64 %indvars.iv.next.i67, %wide.trip.count.i51
br i1 %exitcond.not.i68, label %print.exit69, label %if.end.i59, !llvm.loop !15
print.exit69: ; preds = %if.end.i59, %print.exit, %if.end.peel.i50
%putchar.i49 = call i32 @putchar(i32 10)
%24 = load i32, ptr %n, align 4, !tbaa !18
%cmp10.i70 = icmp slt i32 %24, 1
br i1 %cmp10.i70, label %if.end, label %for.body.preheader.i
for.body.preheader.i: ; preds = %print.exit69
%25 = zext i32 %24 to i64
%26 = load i8, ptr %c1, align 16, !tbaa !14
%27 = load i8, ptr %c2, align 16, !tbaa !14
%cmp5.not.i80 = icmp eq i8 %26, %27
br i1 %cmp5.not.i80, label %for.cond.i, label %if.else
for.cond.i: ; preds = %for.body.preheader.i, %for.body.i
%indvars.iv.i7281 = phi i64 [ %indvars.iv.next.i74, %for.body.i ], [ 0, %for.body.preheader.i ]
%indvars.iv.next.i74 = add nuw nsw i64 %indvars.iv.i7281, 1
%exitcond.i = icmp eq i64 %indvars.iv.next.i74, %25
br i1 %exitcond.i, label %isstable.exit, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i
%arrayidx.i73 = getelementptr inbounds %struct.card, ptr %c1, i64 %indvars.iv.next.i74
%28 = load i8, ptr %arrayidx.i73, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.card, ptr %c2, i64 %indvars.iv.next.i74
%29 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %28, %29
br i1 %cmp5.not.i, label %for.cond.i, label %isstable.exit, !llvm.loop !17
isstable.exit: ; preds = %for.body.i, %for.cond.i
%cmp.i.not.le = icmp ult i64 %indvars.iv.next.i74, %25
br i1 %cmp.i.not.le, label %if.else, label %if.end
if.else: ; preds = %for.body.preheader.i, %isstable.exit
br label %if.end
if.end: ; preds = %isstable.exit, %print.exit69, %if.else
%str.7.sink = phi ptr [ @str.7, %if.else ], [ @str.8, %print.exit69 ], [ @str.8, %isstable.exit ]
%puts32 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %copy) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %c2) #7
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %c1) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !9, i64 1}
!8 = !{!"card", !9, i64 0, !9, i64 1}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = !{!8, !9, i64 0}
!15 = distinct !{!15, !6, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !6}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !9, i64 0}
!20 = !{!9, !9, i64 0}
!21 = distinct !{!21, !6}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct{
char suit;
char value;
}Card;
void swap(Card *,Card *);
int main(){
Card C1[100], C2[100];
int n, i,j,c1,c2,mini,sum=0;
char a;
scanf("%d%c", &n,&a);
for ( i = 0; i < n; i++ ){
scanf("%c%c%c",&C1[i].suit,&C1[i].value,&a);
}
for(i=0;i<n;i++){
strcpy(&C2[i].suit,&C1[i].suit);
strcpy(&C2[i].value,&C1[i].value);
}
for(i=0;i<n-1;i++){
for(j=n-1;j>i;j--){
c1 = atoi(&C1[j].value);
c2 = atoi(&C1[j-1].value);
if(c1 < c2) {
swap(&C1[j],&C1[j-1]);
}
}
}
for(i=0;i<n-1;i++)printf("%c%c ",C1[i].suit,C1[i].value);
printf("%c%c\n",C1[n-1].suit,C1[n-1].value);
printf("Stable\n");
for(i=0;i<n;i++){
mini=i;
for(j=i;j<n;j++){
c1 = atoi(&C2[j].value);
c2 = atoi(&C2[mini].value);
if(c1 < c2){
mini = j;
}
}
swap(&C2[i],&C2[mini]);
}
for(i=0;i<n-1;i++)printf("%c%c ",C2[i].suit,C2[i].value);
printf("%c%c\n",C2[n-1].suit,C2[n-1].value);
for(i=0;i<n;i++){
if(strcmp(&C1[i].suit,&C2[i].suit)!=0 && strcmp(&C1[i].value,&C2[i].value)!=0){
printf("Not stable\n");
sum=1;
break;
}
}
if(sum!=1) printf("Stable\n");
return 0;
}
void swap(Card *a,Card *b){
Card temp;
temp = *a;
*a = *b;
*b = temp;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113691/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113691/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%c%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%c \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%c\0A\00", align 1
@str.6 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%n = alloca i32, align 4
%a = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp220 = icmp sgt i32 %0, 0
br i1 %cmp220, label %for.body, label %for.cond24.preheader.thread
for.cond4.preheader: ; preds = %for.body
%cmp5222 = icmp sgt i32 %1, 0
br i1 %cmp5222, label %for.body6.preheader, label %for.cond24.preheader.thread
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value, ptr noundef nonnull %a)
%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.cond4.preheader, !llvm.loop !9
for.cond24.preheader.thread: ; preds = %for.cond4.preheader, %entry
%.ph = phi i32 [ %1, %for.cond4.preheader ], [ %0, %entry ]
%sub225277 = add nsw i32 %.ph, -1
br label %for.cond51.preheader.for.end65_crit_edge
for.cond24.preheader: ; preds = %for.body6
%sub225 = add nsw i32 %1, -1
%cmp25226 = icmp sgt i32 %1, 1
br i1 %cmp25226, label %for.cond28.preheader, label %for.cond51.preheader.for.end65_crit_edge
for.body6: ; preds = %for.body6.preheader, %for.body6
%indvars.iv249 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next250, %for.body6 ]
%arrayidx8 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv249
%arrayidx11 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv249
%call13 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx8, ptr noundef nonnull dereferenceable(1) %arrayidx11) #8
%value16 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv249, i32 1
%value19 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv249, i32 1
%call20 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %value16, ptr noundef nonnull dereferenceable(1) %value19) #8
%indvars.iv.next250 = add nuw nsw i64 %indvars.iv249, 1
%exitcond.not = icmp eq i64 %indvars.iv.next250, %wide.trip.count
br i1 %exitcond.not, label %for.cond24.preheader, label %for.body6, !llvm.loop !11
for.cond28.preheader: ; preds = %for.cond24.preheader, %for.inc48
%indvars.iv255 = phi i64 [ %indvars.iv.next256, %for.inc48 ], [ 0, %for.cond24.preheader ]
%sub228 = phi i32 [ %sub, %for.inc48 ], [ %sub225, %for.cond24.preheader ]
%3 = sext i32 %sub228 to i64
br label %for.body30
for.cond51.preheader: ; preds = %for.inc48
%4 = icmp sgt i32 %7, 1
br i1 %4, label %for.body54, label %for.cond51.preheader.for.end65_crit_edge
for.cond51.preheader.for.end65_crit_edge: ; preds = %for.cond24.preheader.thread, %for.cond24.preheader, %for.cond51.preheader
%sub52229.pre-phi281 = phi i32 [ %sub, %for.cond51.preheader ], [ %sub225277, %for.cond24.preheader.thread ], [ %sub225, %for.cond24.preheader ]
%.pre = sext i32 %sub52229.pre-phi281 to i64
br label %for.end65
for.body30: ; preds = %for.cond28.preheader, %for.inc46
%indvars.iv252 = phi i64 [ %3, %for.cond28.preheader ], [ %indvars.iv.next253, %for.inc46 ]
%value33 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv252, i32 1
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %value33, ptr noundef null, i32 noundef 10) #8
%conv.i = trunc i64 %call.i to i32
%indvars.iv.next253 = add nsw i64 %indvars.iv252, -1
%value38 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv.next253, i32 1
%call.i214 = call i64 @strtol(ptr nocapture noundef nonnull %value38, ptr noundef null, i32 noundef 10) #8
%conv.i215 = trunc i64 %call.i214 to i32
%cmp40 = icmp slt i32 %conv.i, %conv.i215
br i1 %cmp40, label %if.then, label %for.inc46
if.then: ; preds = %for.body30
%arrayidx37 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv.next253
%5 = load <2 x i16>, ptr %arrayidx37, align 2
%6 = shufflevector <2 x i16> %5, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %6, ptr %arrayidx37, align 2
br label %for.inc46
for.inc46: ; preds = %for.body30, %if.then
%cmp29 = icmp sgt i64 %indvars.iv.next253, %indvars.iv255
br i1 %cmp29, label %for.body30, label %for.inc48, !llvm.loop !12
for.inc48: ; preds = %for.inc46
%indvars.iv.next256 = add nuw nsw i64 %indvars.iv255, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%8 = sext i32 %sub to i64
%cmp25 = icmp slt i64 %indvars.iv.next256, %8
br i1 %cmp25, label %for.cond28.preheader, label %for.cond51.preheader, !llvm.loop !13
for.body54: ; preds = %for.cond51.preheader, %for.body54
%indvars.iv258 = phi i64 [ %indvars.iv.next259, %for.body54 ], [ 0, %for.cond51.preheader ]
%arrayidx56 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv258
%9 = load i8, ptr %arrayidx56, align 2, !tbaa !14
%conv = sext i8 %9 to i32
%value60 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv258, i32 1
%10 = load i8, ptr %value60, align 1, !tbaa !16
%conv61 = sext i8 %10 to i32
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %conv61)
%indvars.iv.next259 = add nuw nsw i64 %indvars.iv258, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%sub52 = add nsw i32 %11, -1
%12 = sext i32 %sub52 to i64
%cmp53 = icmp slt i64 %indvars.iv.next259, %12
br i1 %cmp53, label %for.body54, label %for.end65, !llvm.loop !17
for.end65: ; preds = %for.body54, %for.cond51.preheader.for.end65_crit_edge
%idxprom67.pre-phi = phi i64 [ %.pre, %for.cond51.preheader.for.end65_crit_edge ], [ %12, %for.body54 ]
%arrayidx68 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %idxprom67.pre-phi
%13 = load i8, ptr %arrayidx68, align 2, !tbaa !14
%conv70 = sext i8 %13 to i32
%value74 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %idxprom67.pre-phi, i32 1
%14 = load i8, ptr %value74, align 1, !tbaa !16
%conv75 = sext i8 %14 to i32
%call76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv70, i32 noundef %conv75)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp79237 = icmp sgt i32 %15, 0
br i1 %cmp79237, label %for.cond82.preheader, label %for.cond108.preheader.for.end124_crit_edge
for.cond82.preheader: ; preds = %for.end65, %for.end100
%16 = phi i32 [ %23, %for.end100 ], [ %15, %for.end65 ]
%indvars.iv261 = phi i64 [ %indvars.iv.next262, %for.end100 ], [ 0, %for.end65 ]
%17 = sext i32 %16 to i64
%cmp83233 = icmp slt i64 %indvars.iv261, %17
%18 = trunc i64 %indvars.iv261 to i32
br i1 %cmp83233, label %for.body85, label %for.end100
for.cond108.preheader: ; preds = %for.end100
%cmp110240 = icmp sgt i32 %23, 1
br i1 %cmp110240, label %for.body112, label %for.cond108.preheader.for.end124_crit_edge
for.cond108.preheader.for.end124_crit_edge: ; preds = %for.end65, %for.cond108.preheader
%19 = phi i32 [ %23, %for.cond108.preheader ], [ %15, %for.end65 ]
%sub109239 = add nsw i32 %19, -1
%.pre275 = sext i32 %sub109239 to i64
br label %for.end124
for.body85: ; preds = %for.cond82.preheader, %for.body85
%indvars.iv263 = phi i64 [ %indvars.iv.next264, %for.body85 ], [ %indvars.iv261, %for.cond82.preheader ]
%mini.0235 = phi i32 [ %spec.select, %for.body85 ], [ %18, %for.cond82.preheader ]
%value88 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv263, i32 1
%call.i216 = call i64 @strtol(ptr nocapture noundef nonnull %value88, ptr noundef null, i32 noundef 10) #8
%conv.i217 = trunc i64 %call.i216 to i32
%idxprom90 = sext i32 %mini.0235 to i64
%value92 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %idxprom90, i32 1
%call.i218 = call i64 @strtol(ptr nocapture noundef nonnull %value92, ptr noundef null, i32 noundef 10) #8
%conv.i219 = trunc i64 %call.i218 to i32
%cmp94 = icmp slt i32 %conv.i217, %conv.i219
%20 = trunc i64 %indvars.iv263 to i32
%spec.select = select i1 %cmp94, i32 %20, i32 %mini.0235
%indvars.iv.next264 = add nuw nsw i64 %indvars.iv263, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp83 = icmp slt i64 %indvars.iv.next264, %22
br i1 %cmp83, label %for.body85, label %for.end100, !llvm.loop !18
for.end100: ; preds = %for.body85, %for.cond82.preheader
%.pre-phi = phi i64 [ %17, %for.cond82.preheader ], [ %22, %for.body85 ]
%23 = phi i32 [ %16, %for.cond82.preheader ], [ %21, %for.body85 ]
%mini.0.lcssa = phi i32 [ %18, %for.cond82.preheader ], [ %spec.select, %for.body85 ]
%arrayidx102 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv261
%idxprom103 = sext i32 %mini.0.lcssa to i64
%arrayidx104 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %idxprom103
%24 = load i16, ptr %arrayidx102, align 2
%25 = load i16, ptr %arrayidx104, align 2
store i16 %25, ptr %arrayidx102, align 2
store i16 %24, ptr %arrayidx104, align 2
%indvars.iv.next262 = add nuw nsw i64 %indvars.iv261, 1
%cmp79 = icmp slt i64 %indvars.iv.next262, %.pre-phi
br i1 %cmp79, label %for.cond82.preheader, label %for.cond108.preheader, !llvm.loop !19
for.body112: ; preds = %for.cond108.preheader, %for.body112
%indvars.iv267 = phi i64 [ %indvars.iv.next268, %for.body112 ], [ 0, %for.cond108.preheader ]
%arrayidx114 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv267
%26 = load i8, ptr %arrayidx114, align 2, !tbaa !14
%conv116 = sext i8 %26 to i32
%value119 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv267, i32 1
%27 = load i8, ptr %value119, align 1, !tbaa !16
%conv120 = sext i8 %27 to i32
%call121 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv116, i32 noundef %conv120)
%indvars.iv.next268 = add nuw nsw i64 %indvars.iv267, 1
%28 = load i32, ptr %n, align 4, !tbaa !5
%sub109 = add nsw i32 %28, -1
%29 = sext i32 %sub109 to i64
%cmp110 = icmp slt i64 %indvars.iv.next268, %29
br i1 %cmp110, label %for.body112, label %for.end124, !llvm.loop !20
for.end124: ; preds = %for.body112, %for.cond108.preheader.for.end124_crit_edge
%idxprom126.pre-phi = phi i64 [ %.pre275, %for.cond108.preheader.for.end124_crit_edge ], [ %29, %for.body112 ]
%arrayidx127 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %idxprom126.pre-phi
%30 = load i8, ptr %arrayidx127, align 2, !tbaa !14
%conv129 = sext i8 %30 to i32
%value133 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %idxprom126.pre-phi, i32 1
%31 = load i8, ptr %value133, align 1, !tbaa !16
%conv134 = sext i8 %31 to i32
%call135 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv129, i32 noundef %conv134)
%32 = load i32, ptr %n, align 4, !tbaa !5
%cmp137243 = icmp sgt i32 %32, 0
br i1 %cmp137243, label %for.body139.preheader, label %if.end168
for.body139.preheader: ; preds = %for.end124
%wide.trip.count273 = zext i32 %32 to i64
br label %for.body139
for.body139: ; preds = %for.body139.preheader, %for.inc161
%indvars.iv270 = phi i64 [ 0, %for.body139.preheader ], [ %indvars.iv.next271, %for.inc161 ]
%arrayidx141 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv270
%arrayidx144 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv270
%call146 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx141, ptr noundef nonnull dereferenceable(1) %arrayidx144) #9
%cmp147.not = icmp eq i32 %call146, 0
br i1 %cmp147.not, label %for.inc161, label %land.lhs.true
land.lhs.true: ; preds = %for.body139
%value151 = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv270, i32 1
%value154 = getelementptr inbounds [100 x %struct.Card], ptr %C2, i64 0, i64 %indvars.iv270, i32 1
%call155 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %value151, ptr noundef nonnull dereferenceable(1) %value154) #9
%cmp156.not = icmp eq i32 %call155, 0
br i1 %cmp156.not, label %for.inc161, label %if.end168
for.inc161: ; preds = %for.body139, %land.lhs.true
%indvars.iv.next271 = add nuw nsw i64 %indvars.iv270, 1
%exitcond274.not = icmp eq i64 %indvars.iv.next271, %wide.trip.count273
br i1 %exitcond274.not, label %if.end168, label %for.body139, !llvm.loop !21
if.end168: ; preds = %for.inc161, %land.lhs.true, %for.end124
%str.6.sink = phi ptr [ @str.7, %for.end124 ], [ @str.6, %land.lhs.true ], [ @str.7, %for.inc161 ]
%puts212 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #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 memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i16, ptr %a, align 1
%1 = load i16, ptr %b, align 1
store i16 %1, ptr %a, align 1
store i16 %0, ptr %b, align 1
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !7, i64 0}
!15 = !{!"", !7, i64 0, !7, i64 1}
!16 = !{!15, !7, i64 1}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
typedef struct { char suit, value; } Card;
void bubble(Card A[], int N) {
int i,j;
Card t;
for(i = 0; i<N; i++) {
for(j = N-1; j >= i; j--) {
if(A[j].value < A[j-1].value) {
t = A[j]; A[j] = A[j-1]; A[j-1] = t;
}
}
}
}
void selection(Card A[], int N) {
int i,j,minj;
Card t;
for(i=0;i<N;i++) {
minj = i;
for(j=i; j<N; j++) {
if(A[j].value < A[minj].value) minj = j;
}
t = A[i]; A[i] = A[minj]; A[minj] = t;
}
}
void print(Card A[], int N) {
int i;
for(i=0; i<N; i++) {
if(i>0) printf(" ");
printf("%c%d",A[i].suit,A[i].value);
}
printf("\n");
}
int isStable(Card C1[], Card C2[], int N) {
int i;
for(i=0; i<N; i++) {
if(C1[i].suit != C2[i].suit) return 0;
}
return 1;
}
void str2Card(Card *t,char str[]) {
t->suit = str[0];
t->value = str[1] - '0';
}
int main(void) {
Card C1[100], C2[100];
int N,i;
char str[3];
scanf("%d",&N);
for(i=0;i<N; i++) {
scanf("%s",str);
str2Card(&C1[i],str);
}
for(i=0; i<N; i++) C2[i] = C1[i];
bubble(C1,N);
selection(C2,N);
print(C1,N);
printf("Stable\n");
print(C2,N);
if(isStable(C1,C2,N)) {
printf("Stable\n");
} else {
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113734/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113734/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%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"%s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %N, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv45 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next46, %for.inc21 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i16>, ptr %arrayidx6, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv45
br i1 %cmp2.not.not, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc
%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.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %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 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: 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 void @selection(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.038 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%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.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %N, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 %if.end, !llvm.loop !15
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #5 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; 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 !17
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @str2Card(ptr nocapture noundef writeonly %t, ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !18
store i8 %0, ptr %t, align 1, !tbaa !14
%arrayidx1 = getelementptr inbounds i8, ptr %str, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !18
%sub = add i8 %1, -48
%value = getelementptr inbounds %struct.Card, ptr %t, i64 0, i32 1
store i8 %sub, ptr %value, align 1, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%N = alloca i32, align 4
%str = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %str) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !19
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body.lr.ph, label %print.exit
for.body.lr.ph: ; preds = %entry
%arrayidx1.i = getelementptr inbounds i8, ptr %str, i64 1
br label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp478 = icmp sgt i32 %3, 0
br i1 %cmp478, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %str)
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%1 = load i8, ptr %str, align 1, !tbaa !18
store i8 %1, ptr %arrayidx, align 2, !tbaa !14
%2 = load i8, ptr %arrayidx1.i, align 1, !tbaa !18
%sub.i = add i8 %2, -48
%value.i = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %sub.i, ptr %value.i, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !19
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond3.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv45.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next46.i, %for.inc21.i ]
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %7, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i31 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i31, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9, i32 1
%10 = load i8, ptr %value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %8, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx6.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i
%indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next46.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i33, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i33: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i34 = phi i64 [ %indvars.iv.next.i37, %for.end.i ], [ 0, %for.inc21.i ]
%13 = trunc i64 %indvars.iv.i34 to i32
br label %for.body3.i35
for.body3.i35: ; preds = %for.body3.i35, %for.cond1.preheader.i33
%indvars.iv41.i = phi i64 [ %indvars.iv.i34, %for.cond1.preheader.i33 ], [ %indvars.iv.next42.i, %for.body3.i35 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i33 ], [ %spec.select.i, %for.body3.i35 ]
%value.i36 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%14 = load i8, ptr %value.i36, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.038.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%15 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %16, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %7
br i1 %cmp2.i, label %for.body3.i35, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i35
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i34
%17 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%18 = load i16, ptr %arrayidx15.i, align 2
store i16 %18, ptr %arrayidx11.i, align 2
store i16 %17, ptr %arrayidx15.i, align 2
%indvars.iv.next.i37 = add nuw nsw i64 %indvars.iv.i34, 1
%exitcond.not.i38 = icmp eq i64 %indvars.iv.next.i37, %7
br i1 %exitcond.not.i38, label %if.end.peel.i, label %for.cond1.preheader.i33, !llvm.loop !13
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %C1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i41 = phi i64 [ %indvars.iv.next.i44, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i42 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41
%19 = load i8, ptr %arrayidx.i42, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i43 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41, i32 1
%20 = load i8, ptr %value.i43, align 1, !tbaa !5
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i44 = add nuw nsw i64 %indvars.iv.i41, 1
%exitcond.not.i45 = icmp eq i64 %indvars.iv.next.i44, %7
br i1 %exitcond.not.i45, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %entry, %for.cond3.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %N, align 4, !tbaa !19
%cmp13.i46 = icmp sgt i32 %21, 0
br i1 %cmp13.i46, label %if.end.peel.i49, label %print.exit68
if.end.peel.i49: ; preds = %print.exit
%wide.trip.count.i50 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i51 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre17.i52 = load i8, ptr %value.peel.phi.trans.insert.i51, align 1, !tbaa !5
%.pre.i53 = load i8, ptr %C2, align 16, !tbaa !14
%conv.peel.i54 = sext i8 %.pre.i53 to i32
%conv4.peel.i55 = sext i8 %.pre17.i52 to i32
%call5.peel.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i54, i32 noundef %conv4.peel.i55)
%exitcond.peel.not.i57 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i57, label %print.exit68, label %if.end.i58
if.end.i58: ; preds = %if.end.peel.i49, %if.end.i58
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i66, %if.end.i58 ], [ 1, %if.end.peel.i49 ]
%putchar12.i60 = call i32 @putchar(i32 32)
%arrayidx.i61 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59
%22 = load i8, ptr %arrayidx.i61, align 2, !tbaa !14
%conv.i62 = sext i8 %22 to i32
%value.i63 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59, i32 1
%23 = load i8, ptr %value.i63, align 1, !tbaa !5
%conv4.i64 = sext i8 %23 to i32
%call5.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i62, i32 noundef %conv4.i64)
%indvars.iv.next.i66 = add nuw nsw i64 %indvars.iv.i59, 1
%exitcond.not.i67 = icmp eq i64 %indvars.iv.next.i66, %wide.trip.count.i50
br i1 %exitcond.not.i67, label %print.exit68, label %if.end.i58, !llvm.loop !15
print.exit68: ; preds = %if.end.i58, %print.exit, %if.end.peel.i49
%putchar.i48 = call i32 @putchar(i32 10)
%24 = load i32, ptr %N, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %24, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit68
%wide.trip.count.i69 = zext i32 %24 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i72 = add nuw nsw i64 %indvars.iv.i70, 1
%exitcond.not.i73 = icmp eq i64 %indvars.iv.next.i72, %wide.trip.count.i69
br i1 %exitcond.not.i73, label %if.end, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i70 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i72, %for.cond.i ]
%arrayidx.i71 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i70
%25 = load i8, ptr %arrayidx.i71, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i70
%26 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %25, %26
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit68
%str.7.sink = phi ptr [ @str.8, %print.exit68 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts29 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #6 = { 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 #7 = { nofree nounwind }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1}
!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 = !{!6, !7, i64 0}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = distinct !{!21, !10}
|
#include<stdlib.h>
#include<stdio.h>
#include<stdbool.h>
struct Card
{
char suit, value;
};
void bublleSort(struct Card a[], int n)
{
for (int i = 0; i < n; i++)
{
for (int j = n - 1; j >= i + 1; j--)
{
if (a[j].value < a[j - 1].value)
{
struct Card v = a[j];
a[j] = a[j - 1];
a[j - 1] = v;
}
}
}
}
void selectionSort(struct Card a[], int n)
{
for (int i = 0; i < n - 1; i++)
{
int minj = i;
for (int j = i + 1; j < n; j++)
{
if (a[j].value < a[minj].value)
{
minj = j;
}
}
struct Card v = a[i];
a[i] = a[minj];
a[minj] = v;
}
}
bool isStable(struct Card card1[], struct Card card2[], int n)
{
for (int i = 0; i < n; i++)
{
if (card1[i].suit != card2[i].suit)
{
return false;
}
}
return true;
}
void print(struct Card card[], int n)
{
for (int i = 0; i < n; i++)
{
if (i > 0)
{
printf(" ");
}
printf("%c%c", card[i].suit, card[i].value);
}
printf("\n");
}
int main()
{
struct Card card1[100], card2[100];
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf(" %c", &card1[i].suit);
scanf(" %c", &card1[i].value);
}
for (int i = 0; i < n; i++)
{
card2[i].suit = card1[i].suit;
card2[i].value = card1[i].value;
}
bublleSort(card1, n);
selectionSort(card2, n);
print(card1, n);
printf("Stable\n");
print(card2, n);
if (isStable(card1, card2, n))
{
printf("Stable\n");
} else
{
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113778/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113778/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bublleSort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp43 = icmp sgt i32 %n, 0
br i1 %cmp43, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !5
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv47 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next48, %for.cond.loopexit ]
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
%cmp2.not.not40 = icmp ult i64 %indvars.iv.next48, %0
br i1 %cmp2.not.not40, label %for.body4, label %for.cond.loopexit
for.cond.cleanup: ; preds = %for.cond.loopexit, %entry
ret void
for.body4: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %a, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !7
%2 = add nsw i64 %indvars.iv, -2
%value8 = getelementptr inbounds %struct.Card, ptr %a, i64 %2, i32 1
%3 = load i8, ptr %value8, align 1, !tbaa !7
%cmp10 = icmp slt i8 %1, %3
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%arrayidx7 = getelementptr inbounds %struct.Card, ptr %a, i64 %2
%4 = load <2 x i16>, ptr %arrayidx7, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx7, align 1
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next48
br i1 %cmp2.not.not, label %for.body4, label %for.cond.loopexit, !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(argmem: readwrite) uwtable
define dso_local void @selectionSort(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %n, 1
br i1 %cmp41, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%wide.trip.count49 = zext i32 %sub to i64
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry
ret void
for.body: ; preds = %for.body.preheader, %for.cond.cleanup3
%indvars.iv46 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next47, %for.cond.cleanup3 ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond.cleanup3 ]
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%cmp238 = icmp ult i64 %indvars.iv.next47, %0
%1 = trunc i64 %indvars.iv46 to i32
br i1 %cmp238, label %for.body4, label %for.cond.cleanup3
for.cond.cleanup3: ; preds = %for.body4, %for.body
%minj.0.lcssa = phi i32 [ %1, %for.body ], [ %spec.select, %for.body4 ]
%arrayidx12 = getelementptr inbounds %struct.Card, ptr %a, i64 %indvars.iv46
%2 = load i16, ptr %arrayidx12, align 1
%idxprom15 = sext i32 %minj.0.lcssa to i64
%arrayidx16 = getelementptr inbounds %struct.Card, ptr %a, i64 %idxprom15
%3 = load i16, ptr %arrayidx16, align 1
store i16 %3, ptr %arrayidx12, align 1
store i16 %2, ptr %arrayidx16, align 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.cond.cleanup, label %for.body, !llvm.loop !12
for.body4: ; preds = %for.body, %for.body4
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %for.body4 ], [ %indvars.iv, %for.body ]
%minj.039 = phi i32 [ %spec.select, %for.body4 ], [ %1, %for.body ]
%value = getelementptr inbounds %struct.Card, ptr %a, i64 %indvars.iv43, i32 1
%4 = load i8, ptr %value, align 1, !tbaa !7
%idxprom5 = sext i32 %minj.039 to i64
%value7 = getelementptr inbounds %struct.Card, ptr %a, i64 %idxprom5, i32 1
%5 = load i8, ptr %value7, align 1, !tbaa !7
%cmp9 = icmp slt i8 %4, %5
%6 = trunc i64 %indvars.iv43 to i32
%spec.select = select i1 %cmp9, i32 %6, i32 %minj.039
%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.cond.cleanup3, label %for.body4, !llvm.loop !13
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @isStable(ptr nocapture noundef readonly %card1, ptr nocapture noundef readonly %card2, i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp10 = icmp slt i32 %n, 1
br i1 %cmp10, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
%1 = load i8, ptr %card1, align 1, !tbaa !14
%2 = load i8, ptr %card2, align 1, !tbaa !14
%cmp5.not14 = icmp eq i8 %1, %2
br i1 %cmp5.not14, label %for.cond, label %cleanup
for.cond: ; preds = %for.body.preheader, %for.body
%indvars.iv15 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv15, 1
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %cleanup.loopexit, label %for.body, !llvm.loop !15
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds %struct.Card, ptr %card1, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %card2, i64 %indvars.iv.next
%4 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %3, %4
br i1 %cmp5.not, label %for.cond, label %cleanup.loopexit, !llvm.loop !15
cleanup.loopexit: ; preds = %for.cond, %for.body
%cmp.le = icmp uge i64 %indvars.iv.next, %0
br label %cleanup
cleanup: ; preds = %cleanup.loopexit, %for.body.preheader, %entry
%cmp.lcssa = phi i1 [ true, %entry ], [ false, %for.body.preheader ], [ %cmp.le, %cleanup.loopexit ]
ret i1 %cmp.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %card, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %if.end.peel, label %for.cond.cleanup
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %card, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !7
%.pre = load i8, ptr %card, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%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 ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %card, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %card, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !7
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 !16
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%card1 = alloca [100 x %struct.Card], align 16
%card2 = alloca [100 x %struct.Card], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %card1) #6
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %card2) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !18
%cmp87 = icmp sgt i32 %0, 0
br i1 %cmp87, label %for.body, label %print.exit
for.cond6.preheader: ; preds = %for.body
%cmp789 = icmp sgt i32 %2, 0
br i1 %cmp789, label %for.body9.preheader, label %print.exit
for.body9.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.cond.cleanup8.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx)
%value = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %value)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !18
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !20
for.cond.cleanup8.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%indvars.iv97.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next98.1, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup8, label %for.body9.epil
for.body9.epil: ; preds = %for.cond.cleanup8.unr-lcssa
%arrayidx11.epil = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv97.unr
%4 = load i8, ptr %arrayidx11.epil, align 2, !tbaa !14
%arrayidx14.epil = getelementptr inbounds [100 x %struct.Card], ptr %card2, i64 0, i64 %indvars.iv97.unr
store i8 %4, ptr %arrayidx14.epil, align 2, !tbaa !14
%value18.epil = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv97.unr, i32 1
%5 = load i8, ptr %value18.epil, align 1, !tbaa !7
%value21.epil = getelementptr inbounds [100 x %struct.Card], ptr %card2, i64 0, i64 %indvars.iv97.unr, i32 1
store i8 %5, ptr %value21.epil, align 1, !tbaa !7
br label %for.cond.cleanup8
for.cond.cleanup8: ; preds = %for.cond.cleanup8.unr-lcssa, %for.body9.epil
br i1 %cmp789, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.cond.cleanup8
%6 = zext i32 %2 to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next48.i, %6
br i1 %exitcond.not.i, label %bublleSort.exit, label %for.cond1.preheader.i, !llvm.loop !5
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv47.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next48.i, %for.cond.loopexit.i ]
%indvars.iv.next48.i = add nuw nsw i64 %indvars.iv47.i, 1
%cmp2.not.not40.i = icmp ult i64 %indvars.iv.next48.i, %6
br i1 %cmp2.not.not40.i, label %for.body4.i, label %for.cond.loopexit.i
for.body4.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %6, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i = getelementptr inbounds %struct.Card, ptr %card1, i64 %indvars.iv.next.i, i32 1
%7 = load i8, ptr %value.i, align 1, !tbaa !7
%8 = add nsw i64 %indvars.iv.i, -2
%value8.i = getelementptr inbounds %struct.Card, ptr %card1, i64 %8, i32 1
%9 = load i8, ptr %value8.i, align 1, !tbaa !7
%cmp10.i = icmp slt i8 %7, %9
br i1 %cmp10.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%arrayidx7.i = getelementptr inbounds %struct.Card, ptr %card1, i64 %8
%10 = load <2 x i16>, ptr %arrayidx7.i, align 2
%11 = shufflevector <2 x i16> %10, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %11, ptr %arrayidx7.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next48.i
br i1 %cmp2.not.not.i, label %for.body4.i, label %for.cond.loopexit.i, !llvm.loop !11
bublleSort.exit: ; preds = %for.cond.loopexit.i
%cmp41.i = icmp sgt i32 %2, 1
br i1 %cmp41.i, label %for.body.preheader.i, label %if.end.peel.i
for.body.preheader.i: ; preds = %bublleSort.exit
%sub.i = add nsw i32 %2, -1
%wide.trip.count49.i = zext i32 %sub.i to i64
br label %for.body.i
for.body.i: ; preds = %for.cond.cleanup3.i, %for.body.preheader.i
%indvars.iv46.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next47.i, %for.cond.cleanup3.i ]
%indvars.iv.i45 = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i46, %for.cond.cleanup3.i ]
%indvars.iv.next47.i = add nuw nsw i64 %indvars.iv46.i, 1
%cmp238.i = icmp ult i64 %indvars.iv.next47.i, %6
%12 = trunc i64 %indvars.iv46.i to i32
br i1 %cmp238.i, label %for.body4.i47, label %for.cond.cleanup3.i
for.cond.cleanup3.i: ; preds = %for.body4.i47, %for.body.i
%minj.0.lcssa.i = phi i32 [ %12, %for.body.i ], [ %spec.select.i, %for.body4.i47 ]
%arrayidx12.i = getelementptr inbounds %struct.Card, ptr %card2, i64 %indvars.iv46.i
%13 = load i16, ptr %arrayidx12.i, align 2
%idxprom15.i = sext i32 %minj.0.lcssa.i to i64
%arrayidx16.i = getelementptr inbounds %struct.Card, ptr %card2, i64 %idxprom15.i
%14 = load i16, ptr %arrayidx16.i, align 2
store i16 %14, ptr %arrayidx12.i, align 2
store i16 %13, ptr %arrayidx16.i, align 2
%indvars.iv.next.i46 = add nuw nsw i64 %indvars.iv.i45, 1
%exitcond50.not.i = icmp eq i64 %indvars.iv.next47.i, %wide.trip.count49.i
br i1 %exitcond50.not.i, label %if.end.peel.i, label %for.body.i, !llvm.loop !12
for.body4.i47: ; preds = %for.body.i, %for.body4.i47
%indvars.iv43.i = phi i64 [ %indvars.iv.next44.i, %for.body4.i47 ], [ %indvars.iv.i45, %for.body.i ]
%minj.039.i = phi i32 [ %spec.select.i, %for.body4.i47 ], [ %12, %for.body.i ]
%value.i48 = getelementptr inbounds %struct.Card, ptr %card2, i64 %indvars.iv43.i, i32 1
%15 = load i8, ptr %value.i48, align 1, !tbaa !7
%idxprom5.i = sext i32 %minj.039.i to i64
%value7.i = getelementptr inbounds %struct.Card, ptr %card2, i64 %idxprom5.i, i32 1
%16 = load i8, ptr %value7.i, align 1, !tbaa !7
%cmp9.i = icmp slt i8 %15, %16
%17 = trunc i64 %indvars.iv43.i to i32
%spec.select.i = select i1 %cmp9.i, i32 %17, i32 %minj.039.i
%indvars.iv.next44.i = add nuw nsw i64 %indvars.iv43.i, 1
%exitcond.not.i49 = icmp eq i64 %indvars.iv.next44.i, %6
br i1 %exitcond.not.i49, label %for.cond.cleanup3.i, label %for.body4.i47, !llvm.loop !13
if.end.peel.i: ; preds = %for.cond.cleanup3.i, %bublleSort.exit
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %card1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !7
%.pre.i = load i8, ptr %card1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %2, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i51 = phi i64 [ %indvars.iv.next.i54, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i52 = getelementptr inbounds %struct.Card, ptr %card1, i64 %indvars.iv.i51
%18 = load i8, ptr %arrayidx.i52, align 2, !tbaa !14
%conv.i = sext i8 %18 to i32
%value.i53 = getelementptr inbounds %struct.Card, ptr %card1, i64 %indvars.iv.i51, i32 1
%19 = load i8, ptr %value.i53, align 1, !tbaa !7
%conv4.i = sext i8 %19 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i54 = add nuw nsw i64 %indvars.iv.i51, 1
%exitcond.not.i55 = icmp eq i64 %indvars.iv.next.i54, %6
br i1 %exitcond.not.i55, label %print.exit, label %if.end.i, !llvm.loop !16
print.exit: ; preds = %if.end.i, %entry, %for.cond6.preheader, %for.cond.cleanup8, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%20 = load i32, ptr %n, align 4, !tbaa !18
%cmp13.i56 = icmp sgt i32 %20, 0
br i1 %cmp13.i56, label %if.end.peel.i58, label %print.exit77
if.end.peel.i58: ; preds = %print.exit
%wide.trip.count.i59 = zext i32 %20 to i64
%value.peel.phi.trans.insert.i60 = getelementptr inbounds %struct.Card, ptr %card2, i64 0, i32 1
%.pre17.i61 = load i8, ptr %value.peel.phi.trans.insert.i60, align 1, !tbaa !7
%.pre.i62 = load i8, ptr %card2, align 16, !tbaa !14
%conv.peel.i63 = sext i8 %.pre.i62 to i32
%conv4.peel.i64 = sext i8 %.pre17.i61 to i32
%call5.peel.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i63, i32 noundef %conv4.peel.i64)
%exitcond.peel.not.i66 = icmp eq i32 %20, 1
br i1 %exitcond.peel.not.i66, label %print.exit77, label %if.end.i67
if.end.i67: ; preds = %if.end.peel.i58, %if.end.i67
%indvars.iv.i68 = phi i64 [ %indvars.iv.next.i75, %if.end.i67 ], [ 1, %if.end.peel.i58 ]
%putchar12.i69 = call i32 @putchar(i32 32)
%arrayidx.i70 = getelementptr inbounds %struct.Card, ptr %card2, i64 %indvars.iv.i68
%21 = load i8, ptr %arrayidx.i70, align 2, !tbaa !14
%conv.i71 = sext i8 %21 to i32
%value.i72 = getelementptr inbounds %struct.Card, ptr %card2, i64 %indvars.iv.i68, i32 1
%22 = load i8, ptr %value.i72, align 1, !tbaa !7
%conv4.i73 = sext i8 %22 to i32
%call5.i74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i71, i32 noundef %conv4.i73)
%indvars.iv.next.i75 = add nuw nsw i64 %indvars.iv.i68, 1
%exitcond.not.i76 = icmp eq i64 %indvars.iv.next.i75, %wide.trip.count.i59
br i1 %exitcond.not.i76, label %print.exit77, label %if.end.i67, !llvm.loop !16
print.exit77: ; preds = %if.end.i67, %print.exit, %if.end.peel.i58
%putchar.i57 = call i32 @putchar(i32 10)
%23 = load i32, ptr %n, align 4, !tbaa !18
%cmp10.i78 = icmp slt i32 %23, 1
br i1 %cmp10.i78, label %if.end, label %for.body.preheader.i79
for.body.preheader.i79: ; preds = %print.exit77
%24 = zext i32 %23 to i64
%25 = load i8, ptr %card1, align 16, !tbaa !14
%26 = load i8, ptr %card2, align 16, !tbaa !14
%cmp5.not.i91 = icmp eq i8 %25, %26
br i1 %cmp5.not.i91, label %for.cond.i, label %if.else
for.cond.i: ; preds = %for.body.preheader.i79, %for.body.i81
%indvars.iv.i8292 = phi i64 [ %indvars.iv.next.i84, %for.body.i81 ], [ 0, %for.body.preheader.i79 ]
%indvars.iv.next.i84 = add nuw nsw i64 %indvars.iv.i8292, 1
%exitcond.i = icmp eq i64 %indvars.iv.next.i84, %24
br i1 %exitcond.i, label %isStable.exit, label %for.body.i81, !llvm.loop !15
for.body.i81: ; preds = %for.cond.i
%arrayidx.i83 = getelementptr inbounds %struct.Card, ptr %card1, i64 %indvars.iv.next.i84
%27 = load i8, ptr %arrayidx.i83, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %card2, i64 %indvars.iv.next.i84
%28 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %27, %28
br i1 %cmp5.not.i, label %for.cond.i, label %isStable.exit, !llvm.loop !15
isStable.exit: ; preds = %for.body.i81, %for.cond.i
%cmp.i.not.le = icmp ult i64 %indvars.iv.next.i84, %24
br i1 %cmp.i.not.le, label %if.else, label %if.end
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%indvars.iv97 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next98.1, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.body9 ]
%arrayidx11 = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv97
%29 = load i8, ptr %arrayidx11, align 4, !tbaa !14
%arrayidx14 = getelementptr inbounds [100 x %struct.Card], ptr %card2, i64 0, i64 %indvars.iv97
store i8 %29, ptr %arrayidx14, align 4, !tbaa !14
%value18 = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv97, i32 1
%30 = load i8, ptr %value18, align 1, !tbaa !7
%value21 = getelementptr inbounds [100 x %struct.Card], ptr %card2, i64 0, i64 %indvars.iv97, i32 1
store i8 %30, ptr %value21, align 1, !tbaa !7
%indvars.iv.next98 = or i64 %indvars.iv97, 1
%arrayidx11.1 = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv.next98
%31 = load i8, ptr %arrayidx11.1, align 2, !tbaa !14
%arrayidx14.1 = getelementptr inbounds [100 x %struct.Card], ptr %card2, i64 0, i64 %indvars.iv.next98
store i8 %31, ptr %arrayidx14.1, align 2, !tbaa !14
%value18.1 = getelementptr inbounds [100 x %struct.Card], ptr %card1, i64 0, i64 %indvars.iv.next98, i32 1
%32 = load i8, ptr %value18.1, align 1, !tbaa !7
%value21.1 = getelementptr inbounds [100 x %struct.Card], ptr %card2, i64 0, i64 %indvars.iv.next98, i32 1
store i8 %32, ptr %value21.1, align 1, !tbaa !7
%indvars.iv.next98.1 = add nuw nsw i64 %indvars.iv97, 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.cleanup8.unr-lcssa, label %for.body9, !llvm.loop !21
if.else: ; preds = %for.body.preheader.i79, %isStable.exit
br label %if.end
if.end: ; preds = %isStable.exit, %print.exit77, %if.else
%str.7.sink = phi ptr [ @str.7, %if.else ], [ @str.8, %print.exit77 ], [ @str.8, %isStable.exit ]
%puts42 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %card2) #6
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %card1) #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 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree norecurse nosync nounwind memory(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 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 #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, !9, i64 1}
!8 = !{!"Card", !9, i64 0, !9, i64 1}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = !{!8, !9, i64 0}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !9, i64 0}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
|
#include<stdio.h>
#include<string.h>
#define N 36
typedef struct{
char c;
int value;
}sort;
int main()
{
int i,j,n,flag=0,minj;
sort C1[N],C2[N],a;
char emp;
scanf("%d\n",&n);
for(i=0;i<n;i++){
scanf("%c%d%c",&C1[i].c, &C1[i].value,&emp);
C2[i]=C1[i];
}
//bubble sort
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(C1[j].value < C1[j-1].value){
a=C1[j];
C1[j] = C1[j-1];
C1[j-1] =a;
}
}
}
// bubble fin
//selection sort
for(i=0;i<n;i++){
minj=i;
for(j=i;j<n;j++){
if(C2[j].value <C2[minj].value ) minj=j;
}
if(minj != j){
a=C2[i];
C2[i]=C2[minj];
C2[minj]=a;
}
}
// selection fin
for(j=0;j<n-1;j++){
printf("%c%d ",C1[j].c,C1[j].value);
}
printf("%c%d\n",C1[n-1].c,C1[n-1].value);
printf("Stable\n");
for(j=0;j<n-1;j++){
printf("%c%d ",C2[j].c,C2[j].value );
if(C1[j].c!=C2[j].c) flag=1;
}
printf("%c%d\n",C2[n-1].c,C2[n-1].value);
if(C1[n-1].c!=C2[n-1].c) flag=1;
if(flag==1) printf("Not stable\n");
else printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113820/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113820/source.c"
target datalayout = "e-m:e-p270: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.sort = type { i8, i32 }
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%c%d%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%C1 = alloca [36 x %struct.sort], align 16
%C2 = alloca [36 x %struct.sort], align 16
%emp = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C1) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %C2) #4
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %emp) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp196 = icmp sgt i32 %0, 0
br i1 %cmp196, label %for.body, label %for.cond69.preheader.for.end82_crit_edge
for.cond8.preheader: ; preds = %for.body
%cmp9202 = icmp sgt i32 %5, 0
br i1 %cmp9202, label %for.cond11.preheader.lr.ph, label %for.cond69.preheader.for.end82_crit_edge
for.cond11.preheader.lr.ph: ; preds = %for.cond8.preheader
%j.0198 = add nsw i32 %5, -1
%1 = zext i32 %5 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.0198 to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.cond11.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv
%value = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %value, ptr noundef nonnull %emp)
%arrayidx5 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %indvars.iv
%4 = load i64, ptr %arrayidx, align 8
store i64 %4, ptr %arrayidx5, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.cond11.preheader: ; preds = %for.cond11.preheader.lr.ph, %for.inc34
%indvars.iv230 = phi i64 [ 0, %for.cond11.preheader.lr.ph ], [ %indvars.iv.next231, %for.inc34 ]
%cmp12199 = icmp ult i64 %indvars.iv230, %3
br i1 %cmp12199, label %for.body13, label %for.inc34
for.cond37.preheader: ; preds = %for.inc34
br i1 %cmp9202, label %for.cond40.preheader.preheader, label %for.cond69.preheader
for.cond40.preheader.preheader: ; preds = %for.cond37.preheader
%7 = zext i32 %5 to i64
%wide.trip.count239 = zext i32 %5 to i64
br label %for.cond40.preheader
for.body13: ; preds = %for.cond11.preheader, %for.inc32
%indvars.iv224 = phi i64 [ %indvars.iv.next225, %for.inc32 ], [ %1, %for.cond11.preheader ]
%indvars.iv222 = phi i64 [ %indvars.iv.next223, %for.inc32 ], [ %2, %for.cond11.preheader ]
%indvars.iv.next225 = add nsw i64 %indvars.iv224, -1
%value16 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv222, i32 1
%8 = load i32, ptr %value16, align 4, !tbaa !11
%9 = add nsw i64 %indvars.iv224, -2
%value20 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %9, i32 1
%10 = load i32, ptr %value20, align 4, !tbaa !11
%cmp21 = icmp slt i32 %8, %10
br i1 %cmp21, label %if.then, label %for.inc32
if.then: ; preds = %for.body13
%arrayidx19 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %9
%arrayidx15 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv222
%11 = load i64, ptr %arrayidx15, align 8
%12 = load i64, ptr %arrayidx19, align 8
store i64 %12, ptr %arrayidx15, align 8
store i64 %11, ptr %arrayidx19, align 8
br label %for.inc32
for.inc32: ; preds = %for.body13, %if.then
%indvars.iv.next223 = add nsw i64 %indvars.iv222, -1
%cmp12 = icmp sgt i64 %indvars.iv.next223, %indvars.iv230
br i1 %cmp12, label %for.body13, label %for.inc34, !llvm.loop !13
for.inc34: ; preds = %for.inc32, %for.cond11.preheader
%indvars.iv.next231 = add nuw nsw i64 %indvars.iv230, 1
%exitcond.not = icmp eq i64 %indvars.iv.next231, %wide.trip.count
br i1 %exitcond.not, label %for.cond37.preheader, label %for.cond11.preheader, !llvm.loop !14
for.cond40.preheader: ; preds = %for.cond40.preheader.preheader, %for.inc66
%indvars.iv233 = phi i64 [ 0, %for.cond40.preheader.preheader ], [ %indvars.iv.next234, %for.inc66 ]
%13 = trunc i64 %indvars.iv233 to i32
br label %for.body42
for.cond69.preheader: ; preds = %for.inc66, %for.cond37.preheader
%cmp71209 = icmp sgt i32 %5, 1
br i1 %cmp71209, label %for.body72, label %for.cond69.preheader.for.end82_crit_edge
for.cond69.preheader.for.end82_crit_edge: ; preds = %for.cond8.preheader, %entry, %for.cond69.preheader
%14 = phi i32 [ %5, %for.cond69.preheader ], [ %5, %for.cond8.preheader ], [ %0, %entry ]
%sub70208 = add nsw i32 %14, -1
%.pre = sext i32 %sub70208 to i64
br label %for.end82
for.body42: ; preds = %for.cond40.preheader, %for.body42
%indvars.iv235 = phi i64 [ %indvars.iv233, %for.cond40.preheader ], [ %indvars.iv.next236, %for.body42 ]
%minj.0205 = phi i32 [ %13, %for.cond40.preheader ], [ %spec.select, %for.body42 ]
%value45 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %indvars.iv235, i32 1
%15 = load i32, ptr %value45, align 4, !tbaa !11
%idxprom46 = sext i32 %minj.0205 to i64
%value48 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %idxprom46, i32 1
%16 = load i32, ptr %value48, align 4, !tbaa !11
%cmp49 = icmp slt i32 %15, %16
%17 = trunc i64 %indvars.iv235 to i32
%spec.select = select i1 %cmp49, i32 %17, i32 %minj.0205
%indvars.iv.next236 = add nuw nsw i64 %indvars.iv235, 1
%cmp41 = icmp ult i64 %indvars.iv.next236, %7
br i1 %cmp41, label %for.body42, label %for.end54, !llvm.loop !15
for.end54: ; preds = %for.body42
%18 = trunc i64 %indvars.iv.next236 to i32
%cmp55.not = icmp eq i32 %spec.select, %18
br i1 %cmp55.not, label %for.inc66, label %if.then56
if.then56: ; preds = %for.end54
%arrayidx58 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %indvars.iv233
%19 = load i64, ptr %arrayidx58, align 8
%idxprom61 = sext i32 %spec.select to i64
%arrayidx62 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %idxprom61
%20 = load i64, ptr %arrayidx62, align 8
store i64 %20, ptr %arrayidx58, align 8
store i64 %19, ptr %arrayidx62, align 8
br label %for.inc66
for.inc66: ; preds = %for.end54, %if.then56
%indvars.iv.next234 = add nuw nsw i64 %indvars.iv233, 1
%exitcond240.not = icmp eq i64 %indvars.iv.next234, %wide.trip.count239
br i1 %exitcond240.not, label %for.cond69.preheader, label %for.cond40.preheader, !llvm.loop !16
for.body72: ; preds = %for.cond69.preheader, %for.body72
%indvars.iv241 = phi i64 [ %indvars.iv.next242, %for.body72 ], [ 0, %for.cond69.preheader ]
%arrayidx74 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv241
%21 = load i8, ptr %arrayidx74, align 8, !tbaa !17
%conv = sext i8 %21 to i32
%value78 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv241, i32 1
%22 = load i32, ptr %value78, align 4, !tbaa !11
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv, i32 noundef %22)
%indvars.iv.next242 = add nuw nsw i64 %indvars.iv241, 1
%23 = load i32, ptr %n, align 4, !tbaa !5
%sub70 = add nsw i32 %23, -1
%24 = sext i32 %sub70 to i64
%cmp71 = icmp slt i64 %indvars.iv.next242, %24
br i1 %cmp71, label %for.body72, label %for.end82, !llvm.loop !18
for.end82: ; preds = %for.body72, %for.cond69.preheader.for.end82_crit_edge
%idxprom84.pre-phi = phi i64 [ %.pre, %for.cond69.preheader.for.end82_crit_edge ], [ %24, %for.body72 ]
%arrayidx85 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %idxprom84.pre-phi
%25 = load i8, ptr %arrayidx85, align 8, !tbaa !17
%conv87 = sext i8 %25 to i32
%value91 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %idxprom84.pre-phi, i32 1
%26 = load i32, ptr %value91, align 4, !tbaa !11
%call92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv87, i32 noundef %26)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%27 = load i32, ptr %n, align 4, !tbaa !5
%cmp96213 = icmp sgt i32 %27, 1
br i1 %cmp96213, label %for.body98, label %for.end82.for.end121_crit_edge
for.end82.for.end121_crit_edge: ; preds = %for.end82
%sub95212 = add nsw i32 %27, -1
%.pre247 = sext i32 %sub95212 to i64
br label %for.end121
for.body98: ; preds = %for.end82, %for.body98
%indvars.iv244 = phi i64 [ %indvars.iv.next245, %for.body98 ], [ 0, %for.end82 ]
%flag.0215 = phi i32 [ %spec.select193, %for.body98 ], [ 0, %for.end82 ]
%arrayidx100 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %indvars.iv244
%28 = load i8, ptr %arrayidx100, align 8, !tbaa !17
%conv102 = sext i8 %28 to i32
%value105 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %indvars.iv244, i32 1
%29 = load i32, ptr %value105, align 4, !tbaa !11
%call106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv102, i32 noundef %29)
%arrayidx108 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %indvars.iv244
%30 = load i8, ptr %arrayidx108, align 8, !tbaa !17
%cmp115.not = icmp eq i8 %30, %28
%spec.select193 = select i1 %cmp115.not, i32 %flag.0215, i32 1
%indvars.iv.next245 = add nuw nsw i64 %indvars.iv244, 1
%31 = load i32, ptr %n, align 4, !tbaa !5
%sub95 = add nsw i32 %31, -1
%32 = sext i32 %sub95 to i64
%cmp96 = icmp slt i64 %indvars.iv.next245, %32
br i1 %cmp96, label %for.body98, label %for.end121.loopexit, !llvm.loop !19
for.end121.loopexit: ; preds = %for.body98
%33 = icmp eq i32 %spec.select193, 1
br label %for.end121
for.end121: ; preds = %for.end82.for.end121_crit_edge, %for.end121.loopexit
%idxprom123.pre-phi = phi i64 [ %.pre247, %for.end82.for.end121_crit_edge ], [ %32, %for.end121.loopexit ]
%flag.0.lcssa = phi i1 [ false, %for.end82.for.end121_crit_edge ], [ %33, %for.end121.loopexit ]
%arrayidx124 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %idxprom123.pre-phi
%34 = load i8, ptr %arrayidx124, align 8, !tbaa !17
%conv126 = sext i8 %34 to i32
%value130 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %idxprom123.pre-phi, i32 1
%35 = load i32, ptr %value130, align 4, !tbaa !11
%call131 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %conv126, i32 noundef %35)
%36 = load i32, ptr %n, align 4, !tbaa !5
%sub132 = add nsw i32 %36, -1
%idxprom133 = sext i32 %sub132 to i64
%arrayidx134 = getelementptr inbounds [36 x %struct.sort], ptr %C1, i64 0, i64 %idxprom133
%37 = load i8, ptr %arrayidx134, align 8, !tbaa !17
%arrayidx139 = getelementptr inbounds [36 x %struct.sort], ptr %C2, i64 0, i64 %idxprom133
%38 = load i8, ptr %arrayidx139, align 8, !tbaa !17
%cmp142.not = icmp ne i8 %37, %38
%cmp146 = select i1 %cmp142.not, i1 true, i1 %flag.0.lcssa
%str.7.str.6 = select i1 %cmp146, ptr @str.7, ptr @str.6
%puts191 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.str.6)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %emp) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C2) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %C1) #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 4}
!12 = !{!"", !7, i64 0, !6, i64 4}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!12, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include <stdio.h>
#include<string.h>
#define N 36
#define TRUE 1
#define FALSE 0
typedef struct{
char mark;
short number;
short tag;
}Card;
void SwapCard(Card *C, int i, int j){
Card tmp;
tmp = C[i];
C[i] = C[j];
C[j] = tmp;
}
int IsStable(Card *C,int n){
int i;
for(i=1; i<n; i++){
if(C[i].number == C[i-1].number){
if(C[i].tag < C[i-1].tag){
return FALSE;
}
}
}
return TRUE;
}
void BubbleSort(Card *C, int n){
int i,j;
Card copy[N];
for(i=0; i<n; i++){
copy[i] = C[i];
}
for(i=0; i<n-1; i++){
for(j=n-1; j>i; j--){
if(copy[j].number < copy[j-1].number){
SwapCard(copy,j,j-1);
}
}
}
for(i=0; i<n; i++){
printf("%c%d",copy[i].mark, copy[i].number);
if(i!=n-1) printf(" ");
}
printf("\n");
if(IsStable(copy,n))printf("Stable\n");
else printf("Not Stable\n");
}
void SelectionSort(Card *C, int n){
int i,j,min;
Card copy[N];
for(i=0; i<n; i++){
copy[i] = C[i];
}
for(i=0; i<n; i++){
min = i;
for(j=i; j<n; j++){
if(copy[min].number > copy[j].number){
min = j;
}
}
SwapCard(copy,i,min);
}
for(i=0; i<n; i++){
printf("%c%d",copy[i].mark, copy[i].number);
if(i!=n-1) printf(" ");
}
printf("\n");
if(IsStable(copy,n)) printf("Stable\n");
else printf("Not stable\n");
}
int main(){
int i,n;
char input[3];
Card C[N];
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%s",input);
C[i].mark = input[0];
C[i].number = input[1] - 48;
C[i].tag = i;
}
BubbleSort(C,n);
SelectionSort(C,n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113864/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i16, i16 }
@.str = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@.str.6 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.7 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Not Stable\00", align 1
@str.9 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.10 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @SwapCard(ptr nocapture noundef %C, i32 noundef %i, i32 noundef %j) local_unnamed_addr #0 {
entry:
%tmp = alloca %struct.Card, align 2
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %tmp)
%idxprom = sext i32 %i to i64
%arrayidx = getelementptr inbounds %struct.Card, ptr %C, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %tmp, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx, i64 6, i1 false), !tbaa.struct !5
%idxprom3 = sext i32 %j to i64
%arrayidx4 = getelementptr inbounds %struct.Card, ptr %C, i64 %idxprom3
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx4, i64 6, i1 false), !tbaa.struct !5
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx4, ptr noundef nonnull align 2 dereferenceable(6) %tmp, i64 6, i1 false), !tbaa.struct !5
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %tmp)
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 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: 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: read) uwtable
define dso_local i32 @IsStable(ptr nocapture noundef readonly %C, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp27 = icmp sgt i32 %n, 1
br i1 %cmp27, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%number3.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %C, i64 0, i32 1
%.pre = load i16, ptr %number3.phi.trans.insert, align 2, !tbaa !11
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%0 = phi i16 [ %.pre, %for.body.preheader ], [ %1, %for.inc ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%number = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv, i32 1
%1 = load i16, ptr %number, align 2, !tbaa !11
%cmp5 = icmp eq i16 %1, %0
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %for.body
%2 = add nsw i64 %indvars.iv, -1
%tag = getelementptr inbounds %struct.Card, ptr %C, i64 %indvars.iv, i32 2
%3 = load i16, ptr %tag, align 2, !tbaa !13
%tag13 = getelementptr inbounds %struct.Card, ptr %C, i64 %2, i32 2
%4 = load i16, ptr %tag13, align 2, !tbaa !13
%cmp15 = icmp slt i16 %3, %4
br i1 %cmp15, label %cleanup, 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 %cleanup, label %for.body, !llvm.loop !14
cleanup: ; preds = %if.then, %for.inc, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.inc ], [ 0, %if.then ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @BubbleSort(ptr nocapture noundef readonly %C, i32 noundef %n) local_unnamed_addr #4 {
entry:
%tmp.i = alloca %struct.Card, align 2
%copy = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %copy) #7
%cmp77 = icmp sgt i32 %n, 0
br i1 %cmp77, label %for.cond3.preheader, label %for.end44.thread
for.end44.thread: ; preds = %entry
%putchar107 = tail call i32 @putchar(i32 10)
br label %if.end51
for.cond3.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = mul nuw nsw i64 %0, 6
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %copy, ptr align 2 %C, i64 %1, i1 false)
%sub = add nsw i32 %n, -1
%cmp480 = icmp ne i32 %n, 1
br i1 %cmp480, label %for.cond7.preheader.preheader, label %for.body28.preheader
for.cond7.preheader.preheader: ; preds = %for.cond3.preheader
%2 = zext i32 %n to i64
%3 = add nsw i64 %2, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.inc22
%indvars.iv86 = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %indvars.iv.next87, %for.inc22 ]
br label %for.body9
for.cond25.preheader: ; preds = %for.inc22
br i1 %cmp77, label %for.body28.preheader, label %for.end44
for.body28.preheader: ; preds = %for.cond3.preheader, %for.cond25.preheader
%sub96102 = phi i32 [ %sub, %for.cond25.preheader ], [ 0, %for.cond3.preheader ]
%cmp48097101 = phi i1 [ %cmp480, %for.cond25.preheader ], [ false, %for.cond3.preheader ]
%4 = zext i32 %sub96102 to i64
%wide.trip.count92 = zext i32 %n to i64
br label %for.body28
for.body9: ; preds = %for.cond7.preheader, %for.inc20
%indvars.iv = phi i64 [ %3, %for.cond7.preheader ], [ %indvars.iv.next, %for.inc20 ]
%number = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv, i32 1
%5 = load i16, ptr %number, align 2, !tbaa !11
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%number15 = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv.next, i32 1
%6 = load i16, ptr %number15, align 2, !tbaa !11
%cmp17 = icmp slt i16 %5, %6
br i1 %cmp17, label %if.then, label %for.inc20
if.then: ; preds = %for.body9
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %tmp.i)
%arrayidx.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %tmp.i, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx.i, i64 6, i1 false), !tbaa.struct !5
%arrayidx4.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv.next
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx.i, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx4.i, i64 6, i1 false), !tbaa.struct !5
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx4.i, ptr noundef nonnull align 2 dereferenceable(6) %tmp.i, i64 6, i1 false), !tbaa.struct !5
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %tmp.i)
br label %for.inc20
for.inc20: ; preds = %for.body9, %if.then
%cmp8 = icmp sgt i64 %indvars.iv.next, %indvars.iv86
br i1 %cmp8, label %for.body9, label %for.inc22, !llvm.loop !16
for.inc22: ; preds = %for.inc20
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count
br i1 %exitcond.not, label %for.cond25.preheader, label %for.cond7.preheader, !llvm.loop !17
for.body28: ; preds = %for.body28.preheader, %for.inc42
%indvars.iv89 = phi i64 [ 0, %for.body28.preheader ], [ %indvars.iv.next90, %for.inc42 ]
%arrayidx30 = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv89
%7 = load i8, ptr %arrayidx30, align 2, !tbaa !18
%conv31 = sext i8 %7 to i32
%number34 = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv89, i32 1
%8 = load i16, ptr %number34, align 2, !tbaa !11
%conv35 = sext i16 %8 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv31, i32 noundef %conv35)
%cmp37.not = icmp eq i64 %indvars.iv89, %4
br i1 %cmp37.not, label %for.inc42, label %if.then39
if.then39: ; preds = %for.body28
%putchar74 = tail call i32 @putchar(i32 32)
br label %for.inc42
for.inc42: ; preds = %for.body28, %if.then39
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%exitcond93.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count92
br i1 %exitcond93.not, label %for.end44, label %for.body28, !llvm.loop !19
for.end44: ; preds = %for.inc42, %for.cond25.preheader
%cmp48097100 = phi i1 [ %cmp480, %for.cond25.preheader ], [ %cmp48097101, %for.inc42 ]
%putchar = tail call i32 @putchar(i32 10)
br i1 %cmp48097100, label %for.body.preheader.i, label %if.end51
for.body.preheader.i: ; preds = %for.end44
%wide.trip.count.i = zext i32 %n to i64
%number3.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %copy, i64 0, i32 1
%.pre.i = load i16, ptr %number3.phi.trans.insert.i, align 2, !tbaa !11
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%9 = phi i16 [ %.pre.i, %for.body.preheader.i ], [ %10, %for.inc.i ]
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%number.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv.i, i32 1
%10 = load i16, ptr %number.i, align 2, !tbaa !11
%cmp5.i = icmp eq i16 %10, %9
br i1 %cmp5.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%11 = add nsw i64 %indvars.iv.i, -1
%tag.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv.i, i32 2
%12 = load i16, ptr %tag.i, align 2, !tbaa !13
%tag13.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %11, i32 2
%13 = load i16, ptr %tag13.i, align 2, !tbaa !13
%cmp15.i = icmp slt i16 %12, %13
br i1 %cmp15.i, label %if.end51, label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.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 %if.end51, label %for.body.i, !llvm.loop !14
if.end51: ; preds = %if.then.i, %for.inc.i, %for.end44, %for.end44.thread
%str.sink = phi ptr [ @str.10, %for.end44.thread ], [ @str.10, %for.end44 ], [ @str.10, %for.inc.i ], [ @str, %if.then.i ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %copy) #7
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind uwtable
define dso_local void @SelectionSort(ptr nocapture noundef readonly %C, i32 noundef %n) local_unnamed_addr #4 {
entry:
%tmp.i = alloca %struct.Card, align 2
%copy = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %copy) #7
%cmp75 = icmp sgt i32 %n, 0
br i1 %cmp75, label %for.cond6.preheader.preheader, label %for.end41.thread
for.cond6.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = mul nuw nsw i64 %0, 6
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %copy, ptr align 2 %C, i64 %1, i1 false)
%2 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.end19
%indvars.iv = phi i64 [ 0, %for.cond6.preheader.preheader ], [ %indvars.iv.next, %for.end19 ]
%3 = trunc i64 %indvars.iv to i32
br label %for.body8
for.cond23.preheader: ; preds = %for.end19
br i1 %cmp75, label %for.body26.lr.ph, label %for.end41.thread
for.body26.lr.ph: ; preds = %for.cond23.preheader
%sub = add nsw i32 %n, -1
%4 = zext i32 %sub to i64
%wide.trip.count91 = zext i32 %n to i64
br label %for.body26
for.body8: ; preds = %for.cond6.preheader, %for.body8
%indvars.iv84 = phi i64 [ %indvars.iv, %for.cond6.preheader ], [ %indvars.iv.next85, %for.body8 ]
%min.078 = phi i32 [ %3, %for.cond6.preheader ], [ %spec.select, %for.body8 ]
%idxprom9 = sext i32 %min.078 to i64
%number = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %idxprom9, i32 1
%5 = load i16, ptr %number, align 2, !tbaa !11
%number13 = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv84, i32 1
%6 = load i16, ptr %number13, align 2, !tbaa !11
%cmp15 = icmp sgt i16 %5, %6
%7 = trunc i64 %indvars.iv84 to i32
%spec.select = select i1 %cmp15, i32 %7, i32 %min.078
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%cmp7 = icmp ult i64 %indvars.iv.next85, %2
br i1 %cmp7, label %for.body8, label %for.end19, !llvm.loop !20
for.end19: ; preds = %for.body8
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %tmp.i)
%arrayidx.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %tmp.i, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx.i, i64 6, i1 false), !tbaa.struct !5
%idxprom3.i = sext i32 %spec.select to i64
%arrayidx4.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %idxprom3.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx.i, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx4.i, i64 6, i1 false), !tbaa.struct !5
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx4.i, ptr noundef nonnull align 2 dereferenceable(6) %tmp.i, i64 6, i1 false), !tbaa.struct !5
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %tmp.i)
%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.cond23.preheader, label %for.cond6.preheader, !llvm.loop !21
for.body26: ; preds = %for.body26.lr.ph, %for.inc39
%indvars.iv88 = phi i64 [ 0, %for.body26.lr.ph ], [ %indvars.iv.next89, %for.inc39 ]
%arrayidx28 = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv88
%8 = load i8, ptr %arrayidx28, align 2, !tbaa !18
%conv29 = sext i8 %8 to i32
%number32 = getelementptr inbounds [36 x %struct.Card], ptr %copy, i64 0, i64 %indvars.iv88, i32 1
%9 = load i16, ptr %number32, align 2, !tbaa !11
%conv33 = sext i16 %9 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv29, i32 noundef %conv33)
%cmp34.not = icmp eq i64 %indvars.iv88, %4
br i1 %cmp34.not, label %for.inc39, label %if.then36
if.then36: ; preds = %for.body26
%putchar72 = tail call i32 @putchar(i32 32)
br label %for.inc39
for.inc39: ; preds = %for.body26, %if.then36
%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.end41, label %for.body26, !llvm.loop !22
for.end41.thread: ; preds = %for.cond23.preheader, %entry
%putchar93 = tail call i32 @putchar(i32 10)
br label %if.end48
for.end41: ; preds = %for.inc39
%putchar = tail call i32 @putchar(i32 10)
%cmp27.i = icmp sgt i32 %n, 1
br i1 %cmp27.i, label %for.body.preheader.i, label %if.end48
for.body.preheader.i: ; preds = %for.end41
%wide.trip.count.i = zext i32 %n to i64
%number3.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %copy, i64 0, i32 1
%.pre.i = load i16, ptr %number3.phi.trans.insert.i, align 2, !tbaa !11
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%10 = phi i16 [ %.pre.i, %for.body.preheader.i ], [ %11, %for.inc.i ]
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%number.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv.i, i32 1
%11 = load i16, ptr %number.i, align 2, !tbaa !11
%cmp5.i = icmp eq i16 %11, %10
br i1 %cmp5.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%12 = add nsw i64 %indvars.iv.i, -1
%tag.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %indvars.iv.i, i32 2
%13 = load i16, ptr %tag.i, align 2, !tbaa !13
%tag13.i = getelementptr inbounds %struct.Card, ptr %copy, i64 %12, i32 2
%14 = load i16, ptr %tag13.i, align 2, !tbaa !13
%cmp15.i = icmp slt i16 %13, %14
br i1 %cmp15.i, label %if.end48, label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.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 %if.end48, label %for.body.i, !llvm.loop !14
if.end48: ; preds = %if.then.i, %for.inc.i, %for.end41, %for.end41.thread
%str.9.sink = phi ptr [ @str.10, %for.end41.thread ], [ @str.10, %for.end41 ], [ @str.10, %for.inc.i ], [ @str.9, %if.then.i ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.9.sink)
call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %copy) #7
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%n = alloca i32, align 4
%input = alloca [3 x i8], align 1
%C = alloca [36 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %input) #7
call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %C) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !23
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [3 x i8], ptr %input, i64 0, i64 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %input)
%1 = load i8, ptr %input, align 1, !tbaa !6
%arrayidx2 = getelementptr inbounds [36 x %struct.Card], ptr %C, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx2, align 2, !tbaa !18
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !6
%conv = sext i8 %2 to i16
%sub = add nsw i16 %conv, -48
%number = getelementptr inbounds [36 x %struct.Card], ptr %C, i64 0, i64 %indvars.iv, i32 1
store i16 %sub, ptr %number, align 2, !tbaa !11
%conv7 = trunc i64 %indvars.iv to i16
%tag = getelementptr inbounds [36 x %struct.Card], ptr %C, i64 0, i64 %indvars.iv, i32 2
store i16 %conv7, ptr %tag, align 2, !tbaa !13
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !23
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !25
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
call void @BubbleSort(ptr noundef nonnull %C, i32 noundef %.lcssa)
%5 = load i32, ptr %n, align 4, !tbaa !23
call void @SelectionSort(ptr noundef nonnull %C, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %C) #7
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %input) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{i64 0, i64 1, !6, i64 2, i64 2, !9, i64 4, i64 2, !9}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !10, i64 2}
!12 = !{!"", !7, i64 0, !10, i64 2, !10, i64 4}
!13 = !{!12, !10, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!12, !7, i64 0}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = !{!24, !24, i64 0}
!24 = !{!"int", !7, i64 0}
!25 = distinct !{!25, !15}
|
#include<stdio.h>
typedef struct{
char M[36];
int F[36];
}pre;
int main(){
int i,j,N,s,mini;
char c;
pre inp,oup1,oup2;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf(" %c%d",&c,&s);
inp.M[i]=c;
inp.F[i]=s;
}
oup1=inp;
for(i=0;i<N;i++){
for(j=N-1;j>i;j--){
if(oup1.F[j]<oup1.F[j-1]){
c=oup1.M[j];
oup1.M[j]=oup1.M[j-1];
oup1.M[j-1]=c;
s=oup1.F[j];
oup1.F[j]=oup1.F[j-1];
oup1.F[j-1]=s;
}
}
}
for(j=0;j<N;j++)if(j!=N-1)printf("%c%d ",oup1.M[j],oup1.F[j]);else printf("%c%d\n",oup1.M[j],oup1.F[j]);
printf("Stable\n");
oup2=inp;
for(i=0;i<N;i++){
mini=i;
for(j=i;j<N;j++){
if(oup2.F[j] < oup2.F[mini]){
mini=j;
}
}
s=oup2.F[i];
oup2.F[i]=oup2.F[mini];
oup2.F[mini]=s;
c=oup2.M[i];
oup2.M[i]=oup2.M[mini];
oup2.M[mini]=c;
}
for(j=0;j<N;j++)if(j!=N-1)printf("%c%d ",oup2.M[j],oup2.F[j]);else printf("%c%d\n",oup2.M[j],oup2.F[j]);
for(i=0;i<N;i++)if(oup1.M[i]!=oup2.M[i])goto NS;
printf("Stable\n");
goto S;
NS:
printf("Not stable\n");
S:
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113907/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113907/source.c"
target datalayout = "e-m:e-p270: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.pre = type { [36 x i8], [36 x i32] }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%s = alloca i32, align 4
%c = alloca i8, align 1
%inp = alloca %struct.pre, align 4
%oup1 = alloca %struct.pre, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 180, ptr nonnull %oup1) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp231 = icmp sgt i32 %0, 0
br i1 %cmp231, label %for.body, label %for.end75
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c, ptr noundef nonnull %s)
%1 = load i8, ptr %c, align 1, !tbaa !9
%arrayidx = getelementptr inbounds [36 x i8], ptr %inp, i64 0, i64 %indvars.iv
store i8 %1, ptr %arrayidx, align 1, !tbaa !9
%2 = load i32, ptr %s, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds %struct.pre, ptr %inp, i64 0, i32 1, i64 %indvars.iv
store i32 %2, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(180) %oup1, ptr noundef nonnull align 4 dereferenceable(180) %inp, i64 180, i1 false), !tbaa.struct !12
%cmp5237 = icmp sgt i32 %3, 0
br i1 %cmp5237, label %for.cond7.preheader.lr.ph, label %for.end75
for.cond7.preheader.lr.ph: ; preds = %for.end
%j.0233 = add nsw i32 %3, -1
%5 = zext i32 %3 to i64
%6 = add nsw i64 %5, -1
%7 = zext i32 %j.0233 to i64
%wide.trip.count = zext i32 %3 to i64
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond7.preheader.lr.ph, %for.inc48
%indvars.iv265 = phi i64 [ 0, %for.cond7.preheader.lr.ph ], [ %indvars.iv.next266, %for.inc48 ]
%cmp8234 = icmp ult i64 %indvars.iv265, %7
br i1 %cmp8234, label %for.body9, label %for.inc48
for.cond51.preheader: ; preds = %for.inc48
br i1 %cmp5237, label %for.body53, label %for.end75
for.body9: ; preds = %for.cond7.preheader, %for.inc46
%indvars.iv259 = phi i64 [ %indvars.iv.next260, %for.inc46 ], [ %5, %for.cond7.preheader ]
%indvars.iv257 = phi i64 [ %indvars.iv.next258, %for.inc46 ], [ %6, %for.cond7.preheader ]
%indvars.iv.next260 = add nsw i64 %indvars.iv259, -1
%arrayidx12 = getelementptr inbounds %struct.pre, ptr %oup1, i64 0, i32 1, i64 %indvars.iv257
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%9 = add nsw i64 %indvars.iv259, -2
%arrayidx16 = getelementptr inbounds %struct.pre, ptr %oup1, i64 0, i32 1, i64 %9
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17 = icmp slt i32 %8, %10
br i1 %cmp17, label %if.then, label %for.inc46
if.then: ; preds = %for.body9
%arrayidx20 = getelementptr inbounds [36 x i8], ptr %oup1, i64 0, i64 %indvars.iv257
%11 = load i8, ptr %arrayidx20, align 1, !tbaa !9
store i8 %11, ptr %c, align 1, !tbaa !9
%arrayidx24 = getelementptr inbounds [36 x i8], ptr %oup1, i64 0, i64 %9
%12 = load i8, ptr %arrayidx24, align 1, !tbaa !9
store i8 %12, ptr %arrayidx20, align 1, !tbaa !9
store i8 %11, ptr %arrayidx24, align 1, !tbaa !9
%13 = load i32, ptr %arrayidx12, align 4, !tbaa !5
store i32 %13, ptr %s, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx16, align 4, !tbaa !5
store i32 %14, ptr %arrayidx12, align 4, !tbaa !5
store i32 %13, ptr %arrayidx16, align 4, !tbaa !5
br label %for.inc46
for.inc46: ; preds = %for.body9, %if.then
%indvars.iv.next258 = add nsw i64 %indvars.iv257, -1
%cmp8 = icmp sgt i64 %indvars.iv.next258, %indvars.iv265
br i1 %cmp8, label %for.body9, label %for.inc48, !llvm.loop !13
for.inc48: ; preds = %for.inc46, %for.cond7.preheader
%indvars.iv.next266 = add nuw nsw i64 %indvars.iv265, 1
%exitcond.not = icmp eq i64 %indvars.iv.next266, %wide.trip.count
br i1 %exitcond.not, label %for.cond51.preheader, label %for.cond7.preheader, !llvm.loop !14
for.body53: ; preds = %for.cond51.preheader, %for.body53
%indvars.iv268 = phi i64 [ %indvars.iv.next269, %for.body53 ], [ 0, %for.cond51.preheader ]
%15 = phi i32 [ %19, %for.body53 ], [ %3, %for.cond51.preheader ]
%sub54 = add nsw i32 %15, -1
%16 = zext i32 %sub54 to i64
%cmp55.not = icmp eq i64 %indvars.iv268, %16
%arrayidx66 = getelementptr inbounds [36 x i8], ptr %oup1, i64 0, i64 %indvars.iv268
%17 = load i8, ptr %arrayidx66, align 1, !tbaa !9
%conv67 = sext i8 %17 to i32
%arrayidx70 = getelementptr inbounds %struct.pre, ptr %oup1, i64 0, i32 1, i64 %indvars.iv268
%18 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%.str.3..str.2 = select i1 %cmp55.not, ptr @.str.3, ptr @.str.2
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2, i32 noundef %conv67, i32 noundef %18)
%indvars.iv.next269 = add nuw nsw i64 %indvars.iv268, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp52 = icmp slt i64 %indvars.iv.next269, %20
br i1 %cmp52, label %for.body53, label %for.end75, !llvm.loop !15
for.end75: ; preds = %for.body53, %entry, %for.end, %for.cond51.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%21 = load i32, ptr %N, align 4, !tbaa !5
%cmp78243 = icmp sgt i32 %21, 0
br i1 %cmp78243, label %for.cond81.preheader.preheader, label %S
for.cond81.preheader.preheader: ; preds = %for.end75
%22 = zext i32 %21 to i64
%wide.trip.count277 = zext i32 %21 to i64
br label %for.cond81.preheader
for.cond81.preheader: ; preds = %for.cond81.preheader.preheader, %for.end97
%indvars.iv271 = phi i64 [ 0, %for.cond81.preheader.preheader ], [ %indvars.iv.next272, %for.end97 ]
%23 = trunc i64 %indvars.iv271 to i32
br label %for.body84
for.cond125.preheader: ; preds = %for.end97
store i32 %27, ptr %s, align 4, !tbaa !5
store i8 %29, ptr %c, align 1, !tbaa !9
br i1 %cmp78243, label %for.body128, label %S
for.body84: ; preds = %for.cond81.preheader, %for.body84
%indvars.iv273 = phi i64 [ %indvars.iv271, %for.cond81.preheader ], [ %indvars.iv.next274, %for.body84 ]
%mini.0242 = phi i32 [ %23, %for.cond81.preheader ], [ %spec.select, %for.body84 ]
%arrayidx87 = getelementptr inbounds %struct.pre, ptr %inp, i64 0, i32 1, i64 %indvars.iv273
%24 = load i32, ptr %arrayidx87, align 4, !tbaa !5
%idxprom89 = sext i32 %mini.0242 to i64
%arrayidx90 = getelementptr inbounds %struct.pre, ptr %inp, i64 0, i32 1, i64 %idxprom89
%25 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%cmp91 = icmp slt i32 %24, %25
%26 = trunc i64 %indvars.iv273 to i32
%spec.select = select i1 %cmp91, i32 %26, i32 %mini.0242
%indvars.iv.next274 = add nuw nsw i64 %indvars.iv273, 1
%cmp82 = icmp ult i64 %indvars.iv.next274, %22
br i1 %cmp82, label %for.body84, label %for.end97, !llvm.loop !16
for.end97: ; preds = %for.body84
%arrayidx100 = getelementptr inbounds %struct.pre, ptr %inp, i64 0, i32 1, i64 %indvars.iv271
%27 = load i32, ptr %arrayidx100, align 4, !tbaa !5
%idxprom102 = sext i32 %spec.select to i64
%arrayidx103 = getelementptr inbounds %struct.pre, ptr %inp, i64 0, i32 1, i64 %idxprom102
%28 = load i32, ptr %arrayidx103, align 4, !tbaa !5
store i32 %28, ptr %arrayidx100, align 4, !tbaa !5
store i32 %27, ptr %arrayidx103, align 4, !tbaa !5
%arrayidx112 = getelementptr inbounds [36 x i8], ptr %inp, i64 0, i64 %indvars.iv271
%29 = load i8, ptr %arrayidx112, align 1, !tbaa !9
%arrayidx115 = getelementptr inbounds [36 x i8], ptr %inp, i64 0, i64 %idxprom102
%30 = load i8, ptr %arrayidx115, align 1, !tbaa !9
store i8 %30, ptr %arrayidx112, align 1, !tbaa !9
store i8 %29, ptr %arrayidx115, align 1, !tbaa !9
%indvars.iv.next272 = add nuw nsw i64 %indvars.iv271, 1
%exitcond278.not = icmp eq i64 %indvars.iv.next272, %wide.trip.count277
br i1 %exitcond278.not, label %for.cond125.preheader, label %for.cond81.preheader, !llvm.loop !17
for.cond154.preheader: ; preds = %for.body128
%cmp155250 = icmp sgt i32 %35, 0
br i1 %cmp155250, label %for.body157.preheader, label %S
for.body157.preheader: ; preds = %for.cond154.preheader
%wide.trip.count285 = zext i32 %35 to i64
br label %for.body157
for.body128: ; preds = %for.cond125.preheader, %for.body128
%indvars.iv279 = phi i64 [ %indvars.iv.next280, %for.body128 ], [ 0, %for.cond125.preheader ]
%31 = phi i32 [ %35, %for.body128 ], [ %21, %for.cond125.preheader ]
%sub129 = add nsw i32 %31, -1
%32 = zext i32 %sub129 to i64
%cmp130.not = icmp eq i64 %indvars.iv279, %32
%arrayidx144 = getelementptr inbounds [36 x i8], ptr %inp, i64 0, i64 %indvars.iv279
%33 = load i8, ptr %arrayidx144, align 1, !tbaa !9
%conv145 = sext i8 %33 to i32
%arrayidx148 = getelementptr inbounds %struct.pre, ptr %inp, i64 0, i32 1, i64 %indvars.iv279
%34 = load i32, ptr %arrayidx148, align 4, !tbaa !5
%.str.3..str.2296 = select i1 %cmp130.not, ptr @.str.3, ptr @.str.2
%call140 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2296, i32 noundef %conv145, i32 noundef %34)
%indvars.iv.next280 = add nuw nsw i64 %indvars.iv279, 1
%35 = load i32, ptr %N, align 4, !tbaa !5
%36 = sext i32 %35 to i64
%cmp126 = icmp slt i64 %indvars.iv.next280, %36
br i1 %cmp126, label %for.body128, label %for.cond154.preheader, !llvm.loop !18
for.cond154: ; preds = %for.body157
%indvars.iv.next283 = add nuw nsw i64 %indvars.iv282, 1
%exitcond286.not = icmp eq i64 %indvars.iv.next283, %wide.trip.count285
br i1 %exitcond286.not, label %S, label %for.body157, !llvm.loop !19
for.body157: ; preds = %for.body157.preheader, %for.cond154
%indvars.iv282 = phi i64 [ 0, %for.body157.preheader ], [ %indvars.iv.next283, %for.cond154 ]
%arrayidx160 = getelementptr inbounds [36 x i8], ptr %oup1, i64 0, i64 %indvars.iv282
%37 = load i8, ptr %arrayidx160, align 1, !tbaa !9
%arrayidx164 = getelementptr inbounds [36 x i8], ptr %inp, i64 0, i64 %indvars.iv282
%38 = load i8, ptr %arrayidx164, align 1, !tbaa !9
%cmp166.not = icmp eq i8 %37, %38
br i1 %cmp166.not, label %for.cond154, label %S
S: ; preds = %for.body157, %for.cond154, %for.cond154.preheader, %for.cond125.preheader, %for.end75
%str.7.sink = phi ptr [ @str.6, %for.end75 ], [ @str.6, %for.cond125.preheader ], [ @str.6, %for.cond154.preheader ], [ @str.6, %for.cond154 ], [ @str.7, %for.body157 ]
%puts229 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 180, ptr nonnull %oup1) #5
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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
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 #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: readwrite) }
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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{i64 0, i64 36, !9, i64 36, i64 144, !9}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
|
#include<stdio.h>
typedef struct {
char suit;
int num;
}card;
void swap (int *x, int *y,char *a, char *b) {
int temps;
char tempn;
temps = *x;
*x = *y;
*y = temps;
tempn = *a;
*a = *b;
*b = tempn;
}
int bubble_sort (card A[], int n) {
int i,j = 0;
for (i = 0; i < n - 1; i++){
for (j = n - 1; j >= i + 1; j--){
if (A[j].num < A[j-1].num){
swap(&A[j].num, &A[j-1].num, &A[j].suit, &A[j-1].suit);
}
}
}
}
int selectionSort(card A[], int n){
int i,j,minj;
for(i = 0; i < n; i++){
minj = i;
for(j = i; j < n; j++){
if(A[j].num < A[minj].num){
minj = j;
}
}
swap(&A[i].num, &A[minj].num, &A[i].suit, &A[minj].suit);
}
}
int main(void){
int n,i,f2 = 0;
scanf("%d" ,&n);
card A[n],B[n];
for(i = 0; i < n; i++){
scanf(" %c%d",&A[i].suit,&A[i].num);
B[i] = A[i];
}
bubble_sort (A, n);
for(i = 0; i < n; i++){
if(i < n - 1){
printf("%c%d ",A[i].suit,A[i].num);
}
else{
printf("%c%d\n",A[i].suit,A[i].num);
}
}
printf("Stable\n");
selectionSort(B, n);
for(i = 0; i < n; i++){
if(i < n - 1){
printf("%c%d ",B[i].suit,B[i].num);
}
else{
printf("%c%d\n",B[i].suit,B[i].num);
}
}
for(i = 0; i < n; i++){
if(B[i].num == A[i].num && B[i].suit != A[i].suit){
printf("Not stable\n");
return 0;
}
}
printf("Stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113950/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113950/source.c"
target datalayout = "e-m:e-p270: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.card = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.6 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y, ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
%2 = load i8, ptr %a, align 1, !tbaa !9
%3 = load i8, ptr %b, align 1, !tbaa !9
store i8 %3, ptr %a, align 1, !tbaa !9
store i8 %2, ptr %b, align 1, !tbaa !9
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress 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 @bubble_sort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp41 = icmp sgt i32 %n, 1
br i1 %cmp41, label %for.cond2.preheader.preheader, label %for.end24
for.cond2.preheader.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
%0 = zext i32 %n to i64
%1 = add nsw i64 %0, -1
%wide.trip.count = zext i32 %sub to i64
%num.phi.trans.insert = getelementptr inbounds %struct.card, ptr %A, i64 %1, i32 1
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.inc23
%indvars.iv44 = phi i64 [ 0, %for.cond2.preheader.preheader ], [ %indvars.iv.next45, %for.inc23 ]
%.pre = load i32, ptr %num.phi.trans.insert, align 4, !tbaa !5
br label %for.body4
for.body4: ; preds = %for.cond2.preheader, %for.inc
%2 = phi i32 [ %.pre, %for.cond2.preheader ], [ %6, %for.inc ]
%indvars.iv = phi i64 [ %1, %for.cond2.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%num8 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.next, i32 1
%3 = load i32, ptr %num8, align 4, !tbaa !5
%cmp9 = icmp slt i32 %2, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body4
%num = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv, i32 1
%arrayidx7 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv.next
%arrayidx = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
store i32 %3, ptr %num, align 4, !tbaa !5
store i32 %2, ptr %num8, align 4, !tbaa !5
%4 = load i8, ptr %arrayidx, align 1, !tbaa !9
%5 = load i8, ptr %arrayidx7, align 1, !tbaa !9
store i8 %5, ptr %arrayidx, align 1, !tbaa !9
store i8 %4, ptr %arrayidx7, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.body4, %if.then
%6 = phi i32 [ %3, %for.body4 ], [ %2, %if.then ]
%cmp3.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv44
br i1 %cmp3.not.not, label %for.body4, label %for.inc23, !llvm.loop !10
for.inc23: ; preds = %for.inc
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count
br i1 %exitcond.not, label %for.end24, label %for.cond2.preheader, !llvm.loop !12
for.end24: ; preds = %for.inc23, %entry
ret i32 undef
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @selectionSort(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.cond1.preheader.preheader, label %for.end21
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%wide.trip.count = zext i32 %n to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv42 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next43, %for.body3 ]
%minj.039 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%num = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv42, i32 1
%2 = load i32, ptr %num, align 4, !tbaa !13
%idxprom4 = sext i32 %minj.039 to i64
%num6 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom4, i32 1
%3 = load i32, ptr %num6, align 4, !tbaa !13
%cmp7 = icmp slt i32 %2, %3
%4 = trunc i64 %indvars.iv42 to i32
%spec.select = select i1 %cmp7, i32 %4, i32 %minj.039
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%cmp2 = icmp ult i64 %indvars.iv.next43, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body3
%arrayidx9 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv
%num10 = getelementptr inbounds %struct.card, ptr %A, i64 %indvars.iv, i32 1
%idxprom11 = sext i32 %spec.select to i64
%arrayidx12 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom11
%num13 = getelementptr inbounds %struct.card, ptr %A, i64 %idxprom11, i32 1
%5 = load i32, ptr %num10, align 4, !tbaa !5
%6 = load i32, ptr %num13, align 4, !tbaa !5
store i32 %6, ptr %num10, align 4, !tbaa !5
store i32 %5, ptr %num13, align 4, !tbaa !5
%7 = load i8, ptr %arrayidx9, align 1, !tbaa !9
%8 = load i8, ptr %arrayidx12, align 1, !tbaa !9
store i8 %8, ptr %arrayidx9, align 1, !tbaa !9
store i8 %7, ptr %arrayidx12, align 1, !tbaa !9
%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.end21, label %for.cond1.preheader, !llvm.loop !16
for.end21: ; preds = %for.end, %entry
ret i32 undef
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.card, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca %struct.card, i64 %4, align 16
%cmp130 = icmp sgt i32 %3, 0
br i1 %cmp130, label %for.body, label %for.end31
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv
%num = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %num)
%arrayidx6 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv
%5 = load i64, ptr %arrayidx, align 8
store i64 %5, ptr %arrayidx6, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %.pr to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body
%cmp41.i = icmp sgt i32 %.pr, 1
br i1 %cmp41.i, label %for.cond2.preheader.preheader.i, label %bubble_sort.exit
for.cond2.preheader.preheader.i: ; preds = %for.end
%sub.i = add nsw i32 %.pr, -1
%7 = zext i32 %.pr to i64
%8 = add nsw i64 %7, -1
%wide.trip.count.i = zext i32 %sub.i to i64
%num.phi.trans.insert.i = getelementptr inbounds %struct.card, ptr %vla, i64 %8, i32 1
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.inc23.i, %for.cond2.preheader.preheader.i
%indvars.iv44.i = phi i64 [ 0, %for.cond2.preheader.preheader.i ], [ %indvars.iv.next45.i, %for.inc23.i ]
%.pre.i = load i32, ptr %num.phi.trans.insert.i, align 4, !tbaa !5
br label %for.body4.i
for.body4.i: ; preds = %for.inc.i, %for.cond2.preheader.i
%9 = phi i32 [ %.pre.i, %for.cond2.preheader.i ], [ %13, %for.inc.i ]
%indvars.iv.i = phi i64 [ %8, %for.cond2.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%num8.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv.next.i, i32 1
%10 = load i32, ptr %num8.i, align 4, !tbaa !5
%cmp9.i = icmp slt i32 %9, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body4.i
%num.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv.i, i32 1
%arrayidx7.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv.next.i
%arrayidx.i = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv.i
store i32 %10, ptr %num.i, align 4, !tbaa !5
store i32 %9, ptr %num8.i, align 4, !tbaa !5
%11 = load i8, ptr %arrayidx.i, align 8, !tbaa !9
%12 = load i8, ptr %arrayidx7.i, align 8, !tbaa !9
store i8 %12, ptr %arrayidx.i, align 8, !tbaa !9
store i8 %11, ptr %arrayidx7.i, align 8, !tbaa !9
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body4.i
%13 = phi i32 [ %10, %for.body4.i ], [ %9, %if.then.i ]
%cmp3.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv44.i
br i1 %cmp3.not.not.i, label %for.body4.i, label %for.inc23.i, !llvm.loop !10
for.inc23.i: ; preds = %for.inc.i
%indvars.iv.next45.i = add nuw nsw i64 %indvars.iv44.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next45.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %bubble_sort.exit, label %for.cond2.preheader.i, !llvm.loop !12
bubble_sort.exit: ; preds = %for.inc23.i, %for.end
%cmp11132 = icmp sgt i32 %.pr, 0
br i1 %cmp11132, label %for.body12, label %for.end31
for.body12: ; preds = %bubble_sort.exit, %for.body12
%indvars.iv141 = phi i64 [ %indvars.iv.next142, %for.body12 ], [ 0, %bubble_sort.exit ]
%14 = phi i32 [ %18, %for.body12 ], [ %.pr, %bubble_sort.exit ]
%sub = add nsw i32 %14, -1
%15 = sext i32 %sub to i64
%cmp13 = icmp slt i64 %indvars.iv141, %15
%arrayidx15 = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv141
%16 = load i8, ptr %arrayidx15, align 8, !tbaa !18
%conv = sext i8 %16 to i32
%num19 = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv141, i32 1
%17 = load i32, ptr %num19, align 4, !tbaa !13
%.str.2..str.3 = select i1 %cmp13, ptr @.str.2, ptr @.str.3
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3, i32 noundef %conv, i32 noundef %17)
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp11 = icmp slt i64 %indvars.iv.next142, %19
br i1 %cmp11, label %for.body12, label %for.end31, !llvm.loop !19
for.end31: ; preds = %for.body12, %entry, %bubble_sort.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%20 = load i32, ptr %n, align 4, !tbaa !5
%cmp40.i = icmp sgt i32 %20, 0
br i1 %cmp40.i, label %for.cond1.preheader.preheader.i, label %cleanup
for.cond1.preheader.preheader.i: ; preds = %for.end31
%21 = zext i32 %20 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.end.i, %for.cond1.preheader.preheader.i
%indvars.iv.i125 = phi i64 [ 0, %for.cond1.preheader.preheader.i ], [ %indvars.iv.next.i127, %for.end.i ]
%22 = trunc i64 %indvars.iv.i125 to i32
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.cond1.preheader.i
%indvars.iv42.i = phi i64 [ %indvars.iv.i125, %for.cond1.preheader.i ], [ %indvars.iv.next43.i, %for.body3.i ]
%minj.039.i = phi i32 [ %22, %for.cond1.preheader.i ], [ %spec.select.i, %for.body3.i ]
%num.i126 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv42.i, i32 1
%23 = load i32, ptr %num.i126, align 4, !tbaa !13
%idxprom4.i = sext i32 %minj.039.i to i64
%num6.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %idxprom4.i, i32 1
%24 = load i32, ptr %num6.i, align 4, !tbaa !13
%cmp7.i = icmp slt i32 %23, %24
%25 = trunc i64 %indvars.iv42.i to i32
%spec.select.i = select i1 %cmp7.i, i32 %25, i32 %minj.039.i
%indvars.iv.next43.i = add nuw nsw i64 %indvars.iv42.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next43.i, %21
br i1 %cmp2.i, label %for.body3.i, label %for.end.i, !llvm.loop !15
for.end.i: ; preds = %for.body3.i
%arrayidx9.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv.i125
%num10.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv.i125, i32 1
%idxprom11.i = sext i32 %spec.select.i to i64
%arrayidx12.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %idxprom11.i
%num13.i = getelementptr inbounds %struct.card, ptr %vla1, i64 %idxprom11.i, i32 1
%26 = load i32, ptr %num10.i, align 4, !tbaa !5
%27 = load i32, ptr %num13.i, align 4, !tbaa !5
store i32 %27, ptr %num10.i, align 4, !tbaa !5
store i32 %26, ptr %num13.i, align 4, !tbaa !5
%28 = load i8, ptr %arrayidx9.i, align 8, !tbaa !9
%29 = load i8, ptr %arrayidx12.i, align 8, !tbaa !9
store i8 %29, ptr %arrayidx9.i, align 8, !tbaa !9
store i8 %28, ptr %arrayidx12.i, align 8, !tbaa !9
%indvars.iv.next.i127 = add nuw nsw i64 %indvars.iv.i125, 1
%exitcond.not.i128 = icmp eq i64 %indvars.iv.next.i127, %21
br i1 %exitcond.not.i128, label %selectionSort.exit, label %for.cond1.preheader.i, !llvm.loop !16
selectionSort.exit: ; preds = %for.end.i
br i1 %cmp40.i, label %for.body37, label %cleanup
for.cond63.preheader: ; preds = %for.body37
%cmp64137 = icmp sgt i32 %34, 0
br i1 %cmp64137, label %for.body66.preheader, label %cleanup
for.body66.preheader: ; preds = %for.cond63.preheader
%wide.trip.count = zext i32 %34 to i64
br label %for.body66
for.body37: ; preds = %selectionSort.exit, %for.body37
%indvars.iv144 = phi i64 [ %indvars.iv.next145, %for.body37 ], [ 0, %selectionSort.exit ]
%30 = phi i32 [ %34, %for.body37 ], [ %20, %selectionSort.exit ]
%sub38 = add nsw i32 %30, -1
%31 = sext i32 %sub38 to i64
%cmp39 = icmp slt i64 %indvars.iv144, %31
%arrayidx43 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv144
%32 = load i8, ptr %arrayidx43, align 8, !tbaa !18
%conv45 = sext i8 %32 to i32
%num48 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv144, i32 1
%33 = load i32, ptr %num48, align 4, !tbaa !13
%.str.2..str.3155 = select i1 %cmp39, ptr @.str.2, ptr @.str.3
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3155, i32 noundef %conv45, i32 noundef %33)
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%34 = load i32, ptr %n, align 4, !tbaa !5
%35 = sext i32 %34 to i64
%cmp35 = icmp slt i64 %indvars.iv.next145, %35
br i1 %cmp35, label %for.body37, label %for.cond63.preheader, !llvm.loop !20
for.body66: ; preds = %for.body66.preheader, %for.inc88
%indvars.iv147 = phi i64 [ 0, %for.body66.preheader ], [ %indvars.iv.next148, %for.inc88 ]
%num69 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv147, i32 1
%36 = load i32, ptr %num69, align 4, !tbaa !13
%num72 = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv147, i32 1
%37 = load i32, ptr %num72, align 4, !tbaa !13
%cmp73 = icmp eq i32 %36, %37
br i1 %cmp73, label %land.lhs.true, label %for.inc88
land.lhs.true: ; preds = %for.body66
%arrayidx71 = getelementptr inbounds %struct.card, ptr %vla, i64 %indvars.iv147
%arrayidx68 = getelementptr inbounds %struct.card, ptr %vla1, i64 %indvars.iv147
%38 = load i8, ptr %arrayidx68, align 8, !tbaa !18
%39 = load i8, ptr %arrayidx71, align 8, !tbaa !18
%cmp83.not = icmp eq i8 %38, %39
br i1 %cmp83.not, label %for.inc88, label %cleanup
for.inc88: ; preds = %for.body66, %land.lhs.true
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
%exitcond.not = icmp eq i64 %indvars.iv.next148, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body66, !llvm.loop !21
cleanup: ; preds = %for.inc88, %land.lhs.true, %for.cond63.preheader, %selectionSort.exit, %for.end31
%str.6.sink = phi ptr [ @str.6, %for.end31 ], [ @str.6, %selectionSort.exit ], [ @str.6, %for.cond63.preheader ], [ @str.7, %land.lhs.true ], [ @str.6, %for.inc88 ]
%puts122 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !6, i64 4}
!14 = !{!"", !7, i64 0, !6, i64 4}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = !{!14, !7, i64 0}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
|
#include <stdio.h>
typedef struct {
char type;
int num;
} card_t;
int
main(void)
{
char flag;
int i, j, N, minj;
card_t cards1[36], cards2[36], cards3[36], tmp;
scanf("%d", &N);
for(i = 0; i < N; ++i) {
scanf(" %c%d", &cards1[i].type, &cards1[i].num);
cards2[i] = cards1[i];
cards3[i] = cards1[i];
}
//bubble sort is stable
flag = 1;
while(flag) {
flag = 0;
for(i = N - 1; i > 0; --i) {
if(cards3[i].num < cards3[i-1].num) {
tmp = cards3[i];
cards3[i] = cards3[i-1];
cards3[i-1] = tmp;
flag = 1;
}
}
}
for(i = 0; i < N; ++i) {
for(j = N - 1; j > i; --j) {
if(cards1[j].num < cards1[j-1].num) {
tmp = cards1[j];
cards1[j] = cards1[j-1];
cards1[j-1] = tmp;
}
}
}
flag = 0;
for(i = 0; i < N; ++i) {
if(cards1[i].type != cards3[i].type) flag = 1;
if(i != N - 1) printf("%c%d ", cards1[i].type, cards1[i].num);
else printf("%c%d\n", cards1[i].type, cards1[i].num);
}
if(flag) printf("Not stable\n");
else printf("Stable\n");
for(i = 0; i < N; ++i) {
minj = i;
for(j = i; j < N; ++j) {
if(cards2[j].num < cards2[minj].num)
minj = j;
}
tmp = cards2[i];
cards2[i] = cards2[minj];
cards2[minj] = tmp;
}
flag = 0;
for(i = 0; i < N; ++i) {
if(cards2[i].type != cards3[i].type) flag = 1;
if(i != N - 1) printf("%c%d ", cards2[i].type, cards2[i].num);
else printf("%c%d\n", cards2[i].type, cards2[i].num);
}
if(flag) printf("Not stable\n");
else printf("Stable\n");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_113994/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_113994/source.c"
target datalayout = "e-m:e-p270: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.card_t = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c" %c%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%cards1 = alloca [36 x %struct.card_t], align 16
%cards2 = alloca [36 x %struct.card_t], align 16
%cards3 = alloca [36 x %struct.card_t], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %cards1) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %cards2) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %cards3) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp253 = icmp sgt i32 %0, 0
br i1 %cmp253, label %for.body, label %if.else109
while.cond.preheader: ; preds = %for.body
%cmp13256 = icmp sgt i32 %7, 1
br i1 %cmp13256, label %for.cond12.preheader.us.preheader, label %for.cond35.preheader
for.cond12.preheader.us.preheader: ; preds = %while.cond.preheader
%1 = zext i32 %7 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.backedge, %for.cond12.preheader.us.preheader
%indvars.iv281 = phi i64 [ %1, %for.cond12.preheader.us.preheader ], [ %indvars.iv281.be, %for.body14.us.backedge ]
%i.1.in258.us = phi i32 [ %7, %for.cond12.preheader.us.preheader ], [ %i.1.in258.us.be, %for.body14.us.backedge ]
%flag.1257.us = phi i8 [ 0, %for.cond12.preheader.us.preheader ], [ %flag.1257.us.be, %for.body14.us.backedge ]
%i.1259.us = add nsw i32 %i.1.in258.us, -1
%idxprom15.us = zext i32 %i.1259.us to i64
%num17.us = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %idxprom15.us, i32 1
%2 = load i32, ptr %num17.us, align 4, !tbaa !9
%sub18.us = add nsw i32 %i.1.in258.us, -2
%idxprom19.us = zext i32 %sub18.us to i64
%num21.us = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %idxprom19.us, i32 1
%3 = load i32, ptr %num21.us, align 4, !tbaa !9
%cmp22.us = icmp slt i32 %2, %3
br i1 %cmp22.us, label %if.then.us, label %for.inc33.us
if.then.us: ; preds = %for.body14.us
%arrayidx20.us = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %idxprom19.us
%arrayidx16.us = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %idxprom15.us
%4 = load i64, ptr %arrayidx16.us, align 8
%5 = load i64, ptr %arrayidx20.us, align 8
store i64 %5, ptr %arrayidx16.us, align 8
store i64 %4, ptr %arrayidx20.us, align 8
br label %for.inc33.us
for.inc33.us: ; preds = %if.then.us, %for.body14.us
%flag.2.us = phi i8 [ 1, %if.then.us ], [ %flag.1257.us, %for.body14.us ]
%cmp13.us = icmp sgt i64 %indvars.iv281, 2
%indvars.iv.next282 = add nsw i64 %indvars.iv281, -1
br i1 %cmp13.us, label %for.body14.us.backedge, label %for.cond12.while.cond.loopexit_crit_edge.us
for.body14.us.backedge: ; preds = %for.inc33.us, %for.cond12.while.cond.loopexit_crit_edge.us
%indvars.iv281.be = phi i64 [ %indvars.iv.next282, %for.inc33.us ], [ %1, %for.cond12.while.cond.loopexit_crit_edge.us ]
%i.1.in258.us.be = phi i32 [ %i.1259.us, %for.inc33.us ], [ %7, %for.cond12.while.cond.loopexit_crit_edge.us ]
%flag.1257.us.be = phi i8 [ %flag.2.us, %for.inc33.us ], [ 0, %for.cond12.while.cond.loopexit_crit_edge.us ]
br label %for.body14.us, !llvm.loop !11
for.cond12.while.cond.loopexit_crit_edge.us: ; preds = %for.inc33.us
%tobool.not.us = icmp eq i8 %flag.2.us, 0
br i1 %tobool.not.us, label %for.cond35.preheader, label %for.body14.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %indvars.iv
%num = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %num)
%arrayidx5 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %indvars.iv
%6 = load i64, ptr %arrayidx, align 8
store i64 %6, ptr %arrayidx5, align 8
%arrayidx9 = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %indvars.iv
store i64 %6, ptr %arrayidx9, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !13
for.cond35.preheader: ; preds = %for.cond12.while.cond.loopexit_crit_edge.us, %while.cond.preheader
%cmp36265 = icmp sgt i32 %7, 0
br i1 %cmp36265, label %for.cond39.preheader.lr.ph, label %if.else109
for.cond39.preheader.lr.ph: ; preds = %for.cond35.preheader
%j.0261 = add nsw i32 %7, -1
%9 = zext i32 %7 to i64
%10 = add nsw i64 %9, -1
%11 = zext i32 %j.0261 to i64
%wide.trip.count = zext i32 %7 to i64
br label %for.cond39.preheader
for.cond39.preheader: ; preds = %for.cond39.preheader.lr.ph, %for.inc65
%indvars.iv291 = phi i64 [ 0, %for.cond39.preheader.lr.ph ], [ %indvars.iv.next292, %for.inc65 ]
%cmp40262 = icmp ult i64 %indvars.iv291, %11
br i1 %cmp40262, label %for.body41, label %for.inc65
for.cond68.preheader: ; preds = %for.inc65
br i1 %cmp36265, label %for.body70, label %if.else109
for.body41: ; preds = %for.cond39.preheader, %for.inc62
%indvars.iv285 = phi i64 [ %indvars.iv.next286, %for.inc62 ], [ %9, %for.cond39.preheader ]
%indvars.iv283 = phi i64 [ %indvars.iv.next284, %for.inc62 ], [ %10, %for.cond39.preheader ]
%indvars.iv.next286 = add nsw i64 %indvars.iv285, -1
%num44 = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %indvars.iv283, i32 1
%12 = load i32, ptr %num44, align 4, !tbaa !9
%13 = add nsw i64 %indvars.iv285, -2
%num48 = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %13, i32 1
%14 = load i32, ptr %num48, align 4, !tbaa !9
%cmp49 = icmp slt i32 %12, %14
br i1 %cmp49, label %if.then50, label %for.inc62
if.then50: ; preds = %for.body41
%arrayidx47 = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %13
%arrayidx43 = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %indvars.iv283
%15 = load i64, ptr %arrayidx43, align 8
%16 = load i64, ptr %arrayidx47, align 8
store i64 %16, ptr %arrayidx43, align 8
store i64 %15, ptr %arrayidx47, align 8
br label %for.inc62
for.inc62: ; preds = %for.body41, %if.then50
%indvars.iv.next284 = add nsw i64 %indvars.iv283, -1
%cmp40 = icmp sgt i64 %indvars.iv.next284, %indvars.iv291
br i1 %cmp40, label %for.body41, label %for.inc65, !llvm.loop !14
for.inc65: ; preds = %for.inc62, %for.cond39.preheader
%indvars.iv.next292 = add nuw nsw i64 %indvars.iv291, 1
%exitcond.not = icmp eq i64 %indvars.iv.next292, %wide.trip.count
br i1 %exitcond.not, label %for.cond68.preheader, label %for.cond39.preheader, !llvm.loop !15
for.body70: ; preds = %for.cond68.preheader, %for.body70
%indvars.iv294 = phi i64 [ %indvars.iv.next295, %for.body70 ], [ 0, %for.cond68.preheader ]
%17 = phi i32 [ %22, %for.body70 ], [ %7, %for.cond68.preheader ]
%flag.3268 = phi i8 [ %spec.select, %for.body70 ], [ 0, %for.cond68.preheader ]
%arrayidx72 = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %indvars.iv294
%18 = load i8, ptr %arrayidx72, align 8, !tbaa !16
%arrayidx75 = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %indvars.iv294
%19 = load i8, ptr %arrayidx75, align 8, !tbaa !16
%cmp78.not = icmp eq i8 %18, %19
%spec.select = select i1 %cmp78.not, i8 %flag.3268, i8 1
%sub82 = add nsw i32 %17, -1
%20 = zext i32 %sub82 to i64
%cmp83.not = icmp eq i64 %indvars.iv294, %20
%conv97 = sext i8 %18 to i32
%num100 = getelementptr inbounds [36 x %struct.card_t], ptr %cards1, i64 0, i64 %indvars.iv294, i32 1
%21 = load i32, ptr %num100, align 4, !tbaa !9
%.str.3..str.2 = select i1 %cmp83.not, ptr @.str.3, ptr @.str.2
%call93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2, i32 noundef %conv97, i32 noundef %21)
%indvars.iv.next295 = add nuw nsw i64 %indvars.iv294, 1
%22 = load i32, ptr %N, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp69 = icmp slt i64 %indvars.iv.next295, %23
br i1 %cmp69, label %for.body70, label %for.end105, !llvm.loop !17
for.end105: ; preds = %for.body70
%24 = icmp eq i8 %spec.select, 0
br i1 %24, label %if.else109, label %if.end111
if.else109: ; preds = %for.cond35.preheader, %entry, %for.cond68.preheader, %for.end105
br label %if.end111
if.end111: ; preds = %for.end105, %if.else109
%str.sink = phi ptr [ @str.7, %if.else109 ], [ @str.8, %for.end105 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%25 = load i32, ptr %N, align 4, !tbaa !5
%cmp113273 = icmp sgt i32 %25, 0
br i1 %cmp113273, label %for.cond116.preheader.preheader, label %if.else188
for.cond116.preheader.preheader: ; preds = %if.end111
%26 = zext i32 %25 to i64
%wide.trip.count302 = zext i32 %25 to i64
br label %for.cond116.preheader
for.cond116.preheader: ; preds = %for.cond116.preheader.preheader, %for.end132
%indvars.iv296 = phi i64 [ 0, %for.cond116.preheader.preheader ], [ %indvars.iv.next297, %for.end132 ]
%27 = trunc i64 %indvars.iv296 to i32
br label %for.body119
for.cond144.preheader: ; preds = %for.end132
br i1 %cmp113273, label %for.body147, label %if.else188
for.body119: ; preds = %for.cond116.preheader, %for.body119
%indvars.iv298 = phi i64 [ %indvars.iv296, %for.cond116.preheader ], [ %indvars.iv.next299, %for.body119 ]
%minj.0272 = phi i32 [ %27, %for.cond116.preheader ], [ %spec.select251, %for.body119 ]
%num122 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %indvars.iv298, i32 1
%28 = load i32, ptr %num122, align 4, !tbaa !9
%idxprom123 = sext i32 %minj.0272 to i64
%num125 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %idxprom123, i32 1
%29 = load i32, ptr %num125, align 4, !tbaa !9
%cmp126 = icmp slt i32 %28, %29
%30 = trunc i64 %indvars.iv298 to i32
%spec.select251 = select i1 %cmp126, i32 %30, i32 %minj.0272
%indvars.iv.next299 = add nuw nsw i64 %indvars.iv298, 1
%cmp117 = icmp ult i64 %indvars.iv.next299, %26
br i1 %cmp117, label %for.body119, label %for.end132, !llvm.loop !18
for.end132: ; preds = %for.body119
%arrayidx134 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %indvars.iv296
%31 = load i64, ptr %arrayidx134, align 8
%idxprom137 = sext i32 %spec.select251 to i64
%arrayidx138 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %idxprom137
%32 = load i64, ptr %arrayidx138, align 8
store i64 %32, ptr %arrayidx134, align 8
store i64 %31, ptr %arrayidx138, align 8
%indvars.iv.next297 = add nuw nsw i64 %indvars.iv296, 1
%exitcond303.not = icmp eq i64 %indvars.iv.next297, %wide.trip.count302
br i1 %exitcond303.not, label %for.cond144.preheader, label %for.cond116.preheader, !llvm.loop !19
for.body147: ; preds = %for.cond144.preheader, %for.body147
%indvars.iv304 = phi i64 [ %indvars.iv.next305, %for.body147 ], [ 0, %for.cond144.preheader ]
%33 = phi i32 [ %38, %for.body147 ], [ %25, %for.cond144.preheader ]
%flag.5276 = phi i8 [ %spec.select252, %for.body147 ], [ 0, %for.cond144.preheader ]
%arrayidx149 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %indvars.iv304
%34 = load i8, ptr %arrayidx149, align 8, !tbaa !16
%arrayidx153 = getelementptr inbounds [36 x %struct.card_t], ptr %cards3, i64 0, i64 %indvars.iv304
%35 = load i8, ptr %arrayidx153, align 8, !tbaa !16
%cmp156.not = icmp eq i8 %34, %35
%spec.select252 = select i1 %cmp156.not, i8 %flag.5276, i8 1
%sub160 = add nsw i32 %33, -1
%36 = zext i32 %sub160 to i64
%cmp161.not = icmp eq i64 %indvars.iv304, %36
%conv176 = sext i8 %34 to i32
%num179 = getelementptr inbounds [36 x %struct.card_t], ptr %cards2, i64 0, i64 %indvars.iv304, i32 1
%37 = load i32, ptr %num179, align 4, !tbaa !9
%.str.3..str.2313 = select i1 %cmp161.not, ptr @.str.3, ptr @.str.2
%call171 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2313, i32 noundef %conv176, i32 noundef %37)
%indvars.iv.next305 = add nuw nsw i64 %indvars.iv304, 1
%38 = load i32, ptr %N, align 4, !tbaa !5
%39 = sext i32 %38 to i64
%cmp145 = icmp slt i64 %indvars.iv.next305, %39
br i1 %cmp145, label %for.body147, label %for.end184, !llvm.loop !20
for.end184: ; preds = %for.body147
%40 = icmp eq i8 %spec.select252, 0
br i1 %40, label %if.else188, label %if.end190
if.else188: ; preds = %if.end111, %for.cond144.preheader, %for.end184
br label %if.end190
if.end190: ; preds = %for.end184, %if.else188
%str.7.sink = phi ptr [ @str.7, %if.else188 ], [ @str.8, %for.end184 ]
%puts249 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %cards3) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %cards2) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %cards1) #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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !7, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!10, !7, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
|
#include <stdio.h>
typedef struct { char suit, value; } Card;
void bubble(Card A[], int N) {
int i,j;
Card t;
for(i = 0; i<N; i++) {
for(j = N-1; j >= i; j--) {
if(A[j].value < A[j-1].value) {
t = A[j]; A[j] = A[j-1]; A[j-1] = t;
}
}
}
}
void selection(Card A[], int N) {
int i,j,minj;
Card t;
for(i=0;i<N;i++) {
minj = i;
for(j=i; j<N; j++) {
if(A[j].value < A[minj].value) minj = j;
}
t = A[i]; A[i] = A[minj]; A[minj] = t;
}
}
void print(Card A[], int N) {
int i;
for(i=0; i<N; i++) {
if(i>0) printf(" ");
printf("%c%d",A[i].suit,A[i].value);
}
printf("\n");
}
int isStable(Card C1[], Card C2[], int N) {
int i;
for(i=0; i<N; i++) {
if(C1[i].suit != C2[i].suit) return 0;
}
return 1;
}
void str2Card(Card *t,char str[]) {
t->suit = str[0];
t->value = str[1] - '0';
}
int main(void) {
Card C1[100], C2[100];
int N,i;
char str[3];
scanf("%d",&N);
for(i=0;i<N; i++) {
scanf("%s",str);
str2Card(&C1[i],str);
}
for(i=0; i<N; i++) C2[i] = C1[i];
bubble(C1,N);
selection(C2,N);
print(C1,N);
printf("Stable\n");
print(C2,N);
if(isStable(C1,C2,N)) {
printf("Stable\n");
} else {
printf("Not stable\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114036/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114036/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%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"%s\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @bubble(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp41 = icmp sgt i32 %N, 0
br i1 %cmp41, label %for.cond1.preheader.lr.ph, label %for.end22
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc21
%indvars.iv45 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next46, %for.inc21 ]
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %0, %for.cond1.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%value7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %value7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i16>, ptr %arrayidx6, align 1
%5 = shufflevector <2 x i16> %4, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %5, ptr %arrayidx6, align 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv45
br i1 %cmp2.not.not, label %for.body3, label %for.inc21, !llvm.loop !9
for.inc21: ; preds = %for.inc
%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.end22, label %for.cond1.preheader, !llvm.loop !11
for.end22: ; preds = %for.inc21, %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 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: 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 void @selection(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp39 = icmp sgt i32 %N, 0
br i1 %cmp39, label %for.cond1.preheader.preheader, label %for.end20
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv41 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next42, %for.body3 ]
%minj.038 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv41, i32 1
%2 = load i8, ptr %value, align 1, !tbaa !5
%idxprom4 = sext i32 %minj.038 to i64
%value6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %value6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv41 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %minj.038
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%cmp2 = icmp ult i64 %indvars.iv.next42, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body3
%arrayidx11 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%5 = load i16, ptr %arrayidx11, align 1
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i16, ptr %arrayidx15, align 1
store i16 %6, ptr %arrayidx11, align 1
store i16 %5, ptr %arrayidx15, align 1
%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.end20, label %for.cond1.preheader, !llvm.loop !13
for.end20: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #3 {
entry:
%cmp13 = icmp sgt i32 %N, 0
br i1 %cmp13, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%value.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre17 = load i8, ptr %value.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 1, !tbaa !14
%conv.peel = sext i8 %.pre to i32
%conv4.peel = sext i8 %.pre17 to i32
%call5.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv4.peel)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar12 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%conv = sext i8 %0 to i32
%value = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %value, align 1, !tbaa !5
%conv4 = sext i8 %1 to i32
%call5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv4)
%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 %if.end, !llvm.loop !15
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @isStable(ptr nocapture noundef readonly %C1, ptr nocapture noundef readonly %C2, i32 noundef %N) local_unnamed_addr #5 {
entry:
%cmp10 = icmp sgt i32 %N, 0
br i1 %cmp10, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
br label %for.body
for.cond: ; 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 !17
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !14
%arrayidx2 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv
%1 = load i8, ptr %arrayidx2, align 1, !tbaa !14
%cmp5.not = icmp eq i8 %0, %1
br i1 %cmp5.not, label %for.cond, label %cleanup
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @str2Card(ptr nocapture noundef writeonly %t, ptr nocapture noundef readonly %str) local_unnamed_addr #6 {
entry:
%0 = load i8, ptr %str, align 1, !tbaa !18
store i8 %0, ptr %t, align 1, !tbaa !14
%arrayidx1 = getelementptr inbounds i8, ptr %str, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !18
%sub = add i8 %1, -48
%value = getelementptr inbounds %struct.Card, ptr %t, i64 0, i32 1
store i8 %sub, ptr %value, align 1, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%C1 = alloca [100 x %struct.Card], align 16
%C2 = alloca [100 x %struct.Card], align 16
%N = alloca i32, align 4
%str = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C1) #8
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %str) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !19
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body.lr.ph, label %print.exit
for.body.lr.ph: ; preds = %entry
%arrayidx1.i = getelementptr inbounds i8, ptr %str, i64 1
br label %for.body
for.cond3.preheader: ; preds = %for.body
%cmp478 = icmp sgt i32 %3, 0
br i1 %cmp478, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %str)
%arrayidx = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv
%1 = load i8, ptr %str, align 1, !tbaa !18
store i8 %1, ptr %arrayidx, align 2, !tbaa !14
%2 = load i8, ptr %arrayidx1.i, align 1, !tbaa !18
%sub.i = add i8 %2, -48
%value.i = getelementptr inbounds [100 x %struct.Card], ptr %C1, i64 0, i64 %indvars.iv, i32 1
store i8 %sub.i, ptr %value.i, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !19
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !21
for.cond1.preheader.lr.ph.i: ; preds = %for.cond3.preheader
%5 = zext i32 %3 to i64
%6 = shl nuw nsw i64 %5, 1
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %C2, ptr nonnull align 16 %C1, i64 %6, i1 false)
%7 = zext i32 %3 to i64
br label %for.cond1.preheader.i
for.cond1.preheader.i: ; preds = %for.inc21.i, %for.cond1.preheader.lr.ph.i
%indvars.iv45.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next46.i, %for.inc21.i ]
br label %for.body3.i
for.body3.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%indvars.iv.i = phi i64 [ %7, %for.cond1.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%value.i31 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.next.i, i32 1
%8 = load i8, ptr %value.i31, align 1, !tbaa !5
%9 = add nsw i64 %indvars.iv.i, -2
%value7.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9, i32 1
%10 = load i8, ptr %value7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %8, %10
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %C1, i64 %9
%11 = load <2 x i16>, ptr %arrayidx6.i, align 2
%12 = shufflevector <2 x i16> %11, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
store <2 x i16> %12, ptr %arrayidx6.i, align 2
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv45.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.inc21.i, !llvm.loop !9
for.inc21.i: ; preds = %for.inc.i
%indvars.iv.next46.i = add nuw nsw i64 %indvars.iv45.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next46.i, %7
br i1 %exitcond.not.i, label %for.cond1.preheader.i33, label %for.cond1.preheader.i, !llvm.loop !11
for.cond1.preheader.i33: ; preds = %for.inc21.i, %for.end.i
%indvars.iv.i34 = phi i64 [ %indvars.iv.next.i37, %for.end.i ], [ 0, %for.inc21.i ]
%13 = trunc i64 %indvars.iv.i34 to i32
br label %for.body3.i35
for.body3.i35: ; preds = %for.body3.i35, %for.cond1.preheader.i33
%indvars.iv41.i = phi i64 [ %indvars.iv.i34, %for.cond1.preheader.i33 ], [ %indvars.iv.next42.i, %for.body3.i35 ]
%minj.038.i = phi i32 [ %13, %for.cond1.preheader.i33 ], [ %spec.select.i, %for.body3.i35 ]
%value.i36 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv41.i, i32 1
%14 = load i8, ptr %value.i36, align 1, !tbaa !5
%idxprom4.i = sext i32 %minj.038.i to i64
%value6.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom4.i, i32 1
%15 = load i8, ptr %value6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %14, %15
%16 = trunc i64 %indvars.iv41.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %16, i32 %minj.038.i
%indvars.iv.next42.i = add nuw nsw i64 %indvars.iv41.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next42.i, %7
br i1 %cmp2.i, label %for.body3.i35, label %for.end.i, !llvm.loop !12
for.end.i: ; preds = %for.body3.i35
%arrayidx11.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i34
%17 = load i16, ptr %arrayidx11.i, align 2
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %idxprom14.i
%18 = load i16, ptr %arrayidx15.i, align 2
store i16 %18, ptr %arrayidx11.i, align 2
store i16 %17, ptr %arrayidx15.i, align 2
%indvars.iv.next.i37 = add nuw nsw i64 %indvars.iv.i34, 1
%exitcond.not.i38 = icmp eq i64 %indvars.iv.next.i37, %7
br i1 %exitcond.not.i38, label %if.end.peel.i, label %for.cond1.preheader.i33, !llvm.loop !13
if.end.peel.i: ; preds = %for.end.i
%value.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %C1, i64 0, i32 1
%.pre17.i = load i8, ptr %value.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %C1, align 16, !tbaa !14
%conv.peel.i = sext i8 %.pre.i to i32
%conv4.peel.i = sext i8 %.pre17.i to i32
%call5.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv4.peel.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i41 = phi i64 [ %indvars.iv.next.i44, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar12.i = call i32 @putchar(i32 32)
%arrayidx.i42 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41
%19 = load i8, ptr %arrayidx.i42, align 2, !tbaa !14
%conv.i = sext i8 %19 to i32
%value.i43 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i41, i32 1
%20 = load i8, ptr %value.i43, align 1, !tbaa !5
%conv4.i = sext i8 %20 to i32
%call5.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv4.i)
%indvars.iv.next.i44 = add nuw nsw i64 %indvars.iv.i41, 1
%exitcond.not.i45 = icmp eq i64 %indvars.iv.next.i44, %7
br i1 %exitcond.not.i45, label %print.exit, label %if.end.i, !llvm.loop !15
print.exit: ; preds = %if.end.i, %entry, %for.cond3.preheader, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.8)
%21 = load i32, ptr %N, align 4, !tbaa !19
%cmp13.i46 = icmp sgt i32 %21, 0
br i1 %cmp13.i46, label %if.end.peel.i49, label %print.exit68
if.end.peel.i49: ; preds = %print.exit
%wide.trip.count.i50 = zext i32 %21 to i64
%value.peel.phi.trans.insert.i51 = getelementptr inbounds %struct.Card, ptr %C2, i64 0, i32 1
%.pre17.i52 = load i8, ptr %value.peel.phi.trans.insert.i51, align 1, !tbaa !5
%.pre.i53 = load i8, ptr %C2, align 16, !tbaa !14
%conv.peel.i54 = sext i8 %.pre.i53 to i32
%conv4.peel.i55 = sext i8 %.pre17.i52 to i32
%call5.peel.i56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i54, i32 noundef %conv4.peel.i55)
%exitcond.peel.not.i57 = icmp eq i32 %21, 1
br i1 %exitcond.peel.not.i57, label %print.exit68, label %if.end.i58
if.end.i58: ; preds = %if.end.peel.i49, %if.end.i58
%indvars.iv.i59 = phi i64 [ %indvars.iv.next.i66, %if.end.i58 ], [ 1, %if.end.peel.i49 ]
%putchar12.i60 = call i32 @putchar(i32 32)
%arrayidx.i61 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59
%22 = load i8, ptr %arrayidx.i61, align 2, !tbaa !14
%conv.i62 = sext i8 %22 to i32
%value.i63 = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i59, i32 1
%23 = load i8, ptr %value.i63, align 1, !tbaa !5
%conv4.i64 = sext i8 %23 to i32
%call5.i65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i62, i32 noundef %conv4.i64)
%indvars.iv.next.i66 = add nuw nsw i64 %indvars.iv.i59, 1
%exitcond.not.i67 = icmp eq i64 %indvars.iv.next.i66, %wide.trip.count.i50
br i1 %exitcond.not.i67, label %print.exit68, label %if.end.i58, !llvm.loop !15
print.exit68: ; preds = %if.end.i58, %print.exit, %if.end.peel.i49
%putchar.i48 = call i32 @putchar(i32 10)
%24 = load i32, ptr %N, align 4, !tbaa !19
%cmp10.i = icmp sgt i32 %24, 0
br i1 %cmp10.i, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %print.exit68
%wide.trip.count.i69 = zext i32 %24 to i64
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i72 = add nuw nsw i64 %indvars.iv.i70, 1
%exitcond.not.i73 = icmp eq i64 %indvars.iv.next.i72, %wide.trip.count.i69
br i1 %exitcond.not.i73, label %if.end, label %for.body.i, !llvm.loop !17
for.body.i: ; preds = %for.cond.i, %for.body.preheader.i
%indvars.iv.i70 = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i72, %for.cond.i ]
%arrayidx.i71 = getelementptr inbounds %struct.Card, ptr %C1, i64 %indvars.iv.i70
%25 = load i8, ptr %arrayidx.i71, align 2, !tbaa !14
%arrayidx2.i = getelementptr inbounds %struct.Card, ptr %C2, i64 %indvars.iv.i70
%26 = load i8, ptr %arrayidx2.i, align 2, !tbaa !14
%cmp5.not.i = icmp eq i8 %25, %26
br i1 %cmp5.not.i, label %for.cond.i, label %if.end
if.end: ; preds = %for.body.i, %for.cond.i, %print.exit68
%str.7.sink = phi ptr [ @str.8, %print.exit68 ], [ @str.8, %for.cond.i ], [ @str.7, %for.body.i ]
%puts29 = call i32 @puts(ptr nonnull dereferenceable(1) %str.7.sink)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %str) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C2) #8
call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %C1) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #6 = { 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 #7 = { nofree nounwind }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1}
!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 = !{!6, !7, i64 0}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !10}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
int main()
{
int t,n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
if(n%2==0)
printf("%d\n",n/2);
else
printf("%d\n",n/2+1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11408/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11408/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%n = 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 %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec5 = add nsw i32 %0, -1
store i32 %dec5, ptr %t, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %0, 0
br i1 %tobool.not6, 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 %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = and i32 %1, 1
%div = sdiv i32 %1, 2
%add.sink = add nsw i32 %div, %2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.sink)
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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"}
|
#include <stdio.h>
#include <string.h>
typedef struct{
char a;
int num;
}data;
//バブルソートと比較し安定か安定じゃないか確かめる
int main(){
data data[36],data1[36],data2[36],tmp_data;
char temp[2];
int i,j,n,minj,s=0,flag=0,flag2=0;
scanf("%d",&n);
for(i=0;i<n;i++){
//scanf(" %c %d",&data[i].a,&data[i].num);
scanf("%s", temp);
data[i].a = temp[0];
data[i].num = temp[1] - 48;
data1[i]=data[i];
data2[i]=data[i];
}
//バブルソート
for(i = 0 ; i < n; i++){
for(j = n-1; j >= i + 1; j--){
if(data1[j].num < data1[j-1].num){
tmp_data = data1[j-1];
data1[j-1] = data1[j];
data1[j] = tmp_data;
flag = 1;
}
}
}
for(i=0;i<n;i++){
printf("%c%d",data1[i].a,data1[i].num);
if(i!=n-1)printf(" ");
}
printf("\nStable\n");
//セレクションソート
for(i=0;i<n;i++){
minj=i;
for(j=i;j<n;j++){
if(data2[j].num < data2[minj].num){
minj = j;
}
}
tmp_data = data2[i];
data2[i] = data2[minj];
data2[minj] = tmp_data;
}
for(i=0;i<n;i++){
printf("%c%d",data2[i].a,data2[i].num);
if(i!=n-1)printf(" ");
if(data1[i].a!=data2[i].a)flag2=1;
}
printf("\n");
if(flag2==0)printf("Stable\n");
else printf("Not stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114122/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114122/source.c"
target datalayout = "e-m:e-p270: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.data = type { i8, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1
@str = private unnamed_addr constant [8 x i8] c"\0AStable\00", align 1
@str.8 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.9 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data = alloca [36 x %struct.data], align 16
%data1 = alloca [36 x %struct.data], align 16
%data2 = alloca [36 x %struct.data], align 16
%temp = alloca [2 x i8], align 1
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %data) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %data1) #4
call void @llvm.lifetime.start.p0(i64 288, ptr nonnull %data2) #4
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %temp) #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
%cmp187 = icmp sgt i32 %0, 0
br i1 %cmp187, label %for.body.lr.ph, label %for.end67
for.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [2 x i8], ptr %temp, i64 0, i64 1
br label %for.body
for.cond14.preheader: ; preds = %for.body
%cmp15194 = icmp sgt i32 %5, 0
br i1 %cmp15194, label %for.cond19.preheader.lr.ph, label %for.end67
for.cond19.preheader.lr.ph: ; preds = %for.cond14.preheader
%1 = zext i32 %5 to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.cond19.preheader
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %temp)
%2 = load i8, ptr %temp, align 1, !tbaa !9
%arrayidx2 = getelementptr inbounds [36 x %struct.data], ptr %data, i64 0, i64 %indvars.iv
store i8 %2, ptr %arrayidx2, align 8, !tbaa !10
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !9
%conv = sext i8 %3 to i32
%sub = add nsw i32 %conv, -48
%num = getelementptr inbounds [36 x %struct.data], ptr %data, i64 0, i64 %indvars.iv, i32 1
store i32 %sub, ptr %num, align 4, !tbaa !12
%arrayidx7 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %indvars.iv
%4 = load i64, ptr %arrayidx2, align 8
store i64 %4, ptr %arrayidx7, align 8
%arrayidx11 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %indvars.iv
store i64 %4, ptr %arrayidx11, align 8
%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.cond14.preheader, !llvm.loop !13
for.cond14.loopexit: ; preds = %for.inc42, %for.cond19.preheader
%exitcond.not = icmp eq i64 %indvars.iv.next213, %wide.trip.count
br i1 %exitcond.not, label %for.cond47.preheader, label %for.cond19.preheader, !llvm.loop !15
for.cond19.preheader: ; preds = %for.cond19.preheader.lr.ph, %for.cond14.loopexit
%indvars.iv212 = phi i64 [ 0, %for.cond19.preheader.lr.ph ], [ %indvars.iv.next213, %for.cond14.loopexit ]
%indvars.iv.next213 = add nuw nsw i64 %indvars.iv212, 1
%cmp20.not.not190 = icmp ult i64 %indvars.iv.next213, %1
br i1 %cmp20.not.not190, label %for.body22, label %for.cond14.loopexit
for.cond47.preheader: ; preds = %for.cond14.loopexit
br i1 %cmp15194, label %for.body50, label %for.end67
for.body22: ; preds = %for.cond19.preheader, %for.inc42
%indvars.iv208 = phi i64 [ %indvars.iv.next209, %for.inc42 ], [ %1, %for.cond19.preheader ]
%indvars.iv.next209 = add nsw i64 %indvars.iv208, -1
%num25 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %indvars.iv.next209, i32 1
%7 = load i32, ptr %num25, align 4, !tbaa !12
%8 = add nsw i64 %indvars.iv208, -2
%num29 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %8, i32 1
%9 = load i32, ptr %num29, align 4, !tbaa !12
%cmp30 = icmp slt i32 %7, %9
br i1 %cmp30, label %if.then, label %for.inc42
if.then: ; preds = %for.body22
%arrayidx28 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %8
%10 = load <2 x i64>, ptr %arrayidx28, align 8
%11 = shufflevector <2 x i64> %10, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %11, ptr %arrayidx28, align 8
br label %for.inc42
for.inc42: ; preds = %for.body22, %if.then
%cmp20.not.not = icmp sgt i64 %indvars.iv.next209, %indvars.iv.next213
br i1 %cmp20.not.not, label %for.body22, label %for.cond14.loopexit, !llvm.loop !16
for.body50: ; preds = %for.cond47.preheader, %for.inc65
%indvars.iv215 = phi i64 [ %indvars.iv.next216, %for.inc65 ], [ 0, %for.cond47.preheader ]
%arrayidx52 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %indvars.iv215
%12 = load i8, ptr %arrayidx52, align 8, !tbaa !10
%conv54 = sext i8 %12 to i32
%num57 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %indvars.iv215, i32 1
%13 = load i32, ptr %num57, align 4, !tbaa !12
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv54, i32 noundef %13)
%14 = load i32, ptr %n, align 4, !tbaa !5
%sub59 = add nsw i32 %14, -1
%15 = zext i32 %sub59 to i64
%cmp60.not = icmp eq i64 %indvars.iv215, %15
br i1 %cmp60.not, label %for.inc65, label %if.then62
if.then62: ; preds = %for.body50
%putchar185 = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc65
for.inc65: ; preds = %for.body50, %if.then62
%16 = phi i32 [ %14, %for.body50 ], [ %.pre, %if.then62 ]
%indvars.iv.next216 = add nuw nsw i64 %indvars.iv215, 1
%17 = sext i32 %16 to i64
%cmp48 = icmp slt i64 %indvars.iv.next216, %17
br i1 %cmp48, label %for.body50, label %for.end67, !llvm.loop !17
for.end67: ; preds = %for.inc65, %entry, %for.cond14.preheader, %for.cond47.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp70200 = icmp sgt i32 %18, 0
br i1 %cmp70200, label %for.cond73.preheader.preheader, label %for.end133.thread
for.cond73.preheader.preheader: ; preds = %for.end67
%19 = zext i32 %18 to i64
%wide.trip.count224 = zext i32 %18 to i64
br label %for.cond73.preheader
for.cond73.preheader: ; preds = %for.cond73.preheader.preheader, %for.end89
%indvars.iv218 = phi i64 [ 0, %for.cond73.preheader.preheader ], [ %indvars.iv.next219, %for.end89 ]
%20 = trunc i64 %indvars.iv218 to i32
br label %for.body76
for.cond101.preheader: ; preds = %for.end89
br i1 %cmp70200, label %for.body104, label %for.end133.thread
for.body76: ; preds = %for.cond73.preheader, %for.body76
%indvars.iv220 = phi i64 [ %indvars.iv218, %for.cond73.preheader ], [ %indvars.iv.next221, %for.body76 ]
%minj.0199 = phi i32 [ %20, %for.cond73.preheader ], [ %spec.select, %for.body76 ]
%num79 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %indvars.iv220, i32 1
%21 = load i32, ptr %num79, align 4, !tbaa !12
%idxprom80 = sext i32 %minj.0199 to i64
%num82 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %idxprom80, i32 1
%22 = load i32, ptr %num82, align 4, !tbaa !12
%cmp83 = icmp slt i32 %21, %22
%23 = trunc i64 %indvars.iv220 to i32
%spec.select = select i1 %cmp83, i32 %23, i32 %minj.0199
%indvars.iv.next221 = add nuw nsw i64 %indvars.iv220, 1
%cmp74 = icmp ult i64 %indvars.iv.next221, %19
br i1 %cmp74, label %for.body76, label %for.end89, !llvm.loop !18
for.end89: ; preds = %for.body76
%arrayidx91 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %indvars.iv218
%24 = load i64, ptr %arrayidx91, align 8
%idxprom94 = sext i32 %spec.select to i64
%arrayidx95 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %idxprom94
%25 = load i64, ptr %arrayidx95, align 8
store i64 %25, ptr %arrayidx91, align 8
store i64 %24, ptr %arrayidx95, align 8
%indvars.iv.next219 = add nuw nsw i64 %indvars.iv218, 1
%exitcond225.not = icmp eq i64 %indvars.iv.next219, %wide.trip.count224
br i1 %exitcond225.not, label %for.cond101.preheader, label %for.cond73.preheader, !llvm.loop !19
for.body104: ; preds = %for.cond101.preheader, %if.end118
%indvars.iv226 = phi i64 [ %indvars.iv.next227, %if.end118 ], [ 0, %for.cond101.preheader ]
%flag2.0204 = phi i32 [ %spec.select186, %if.end118 ], [ 0, %for.cond101.preheader ]
%arrayidx106 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %indvars.iv226
%26 = load i8, ptr %arrayidx106, align 8, !tbaa !10
%conv108 = sext i8 %26 to i32
%num111 = getelementptr inbounds [36 x %struct.data], ptr %data2, i64 0, i64 %indvars.iv226, i32 1
%27 = load i32, ptr %num111, align 4, !tbaa !12
%call112 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv108, i32 noundef %27)
%28 = load i32, ptr %n, align 4, !tbaa !5
%sub113 = add nsw i32 %28, -1
%29 = zext i32 %sub113 to i64
%cmp114.not = icmp eq i64 %indvars.iv226, %29
br i1 %cmp114.not, label %if.end118, label %if.then116
if.then116: ; preds = %for.body104
%putchar184 = call i32 @putchar(i32 32)
%.pre229 = load i32, ptr %n, align 4, !tbaa !5
br label %if.end118
if.end118: ; preds = %if.then116, %for.body104
%30 = phi i32 [ %.pre229, %if.then116 ], [ %28, %for.body104 ]
%arrayidx120 = getelementptr inbounds [36 x %struct.data], ptr %data1, i64 0, i64 %indvars.iv226
%31 = load i8, ptr %arrayidx120, align 8, !tbaa !10
%cmp127.not = icmp eq i8 %31, %26
%spec.select186 = select i1 %cmp127.not, i32 %flag2.0204, i32 1
%indvars.iv.next227 = add nuw nsw i64 %indvars.iv226, 1
%32 = sext i32 %30 to i64
%cmp102 = icmp slt i64 %indvars.iv.next227, %32
br i1 %cmp102, label %for.body104, label %for.end133, !llvm.loop !20
for.end133.thread: ; preds = %for.cond101.preheader, %for.end67
%putchar234 = call i32 @putchar(i32 10)
br label %if.end140
for.end133: ; preds = %if.end118
%33 = icmp eq i32 %spec.select186, 0
%putchar = call i32 @putchar(i32 10)
%spec.select235 = select i1 %33, ptr @str.9, ptr @str.8
br label %if.end140
if.end140: ; preds = %for.end133, %for.end133.thread
%str.8.sink = phi ptr [ @str.9, %for.end133.thread ], [ %spec.select235, %for.end133 ]
%puts182 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %temp) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %data2) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %data1) #4
call void @llvm.lifetime.end.p0(i64 288, ptr nonnull %data) #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
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 0}
!11 = !{!"", !7, i64 0, !6, i64 4}
!12 = !{!11, !6, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
|
#include<stdio.h>
typedef struct{
char suit;
char num;
int idx;
}Card;
void print(Card* A, int N){
int i;
for(i = 0; i < N; i++){
if(i) printf(" ");
printf("%c%c",A[i].suit,A[i].num);
}
printf("\n");
}
void is_stable(Card* A, int N){
int i;
for(i = 0; i+1 < N; i++)
if(A[i].num == A[i+1].num && A[i].idx > A[i+1].idx){
printf("Not stable\n");
return;
}
printf("Stable\n");
}
void swap(Card* a, Card* b){
Card tmp = *a;
*a = *b;
*b = tmp;
}
int bubble_sort(Card* A, int N){
int i,j, cnt=0;
for(i = 0; i < N; i++)
for(j = N-1; j >= i+1; j--)
if(A[j].num < A[j-1].num){
swap(&A[j],&A[j-1]);
cnt++;
}
return cnt;
}
int selection_sort(Card* A, int N){
int i,j,cnt=0;
for(i = 0; i < N; i++){
int mini = i;
for(j = i; j < N; j++) if(A[j].num < A[mini].num) mini = j;
cnt += (i==mini?0:1);
swap(&A[i],&A[mini]);
}
return cnt;
}
int main(){
int i,N;
Card data1[40],data2[40];
scanf("%d\n",&N);
for(i = 0; i < N; i++) scanf("%c%c ",&data1[i].suit, &data1[i].num);
for(i = 0; i < N; i++){
data2[i] = data1[i];
data1[i].idx = data2[i].idx = i;
}
bubble_sort(data1,N);
selection_sort(data2,N);
print(data1,N);
is_stable(data1,N);
print(data2,N);
is_stable(data2,N);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114166/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114166/source.c"
target datalayout = "e-m:e-p270: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.Card = type { i8, i8, i32 }
@.str.1 = private unnamed_addr constant [5 x i8] c"%c%c\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.6 = private unnamed_addr constant [6 x i8] c"%c%c \00", align 1
@str = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
@str.7 = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp12 = icmp sgt i32 %N, 0
br i1 %cmp12, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %N to i64
%num.peel.phi.trans.insert = getelementptr inbounds %struct.Card, ptr %A, i64 0, i32 1
%.pre16 = load i8, ptr %num.peel.phi.trans.insert, align 1, !tbaa !5
%.pre = load i8, ptr %A, align 4, !tbaa !10
%conv.peel = sext i8 %.pre to i32
%conv3.peel = sext i8 %.pre16 to i32
%call4.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel, i32 noundef %conv3.peel)
%exitcond.peel.not = icmp eq i32 %N, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar11 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 4, !tbaa !10
%conv = sext i8 %0 to i32
%num = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%1 = load i8, ptr %num, align 1, !tbaa !5
%conv3 = sext i8 %1 to i32
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv, i32 noundef %conv3)
%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 %if.end, !llvm.loop !11
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @is_stable(ptr nocapture noundef readonly %A, i32 noundef %N) local_unnamed_addr #0 {
entry:
%cmp26 = icmp sgt i32 %N, 1
br i1 %cmp26, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%0 = add nsw i32 %N, -1
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv29 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next30, %for.inc ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%num = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv29, i32 1
%1 = load i8, ptr %num, align 1, !tbaa !5
%num4 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 1
%2 = load i8, ptr %num4, align 1, !tbaa !5
%cmp6 = icmp eq i8 %1, %2
br i1 %cmp6, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%idx = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv29, i32 2
%3 = load i32, ptr %idx, align 4, !tbaa !14
%idx13 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv, i32 2
%4 = load i32, ptr %idx13, align 4, !tbaa !14
%cmp14 = icmp sgt i32 %3, %4
br i1 %cmp14, label %cleanup, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next30, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !15
cleanup: ; preds = %for.inc, %land.lhs.true, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str.7, %land.lhs.true ], [ @str, %for.inc ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %a, align 4
%1 = load i64, ptr %b, align 4
store i64 %1, ptr %a, align 4
store i64 %0, ptr %b, align 4
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @bubble_sort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp37 = icmp sgt i32 %N, 0
br i1 %cmp37, label %for.cond1.preheader.lr.ph, label %for.end18
for.cond1.preheader.lr.ph: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond.loopexit: ; preds = %for.inc, %for.cond1.preheader
%cnt.1.lcssa = phi i32 [ %cnt.039, %for.cond1.preheader ], [ %cnt.2, %for.inc ]
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.end18, label %for.cond1.preheader, !llvm.loop !16
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.loopexit
%indvars.iv43 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next44, %for.cond.loopexit ]
%cnt.039 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %cnt.1.lcssa, %for.cond.loopexit ]
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%cmp2.not.not32 = icmp ult i64 %indvars.iv.next44, %0
br i1 %cmp2.not.not32, label %for.body3, label %for.cond.loopexit
for.body3: ; preds = %for.cond1.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %0, %for.cond1.preheader ]
%cnt.134 = phi i32 [ %cnt.2, %for.inc ], [ %cnt.039, %for.cond1.preheader ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%num = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv.next, i32 1
%1 = load i8, ptr %num, align 1, !tbaa !5
%2 = add nsw i64 %indvars.iv, -2
%num7 = getelementptr inbounds %struct.Card, ptr %A, i64 %2, i32 1
%3 = load i8, ptr %num7, align 1, !tbaa !5
%cmp9 = icmp slt i8 %1, %3
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%arrayidx6 = getelementptr inbounds %struct.Card, ptr %A, i64 %2
%4 = load <2 x i64>, ptr %arrayidx6, align 4
%5 = shufflevector <2 x i64> %4, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %5, ptr %arrayidx6, align 4
%inc = add nsw i32 %cnt.134, 1
br label %for.inc
for.inc: ; preds = %for.body3, %if.then
%cnt.2 = phi i32 [ %inc, %if.then ], [ %cnt.134, %for.body3 ]
%cmp2.not.not = icmp sgt i64 %indvars.iv.next, %indvars.iv.next44
br i1 %cmp2.not.not, label %for.body3, label %for.cond.loopexit, !llvm.loop !17
for.end18: ; preds = %for.cond.loopexit, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.1.lcssa, %for.cond.loopexit ]
ret i32 %cnt.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @selection_sort(ptr nocapture noundef %A, i32 noundef %N) local_unnamed_addr #4 {
entry:
%cmp36 = icmp sgt i32 %N, 0
br i1 %cmp36, label %for.cond1.preheader.preheader, label %for.end18
for.cond1.preheader.preheader: ; preds = %entry
%0 = zext i32 %N to i64
%wide.trip.count = zext i32 %N to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end
%indvars.iv = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next, %for.end ]
%cnt.038 = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %add, %for.end ]
%1 = trunc i64 %indvars.iv to i32
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv39 = phi i64 [ %indvars.iv, %for.cond1.preheader ], [ %indvars.iv.next40, %for.body3 ]
%mini.035 = phi i32 [ %1, %for.cond1.preheader ], [ %spec.select, %for.body3 ]
%num = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv39, i32 1
%2 = load i8, ptr %num, align 1, !tbaa !5
%idxprom4 = sext i32 %mini.035 to i64
%num6 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom4, i32 1
%3 = load i8, ptr %num6, align 1, !tbaa !5
%cmp8 = icmp slt i8 %2, %3
%4 = trunc i64 %indvars.iv39 to i32
%spec.select = select i1 %cmp8, i32 %4, i32 %mini.035
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%cmp2 = icmp ult i64 %indvars.iv.next40, %0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !18
for.end: ; preds = %for.body3
%5 = zext i32 %spec.select to i64
%cmp10 = icmp ne i64 %indvars.iv, %5
%cond = zext i1 %cmp10 to i32
%add = add nuw nsw i32 %cnt.038, %cond
%arrayidx13 = getelementptr inbounds %struct.Card, ptr %A, i64 %indvars.iv
%idxprom14 = sext i32 %spec.select to i64
%arrayidx15 = getelementptr inbounds %struct.Card, ptr %A, i64 %idxprom14
%6 = load i64, ptr %arrayidx13, align 4
%7 = load i64, ptr %arrayidx15, align 4
store i64 %7, ptr %arrayidx13, align 4
store i64 %6, ptr %arrayidx15, align 4
%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.end18, label %for.cond1.preheader, !llvm.loop !19
for.end18: ; preds = %for.end, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.end ]
ret i32 %cnt.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%data1 = alloca [40 x %struct.Card], align 16
%data2 = alloca [40 x %struct.Card], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 320, ptr nonnull %data1) #6
call void @llvm.lifetime.start.p0(i64 320, ptr nonnull %data2) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !20
%cmp100 = icmp sgt i32 %0, 0
br i1 %cmp100, label %for.body, label %print.exit
for.cond4.preheader: ; preds = %for.body
%cmp5102 = icmp sgt i32 %2, 0
br i1 %cmp5102, label %for.body6.preheader, label %print.exit
for.body6.preheader: ; preds = %for.cond4.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.end18.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv
%num = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %arrayidx, ptr noundef nonnull %num)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !20
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !21
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv106 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next107.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx8 = getelementptr inbounds [40 x %struct.Card], ptr %data2, i64 0, i64 %indvars.iv106
%arrayidx10 = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv106
%4 = load i64, ptr %arrayidx10, align 16
store i64 %4, ptr %arrayidx8, align 16
%idx = getelementptr inbounds [40 x %struct.Card], ptr %data2, i64 0, i64 %indvars.iv106, i32 2
%5 = trunc i64 %indvars.iv106 to i32
store i32 %5, ptr %idx, align 4, !tbaa !14
%idx15 = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv106, i32 2
store i32 %5, ptr %idx15, align 4, !tbaa !14
%indvars.iv.next107 = or i64 %indvars.iv106, 1
%arrayidx8.1 = getelementptr inbounds [40 x %struct.Card], ptr %data2, i64 0, i64 %indvars.iv.next107
%arrayidx10.1 = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv.next107
%6 = load i64, ptr %arrayidx10.1, align 8
store i64 %6, ptr %arrayidx8.1, align 8
%idx.1 = getelementptr inbounds [40 x %struct.Card], ptr %data2, i64 0, i64 %indvars.iv.next107, i32 2
%7 = trunc i64 %indvars.iv.next107 to i32
store i32 %7, ptr %idx.1, align 4, !tbaa !14
%idx15.1 = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv.next107, i32 2
store i32 %7, ptr %idx15.1, align 4, !tbaa !14
%indvars.iv.next107.1 = add nuw nsw i64 %indvars.iv106, 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.end18.unr-lcssa, label %for.body6, !llvm.loop !22
for.end18.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%indvars.iv106.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next107.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end18, label %for.body6.epil
for.body6.epil: ; preds = %for.end18.unr-lcssa
%arrayidx8.epil = getelementptr inbounds [40 x %struct.Card], ptr %data2, i64 0, i64 %indvars.iv106.unr
%arrayidx10.epil = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv106.unr
%8 = load i64, ptr %arrayidx10.epil, align 8
store i64 %8, ptr %arrayidx8.epil, align 8
%idx.epil = getelementptr inbounds [40 x %struct.Card], ptr %data2, i64 0, i64 %indvars.iv106.unr, i32 2
%9 = trunc i64 %indvars.iv106.unr to i32
store i32 %9, ptr %idx.epil, align 4, !tbaa !14
%idx15.epil = getelementptr inbounds [40 x %struct.Card], ptr %data1, i64 0, i64 %indvars.iv106.unr, i32 2
store i32 %9, ptr %idx15.epil, align 4, !tbaa !14
br label %for.end18
for.end18: ; preds = %for.end18.unr-lcssa, %for.body6.epil
br i1 %cmp5102, label %for.cond1.preheader.lr.ph.i, label %print.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end18
%10 = zext i32 %2 to i64
br label %for.cond1.preheader.i
for.cond.loopexit.i: ; preds = %for.inc.i, %for.cond1.preheader.i
%exitcond.not.i = icmp eq i64 %indvars.iv.next44.i, %10
br i1 %exitcond.not.i, label %for.cond1.preheader.i38, label %for.cond1.preheader.i, !llvm.loop !16
for.cond1.preheader.i: ; preds = %for.cond.loopexit.i, %for.cond1.preheader.lr.ph.i
%indvars.iv43.i = phi i64 [ 0, %for.cond1.preheader.lr.ph.i ], [ %indvars.iv.next44.i, %for.cond.loopexit.i ]
%indvars.iv.next44.i = add nuw nsw i64 %indvars.iv43.i, 1
%cmp2.not.not32.i = icmp ult i64 %indvars.iv.next44.i, %10
br i1 %cmp2.not.not32.i, label %for.body3.i, label %for.cond.loopexit.i
for.body3.i: ; preds = %for.cond1.preheader.i, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ %10, %for.cond1.preheader.i ]
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%num.i = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv.next.i, i32 1
%11 = load i8, ptr %num.i, align 1, !tbaa !5
%12 = add nsw i64 %indvars.iv.i, -2
%num7.i = getelementptr inbounds %struct.Card, ptr %data1, i64 %12, i32 1
%13 = load i8, ptr %num7.i, align 1, !tbaa !5
%cmp9.i = icmp slt i8 %11, %13
br i1 %cmp9.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body3.i
%arrayidx6.i = getelementptr inbounds %struct.Card, ptr %data1, i64 %12
%14 = load <2 x i64>, ptr %arrayidx6.i, align 8
%15 = shufflevector <2 x i64> %14, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %15, ptr %arrayidx6.i, align 8
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body3.i
%cmp2.not.not.i = icmp sgt i64 %indvars.iv.next.i, %indvars.iv.next44.i
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond.loopexit.i, !llvm.loop !17
for.cond1.preheader.i38: ; preds = %for.cond.loopexit.i, %for.end.i
%indvars.iv.i39 = phi i64 [ %indvars.iv.next.i42, %for.end.i ], [ 0, %for.cond.loopexit.i ]
%16 = trunc i64 %indvars.iv.i39 to i32
br label %for.body3.i40
for.body3.i40: ; preds = %for.body3.i40, %for.cond1.preheader.i38
%indvars.iv39.i = phi i64 [ %indvars.iv.i39, %for.cond1.preheader.i38 ], [ %indvars.iv.next40.i, %for.body3.i40 ]
%mini.035.i = phi i32 [ %16, %for.cond1.preheader.i38 ], [ %spec.select.i, %for.body3.i40 ]
%num.i41 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv39.i, i32 1
%17 = load i8, ptr %num.i41, align 1, !tbaa !5
%idxprom4.i = sext i32 %mini.035.i to i64
%num6.i = getelementptr inbounds %struct.Card, ptr %data2, i64 %idxprom4.i, i32 1
%18 = load i8, ptr %num6.i, align 1, !tbaa !5
%cmp8.i = icmp slt i8 %17, %18
%19 = trunc i64 %indvars.iv39.i to i32
%spec.select.i = select i1 %cmp8.i, i32 %19, i32 %mini.035.i
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%cmp2.i = icmp ult i64 %indvars.iv.next40.i, %10
br i1 %cmp2.i, label %for.body3.i40, label %for.end.i, !llvm.loop !18
for.end.i: ; preds = %for.body3.i40
%arrayidx13.i = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv.i39
%idxprom14.i = sext i32 %spec.select.i to i64
%arrayidx15.i = getelementptr inbounds %struct.Card, ptr %data2, i64 %idxprom14.i
%20 = load i64, ptr %arrayidx13.i, align 8
%21 = load i64, ptr %arrayidx15.i, align 8
store i64 %21, ptr %arrayidx13.i, align 8
store i64 %20, ptr %arrayidx15.i, align 8
%indvars.iv.next.i42 = add nuw nsw i64 %indvars.iv.i39, 1
%exitcond.not.i43 = icmp eq i64 %indvars.iv.next.i42, %10
br i1 %exitcond.not.i43, label %if.end.peel.i, label %for.cond1.preheader.i38, !llvm.loop !19
if.end.peel.i: ; preds = %for.end.i
%num.peel.phi.trans.insert.i = getelementptr inbounds %struct.Card, ptr %data1, i64 0, i32 1
%.pre16.i = load i8, ptr %num.peel.phi.trans.insert.i, align 1, !tbaa !5
%.pre.i = load i8, ptr %data1, align 16, !tbaa !10
%conv.peel.i = sext i8 %.pre.i to i32
%conv3.peel.i = sext i8 %.pre16.i to i32
%call4.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i, i32 noundef %conv3.peel.i)
%exitcond.peel.not.i = icmp eq i32 %2, 1
br i1 %exitcond.peel.not.i, label %print.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i46 = phi i64 [ %indvars.iv.next.i49, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar11.i = call i32 @putchar(i32 32)
%arrayidx.i47 = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv.i46
%22 = load i8, ptr %arrayidx.i47, align 8, !tbaa !10
%conv.i = sext i8 %22 to i32
%num.i48 = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv.i46, i32 1
%23 = load i8, ptr %num.i48, align 1, !tbaa !5
%conv3.i = sext i8 %23 to i32
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i, i32 noundef %conv3.i)
%indvars.iv.next.i49 = add nuw nsw i64 %indvars.iv.i46, 1
%exitcond.not.i50 = icmp eq i64 %indvars.iv.next.i49, %10
br i1 %exitcond.not.i50, label %print.exit, label %if.end.i, !llvm.loop !11
print.exit: ; preds = %if.end.i, %entry, %for.cond4.preheader, %for.end18, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%24 = load i32, ptr %N, align 4, !tbaa !20
%cmp26.i = icmp sgt i32 %24, 1
br i1 %cmp26.i, label %for.body.preheader.i, label %is_stable.exit
for.body.preheader.i: ; preds = %print.exit
%25 = add nsw i32 %24, -1
%wide.trip.count.i51 = zext i32 %25 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i54, %for.body.preheader.i
%indvars.iv29.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next30.i, %for.inc.i54 ]
%indvars.iv.i52 = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i55, %for.inc.i54 ]
%indvars.iv.next30.i = add nuw nsw i64 %indvars.iv29.i, 1
%num.i53 = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv29.i, i32 1
%26 = load i8, ptr %num.i53, align 1, !tbaa !5
%num4.i = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv.i52, i32 1
%27 = load i8, ptr %num4.i, align 1, !tbaa !5
%cmp6.i = icmp eq i8 %26, %27
br i1 %cmp6.i, label %land.lhs.true.i, label %for.inc.i54
land.lhs.true.i: ; preds = %for.body.i
%idx.i = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv29.i, i32 2
%28 = load i32, ptr %idx.i, align 4, !tbaa !14
%idx13.i = getelementptr inbounds %struct.Card, ptr %data1, i64 %indvars.iv.i52, i32 2
%29 = load i32, ptr %idx13.i, align 4, !tbaa !14
%cmp14.i = icmp sgt i32 %28, %29
br i1 %cmp14.i, label %is_stable.exit, label %for.inc.i54
for.inc.i54: ; preds = %land.lhs.true.i, %for.body.i
%indvars.iv.next.i55 = add nuw nsw i64 %indvars.iv.i52, 1
%exitcond.not.i56 = icmp eq i64 %indvars.iv.next30.i, %wide.trip.count.i51
br i1 %exitcond.not.i56, label %is_stable.exit, label %for.body.i, !llvm.loop !15
is_stable.exit: ; preds = %land.lhs.true.i, %for.inc.i54, %print.exit
%str.sink.i = phi ptr [ @str, %print.exit ], [ @str, %for.inc.i54 ], [ @str.7, %land.lhs.true.i ]
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i)
%30 = load i32, ptr %N, align 4, !tbaa !20
%cmp12.i57 = icmp sgt i32 %30, 0
br i1 %cmp12.i57, label %if.end.peel.i60, label %print.exit79
if.end.peel.i60: ; preds = %is_stable.exit
%wide.trip.count.i61 = zext i32 %30 to i64
%num.peel.phi.trans.insert.i62 = getelementptr inbounds %struct.Card, ptr %data2, i64 0, i32 1
%.pre16.i63 = load i8, ptr %num.peel.phi.trans.insert.i62, align 1, !tbaa !5
%.pre.i64 = load i8, ptr %data2, align 16, !tbaa !10
%conv.peel.i65 = sext i8 %.pre.i64 to i32
%conv3.peel.i66 = sext i8 %.pre16.i63 to i32
%call4.peel.i67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.peel.i65, i32 noundef %conv3.peel.i66)
%exitcond.peel.not.i68 = icmp eq i32 %30, 1
br i1 %exitcond.peel.not.i68, label %print.exit79, label %if.end.i69
if.end.i69: ; preds = %if.end.peel.i60, %if.end.i69
%indvars.iv.i70 = phi i64 [ %indvars.iv.next.i77, %if.end.i69 ], [ 1, %if.end.peel.i60 ]
%putchar11.i71 = call i32 @putchar(i32 32)
%arrayidx.i72 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv.i70
%31 = load i8, ptr %arrayidx.i72, align 8, !tbaa !10
%conv.i73 = sext i8 %31 to i32
%num.i74 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv.i70, i32 1
%32 = load i8, ptr %num.i74, align 1, !tbaa !5
%conv3.i75 = sext i8 %32 to i32
%call4.i76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv.i73, i32 noundef %conv3.i75)
%indvars.iv.next.i77 = add nuw nsw i64 %indvars.iv.i70, 1
%exitcond.not.i78 = icmp eq i64 %indvars.iv.next.i77, %wide.trip.count.i61
br i1 %exitcond.not.i78, label %print.exit79, label %if.end.i69, !llvm.loop !11
print.exit79: ; preds = %if.end.i69, %is_stable.exit, %if.end.peel.i60
%putchar.i59 = call i32 @putchar(i32 10)
%33 = load i32, ptr %N, align 4, !tbaa !20
%cmp26.i80 = icmp sgt i32 %33, 1
br i1 %cmp26.i80, label %for.body.preheader.i83, label %is_stable.exit99
for.body.preheader.i83: ; preds = %print.exit79
%34 = add nsw i32 %33, -1
%wide.trip.count.i84 = zext i32 %34 to i64
br label %for.body.i85
for.body.i85: ; preds = %for.inc.i92, %for.body.preheader.i83
%indvars.iv29.i86 = phi i64 [ 0, %for.body.preheader.i83 ], [ %indvars.iv.next30.i88, %for.inc.i92 ]
%indvars.iv.i87 = phi i64 [ 1, %for.body.preheader.i83 ], [ %indvars.iv.next.i93, %for.inc.i92 ]
%indvars.iv.next30.i88 = add nuw nsw i64 %indvars.iv29.i86, 1
%num.i89 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv29.i86, i32 1
%35 = load i8, ptr %num.i89, align 1, !tbaa !5
%num4.i90 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv.i87, i32 1
%36 = load i8, ptr %num4.i90, align 1, !tbaa !5
%cmp6.i91 = icmp eq i8 %35, %36
br i1 %cmp6.i91, label %land.lhs.true.i95, label %for.inc.i92
land.lhs.true.i95: ; preds = %for.body.i85
%idx.i96 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv29.i86, i32 2
%37 = load i32, ptr %idx.i96, align 4, !tbaa !14
%idx13.i97 = getelementptr inbounds %struct.Card, ptr %data2, i64 %indvars.iv.i87, i32 2
%38 = load i32, ptr %idx13.i97, align 4, !tbaa !14
%cmp14.i98 = icmp sgt i32 %37, %38
br i1 %cmp14.i98, label %is_stable.exit99, label %for.inc.i92
for.inc.i92: ; preds = %land.lhs.true.i95, %for.body.i85
%indvars.iv.next.i93 = add nuw nsw i64 %indvars.iv.i87, 1
%exitcond.not.i94 = icmp eq i64 %indvars.iv.next30.i88, %wide.trip.count.i84
br i1 %exitcond.not.i94, label %is_stable.exit99, label %for.body.i85, !llvm.loop !15
is_stable.exit99: ; preds = %land.lhs.true.i95, %for.inc.i92, %print.exit79
%str.sink.i81 = phi ptr [ @str, %print.exit79 ], [ @str, %for.inc.i92 ], [ @str.7, %land.lhs.true.i95 ]
%puts.i82 = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink.i81)
call void @llvm.lifetime.end.p0(i64 320, ptr nonnull %data2) #6
call void @llvm.lifetime.end.p0(i64 320, ptr nonnull %data1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: 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 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 #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 1}
!6 = !{!"", !7, i64 0, !7, i64 1, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = !{!6, !9, i64 4}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!9, !9, i64 0}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
|
#include<stdio.h>
#define N 36
typedef struct{
char chara;
int num;
int no;
} trump;
int main(){
int i,j,n,flag=1,minj;
trump T1[N],T2[N],tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
while(1){
scanf("%c",&T1[i].chara);
if(T1[i].chara != 'S' && T1[i].chara != 'H' && T1[i].chara != 'C' && T1[i].c\
hara != 'D') continue;
scanf("%d",&T1[i].num);
break;
}
T1[i].no=i+1;
T2[i]=T1[i];
}
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(T1[j].num<T1[j-1].num){
tmp = T1[j];
T1[j] = T1[j-1];
T1[j-1] = tmp;
}
}
}
for(i=0;i<n;i++){
if(i != n-1)printf("%c%d ",T1[i].chara,T1[i].num);
else printf("%c%d\nStable\n",T1[i].chara,T1[i].num);
}
for(i=0;i<n-1;i++){
minj = i;
for(j=i;j<n;j++){
if(T2[j].num<T2[minj].num){
minj = j;
}
}
tmp = T2[i];
T2[i] = T2[minj];
T2[minj] = tmp;
}
for(i=0;i<n;i++){
if(i != n-1 ) printf("%c%d ",T2[i].chara,T2[i].num);
else printf("%c%d\n",T2[i].chara,T2[i].num);
}
for(i=1;i<n;i++){
if(T2[i].num == T2[i-1].num && T2[i].no - T2[i-1].no < 0){
flag = 0;
}
}
if(flag == 1)printf("Stable\n");
else printf("Not stable\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114209/source.c"
target datalayout = "e-m:e-p270: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.trump = type { i8, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%c%d \00", align 1
@.str.3 = private unnamed_addr constant [13 x i8] c"%c%d\0AStable\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%c%d\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"Not stable\00", align 1
@str.7 = private unnamed_addr constant [7 x i8] c"Stable\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%T1 = alloca [36 x %struct.trump], align 16
%T2 = alloca [36 x %struct.trump], align 16
%tmp = alloca %struct.trump, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 432, ptr nonnull %T1) #5
call void @llvm.lifetime.start.p0(i64 432, ptr nonnull %T2) #5
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %tmp)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp255 = icmp sgt i32 %0, 0
br i1 %cmp255, label %while.cond.preheader, label %if.end195
while.cond.preheader: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv
br label %while.cond
for.cond36.preheader: ; preds = %if.end
%cmp37261 = icmp sgt i32 %6, 0
br i1 %cmp37261, label %for.cond40.preheader.lr.ph, label %if.end195
for.cond40.preheader.lr.ph: ; preds = %for.cond36.preheader
%j.0257 = add nsw i32 %6, -1
%1 = zext i32 %6 to i64
%2 = add nsw i64 %1, -1
%3 = zext i32 %j.0257 to i64
%wide.trip.count = zext i32 %6 to i64
br label %for.cond40.preheader
while.cond: ; preds = %while.cond.preheader, %while.cond
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load i8, ptr %arrayidx, align 4, !tbaa !9
switch i8 %4, label %while.cond [
i8 83, label %if.end
i8 72, label %if.end
i8 67, label %if.end
i8 68, label %if.end
]
if.end: ; preds = %while.cond, %while.cond, %while.cond, %while.cond
%num = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv, i32 1
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%no = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv, i32 2
%5 = trunc i64 %indvars.iv.next to i32
store i32 %5, ptr %no, align 4, !tbaa !11
%arrayidx33 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx33, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false), !tbaa.struct !12
%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 %while.cond.preheader, label %for.cond36.preheader, !llvm.loop !14
for.cond40.preheader: ; preds = %for.cond40.preheader.lr.ph, %for.inc67
%indvars.iv291 = phi i64 [ 0, %for.cond40.preheader.lr.ph ], [ %indvars.iv.next292, %for.inc67 ]
%cmp41258 = icmp ult i64 %indvars.iv291, %3
br i1 %cmp41258, label %for.body43, label %for.inc67
for.cond70.preheader: ; preds = %for.inc67
br i1 %cmp37261, label %for.body73, label %for.cond98.preheader
for.body43: ; preds = %for.cond40.preheader, %for.inc65
%indvars.iv285 = phi i64 [ %indvars.iv.next286, %for.inc65 ], [ %1, %for.cond40.preheader ]
%indvars.iv283 = phi i64 [ %indvars.iv.next284, %for.inc65 ], [ %2, %for.cond40.preheader ]
%indvars.iv.next286 = add nsw i64 %indvars.iv285, -1
%num46 = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv283, i32 1
%8 = load i32, ptr %num46, align 4, !tbaa !16
%9 = add nsw i64 %indvars.iv285, -2
%num50 = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %9, i32 1
%10 = load i32, ptr %num50, align 4, !tbaa !16
%cmp51 = icmp slt i32 %8, %10
br i1 %cmp51, label %if.then53, label %for.inc65
if.then53: ; preds = %for.body43
%arrayidx49 = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %9
%arrayidx45 = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv283
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %tmp, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx45, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx45, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx49, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx49, ptr noundef nonnull align 4 dereferenceable(12) %tmp, i64 12, i1 false), !tbaa.struct !12
br label %for.inc65
for.inc65: ; preds = %for.body43, %if.then53
%indvars.iv.next284 = add nsw i64 %indvars.iv283, -1
%cmp41 = icmp sgt i64 %indvars.iv.next284, %indvars.iv291
br i1 %cmp41, label %for.body43, label %for.inc67, !llvm.loop !17
for.inc67: ; preds = %for.inc65, %for.cond40.preheader
%indvars.iv.next292 = add nuw nsw i64 %indvars.iv291, 1
%exitcond.not = icmp eq i64 %indvars.iv.next292, %wide.trip.count
br i1 %exitcond.not, label %for.cond70.preheader, label %for.cond40.preheader, !llvm.loop !18
for.cond98.preheader: ; preds = %for.body73, %for.cond70.preheader
%11 = phi i32 [ %6, %for.cond70.preheader ], [ %17, %for.body73 ]
%cmp100270 = icmp sgt i32 %11, 1
br i1 %cmp100270, label %for.cond103.preheader.preheader, label %for.cond131.preheader
for.cond103.preheader.preheader: ; preds = %for.cond98.preheader
%sub99 = add nsw i32 %11, -1
%12 = zext i32 %11 to i64
%wide.trip.count305 = zext i32 %sub99 to i64
%wide.trip.count302 = zext i32 %11 to i64
br label %for.cond103.preheader
for.body73: ; preds = %for.cond70.preheader, %for.body73
%indvars.iv294 = phi i64 [ %indvars.iv.next295, %for.body73 ], [ 0, %for.cond70.preheader ]
%13 = phi i32 [ %17, %for.body73 ], [ %6, %for.cond70.preheader ]
%sub74 = add nsw i32 %13, -1
%14 = zext i32 %sub74 to i64
%cmp75.not = icmp eq i64 %indvars.iv294, %14
%arrayidx87 = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv294
%15 = load i8, ptr %arrayidx87, align 4, !tbaa !9
%conv89 = sext i8 %15 to i32
%num92 = getelementptr inbounds [36 x %struct.trump], ptr %T1, i64 0, i64 %indvars.iv294, i32 1
%16 = load i32, ptr %num92, align 4, !tbaa !16
%.str.3..str.2 = select i1 %cmp75.not, ptr @.str.3, ptr @.str.2
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.2, i32 noundef %conv89, i32 noundef %16)
%indvars.iv.next295 = add nuw nsw i64 %indvars.iv294, 1
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp71 = icmp slt i64 %indvars.iv.next295, %18
br i1 %cmp71, label %for.body73, label %for.cond98.preheader, !llvm.loop !19
for.cond103.preheader: ; preds = %for.cond103.preheader.preheader, %for.end119
%indvars.iv297 = phi i64 [ 0, %for.cond103.preheader.preheader ], [ %indvars.iv.next298, %for.end119 ]
%cmp104266 = icmp ult i64 %indvars.iv297, %12
%19 = trunc i64 %indvars.iv297 to i32
br i1 %cmp104266, label %for.body106, label %for.end119
for.cond131.preheader: ; preds = %for.end119, %for.cond98.preheader
%cmp132272 = icmp sgt i32 %11, 0
br i1 %cmp132272, label %for.body134, label %if.end195
for.body106: ; preds = %for.cond103.preheader, %for.body106
%indvars.iv299 = phi i64 [ %indvars.iv.next300, %for.body106 ], [ %indvars.iv297, %for.cond103.preheader ]
%minj.0268 = phi i32 [ %spec.select, %for.body106 ], [ %19, %for.cond103.preheader ]
%num109 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv299, i32 1
%20 = load i32, ptr %num109, align 4, !tbaa !16
%idxprom110 = sext i32 %minj.0268 to i64
%num112 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %idxprom110, i32 1
%21 = load i32, ptr %num112, align 4, !tbaa !16
%cmp113 = icmp slt i32 %20, %21
%22 = trunc i64 %indvars.iv299 to i32
%spec.select = select i1 %cmp113, i32 %22, i32 %minj.0268
%indvars.iv.next300 = add nuw nsw i64 %indvars.iv299, 1
%exitcond303.not = icmp eq i64 %indvars.iv.next300, %wide.trip.count302
br i1 %exitcond303.not, label %for.end119, label %for.body106, !llvm.loop !20
for.end119: ; preds = %for.body106, %for.cond103.preheader
%minj.0.lcssa = phi i32 [ %19, %for.cond103.preheader ], [ %spec.select, %for.body106 ]
%arrayidx121 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv297
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %tmp, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx121, i64 12, i1 false), !tbaa.struct !12
%idxprom124 = sext i32 %minj.0.lcssa to i64
%arrayidx125 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %idxprom124
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx121, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx125, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx125, ptr noundef nonnull align 4 dereferenceable(12) %tmp, i64 12, i1 false), !tbaa.struct !12
%indvars.iv.next298 = add nuw nsw i64 %indvars.iv297, 1
%exitcond306.not = icmp eq i64 %indvars.iv.next298, %wide.trip.count305
br i1 %exitcond306.not, label %for.cond131.preheader, label %for.cond103.preheader, !llvm.loop !21
for.cond160.preheader: ; preds = %for.body134
%cmp161275 = icmp sgt i32 %29, 1
br i1 %cmp161275, label %for.body163.preheader, label %if.end195
for.body163.preheader: ; preds = %for.cond160.preheader
%wide.trip.count314 = zext i32 %29 to i64
%num170.phi.trans.insert = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 0, i32 1
%.pre = load i32, ptr %num170.phi.trans.insert, align 4, !tbaa !16
%23 = add nsw i64 %wide.trip.count314, -1
%xtraiter = and i64 %23, 1
%24 = icmp eq i32 %29, 2
br i1 %24, label %for.end188.unr-lcssa, label %for.body163.preheader.new
for.body163.preheader.new: ; preds = %for.body163.preheader
%unroll_iter = and i64 %23, -2
br label %for.body163
for.body134: ; preds = %for.cond131.preheader, %for.body134
%indvars.iv307 = phi i64 [ %indvars.iv.next308, %for.body134 ], [ 0, %for.cond131.preheader ]
%25 = phi i32 [ %29, %for.body134 ], [ %11, %for.cond131.preheader ]
%sub135 = add nsw i32 %25, -1
%26 = zext i32 %sub135 to i64
%cmp136.not = icmp eq i64 %indvars.iv307, %26
%arrayidx149 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv307
%27 = load i8, ptr %arrayidx149, align 4, !tbaa !9
%conv151 = sext i8 %27 to i32
%num154 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv307, i32 1
%28 = load i32, ptr %num154, align 4, !tbaa !16
%.str.4..str.2 = select i1 %cmp136.not, ptr @.str.4, ptr @.str.2
%call146 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4..str.2, i32 noundef %conv151, i32 noundef %28)
%indvars.iv.next308 = add nuw nsw i64 %indvars.iv307, 1
%29 = load i32, ptr %n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp132 = icmp slt i64 %indvars.iv.next308, %30
br i1 %cmp132, label %for.body134, label %for.cond160.preheader, !llvm.loop !22
for.body163: ; preds = %for.inc186.1, %for.body163.preheader.new
%31 = phi i32 [ %.pre, %for.body163.preheader.new ], [ %36, %for.inc186.1 ]
%indvars.iv310 = phi i64 [ 1, %for.body163.preheader.new ], [ %indvars.iv.next311.1, %for.inc186.1 ]
%flag.0277 = phi i32 [ 1, %for.body163.preheader.new ], [ %flag.1.1, %for.inc186.1 ]
%niter = phi i64 [ 0, %for.body163.preheader.new ], [ %niter.next.1, %for.inc186.1 ]
%num166 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv310, i32 1
%32 = load i32, ptr %num166, align 4, !tbaa !16
%cmp171 = icmp eq i32 %32, %31
br i1 %cmp171, label %land.lhs.true173, label %for.inc186
land.lhs.true173: ; preds = %for.body163
%33 = add nsw i64 %indvars.iv310, -1
%no176 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv310, i32 2
%34 = load i32, ptr %no176, align 4, !tbaa !11
%no180 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %33, i32 2
%35 = load i32, ptr %no180, align 4, !tbaa !11
%cmp182 = icmp slt i32 %34, %35
%spec.select252 = select i1 %cmp182, i32 0, i32 %flag.0277
br label %for.inc186
for.inc186: ; preds = %land.lhs.true173, %for.body163
%flag.1 = phi i32 [ %flag.0277, %for.body163 ], [ %spec.select252, %land.lhs.true173 ]
%indvars.iv.next311 = add nuw nsw i64 %indvars.iv310, 1
%num166.1 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv.next311, i32 1
%36 = load i32, ptr %num166.1, align 4, !tbaa !16
%cmp171.1 = icmp eq i32 %36, %32
br i1 %cmp171.1, label %land.lhs.true173.1, label %for.inc186.1
land.lhs.true173.1: ; preds = %for.inc186
%no176.1 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv.next311, i32 2
%37 = load i32, ptr %no176.1, align 4, !tbaa !11
%no180.1 = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv310, i32 2
%38 = load i32, ptr %no180.1, align 4, !tbaa !11
%cmp182.1 = icmp slt i32 %37, %38
%spec.select252.1 = select i1 %cmp182.1, i32 0, i32 %flag.1
br label %for.inc186.1
for.inc186.1: ; preds = %land.lhs.true173.1, %for.inc186
%flag.1.1 = phi i32 [ %flag.1, %for.inc186 ], [ %spec.select252.1, %land.lhs.true173.1 ]
%indvars.iv.next311.1 = add nuw nsw i64 %indvars.iv310, 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.end188.unr-lcssa, label %for.body163, !llvm.loop !23
for.end188.unr-lcssa: ; preds = %for.inc186.1, %for.body163.preheader
%flag.1.lcssa.ph = phi i32 [ undef, %for.body163.preheader ], [ %flag.1.1, %for.inc186.1 ]
%.unr = phi i32 [ %.pre, %for.body163.preheader ], [ %36, %for.inc186.1 ]
%indvars.iv310.unr = phi i64 [ 1, %for.body163.preheader ], [ %indvars.iv.next311.1, %for.inc186.1 ]
%flag.0277.unr = phi i32 [ 1, %for.body163.preheader ], [ %flag.1.1, %for.inc186.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end188, label %for.body163.epil
for.body163.epil: ; preds = %for.end188.unr-lcssa
%num166.epil = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv310.unr, i32 1
%39 = load i32, ptr %num166.epil, align 4, !tbaa !16
%cmp171.epil = icmp eq i32 %39, %.unr
br i1 %cmp171.epil, label %land.lhs.true173.epil, label %for.end188
land.lhs.true173.epil: ; preds = %for.body163.epil
%40 = add nsw i64 %indvars.iv310.unr, -1
%no176.epil = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %indvars.iv310.unr, i32 2
%41 = load i32, ptr %no176.epil, align 4, !tbaa !11
%no180.epil = getelementptr inbounds [36 x %struct.trump], ptr %T2, i64 0, i64 %40, i32 2
%42 = load i32, ptr %no180.epil, align 4, !tbaa !11
%cmp182.epil = icmp slt i32 %41, %42
%spec.select252.epil = select i1 %cmp182.epil, i32 0, i32 %flag.0277.unr
br label %for.end188
for.end188: ; preds = %for.body163.epil, %land.lhs.true173.epil, %for.end188.unr-lcssa
%flag.1.lcssa = phi i32 [ %flag.1.lcssa.ph, %for.end188.unr-lcssa ], [ %flag.0277.unr, %for.body163.epil ], [ %spec.select252.epil, %land.lhs.true173.epil ]
%43 = icmp eq i32 %flag.1.lcssa, 1
%spec.select327 = select i1 %43, ptr @str.7, ptr @str
br label %if.end195
if.end195: ; preds = %for.end188, %for.cond160.preheader, %for.cond131.preheader, %for.cond36.preheader, %entry
%str.sink = phi ptr [ @str.7, %entry ], [ @str.7, %for.cond36.preheader ], [ @str.7, %for.cond131.preheader ], [ @str.7, %for.cond160.preheader ], [ %spec.select327, %for.end188 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %tmp)
call void @llvm.lifetime.end.p0(i64 432, ptr nonnull %T2) #5
call void @llvm.lifetime.end.p0(i64 432, ptr nonnull %T1) #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 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
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 #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: readwrite) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"", !7, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{i64 0, i64 1, !13, i64 4, i64 4, !5, i64 8, i64 4, !5}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 4}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
|
// AOJ 1249: Make a Sequence
// 2017.10.16 bal4u@uu
#include <stdio.h>
#include <string.h>
typedef struct { int x, y; } T;
T a[350];
int n, m;
char peg[8][8][8]; char hi[8][8];
int dx[13] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 };
int dy[13] = { 0, 1, 0, 1,-1, 0, 0, 1, 1, 1, 1,-1,-1 };
int dz[13] = { 0, 0, 1, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1 };
int check(int color)
{
int x, y, z, xx, yy, zz, i, cnt;
for (x = 0; x < n; x++) for (y = 0; y < n; y++) for (z = 0; z < n; z++) {
for (i = 0; i < 13; i++) {
xx = x, yy = y, zz = z, cnt = 0;
while (0 <= xx && xx < n && 0 <= yy && yy < n &&
0 <= zz && zz < n && peg[xx][yy][zz] == color) {
xx += dx[i], yy += dy[i], zz += dz[i], cnt++;
if(cnt >= m) return 1;
}
}
}
return 0;
}
int main()
{
int p, i, x, y, color;
while (scanf("%d%d%d", &n, &m, &p) && n > 0) {
memset(peg, -1, sizeof(peg)); memset(hi, 0, sizeof(hi));
for (i = 0; i < p; i++) scanf("%d%d", &a[i].x, &a[i].y);
for (color = 1,i = 0; i < p; i++, color = !color) {
x = a[i].x-1, y = a[i].y-1;
peg[x][y][hi[x][y]++] = color;
if (check(color)) break;
}
if (i == p) puts("Draw");
else printf("%s %d\n", color ? "Black" : "White", i+1);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_114252/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_114252/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.T = type { i32, i32 }
@dx = dso_local local_unnamed_addr global [13 x i32] [i32 1, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1], align 16
@dy = dso_local local_unnamed_addr global [13 x i32] [i32 0, i32 1, i32 0, i32 1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 -1, i32 -1], align 16
@dz = dso_local local_unnamed_addr global [13 x i32] [i32 0, i32 0, i32 1, i32 0, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 1, i32 -1, i32 1, i32 -1], align 16
@n = dso_local global i32 0, align 4
@peg = dso_local local_unnamed_addr global [8 x [8 x [8 x i8]]] zeroinitializer, align 16
@m = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@hi = dso_local local_unnamed_addr global [8 x [8 x i8]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@a = dso_local global [350 x %struct.T] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"Draw\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"Black\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"White\00", align 1
; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @check(i32 noundef %color) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp81 = icmp sgt i32 %0, 0
br i1 %cmp81, label %for.cond1.preheader.lr.ph, label %cleanup
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr @m, align 4
%smax = tail call i32 @llvm.smax.i32(i32 %1, i32 1)
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.for.inc43_crit_edge.split.us.us, %for.cond1.preheader.lr.ph
%x.082.us = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc44.us, %for.cond1.for.inc43_crit_edge.split.us.us ]
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.for.inc40_crit_edge.us.us, %for.cond1.preheader.us
%y.080.us.us = phi i32 [ 0, %for.cond1.preheader.us ], [ %inc41.us.us, %for.cond4.for.inc40_crit_edge.us.us ]
br label %for.cond7.preheader.us.us
for.inc37.us.us: ; preds = %for.inc.us.us
%inc38.us.us = add nuw nsw i32 %z.078.us.us, 1
%exitcond93.not = icmp eq i32 %inc38.us.us, %0
br i1 %exitcond93.not, label %for.cond4.for.inc40_crit_edge.us.us, label %for.cond7.preheader.us.us, !llvm.loop !9
while.cond.us.us: ; preds = %while.cond.preheader.us.us, %while.body.us.us
%xx.0.us.us = phi i32 [ %add.us.us, %while.body.us.us ], [ %x.082.us, %while.cond.preheader.us.us ]
%yy.0.us.us = phi i32 [ %add30.us.us, %while.body.us.us ], [ %y.080.us.us, %while.cond.preheader.us.us ]
%zz.0.us.us = phi i32 [ %add33.us.us, %while.body.us.us ], [ %z.078.us.us, %while.cond.preheader.us.us ]
%cnt.0.us.us = phi i32 [ %inc.us.us, %while.body.us.us ], [ 0, %while.cond.preheader.us.us ]
%cmp10.us.us = icmp sgt i32 %xx.0.us.us, -1
br i1 %cmp10.us.us, label %land.lhs.true.us.us, label %for.inc.us.us
land.lhs.true.us.us: ; preds = %while.cond.us.us
%cmp11.us.us = icmp slt i32 %xx.0.us.us, %0
%cmp13.us.us = icmp sgt i32 %yy.0.us.us, -1
%or.cond.us.us = select i1 %cmp11.us.us, i1 %cmp13.us.us, i1 false
br i1 %or.cond.us.us, label %land.lhs.true14.us.us, label %for.inc.us.us
land.lhs.true14.us.us: ; preds = %land.lhs.true.us.us
%cmp15.us.us = icmp slt i32 %yy.0.us.us, %0
%cmp17.us.us = icmp sgt i32 %zz.0.us.us, -1
%or.cond53.us.us = select i1 %cmp15.us.us, i1 %cmp17.us.us, i1 false
%cmp19.us.us = icmp slt i32 %zz.0.us.us, %0
%or.cond74.us.us = select i1 %or.cond53.us.us, i1 %cmp19.us.us, i1 false
br i1 %or.cond74.us.us, label %land.rhs.us.us, label %for.inc.us.us
land.rhs.us.us: ; preds = %land.lhs.true14.us.us
%idxprom.us.us = zext i32 %xx.0.us.us to i64
%idxprom20.us.us = zext i32 %yy.0.us.us to i64
%idxprom22.us.us = zext i32 %zz.0.us.us to i64
%arrayidx23.us.us = getelementptr inbounds [8 x [8 x [8 x i8]]], ptr @peg, i64 0, i64 %idxprom.us.us, i64 %idxprom20.us.us, i64 %idxprom22.us.us
%2 = load i8, ptr %arrayidx23.us.us, align 1, !tbaa !11
%conv.us.us = sext i8 %2 to i32
%cmp24.us.us = icmp eq i32 %conv.us.us, %color
br i1 %cmp24.us.us, label %while.body.us.us, label %for.inc.us.us
for.inc.us.us: ; preds = %land.rhs.us.us, %land.lhs.true14.us.us, %land.lhs.true.us.us, %while.cond.us.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond92.not = icmp eq i64 %indvars.iv.next, 13
br i1 %exitcond92.not, label %for.inc37.us.us, label %while.cond.preheader.us.us, !llvm.loop !12
while.body.us.us: ; preds = %land.rhs.us.us
%3 = load i32, ptr %arrayidx27.us.us, align 4, !tbaa !5
%add.us.us = add nsw i32 %3, %xx.0.us.us
%4 = load i32, ptr %arrayidx29.us.us, align 4, !tbaa !5
%add30.us.us = add nsw i32 %4, %yy.0.us.us
%5 = load i32, ptr %arrayidx32.us.us, align 4, !tbaa !5
%add33.us.us = add nsw i32 %5, %zz.0.us.us
%inc.us.us = add nuw nsw i32 %cnt.0.us.us, 1
%exitcond.not = icmp eq i32 %inc.us.us, %smax
br i1 %exitcond.not, label %cleanup, label %while.cond.us.us, !llvm.loop !13
while.cond.preheader.us.us: ; preds = %for.cond7.preheader.us.us, %for.inc.us.us
%indvars.iv = phi i64 [ 0, %for.cond7.preheader.us.us ], [ %indvars.iv.next, %for.inc.us.us ]
%arrayidx27.us.us = getelementptr inbounds [13 x i32], ptr @dx, i64 0, i64 %indvars.iv
%arrayidx29.us.us = getelementptr inbounds [13 x i32], ptr @dy, i64 0, i64 %indvars.iv
%arrayidx32.us.us = getelementptr inbounds [13 x i32], ptr @dz, i64 0, i64 %indvars.iv
br label %while.cond.us.us
for.cond7.preheader.us.us: ; preds = %for.inc37.us.us, %for.cond4.preheader.us.us
%z.078.us.us = phi i32 [ 0, %for.cond4.preheader.us.us ], [ %inc38.us.us, %for.inc37.us.us ]
br label %while.cond.preheader.us.us
for.cond4.for.inc40_crit_edge.us.us: ; preds = %for.inc37.us.us
%inc41.us.us = add nuw nsw i32 %y.080.us.us, 1
%exitcond94.not = icmp eq i32 %inc41.us.us, %0
br i1 %exitcond94.not, label %for.cond1.for.inc43_crit_edge.split.us.us, label %for.cond4.preheader.us.us, !llvm.loop !14
for.cond1.for.inc43_crit_edge.split.us.us: ; preds = %for.cond4.for.inc40_crit_edge.us.us
%inc44.us = add nuw nsw i32 %x.082.us, 1
%exitcond96.not = icmp eq i32 %inc44.us, %0
br i1 %exitcond96.not, label %cleanup, label %for.cond1.preheader.us, !llvm.loop !15
cleanup: ; preds = %for.cond1.for.inc43_crit_edge.split.us.us, %while.body.us.us, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %while.body.us.us ], [ 0, %for.cond1.for.inc43_crit_edge.split.us.us ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #6
%call72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull %p)
%tobool73 = icmp ne i32 %call72, 0
%0 = load i32, ptr @n, align 4
%cmp74 = icmp sgt i32 %0, 0
%1 = select i1 %tobool73, i1 %cmp74, i1 false
br i1 %1, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end40
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(512) @peg, i8 -1, i64 512, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) @hi, i8 0, i64 64, i1 false)
%2 = load i32, ptr %p, align 4, !tbaa !5
%cmp162 = icmp sgt i32 %2, 0
br i1 %cmp162, label %for.body, label %for.end33
for.cond7.preheader: ; preds = %for.body
%cmp864 = icmp sgt i32 %12, 0
br i1 %cmp864, label %for.body9.lr.ph, label %for.end33
for.body9.lr.ph: ; preds = %for.cond7.preheader
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp81.i = icmp sgt i32 %3, 0
%4 = load i32, ptr @m, align 4
%smax.i = call i32 @llvm.smax.i32(i32 %4, i32 1)
%wide.trip.count87 = zext i32 %12 to i64
br i1 %cmp81.i, label %for.body9.us, label %for.body9
for.body9.us: ; preds = %for.body9.lr.ph, %for.inc30.loopexit.us
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.inc30.loopexit.us ], [ 0, %for.body9.lr.ph ]
%color.066.us = phi i32 [ %lnot.ext.us, %for.inc30.loopexit.us ], [ 1, %for.body9.lr.ph ]
%arrayidx11.us = getelementptr inbounds [350 x %struct.T], ptr @a, i64 0, i64 %indvars.iv84
%5 = load i32, ptr %arrayidx11.us, align 8, !tbaa !16
%sub.us = add nsw i32 %5, -1
%y15.us = getelementptr inbounds [350 x %struct.T], ptr @a, i64 0, i64 %indvars.iv84, i32 1
%6 = load i32, ptr %y15.us, align 4, !tbaa !18
%sub16.us = add nsw i32 %6, -1
%conv.us = trunc i32 %color.066.us to i8
%idxprom17.us = sext i32 %sub.us to i64
%idxprom19.us = sext i32 %sub16.us to i64
%arrayidx24.us = getelementptr inbounds [8 x [8 x i8]], ptr @hi, i64 0, i64 %idxprom17.us, i64 %idxprom19.us
%7 = load i8, ptr %arrayidx24.us, align 1, !tbaa !11
%inc25.us = add i8 %7, 1
store i8 %inc25.us, ptr %arrayidx24.us, align 1, !tbaa !11
%idxprom26.us = sext i8 %7 to i64
%arrayidx27.us = getelementptr inbounds [8 x [8 x [8 x i8]]], ptr @peg, i64 0, i64 %idxprom17.us, i64 %idxprom19.us, i64 %idxprom26.us
store i8 %conv.us, ptr %arrayidx27.us, align 1, !tbaa !11
br label %for.cond1.preheader.us.i.us
for.cond1.preheader.us.i.us: ; preds = %for.cond1.for.inc43_crit_edge.split.us.us.i.us, %for.body9.us
%x.082.us.i.us = phi i32 [ 0, %for.body9.us ], [ %inc44.us.i.us, %for.cond1.for.inc43_crit_edge.split.us.us.i.us ]
br label %for.cond4.preheader.us.us.i.us
for.cond4.preheader.us.us.i.us: ; preds = %for.cond4.for.inc40_crit_edge.us.us.i.us, %for.cond1.preheader.us.i.us
%y.080.us.us.i.us = phi i32 [ 0, %for.cond1.preheader.us.i.us ], [ %inc41.us.us.i.us, %for.cond4.for.inc40_crit_edge.us.us.i.us ]
br label %for.cond7.preheader.us.us.i.us
for.cond7.preheader.us.us.i.us: ; preds = %for.inc37.us.us.i.us, %for.cond4.preheader.us.us.i.us
%z.078.us.us.i.us = phi i32 [ 0, %for.cond4.preheader.us.us.i.us ], [ %inc38.us.us.i.us, %for.inc37.us.us.i.us ]
br label %while.cond.preheader.us.us.i.us
while.cond.preheader.us.us.i.us: ; preds = %for.inc.us.us.i.us, %for.cond7.preheader.us.us.i.us
%indvars.iv.i.us = phi i64 [ 0, %for.cond7.preheader.us.us.i.us ], [ %indvars.iv.next.i.us, %for.inc.us.us.i.us ]
%arrayidx27.us.us.i.us = getelementptr inbounds [13 x i32], ptr @dx, i64 0, i64 %indvars.iv.i.us
%arrayidx29.us.us.i.us = getelementptr inbounds [13 x i32], ptr @dy, i64 0, i64 %indvars.iv.i.us
%arrayidx32.us.us.i.us = getelementptr inbounds [13 x i32], ptr @dz, i64 0, i64 %indvars.iv.i.us
br label %while.cond.us.us.i.us
while.cond.us.us.i.us: ; preds = %while.body.us.us.i.us, %while.cond.preheader.us.us.i.us
%xx.0.us.us.i.us = phi i32 [ %add.us.us.i.us, %while.body.us.us.i.us ], [ %x.082.us.i.us, %while.cond.preheader.us.us.i.us ]
%yy.0.us.us.i.us = phi i32 [ %add30.us.us.i.us, %while.body.us.us.i.us ], [ %y.080.us.us.i.us, %while.cond.preheader.us.us.i.us ]
%zz.0.us.us.i.us = phi i32 [ %add33.us.us.i.us, %while.body.us.us.i.us ], [ %z.078.us.us.i.us, %while.cond.preheader.us.us.i.us ]
%cnt.0.us.us.i.us = phi i32 [ %inc.us.us.i.us, %while.body.us.us.i.us ], [ 0, %while.cond.preheader.us.us.i.us ]
%cmp10.us.us.i.us = icmp sgt i32 %xx.0.us.us.i.us, -1
br i1 %cmp10.us.us.i.us, label %land.lhs.true.us.us.i.us, label %for.inc.us.us.i.us
land.lhs.true.us.us.i.us: ; preds = %while.cond.us.us.i.us
%cmp11.us.us.i.us = icmp slt i32 %xx.0.us.us.i.us, %3
%cmp13.us.us.i.us = icmp sgt i32 %yy.0.us.us.i.us, -1
%or.cond.us.us.i.us = select i1 %cmp11.us.us.i.us, i1 %cmp13.us.us.i.us, i1 false
br i1 %or.cond.us.us.i.us, label %land.lhs.true14.us.us.i.us, label %for.inc.us.us.i.us
land.lhs.true14.us.us.i.us: ; preds = %land.lhs.true.us.us.i.us
%cmp15.us.us.i.us = icmp slt i32 %yy.0.us.us.i.us, %3
%cmp17.us.us.i.us = icmp sgt i32 %zz.0.us.us.i.us, -1
%or.cond53.us.us.i.us = select i1 %cmp15.us.us.i.us, i1 %cmp17.us.us.i.us, i1 false
%cmp19.us.us.i.us = icmp slt i32 %zz.0.us.us.i.us, %3
%or.cond74.us.us.i.us = select i1 %or.cond53.us.us.i.us, i1 %cmp19.us.us.i.us, i1 false
br i1 %or.cond74.us.us.i.us, label %land.rhs.us.us.i.us, label %for.inc.us.us.i.us
land.rhs.us.us.i.us: ; preds = %land.lhs.true14.us.us.i.us
%idxprom.us.us.i.us = zext i32 %xx.0.us.us.i.us to i64
%idxprom20.us.us.i.us = zext i32 %yy.0.us.us.i.us to i64
%idxprom22.us.us.i.us = zext i32 %zz.0.us.us.i.us to i64
%arrayidx23.us.us.i.us = getelementptr inbounds [8 x [8 x [8 x i8]]], ptr @peg, i64 0, i64 %idxprom.us.us.i.us, i64 %idxprom20.us.us.i.us, i64 %idxprom22.us.us.i.us
%8 = load i8, ptr %arrayidx23.us.us.i.us, align 1, !tbaa !11
%conv.us.us.i.us = sext i8 %8 to i32
%cmp24.us.us.i.us = icmp eq i32 %color.066.us, %conv.us.us.i.us
br i1 %cmp24.us.us.i.us, label %while.body.us.us.i.us, label %for.inc.us.us.i.us
for.inc.us.us.i.us: ; preds = %land.rhs.us.us.i.us, %land.lhs.true14.us.us.i.us, %land.lhs.true.us.us.i.us, %while.cond.us.us.i.us
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%exitcond92.not.i.us = icmp eq i64 %indvars.iv.next.i.us, 13
br i1 %exitcond92.not.i.us, label %for.inc37.us.us.i.us, label %while.cond.preheader.us.us.i.us, !llvm.loop !12
for.inc37.us.us.i.us: ; preds = %for.inc.us.us.i.us
%inc38.us.us.i.us = add nuw nsw i32 %z.078.us.us.i.us, 1
%exitcond93.not.i.us = icmp eq i32 %inc38.us.us.i.us, %3
br i1 %exitcond93.not.i.us, label %for.cond4.for.inc40_crit_edge.us.us.i.us, label %for.cond7.preheader.us.us.i.us, !llvm.loop !9
for.cond4.for.inc40_crit_edge.us.us.i.us: ; preds = %for.inc37.us.us.i.us
%inc41.us.us.i.us = add nuw nsw i32 %y.080.us.us.i.us, 1
%exitcond94.not.i.us = icmp eq i32 %inc41.us.us.i.us, %3
br i1 %exitcond94.not.i.us, label %for.cond1.for.inc43_crit_edge.split.us.us.i.us, label %for.cond4.preheader.us.us.i.us, !llvm.loop !14
for.cond1.for.inc43_crit_edge.split.us.us.i.us: ; preds = %for.cond4.for.inc40_crit_edge.us.us.i.us
%inc44.us.i.us = add nuw nsw i32 %x.082.us.i.us, 1
%exitcond96.not.i.us = icmp eq i32 %inc44.us.i.us, %3
br i1 %exitcond96.not.i.us, label %for.inc30.loopexit.us, label %for.cond1.preheader.us.i.us, !llvm.loop !15
while.body.us.us.i.us: ; preds = %land.rhs.us.us.i.us
%9 = load i32, ptr %arrayidx27.us.us.i.us, align 4, !tbaa !5
%add.us.us.i.us = add nsw i32 %9, %xx.0.us.us.i.us
%10 = load i32, ptr %arrayidx29.us.us.i.us, align 4, !tbaa !5
%add30.us.us.i.us = add nsw i32 %10, %yy.0.us.us.i.us
%11 = load i32, ptr %arrayidx32.us.us.i.us, align 4, !tbaa !5
%add33.us.us.i.us = add nsw i32 %11, %zz.0.us.us.i.us
%inc.us.us.i.us = add nuw nsw i32 %cnt.0.us.us.i.us, 1
%exitcond.not.i.us = icmp eq i32 %inc.us.us.i.us, %smax.i
br i1 %exitcond.not.i.us, label %for.end33.loopexit, label %while.cond.us.us.i.us, !llvm.loop !13
for.inc30.loopexit.us: ; preds = %for.cond1.for.inc43_crit_edge.split.us.us.i.us
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%lnot.ext.us = xor i32 %color.066.us, 1
%exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
br i1 %exitcond88.not, label %if.then36, label %for.body9.us, !llvm.loop !19
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [350 x %struct.T], ptr @a, i64 0, i64 %indvars.iv
%y5 = getelementptr inbounds [350 x %struct.T], ptr @a, i64 0, i64 %indvars.iv, i32 1
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %y5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %p, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp1, label %for.body, label %for.cond7.preheader, !llvm.loop !20
for.body9: ; preds = %for.body9.lr.ph, %for.body9
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body9 ], [ 0, %for.body9.lr.ph ]
%color.066 = phi i32 [ %lnot.ext, %for.body9 ], [ 1, %for.body9.lr.ph ]
%arrayidx11 = getelementptr inbounds [350 x %struct.T], ptr @a, i64 0, i64 %indvars.iv81
%14 = load i32, ptr %arrayidx11, align 8, !tbaa !16
%sub = add nsw i32 %14, -1
%y15 = getelementptr inbounds [350 x %struct.T], ptr @a, i64 0, i64 %indvars.iv81, i32 1
%15 = load i32, ptr %y15, align 4, !tbaa !18
%sub16 = add nsw i32 %15, -1
%conv = trunc i32 %color.066 to i8
%idxprom17 = sext i32 %sub to i64
%idxprom19 = sext i32 %sub16 to i64
%arrayidx24 = getelementptr inbounds [8 x [8 x i8]], ptr @hi, i64 0, i64 %idxprom17, i64 %idxprom19
%16 = load i8, ptr %arrayidx24, align 1, !tbaa !11
%inc25 = add i8 %16, 1
store i8 %inc25, ptr %arrayidx24, align 1, !tbaa !11
%idxprom26 = sext i8 %16 to i64
%arrayidx27 = getelementptr inbounds [8 x [8 x [8 x i8]]], ptr @peg, i64 0, i64 %idxprom17, i64 %idxprom19, i64 %idxprom26
store i8 %conv, ptr %arrayidx27, align 1, !tbaa !11
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%lnot.ext = xor i32 %color.066, 1
%exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count87
br i1 %exitcond.not, label %if.then36, label %for.body9, !llvm.loop !19
for.end33.loopexit: ; preds = %while.body.us.us.i.us
%17 = trunc i64 %indvars.iv84 to i32
br label %for.end33
for.end33: ; preds = %while.body, %for.end33.loopexit, %for.cond7.preheader
%.lcssa91 = phi i32 [ %12, %for.cond7.preheader ], [ %12, %for.end33.loopexit ], [ %2, %while.body ]
%i.161 = phi i32 [ 0, %for.cond7.preheader ], [ %17, %for.end33.loopexit ], [ 0, %while.body ]
%color.059 = phi i32 [ 1, %for.cond7.preheader ], [ %color.066.us, %for.end33.loopexit ], [ 1, %while.body ]
%cmp34 = icmp eq i32 %i.161, %.lcssa91
br i1 %cmp34, label %if.then36, label %if.else
if.then36: ; preds = %for.body9, %for.inc30.loopexit.us, %for.end33
%call37 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end40
if.else: ; preds = %for.end33
%tobool38.not = icmp eq i32 %color.059, 0
%cond = select i1 %tobool38.not, ptr @.str.5, ptr @.str.4
%add = add nuw nsw i32 %i.161, 1
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %cond, i32 noundef %add)
br label %if.end40
if.end40: ; preds = %if.else, %if.then36
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull %p)
%tobool = icmp ne i32 %call, 0
%18 = load i32, ptr @n, align 4
%cmp = icmp sgt i32 %18, 0
%19 = select i1 %tobool, i1 %cmp, i1 false
br i1 %19, label %while.body, label %while.end, !llvm.loop !21
while.end: ; preds = %if.end40, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
attributes #0 = { nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !6, i64 0}
!17 = !{!"", !6, i64 0, !6, i64 4}
!18 = !{!17, !6, i64 4}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
int n,ans ;
scanf("%d",&n);
if(n<=2)
{
ans=1;
}
else
{
if(n%2!=0)
ans=n/2+1;
else if(n%2==0)
ans=n/2;
}
printf("%d\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_11431/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_11431/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.017 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %1, 3
%rem = and i32 %1, 1
%div914 = lshr i32 %1, 1
%spec.select = add nuw i32 %div914, %rem
%ans.1 = select i1 %cmp2, i32 1, i32 %spec.select
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
%inc = add nuw nsw i32 %i.017, 1
%2 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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"}
|